make ContactCalls a property instead of DefCore entry

This allows for useful runtime changes, like disabling contact calls when an animal dies.
liquid_container
Maikel de Vries 2016-02-08 21:16:11 +01:00
parent 3fb3f45a35
commit 159dbf071f
51 changed files with 39 additions and 41 deletions

View File

@ -5,7 +5,7 @@
<doc>
<title>CNAT - Contact Attachment</title>
<h>CNAT - Contact Attachment</h>
<text>In multiple places the engine uses ContactAttachment values (a bitmask) to manage the orientation of objects and processes. For example, a vertex of an object can have the <code id="CNAT">CNAT</code> bit <em>left</em>. If that object has <emlink href="definition/defcore.html">ContactCalls</emlink> activated, the engine calls on every contact of that vertex with the landscape the object script function <em>ContactLeft</em>. CNAT values are composed of the following bits:</text>
<text>In multiple places the engine uses ContactAttachment values (a bitmask) to manage the orientation of objects and processes. For example, a vertex of an object can have the <code id="CNAT">CNAT</code> bit <em>left</em>. If that object has <emlink href="definition/properties.html">ContactCalls</emlink> activated, the engine calls on every contact of that vertex with the landscape the object script function <em>ContactLeft</em>. CNAT values are composed of the following bits:</text>
<text>
<table>
<rowh>

View File

@ -35,11 +35,6 @@
<col>Integer</col>
<col>Category of the object. Also see <emlink href="definition/category.html">object categories</emlink>.</col>
</row>
<row>
<literal_col>ContactCalls</literal_col>
<col>Integer</col>
<col>0 or 1. If 1, Contactcalls are called in the object script.</col>
</row>
<row>
<literal_col>Width</literal_col>
<col>Integer</col>

View File

@ -180,6 +180,11 @@ Stand = {
<col>Integer</col>
<col>Bit mask indicating object boundaries: stop at map sides (C4D_Border_Sides), stop at map top (C4D_Border_Top), stop at map bottom (C4D_Border_Sides), stop at object layer boundaries (C4D_Border_Layer). For example BorderBound = C4D_Border_Top | C4D_Border_Bottom.</col>
</row>
<row>
<literal_col>ContactCalls</literal_col>
<col>bool</col>
<col>True or false. If true, <emlink href="definition/cnat.html">ContactCalls</emlink> are called in the object script.</col>
</row>
</table>
</text>
</part>

View File

@ -2,7 +2,6 @@
id=Boomattack
Version=7,0
Category=C4D_Vehicle
ContactCalls=1
Width=15
Height=27
Offset=-7,-13

View File

@ -100,3 +100,4 @@ local PerspectiveTheta = 25;
local PerspectivePhi = 30;
local FlySpeed = 100;
local Name = "$Name$";
local ContactCalls = true;

View File

@ -2,7 +2,6 @@
id=BigBoomattack
Version=6,0
Category=C4D_Object
ContactCalls=1
Width=60
Height=100
Offset=-30,-50

View File

@ -109,4 +109,5 @@ local ActMap = {
Hgt = 100
},
};
local ContactCalls = true;
*/

View File

@ -2,7 +2,6 @@
id=Boomattack
Version=7,0
Category=C4D_Vehicle
ContactCalls=1
Width=15
Height=27
Offset=-7,-13

View File

@ -130,4 +130,5 @@ local ActMap = {
};
local FlySpeed = 100;
local Name = "$Name$";
local Name = "$Name$";
local ContactCalls = true;

View File

@ -2,7 +2,6 @@
id=CableLorry
Version=6,0
Category=C4D_Vehicle
ContactCalls=1
Width=22
Height=16
Offset=-11,-8

View File

@ -138,4 +138,5 @@ func Definition(def)
local Name = "$Name$";
local Description = "$Description$";
local Touchable = 1;
local BorderBound = C4D_Border_Sides;
local BorderBound = C4D_Border_Sides;
local ContactCalls = true;

View File

@ -11,7 +11,6 @@ VertexY=0,-4,2,0
VertexFriction=25,25,25,25
VertexCNAT=1,4,8,2
Mass=3
ContactCalls=1
StretchGrowth=1
Oversize=1
IncompleteActivity=1

View File

@ -529,6 +529,7 @@ local MaxBreath = 180;
local NoBurnDecay = 1;
local ContactIncinerate = 10;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
local ContactCalls = true;
local ActMap = {
Hang = {

View File

@ -2,7 +2,6 @@
id=Butterfly
Version=6,0
Category=C4D_Living
ContactCalls=1
Width=6
Height=4
Offset=-3,-2

View File

@ -216,6 +216,7 @@ local MaxBreath = 125;
local Placement = 2;
local NoBurnDecay = 1;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
local ContactCalls = true;
func Definition(def) {
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(20,1,0,0),Trans_Rotate(70,0,1,0)), def);

View File

@ -11,7 +11,6 @@ VertexY=-1,-3,3,-0,-0,-3,-3
VertexCNAT=0,4,11,1,2,1,2
VertexFriction=300,300,100,300,300,300,300
Mass=30
ContactCalls=1
NoGet=1
Float=0
StretchGrowth=1

View File

@ -274,6 +274,7 @@ local NoBurnDecay = 1;
local ContactIncinerate = 15;
local CorrosionResist = 1;
local BorderBound = C4D_Border_Sides;
local ContactCalls = true;
local ActMap = {
Walk = {

View File

@ -2,7 +2,6 @@
id=Fish
Version=6,0
Category=C4D_Living
ContactCalls=1
Width=7
Height=7
Offset=-3,-3

View File

@ -513,6 +513,7 @@ local Placement = 1;
local NoBurnDecay = 1;
local BreatheWater = 1;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
local ContactCalls = true;
func IsPrey() { return true; }

View File

@ -2,7 +2,6 @@
id=Mosquito
Version=6,1
Category=C4D_Living
ContactCalls=1
Width=2
Height=2
Offset=-1,-1

View File

@ -250,4 +250,5 @@ local MaxEnergy = 20000;
local MaxBreath = 250;
local Placement = 2;
local NoBurnDecay = 1;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
local ContactCalls = true;

View File

@ -2,7 +2,6 @@
id=Piranha
Version=6,0
Category=C4D_Living
ContactCalls=1
Width=8
Height=6
Offset=-4,-3

View File

@ -118,6 +118,7 @@ local Placement = 1;
local NoBurnDecay = 1;
local BreatheWater = 1;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
local ContactCalls = true;
func IsPrey() { return false; }
func IsPredator() { return true; }

View File

@ -2,7 +2,6 @@
id=PiranhaSmall
Version=6,0
Category=C4D_Living
ContactCalls=1
Width=4
Height=2
Offset=-2,-1

View File

@ -11,7 +11,6 @@ VertexY= 0,-3,4, 1,1,-1,-1
VertexCNAT=0, 4,8, 1,2, 1, 2
VertexFriction=300,300,100,300,300,300,300
Mass=30
ContactCalls=1
NoGet=1
Float=0
StretchGrowth=1

View File

@ -754,6 +754,8 @@ local MaxEnergy = 30000;
local MaxBreath = 10000;
local NoBurnDecay = 1;
local BorderBound = C4D_Border_Sides;
local ContactCalls = true;
local ActMap = {
Walk = {

View File

@ -2,7 +2,6 @@
id=Squid
Version=5,2,0,1
Category=C4D_Living
ContactCalls=1
Width=20
Height=15
Offset=-10,-7

View File

@ -556,6 +556,7 @@ local Placement = 1;
local NoBurnDecay = 1;
local BreatheWater = 1;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
local ContactCalls = true;
public func Definition(def) {
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(20,1,0,0),Trans_Rotate(70,0,1,0)), def);

View File

@ -16,5 +16,4 @@ Float=0
StretchGrowth=1
IncompleteActivity=1
Oversize=1
Pathfinder=1
ContactCalls=1
Pathfinder=1

View File

@ -651,6 +651,7 @@ local NoBurnDecay = true;
local Collectible = true;
local ContactIncinerate = 10;
local BorderBound = C4D_Border_Sides;
local ContactCalls = true;
protected func Definition(proplist def)
{

View File

@ -2,7 +2,6 @@
id=Zap
Version=6,1
Category=C4D_Living
ContactCalls=1
Width=2
Height=2
Offset=-1,-1

View File

@ -247,4 +247,5 @@ local MaxEnergy = 30000;
local MaxBreath = 250;
local Placement = 2;
local NoBurnDecay = 1;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
local BorderBound = C4D_Border_Sides | C4D_Border_Top | C4D_Border_Bottom;
local ContactCalls = true;

View File

@ -10,5 +10,4 @@ VertexX=0,0,-15,15,-12,12,-10,10,0,-5,5,0
VertexY=30,-15,0,0,-8,-8,10,10,35,30,30,25
VertexFriction=50,50,50,50,50,50,50,50,50,50,50,50
VertexCNAT=16,4,1,2,5,6,1,2,8,9,10,24
ContactCalls=1
Mass=3

View File

@ -291,3 +291,4 @@ local ActMap = {
};
local Name = "$Name$";
local BorderBound = C4D_Border_Sides;
local ContactCalls = true;

View File

@ -17,5 +17,4 @@ Components=Wood=1
SolidMask=0,0,24,3,0,23
Picture=24,0,128,128
HorizontalFix=1
NoPushEnter=1
ContactCalls=1
NoPushEnter=1

View File

@ -774,3 +774,4 @@ local Touchable = 2;
local HitPoints = 50;
local Plane = 250;
local BorderBound = C4D_Border_Top | C4D_Border_Bottom;
local ContactCalls = true;

View File

@ -13,7 +13,6 @@ VertexCNAT=4,2,1
Value=4
Mass=4
Components=Coconut=1
ContactCalls=1
Projectile=1
Float=1
Rotate=1

View File

@ -138,4 +138,5 @@ local Name = "$Name$";
local Description = "$Description$";
local BlastIncinerate = 8;
local ContactIncinerate = 2;
local Confinement;
local Confinement;
local ContactCalls = true;

View File

@ -2,7 +2,6 @@
id=Cannon
Version=6,0
Category=C4D_Vehicle
ContactCalls=1
Width=22
Height=16
Offset=-11,-8

View File

@ -297,4 +297,5 @@ Roll = {
local Name = "$Name$";
local Description = "$Description$";
local Touchable = 1;
local BorderBound = C4D_Border_Sides;
local BorderBound = C4D_Border_Sides;
local ContactCalls = true;

View File

@ -2,7 +2,6 @@
id=Catapult
Version=6,0
Category=C4D_Vehicle
ContactCalls=1
Width=34
Height=30
Offset=-17,-15

View File

@ -325,6 +325,7 @@ local Name = "$Name$";
local Description = "$Description$";
local Touchable = 1;
local BorderBound = C4D_Border_Sides;
local ContactCalls = true;
local ActMap = {
Roll = {

View File

@ -2,7 +2,6 @@
id=Lorry
Version=6,0
Category=C4D_Vehicle
ContactCalls=1
Width=22
Height=16
Offset=-11,-8

View File

@ -301,4 +301,4 @@ local Name = "$Name$";
local Description = "$Description$";
local Touchable = 1;
local BorderBound = C4D_Border_Sides;
local ContactCalls = true;

View File

@ -2,7 +2,6 @@
id=Locomotive
Version=7,0
Category=C4D_Vehicle
ContactCalls=1
Width=24
Height=22
Offset=-12,-11

View File

@ -207,3 +207,4 @@ local PictureTransformation = [0, -940, -342, -18000, 1000, 0, 0, 27000, 0, -342
local Name = "$Name$";
local Description = "$Description$";
local BorderBound = C4D_Border_Sides;
local ContactCalls = true;

View File

@ -111,7 +111,6 @@ void C4Def::DefaultDefCore()
LiftTop=0;
GrabPutGet=0;
UprightAttach=0;
ContactFunctionCalls=0;
Line=0;
LineIntersect=0;
IncompleteActivity=0;
@ -209,7 +208,6 @@ void C4Def::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt(mkBitfieldAdapt<int32_t>(Category, Categories),
"Category", 0 ));
pComp->Value(mkNamingAdapt(ContactFunctionCalls, "ContactCalls", 0 ));
pComp->Value(mkParAdapt(Shape, static_cast<C4Shape*>(NULL)));
pComp->Value(mkNamingAdapt(Value, "Value", 0 ));
pComp->Value(mkNamingAdapt(Mass, "Mass", 0 ));

View File

@ -127,7 +127,6 @@ public:
int32_t LiftTop;
int32_t GrabPutGet;
int32_t UprightAttach;
int32_t ContactFunctionCalls;
int32_t Line;
int32_t LineIntersect;
int32_t IncompleteActivity;

View File

@ -113,7 +113,7 @@ const char *CNATName(int32_t cnat)
bool C4Object::Contact(int32_t iCNAT)
{
if (Def->ContactFunctionCalls)
if (GetPropertyInt(P_ContactCalls))
{
return !! Call(FormatString(PSF_Contact, CNATName(iCNAT)).getData());
}

View File

@ -147,6 +147,7 @@ C4StringTable::C4StringTable()
P[P_IncineratingObj] = "IncineratingObj";
P[P_Plane] = "Plane";
P[P_BorderBound] = "BorderBound";
P[P_ContactCalls] = "ContactCalls";
P[P_SolidMaskPlane] = "SolidMaskPlane";
P[P_Tooltip] = "Tooltip";
P[P_Placement] = "Placement";

View File

@ -354,6 +354,7 @@ enum C4PropertyName
P_IncineratingObj, // unused?
P_Plane,
P_BorderBound,
P_ContactCalls,
P_SolidMaskPlane,
P_Tooltip,
P_Placement,