Engine: Removed all specific line behaviour

This can be implemented in C4Script very easily.
Removed OCF_LineConstruct, ObjectComLineConstruction, Defcore LineConnect, Line types, Line related IDs.
Changed LineAttach, is now a property of the object to which the line should be attached.
Updated documentation.
floating-point
Maikel de Vries 2010-12-21 19:22:06 +01:00
parent 5db69dd5e0
commit 8a200ba706
21 changed files with 52 additions and 408 deletions

View File

@ -16868,34 +16868,6 @@ msgstr "<placeholder-1/> wird auch nach der Beleuchtung angewandt. Die transform
msgid "If both \"MeshTransformation\" and <placeholder-1/> are set then first the \"MeshTransformation\" is applied to the mesh and then <placeholder-2/>."
msgstr "Sind sowohl \"MeshTransformation\" als auch <placeholder-1/> gesetzt, so wird zuerst die \"MeshTransformation\" auf das Mesh angewandt und dann <placeholder-2/>."
#: sdk/definition/lineconnect.xml:8(text)
msgid "The LineConnect attribute is a bitmask and determines which lines can be connected to an object and what the object conducts."
msgstr "Die LineConnect-Eigenschaft (DWord-Bitmaske) eines Objekts bestimmt, welche Leitungen an das Objekt angeschlossen werden können und welches Leitungsverhalten das Objekt hat."
#: sdk/definition/lineconnect.xml:20(col)
msgid "C4D_LiquidInput"
msgstr "C4D_LiquidInput"
#: sdk/definition/lineconnect.xml:21(col)
msgid "The end of a pipe can be connected."
msgstr "Das Ende eines Rohres kann angeschlossen werden."
#: sdk/definition/lineconnect.xml:26(col)
msgid "C4D_LiquidOutput"
msgstr "C4D_LiquidOutput"
#: sdk/definition/lineconnect.xml:27(col)
msgid "The beginning of a pipe can be connected."
msgstr "Der Anfang eines Rohres kann angeschlossen werden."
#: sdk/definition/lineconnect.xml:32(col)
msgid "C4D_LiquidPump"
msgstr "C4D_LiquidPump"
#: sdk/definition/lineconnect.xml:33(col)
msgid "The object is a pump."
msgstr "Das Objekt ist eine Pumpe."
#: sdk/definition/index.xml:9(text)
msgid "Object definitions are used for all game objects in clonk: fire monsters, the wooden hut, and the clonk himself. An object definition is a group file composed from the following components:"
msgstr "Mit Objektdefinitionen werden alle in Clonk vorkommenden Spielobjekte - vom Feuermonsterei über Holzhütten bis zum Clonk selber - definiert. Eine Objektdefinition ist eine Gruppendatei, die sich aus folgenden Komponenten zusammen setzt:"

View File

@ -86,8 +86,6 @@
<li><img src='../images/bullet_sheet.gif' alt='-' />
<emlink href="definition/vertices.html">Vertices</emlink></li>
<li><img src='../images/bullet_sheet.gif' alt='-' />
<emlink href="definition/lineconnect.html">LineConnect</emlink></li>
<li><img src='../images/bullet_sheet.gif' alt='-' />
<emlink href="definition/cnat.html">CNAT - Contact Attachment</emlink></li>
</ul>
</li>

View File

@ -173,12 +173,7 @@
<row>
<literal_col>Line</literal_col>
<col>Integer</col>
<col>1 source pipe, 2 drain pipe.</col>
</row>
<row>
<literal_col>LineConnect</literal_col>
<col>Integer</col>
<col>Connection behaviour for lines. See <emlink href="definition/lineconnect.html">LineConnect</emlink>.</col>
<col>0 or 1. If 1 the object is a line and exhibits special behaviour.</col>
</row>
<row>
<literal_col>Prey</literal_col>

View File

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE doc
SYSTEM '../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../clonk.xsl"?>
<doc>
<title>LineConnect</title>
<h id="LineConnect">LineConnect</h>
<text>The LineConnect attribute is a bitmask and determines which lines can be connected to an object and what the object conducts.</text>
<text>
<table>
<rowh>
<col>Bit</col>
<col>Value</col>
<col>Name</col>
<col>Description</col>
</rowh>
<row>
<col>1</col>
<col>1</col>
<col>C4D_LiquidInput</col>
<col>The end of a pipe can be connected.</col>
</row>
<row>
<col>2</col>
<col>2</col>
<col>C4D_LiquidOutput</col>
<col>The beginning of a pipe can be connected.</col>
</row>
<row>
<col>3</col>
<col>4</col>
<col>C4D_LiquidPump</col>
<col>The object is a pump.</col>
</row>
</table>
</text>
<author>Sven2</author><date>2002-04</date>
<author>Newton</author><date>2005-01</date>
<author>Günther</author><date>2006-07</date>
</doc>

View File

@ -14,6 +14,6 @@ while (obj = <funclink>FindObject</funclink>(0, -100,-100,200,200, <funclink>OCF
<funclink>SetR</funclink>(180, obj);</code> <text>This script turns all rotatable objects upside down.</text>
<h id="ocf_fns">OCF Constants</h>
<text>The following OCFs are defined in C4Script:</text>
<text><funclink>OCF_Alive</funclink>, <funclink>OCF_AttractLightning</funclink>, <funclink>OCF_Available</funclink>, <funclink>OCF_Chop</funclink>, <funclink>OCF_Collectible</funclink>, <funclink>OCF_Collection</funclink>, <funclink>OCF_Construct</funclink>, <funclink>OCF_Container</funclink>, <funclink>OCF_CrewMember</funclink>, <funclink>OCF_Edible</funclink>, <funclink>OCF_Entrance</funclink>, <funclink>OCF_Exclusive</funclink>, <funclink>OCF_Fullcon</funclink>, <funclink>OCF_Grab</funclink>, <funclink>OCF_HitSpeed1</funclink>, <funclink>OCF_HitSpeed2</funclink>, <funclink>OCF_HitSpeed3</funclink>, <funclink>OCF_HitSpeed4</funclink>, <funclink>OCF_Inflammable</funclink>, <funclink>OCF_InFree</funclink>, <funclink>OCF_InLiquid</funclink>, <funclink>OCF_InSolid</funclink>, <funclink>OCF_LineConstruct</funclink>, <funclink>OCF_Living</funclink>, <funclink>OCF_NotContained</funclink>, <funclink>OCF_OnFire</funclink>, <funclink>OCF_Prey</funclink>, <funclink>OCF_Rotate</funclink></text>
<text><funclink>OCF_Alive</funclink>, <funclink>OCF_AttractLightning</funclink>, <funclink>OCF_Available</funclink>, <funclink>OCF_Chop</funclink>, <funclink>OCF_Collectible</funclink>, <funclink>OCF_Collection</funclink>, <funclink>OCF_Construct</funclink>, <funclink>OCF_Container</funclink>, <funclink>OCF_CrewMember</funclink>, <funclink>OCF_Edible</funclink>, <funclink>OCF_Entrance</funclink>, <funclink>OCF_Exclusive</funclink>, <funclink>OCF_Fullcon</funclink>, <funclink>OCF_Grab</funclink>, <funclink>OCF_HitSpeed1</funclink>, <funclink>OCF_HitSpeed2</funclink>, <funclink>OCF_HitSpeed3</funclink>, <funclink>OCF_HitSpeed4</funclink>, <funclink>OCF_Inflammable</funclink>, <funclink>OCF_InFree</funclink>, <funclink>OCF_InLiquid</funclink>, <funclink>OCF_InSolid</funclink>, <funclink>OCF_Living</funclink>, <funclink>OCF_NotContained</funclink>, <funclink>OCF_OnFire</funclink>, <funclink>OCF_Prey</funclink>, <funclink>OCF_Rotate</funclink></text>
<author>Sven2</author><date>2002-05</date>
</doc>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>OCF_LineConstruct</title>
<category>Objects</category>
<subcat>OCF</subcat>
<version>4.9.1.0 GWE</version>
<syntax><rtype>int</rtype></syntax>
<desc>Object character flag: it is currently possible to connect lines to this object.</desc>
<remark>This value is also defined as a constant. Thus the parameter brackets can be omitted.</remark>
<remark>For more information and examples regarding these constants see <emlink href="definition/ocf.html">object character flags</emlink>.</remark>
<related>
<funclink>GetOCF</funclink>
<funclink>FindObject</funclink>
<emlink href="definition/ocf.html">Object character flags</emlink>
</related>
</func>
<author>Sven2</author><date>2002-05</date>
</funcs>

View File

@ -3,4 +3,4 @@ id=PowerLine
Version=4,10,0,0
Category=C4D_StaticBack
Vertices=2
Line=C4D_LineColored
Line=1

View File

@ -2,10 +2,6 @@
id=Fuse
Version=4,10,0,0
Category=C4D_StaticBack
Width=1
Height=1
Vertices=2
Value=0
Mass=0
Picture=0,0,64,64
Line=C4D_LineColored
Line=1

View File

@ -3,8 +3,6 @@ id=GrappleRope
Version=4,10,0,0
Category=C4D_StaticBack
Vertices=2
#Line=C4D_LineRope
#LineIntersect=0
Width=5
Height=12
Offset=-1,-6

View File

@ -17,7 +17,6 @@ Picture=0,0,64,52
Collection=-53,15,15,17
Exclusive=1
BlastIncinerate=130
LineConnect=C4D_LiquidInput
Construction=1
ContainBlast=1
AutoContextMenu=1

View File

@ -26,7 +26,6 @@ global func GetDefBlastIncinerate() { return GetDefCoreVal("BlastIncinerate", "D
global func GetDefBurnTo() { return GetDefCoreVal("BurnTo", "DefCore"); }
global func GetDefBase() { return GetDefCoreVal("Base", "DefCore"); }
global func GetDefLine() { return GetDefCoreVal("Line", "DefCore"); }
global func GetDefLineConnect() { return GetDefCoreVal("Exclusive", "DefCore"); }
global func GetDefPrey() { return GetDefCoreVal("Prey", "DefCore"); }
global func GetDefEdible() { return GetDefCoreVal("Edible", "DefCore"); }
global func GetDefCrewMember() { return GetDefCoreVal("Prey", "DefCore"); }

View File

@ -112,18 +112,17 @@ const uint32_t
OCF_Collection = 1<<14,
OCF_Living = 1<<15,
OCF_HitSpeed4 = 1<<16,
OCF_LineConstruct = 1<<17,
OCF_Prey = 1<<18,
OCF_AttractLightning = 1<<19,
OCF_NotContained = 1<<20,
OCF_CrewMember = 1<<21,
OCF_Edible = 1<<22,
OCF_InLiquid = 1<<23,
OCF_InSolid = 1<<24,
OCF_InFree = 1<<25,
OCF_Available = 1<<26,
OCF_Container = 1<<27,
OCF_Alive = 1<<28;
OCF_Prey = 1<<17,
OCF_AttractLightning = 1<<18,
OCF_NotContained = 1<<19,
OCF_CrewMember = 1<<20,
OCF_Edible = 1<<21,
OCF_InLiquid = 1<<22,
OCF_InSolid = 1<<23,
OCF_InFree = 1<<24,
OCF_Available = 1<<25,
OCF_Container = 1<<26,
OCF_Alive = 1<<27;
//================================== Contact / Attachment ==============================================

View File

@ -1849,15 +1849,12 @@ void C4Command::Acquire()
// Object is near enough
if (Inside(cObj->GetX()-pMaterial->GetX(),-Tx._getInt(),+Tx._getInt()))
if (Inside(cObj->GetY()-pMaterial->GetY(),-Ty,+Ty))
// Object is not connected to a pipe (for line construction kits)
if (!Game.FindObject(C4ID::SourcePipe,0,0,0,0,OCF_All,"Connect",pMaterial))
if (!Game.FindObject(C4ID::DrainPipe,0,0,0,0,OCF_All,"Connect",pMaterial))
// Must be complete
if (pMaterial->OCF & OCF_FullCon)
// Doesn't burn
if (!pMaterial->GetOnFire())
// We found one
break;
// Must be complete
if (pMaterial->OCF & OCF_FullCon)
// Doesn't burn
if (!pMaterial->GetOnFire())
// We found one
break;
// Available material found: get material
if (pMaterial)
@ -1977,8 +1974,6 @@ void C4Command::Fail(const char *szFailMessage)
}
}
C4Object *CreateLine(C4ID idType, int32_t iOwner, C4Object *pFrom, C4Object *pTo);
void C4Command::Retry()
{

View File

@ -86,7 +86,6 @@ void C4Def::DefaultDefCore()
UprightAttach=0;
ContactFunctionCalls=0;
Line=0;
LineConnect=0;
LineIntersect=0;
NoBurnDecay=0;
IncompleteActivity=0;
@ -235,35 +234,8 @@ void C4Def::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt(Exclusive, "Exclusive", 0 ));
pComp->Value(mkNamingAdapt(ContactIncinerate, "ContactIncinerate", 0 ));
pComp->Value(mkNamingAdapt(BlastIncinerate, "BlastIncinerate", 0 ));
pComp->Value(mkNamingAdapt(BurnTurnTo, "BurnTo", C4ID::None ));
const StdBitfieldEntry<int32_t> LineTypes[] =
{
{ "C4D_LineSource" ,C4D_Line_Source},
{ "C4D_LineDrain" ,C4D_Line_Drain},
{ "C4D_LineColored" ,C4D_Line_Colored},
{ "C4D_LineVertex" ,C4D_Line_Vertex},
{ NULL, 0}
};
pComp->Value(mkNamingAdapt(mkBitfieldAdapt(Line, LineTypes),"Line", 0 ));
const StdBitfieldEntry<int32_t> LineConnectTypes[] =
{
{ "C4D_LiquidInput" ,C4D_Liquid_Input},
{ "C4D_LiquidOutput" ,C4D_Liquid_Output},
{ "C4D_LiquidPump" ,C4D_Liquid_Pump},
{ NULL, 0}
};
pComp->Value(mkNamingAdapt(mkBitfieldAdapt(LineConnect, LineConnectTypes),
"LineConnect", 0 ));
pComp->Value(mkNamingAdapt(BurnTurnTo, "BurnTo", C4ID::None ));
pComp->Value(mkNamingAdapt(Line, "Line", 0 ));
pComp->Value(mkNamingAdapt(LineIntersect, "LineIntersect", 0 ));
pComp->Value(mkNamingAdapt(Prey, "Prey", 0 ));
pComp->Value(mkNamingAdapt(Edible, "Edible", 0 ));
@ -272,8 +244,8 @@ void C4Def::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt(Growth, "Growth", 0 ));
pComp->Value(mkNamingAdapt(Rebuyable, "Rebuy", 0 ));
pComp->Value(mkNamingAdapt(Constructable, "Construction", 0 ));
pComp->Value(mkNamingAdapt(BuildTurnTo, "ConstructTo", C4ID::None ));
pComp->Value(mkNamingAdapt(Grab, "Grab", 0 ));
pComp->Value(mkNamingAdapt(BuildTurnTo, "ConstructTo", C4ID::None ));
pComp->Value(mkNamingAdapt(Grab, "Grab", 0 ));
const StdBitfieldEntry<int32_t> GrabPutGetTypes[] =
{

View File

@ -75,15 +75,6 @@ C4D_Border_Top = 2,
C4D_Border_Bottom = 4,
C4D_Border_Layer = 8,
C4D_Line_Source = 1,
C4D_Line_Drain = 2,
C4D_Line_Colored = 3,
C4D_Line_Vertex = 4,
C4D_Liquid_Input = 1,
C4D_Liquid_Output = 2,
C4D_Liquid_Pump = 4,
C4D_Place_Surface = 0,
C4D_Place_Liquid = 1,
C4D_Place_Air = 2;
@ -151,7 +142,6 @@ public:
int32_t UprightAttach;
int32_t ContactFunctionCalls;
int32_t Line;
int32_t LineConnect;
int32_t LineIntersect;
int32_t NoBurnDecay;
int32_t IncompleteActivity;

View File

@ -39,10 +39,7 @@ const C4ID C4ID::StructuresSnowIn(std::string("STSN"));
const C4ID C4ID::CnMaterial(std::string("CNMT"));
const C4ID C4ID::Flag(std::string("FLAG"));
const C4ID C4ID::FlagRemvbl(std::string("FGRV"));
const C4ID C4ID::Linekit(std::string("CableReel"));
const C4ID C4ID::Conkit(std::string("CNKT"));
const C4ID C4ID::SourcePipe(std::string("SPIP"));
const C4ID C4ID::DrainPipe(std::string("DPIP"));
const C4ID C4ID::Clonk(std::string("Clonk"));
const C4ID C4ID::Flame(std::string("FLAM"));
const C4ID C4ID::Meteor(std::string("METO"));

View File

@ -55,10 +55,7 @@ public:
DEPRECATED static const C4ID StructuresSnowIn;
DEPRECATED static const C4ID Flag;
DEPRECATED static const C4ID FlagRemvbl; // Flag removable
DEPRECATED static const C4ID Linekit;
DEPRECATED static const C4ID Conkit; // Construction kit
DEPRECATED static const C4ID SourcePipe;
DEPRECATED static const C4ID DrainPipe;
DEPRECATED static const C4ID Clonk;
DEPRECATED static const C4ID Flame;
DEPRECATED static const C4ID Meteor;

View File

@ -816,10 +816,6 @@ void C4Object::SetOCF()
OCF|=OCF_Living;
if (Alive) OCF|=OCF_Alive;
}
// OCF_LineConstruct
if (OCF & OCF_FullCon)
if (Def->LineConnect)
OCF|=OCF_LineConstruct;
// OCF_Prey
if (Def->Prey)
if (Alive)
@ -883,7 +879,7 @@ void C4Object::UpdateOCF()
OCF=OCF & (OCF_Normal | OCF_Exclusive | OCF_Edible | OCF_Grab | OCF_FullCon
/*| OCF_Chop - now updated regularly, see below */
| OCF_Rotate | OCF_OnFire | OCF_Inflammable | OCF_Living | OCF_Alive
| OCF_LineConstruct | OCF_Prey | OCF_CrewMember | OCF_AttractLightning);
| OCF_Prey | OCF_CrewMember | OCF_AttractLightning);
// OCF_Carryable: Can be picked up
if (GetPropertyInt(P_Collectible))
OCF|=OCF_Carryable;
@ -2527,19 +2523,13 @@ void C4Object::DrawLine(C4TargetFacet &cgo)
int32_t color0 = 0xFFFF00FF, color1 = 0xFFFF00FF; // use bright colors so author notices
if (colors)
{
color0 = colors->GetItem(0).getInt(); color1 = colors->GetItem(1).getInt();
color0 = colors->GetItem(0).getInt();
color1 = colors->GetItem(1).getInt();
}
for (int32_t vtx=0; vtx+1<Shape.VtxNum; vtx++)
switch (Def->Line)
{
case C4D_Line_Source: case C4D_Line_Drain:
case C4D_Line_Vertex:
case C4D_Line_Colored:
cgo.DrawLineDw(Shape.VtxX[vtx],Shape.VtxY[vtx],
Shape.VtxX[vtx+1],Shape.VtxY[vtx+1],
color0, color1);
break;
}
cgo.DrawLineDw(Shape.VtxX[vtx],Shape.VtxY[vtx],
Shape.VtxX[vtx+1],Shape.VtxY[vtx+1],
color0, color1);
// reset blit mode
FinishedDrawing();
}
@ -4345,18 +4335,9 @@ void C4Object::ExecAction()
bool fBroke;
fBroke=false;
int32_t iConnectX,iConnectY;
int32_t attachVertex0,attachVertex1;
attachVertex0=attachVertex1=0;
{
C4Value lineAttachV; GetProperty(P_LineAttach, &lineAttachV);
C4ValueArray *lineAttach = lineAttachV.getArray();
if (lineAttach)
{
attachVertex0 = lineAttach->GetItem(0).getInt();
attachVertex1 = lineAttach->GetItem(1).getInt();
}
}
int32_t iConnectX, iConnectY;
int32_t iAttachX, iAttachY;
iAttachX = iAttachY = 0;
// Line destruction check: Target missing or incomplete
if (!Action.Target || (Action.Target->Con<FullCon)) fBroke=true;
@ -4371,17 +4352,16 @@ void C4Object::ExecAction()
// Movement by Target
if (Action.Target)
{
// Connect to vertex
if (Def->Line == C4D_Line_Vertex)
// Connect to attach vertex
C4Value lineAttachV;
Action.Target->GetProperty(P_LineAttach, &lineAttachV);
C4ValueArray *lineAttach = lineAttachV.getArray();
iConnectX = Action.Target->GetX();
iConnectY = Action.Target->GetY();
if (lineAttach)
{
iConnectX=Action.Target->GetX()+Action.Target->Shape.GetVertexX(attachVertex0);
iConnectY=Action.Target->GetY()+Action.Target->Shape.GetVertexY(attachVertex0);
}
// Connect to bottom center
else
{
iConnectX=Action.Target->GetX();
iConnectY=Action.Target->GetY()+Action.Target->Shape.Hgt/4;
iConnectX += lineAttach->GetItem(0).getInt();
iConnectY += lineAttach->GetItem(1).getInt();
}
if ((iConnectX!=Shape.VtxX[0]) || (iConnectY!=Shape.VtxY[0]))
{
@ -4397,17 +4377,16 @@ void C4Object::ExecAction()
// Movement by Target2
if (Action.Target2)
{
// Connect to vertex
if (Def->Line == C4D_Line_Vertex)
// Connect to attach vertex
C4Value lineAttachV;
Action.Target2->GetProperty(P_LineAttach, &lineAttachV);
C4ValueArray *lineAttach = lineAttachV.getArray();
iConnectX = Action.Target2->GetX();
iConnectY = Action.Target2->GetY();
if (lineAttach)
{
iConnectX=Action.Target2->GetX()+Action.Target2->Shape.GetVertexX(attachVertex1);
iConnectY=Action.Target2->GetY()+Action.Target2->Shape.GetVertexY(attachVertex1);
}
// Connect to bottom center
else
{
iConnectX=Action.Target2->GetX();
iConnectY=Action.Target2->GetY()+Action.Target2->Shape.Hgt/4;
iConnectX += lineAttach->GetItem(0).getInt();
iConnectY += lineAttach->GetItem(1).getInt();
}
if ((iConnectX!=Shape.VtxX[Shape.VtxNum-1]) || (iConnectY!=Shape.VtxY[Shape.VtxNum-1]))
{

View File

@ -376,159 +376,6 @@ bool ObjectComDig(C4Object *cObj) // by DFA_WALK
return true;
}
C4Object *CreateLine(C4ID idType, int32_t iOwner, C4Object *pFrom, C4Object *pTo)
{
C4Object *pLine;
if (!pFrom || !pTo) return NULL;
if (!(pLine=Game.CreateObject(idType,pFrom,iOwner,0,0))) return NULL;
pLine->Shape.VtxNum=2;
pLine->Shape.VtxX[0]=pFrom->GetX();
pLine->Shape.VtxY[0]=pFrom->GetY()+pFrom->Shape.Hgt/4;
pLine->Shape.VtxX[1]=pTo->GetX();
pLine->Shape.VtxY[1]=pTo->GetY()+pTo->Shape.Hgt/4;
pLine->Action.Target=pFrom;
pLine->Action.Target2=pTo;
return pLine;
}
bool ObjectComLineConstruction(C4Object *cObj)
{
C4Object *linekit,*tstruct,*cline;
DWORD ocf;
ObjectActionStand(cObj);
// - - - - - - - - - - - - - - - - - - Line pickup - - - - - - - - - - - - - - - - -
// Check for linekit
if (!(linekit=cObj->Contents.Find(C4ID::Linekit)))
{
// Check line pickup
ocf=OCF_LineConstruct;
tstruct=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj);
if (!tstruct || !(ocf & OCF_LineConstruct)) return false;
if (!(cline=Game.FindObject(C4ID::None,0,0,0,0,OCF_All,"Connect",tstruct))) return false;
// Check line connected to linekit at other end
if ( (cline->Action.Target && (cline->Action.Target->Def->id==C4ID::Linekit))
|| (cline->Action.Target2 && (cline->Action.Target2->Def->id==C4ID::Linekit)) )
{
StartSoundEffect("Error",false,100,cObj);
GameMsgObjectError(FormatString(LoadResStr("IDS_OBJ_NODOUBLEKIT"),cline->GetName()).getData(),cObj); return false;
}
// Create new linekit
if (!(linekit=Game.CreateObject(C4ID::Linekit,cObj,cline->Owner))) return false;
// Enter linekit into clonk
bool fRejectCollect;
if (!linekit->Enter(cObj, true, true, &fRejectCollect))
{
// Enter failed: abort operation
linekit->AssignRemoval(); return false;
}
// Attach line to collected linekit
StartSoundEffect("Connect",false,100,cObj);
if (cline->Action.Target==tstruct) cline->Action.Target=linekit;
if (cline->Action.Target2==tstruct) cline->Action.Target2=linekit;
// Message
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_DISCONNECT"),cline->GetName(),tstruct->GetName()).getData(),tstruct);
return true;
}
// - - - - - - - - - - - - - - - Active construction - - - - - - - - - - - - - - - - -
// Active line construction
if ((cline=Game.FindObject(C4ID::None,0,0,0,0,OCF_All,"Connect",linekit)))
{
// Check for structure connection
ocf=OCF_LineConstruct;
tstruct=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj);
// No structure
if (!tstruct || !(ocf & OCF_LineConstruct))
{
// No connect
StartSoundEffect("Error",false,100,cObj);
GameMsgObjectError(LoadResStr("IDS_OBJ_NOCONNECT"),cObj); return false;
}
// Check short circuit -> removal
if ((cline->Action.Target==tstruct)
|| (cline->Action.Target2==tstruct))
{
StartSoundEffect("Connect",false,100,cObj);
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_LINEREMOVAL"),cline->GetName()).getData(),tstruct);
cline->AssignRemoval();
return true;
}
// Check for correct connection type
bool connect_okay=false;
switch (cline->Def->Line)
{
case C4D_Line_Source:
if (tstruct->Def->LineConnect & C4D_Liquid_Output) connect_okay=true; break;
case C4D_Line_Drain:
if (tstruct->Def->LineConnect & C4D_Liquid_Input) connect_okay=true; break;
default: return false; // Undefined line type
}
if (!connect_okay)
{
StartSoundEffect("Error",false,100,cObj);
GameMsgObjectError(FormatString(LoadResStr("IDS_OBJ_NOCONNECTTYPE"),cline->GetName(),tstruct->GetName()).getData(),tstruct);
return false;
}
// Connect line to structure
StartSoundEffect("Connect",false,100,cObj);
if (cline->Action.Target==linekit) cline->Action.Target=tstruct;
if (cline->Action.Target2==linekit) cline->Action.Target2=tstruct;
linekit->Exit();
linekit->AssignRemoval();
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_CONNECT"),cline->GetName(),tstruct->GetName()).getData(),tstruct);
return true;
}
// - - - - - - - - - - - - - - - - New line - - - - - - - - - - - - - - - - - - - - -
// Check for new structure connection
ocf=OCF_LineConstruct;
tstruct=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj);
if (!tstruct || !(ocf & OCF_LineConstruct))
{
StartSoundEffect("Error",false,100,cObj);
GameMsgObjectError(LoadResStr("IDS_OBJ_NONEWLINE"),cObj); return false;
}
// Determine new line type
C4ID linetype=C4ID::None;
// Check source pipe
if (linetype==C4ID::None)
if (tstruct->Def->LineConnect & C4D_Liquid_Pump)
if (!Game.FindObject(C4ID::SourcePipe,0,0,0,0,OCF_All,"Connect",tstruct))
linetype = C4ID::SourcePipe;
// Check drain pipe
if (linetype==C4ID::None)
if (tstruct->Def->LineConnect & C4D_Liquid_Output)
if (!Game.FindObject(C4ID::DrainPipe,0,0,0,0,OCF_All,"Connect",tstruct))
linetype = C4ID::DrainPipe;
// No good
if (linetype==C4ID::None)
{
StartSoundEffect("Error",false,100,cObj);
GameMsgObjectError(LoadResStr("IDS_OBJ_NONEWLINE"),cObj); return false;
}
// Create new line
C4Object *newline=CreateLine(linetype,cObj->Owner,
tstruct,linekit);
if (!newline) return false;
StartSoundEffect("Connect",false,100,cObj);
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NEWLINE"),newline->GetName()).getData(),tstruct);
return true;
}
void ObjectComDigDouble(C4Object *cObj) // "Activation" by DFA_WALK, DFA_DIG, DFA_SWIM
{
C4Object *pTarget;
@ -539,13 +386,6 @@ void ObjectComDigDouble(C4Object *cObj) // "Activation" by DFA_WALK, DFA_DIG, DF
if (!! cObj->Contents.GetObject()->Call(PSF_Activate,&C4AulParSet(C4VObj(cObj))))
return;
// Linekit: Line construction (move to linekit script...)
if (cObj->Contents.GetObject() && (cObj->Contents.GetObject()->id==C4ID::Linekit))
{
ObjectComLineConstruction(cObj);
return;
}
// Chop
ocf=OCF_Chop;
if (cObj->GetProcedure()!=DFA_SWIM)
@ -556,14 +396,6 @@ void ObjectComDigDouble(C4Object *cObj) // "Activation" by DFA_WALK, DFA_DIG, DF
return;
}
// Line construction pick up
ocf=OCF_LineConstruct;
if (!cObj->Contents.GetObject())
if ((pTarget=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
if (ocf & OCF_LineConstruct)
if (ObjectComLineConstruction(cObj))
return;
// Own activation call
if (!! cObj->Call(PSF_Activate, &C4AulParSet(C4VObj(cObj)))) return;

View File

@ -533,8 +533,6 @@ void C4Player::PlaceReadyCrew(int32_t tx1, int32_t tx2, int32_t ty, C4Object *Fi
}
C4Object *CreateLine(C4ID linetype, int32_t owner, C4Object *fobj, C4Object *tobj);
void C4Player::PlaceReadyBase(int32_t &tx, int32_t &ty, C4Object **pFirstBase)
{
int32_t cnt,cnt2,ctx,cty;

View File

@ -6073,15 +6073,6 @@ C4ScriptConstDef C4ScriptConstMap[]=
{ "C4D_GrabGet" ,C4V_Int, C4D_Grab_Get},
{ "C4D_GrabPut" ,C4V_Int, C4D_Grab_Put},
{ "C4D_LineSource" ,C4V_Int, C4D_Line_Source},
{ "C4D_LineDrain" ,C4V_Int, C4D_Line_Drain},
{ "C4D_LineColored" ,C4V_Int, C4D_Line_Colored},
{ "C4D_LineVertex" ,C4V_Int, C4D_Line_Vertex},
{ "C4D_LiquidInput" ,C4V_Int, C4D_Liquid_Input},
{ "C4D_LiquidOutput" ,C4V_Int, C4D_Liquid_Output},
{ "C4D_LiquidPump" ,C4V_Int, C4D_Liquid_Pump},
{ "C4V_Any" ,C4V_Int, C4V_Any},
{ "C4V_Int" ,C4V_Int, C4V_Int},
{ "C4V_Bool" ,C4V_Int, C4V_Bool},
@ -6120,7 +6111,6 @@ C4ScriptConstDef C4ScriptConstMap[]=
{ "OCF_Collection" ,C4V_Int, OCF_Collection},
{ "OCF_Living" ,C4V_Int, OCF_Living},
{ "OCF_HitSpeed4" ,C4V_Int, OCF_HitSpeed4},
{ "OCF_LineConstruct" ,C4V_Int, OCF_LineConstruct},
{ "OCF_Prey" ,C4V_Int, OCF_Prey},
{ "OCF_AttractLightning" ,C4V_Int, OCF_AttractLightning},
{ "OCF_NotContained" ,C4V_Int, OCF_NotContained},