objects: Replace Grab defcore value with Touchable property

Günther Brammer 2011-01-02 23:55:48 +01:00
parent db54822b89
commit 96fa57eb6b
15 changed files with 12 additions and 13 deletions

View File

@ -11,5 +11,4 @@ VertexY=8,8,0
VertexFriction=100,100,100
Value=20
Mass=1000
Grab=2
Components=Wood=3;Metal=1;

View File

@ -60,3 +60,4 @@ func Definition(def) {
SetProperty("PictureTransformation", Trans_Mul(Trans_Scale(800), Trans_Translate(0,0,0),Trans_Rotate(-20,1,0,0),Trans_Rotate(-30,0,1,0)), def);
SetProperty("MeshTransformation", Trans_Rotate(-13,0,1,0));
}
local Touchable = 2;

View File

@ -11,5 +11,4 @@ VertexY=8,8,0
VertexFriction=100,100,100
Value=20
Mass=1000
Grab=2
Components=Wood=3;Metal=1;

View File

@ -67,3 +67,4 @@ func Definition(def) {
SetProperty("PictureTransformation", Trans_Mul(Trans_Scale(800), Trans_Translate(0,0,0),Trans_Rotate(-20,1,0,0),Trans_Rotate(-30,0,1,0)), def);
SetProperty("MeshTransformation", Trans_Rotate(-13,0,1,0));
}
local Touchable = 2;

View File

@ -15,7 +15,6 @@ Value=50
Mass=125
Components=Metal=4;Wood=2;
Rebuy=1
Grab=1
GrabPutGet=C4D_GrabGet|C4D_GrabPut
Rotate=30
UprightAttach=8

View File

@ -346,3 +346,4 @@ func Definitio(def)
local Name = "$Name$";
local Description = "$Description$";
local Touchable = 1;

View File

@ -16,7 +16,6 @@ Mass=75
Components=Metal=2;Wood=1;
Collection=-12,-8,24,10
Rebuy=1
Grab=1
GrabPutGet=C4D_GrabGet|C4D_GrabPut
Rotate=30
UprightAttach=8

View File

@ -119,3 +119,4 @@ func Definition(def)
local Name = "$Name$";
local Description = "$Description$";
local Touchable = 1;

View File

@ -292,7 +292,7 @@ void C4Command::MoveTo()
// Pushing grab only or not desired: let go (pulling, too?)
if (cObj->GetProcedure()==DFA_PUSH)
if (cObj->Action.Target)
if (cObj->Action.Target->Def->Grab == 2 || !(Data.getInt() & C4CMD_MoveTo_PushTarget))
if (cObj->Action.Target->GetPropertyInt(P_Touchable) == 2 || !(Data.getInt() & C4CMD_MoveTo_PushTarget))
{
// Re-evaluate this command because vehicle control might have blocked evaluation
Evaluated=false;
@ -568,7 +568,7 @@ void C4Command::Enter()
// Pushing grab only or pushing not desired: let go
if (cObj->GetProcedure()==DFA_PUSH)
if (cObj->Action.Target)
if (cObj->Action.Target->Def->Grab == 2 || !(Data.getInt() & C4CMD_Enter_PushTarget))
if (cObj->Action.Target->GetPropertyInt(P_Touchable) == 2 || !(Data.getInt() & C4CMD_Enter_PushTarget))
{ cObj->AddCommand(C4CMD_UnGrab,NULL,0,0,50); return; }
// Pushing target: let go

View File

@ -71,7 +71,6 @@ void C4Def::DefaultDefCore()
ContactIncinerate=0;
BlastIncinerate=0;
Constructable=0;
Grab=0;
Rotateable=0;
RotatedEntrance=0;
Float=0;
@ -243,7 +242,6 @@ void C4Def::CompileFunc(StdCompiler *pComp)
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 ));
const StdBitfieldEntry<int32_t> GrabPutGetTypes[] =
{

View File

@ -128,7 +128,6 @@ public:
int32_t ContactIncinerate; // 0 off 1 high - 5 low
int32_t BlastIncinerate; // 0 off 1 - x if > damage
int32_t Constructable;
int32_t Grab; // 0 not 1 push 2 grab only
int32_t Rotateable;
int32_t Float;
int32_t ColorByOwner;

View File

@ -765,7 +765,7 @@ void C4Object::SetOCF()
&& (r==0) && !OnFire)
OCF|=OCF_Construct;
// OCF_Grab: Can be pushed
if (Def->Grab && !(Category & C4D_StaticBack))
if (GetPropertyInt(P_Touchable))
OCF|=OCF_Grab;
// OCF_Carryable: Can be picked up
if (GetPropertyInt(P_Collectible))
@ -1560,7 +1560,7 @@ bool C4Object::Push(C4Real txdir, C4Real dforce, bool fStraighten)
// Valid check
if (!Status || !Def || Contained || !(OCF & OCF_Grab)) return false;
// Grabbing okay, no pushing
if (Def->Grab==2) return true;
if (GetPropertyInt(P_Touchable)==2) return true;
// Mobilization check (pre-mobilization zero)
if (!Mobile)
{ xdir=ydir=Fix0; }

View File

@ -91,6 +91,7 @@ C4StringTable::C4StringTable()
P[P_CommandTarget] = "CommandTarget";
P[P_Time] = "Time";
P[P_Collectible] = "Collectible";
P[P_Touchable] = "Touchable";
P[P_ActMap] = "ActMap";
P[P_Procedure] = "Procedure";
P[P_Speed] = "Speed";

View File

@ -179,6 +179,7 @@ enum C4PropertyName
P_CommandTarget,
P_Time,
P_Collectible,
P_Touchable,
P_ActMap,
P_Attach,
P_Visibility,

View File

@ -87,8 +87,8 @@ for root, dirs, files in os.walk('.'):
properties["Name"] = convertname(root, files, m.group(2))
elif m and m.group(1) == "Collectible":
properties["Collectible"] = m.group(2)
#elif m and m.group(1) == "Grab":
#properties["Touchable"] = m.group(2)
elif m and m.group(1) == "Grab":
properties["Touchable"] = m.group(2)
else:
f.write(line)
f.write("\n")