hmm lineendings again...
|
@ -1,5 +1,5 @@
|
|||
[DefCore]
|
||||
id=ANIM
|
||||
Version=4,9,8
|
||||
Category=C4D_StaticBack
|
||||
Picture=0,0,64,64
|
||||
[DefCore]
|
||||
id=ANIM
|
||||
Version=4,9,8
|
||||
Category=C4D_StaticBack
|
||||
Picture=0,0,64,64
|
||||
|
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
|
@ -1,93 +1,93 @@
|
|||
/*-- Animal reproduction --*/
|
||||
|
||||
#strict 2
|
||||
|
||||
// Status
|
||||
public func IsAnimal() { return true; }
|
||||
|
||||
// Population control
|
||||
private func ReproductionAreaSize() { return 800; } // The area, in which new animals of this kind can appear
|
||||
private func ReproductionRate() { return 4000; } // The chane that reproduction takes place in one timer intervall
|
||||
private func MaxAnimalCount() { return 10; } // The maximal animalcount in the area
|
||||
|
||||
// Special reproduction (e.g. with egg)
|
||||
private func SpecialRepr()
|
||||
{
|
||||
}
|
||||
|
||||
// Special Conditions (e.g. a fish should have Swim action)
|
||||
private func SpecialReprodCond()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Count animals
|
||||
private func CountMe()
|
||||
{
|
||||
var ReprodSize = ReproductionAreaSize();
|
||||
var ReprodSizeHalb = ReprodSize / -2;
|
||||
return ObjectCount(Find_ID(GetID()), Find_InRect(ReprodSizeHalb, ReprodSizeHalb, ReprodSize , ReprodSize), Find_OCF(OCF_Alive));
|
||||
}
|
||||
|
||||
/* Reproduction */
|
||||
|
||||
public func Reproduction(bool fRepr)
|
||||
{
|
||||
// Already dead
|
||||
if (!GetAlive()) return 0;
|
||||
// Not full grown up
|
||||
if (GetCon() < 100) return 0;
|
||||
// Special conditions not fulfilled
|
||||
if (!SpecialReprodCond()) return 0;
|
||||
// Already to much animals of this kind
|
||||
if(!FindObject(REPR)) { if (CountMe() >= MaxAnimalCount()) return 0; }
|
||||
else if(ObjectCount(Find_ID(GetID()))+1 >= GetComponent(GetID(), 0, FindObject(Find_ID(REPR)))) return 0;
|
||||
// Reproduction
|
||||
if (!SpecialRepr())
|
||||
{
|
||||
// Normal reproduction
|
||||
var pChild = CreateConstruction(GetID(), 0, 0, -1, 40);
|
||||
pChild->~Birth();
|
||||
}
|
||||
// Success
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Birth */
|
||||
|
||||
public func Birth()
|
||||
{
|
||||
SetAction("Walk");
|
||||
if (Random(2)) SetComDir(COMD_Left);
|
||||
else SetComDir(COMD_Right);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Collection of animals */
|
||||
|
||||
local fForceEnter;
|
||||
|
||||
// Force collection
|
||||
public func ForceEnter(object pContainer)
|
||||
{
|
||||
fForceEnter = 1;
|
||||
Enter(pContainer);
|
||||
fForceEnter = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func RejectEntrance(object pContainer)
|
||||
{
|
||||
// Handing over (z.B. Clonk->Lore) is always ok
|
||||
if (Contained()) return;
|
||||
// Dead? OK too
|
||||
if (!GetAlive()) return;
|
||||
// Forced? Well ok.
|
||||
if (fForceEnter) return;
|
||||
// All other cases depend on the global settings (game rule)
|
||||
return 1;// !ANIM_IsCollectible(pContainer); TODO create this rule :-)
|
||||
}
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("Name", "$Name$", def);
|
||||
/*-- Animal reproduction --*/
|
||||
|
||||
#strict 2
|
||||
|
||||
// Status
|
||||
public func IsAnimal() { return true; }
|
||||
|
||||
// Population control
|
||||
private func ReproductionAreaSize() { return 800; } // The area, in which new animals of this kind can appear
|
||||
private func ReproductionRate() { return 4000; } // The chane that reproduction takes place in one timer intervall
|
||||
private func MaxAnimalCount() { return 10; } // The maximal animalcount in the area
|
||||
|
||||
// Special reproduction (e.g. with egg)
|
||||
private func SpecialRepr()
|
||||
{
|
||||
}
|
||||
|
||||
// Special Conditions (e.g. a fish should have Swim action)
|
||||
private func SpecialReprodCond()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Count animals
|
||||
private func CountMe()
|
||||
{
|
||||
var ReprodSize = ReproductionAreaSize();
|
||||
var ReprodSizeHalb = ReprodSize / -2;
|
||||
return ObjectCount(Find_ID(GetID()), Find_InRect(ReprodSizeHalb, ReprodSizeHalb, ReprodSize , ReprodSize), Find_OCF(OCF_Alive));
|
||||
}
|
||||
|
||||
/* Reproduction */
|
||||
|
||||
public func Reproduction(bool fRepr)
|
||||
{
|
||||
// Already dead
|
||||
if (!GetAlive()) return 0;
|
||||
// Not full grown up
|
||||
if (GetCon() < 100) return 0;
|
||||
// Special conditions not fulfilled
|
||||
if (!SpecialReprodCond()) return 0;
|
||||
// Already to much animals of this kind
|
||||
if(!FindObject(REPR)) { if (CountMe() >= MaxAnimalCount()) return 0; }
|
||||
else if(ObjectCount(Find_ID(GetID()))+1 >= GetComponent(GetID(), 0, FindObject(Find_ID(REPR)))) return 0;
|
||||
// Reproduction
|
||||
if (!SpecialRepr())
|
||||
{
|
||||
// Normal reproduction
|
||||
var pChild = CreateConstruction(GetID(), 0, 0, -1, 40);
|
||||
pChild->~Birth();
|
||||
}
|
||||
// Success
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Birth */
|
||||
|
||||
public func Birth()
|
||||
{
|
||||
SetAction("Walk");
|
||||
if (Random(2)) SetComDir(COMD_Left);
|
||||
else SetComDir(COMD_Right);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Collection of animals */
|
||||
|
||||
local fForceEnter;
|
||||
|
||||
// Force collection
|
||||
public func ForceEnter(object pContainer)
|
||||
{
|
||||
fForceEnter = 1;
|
||||
Enter(pContainer);
|
||||
fForceEnter = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func RejectEntrance(object pContainer)
|
||||
{
|
||||
// Handing over (z.B. Clonk->Lore) is always ok
|
||||
if (Contained()) return;
|
||||
// Dead? OK too
|
||||
if (!GetAlive()) return;
|
||||
// Forced? Well ok.
|
||||
if (fForceEnter) return;
|
||||
// All other cases depend on the global settings (game rule)
|
||||
return 1;// !ANIM_IsCollectible(pContainer); TODO create this rule :-)
|
||||
}
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("Name", "$Name$", def);
|
||||
}
|
|
@ -1 +1 @@
|
|||
Name=Tiervermehrung
|
||||
Name=Tiervermehrung
|
||||
|
|
|
@ -1 +1 @@
|
|||
Name=Animal reproduction
|
||||
Name=Animal reproduction
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
[DefCore]
|
||||
id=WOLF
|
||||
Version=4,9,8
|
||||
Category=C4D_Living|C4D_SelectAnimal
|
||||
MaxUserSelect=10
|
||||
TimerCall=Activity
|
||||
ContactCalls=1
|
||||
Width=26
|
||||
Height=18
|
||||
Offset=-13,-9
|
||||
Vertices=6
|
||||
VertexX=0,0,-2,2,-4,4
|
||||
VertexY=-5,8,-2,-2,4,4
|
||||
VertexCNAT=4,8,1,2,1,2
|
||||
VertexFriction=100,100,100,100,100,100
|
||||
Value=15
|
||||
Mass=20
|
||||
Components=RMET=2;WSKN=1;BONE=1
|
||||
Picture=432,0,64,64
|
||||
Collection=-12,-9,24,18
|
||||
ContactIncinerate=1
|
||||
Prey=1
|
||||
Growth=15
|
||||
Collectible=1
|
||||
Float=1
|
||||
BorderBound=1
|
||||
StretchGrowth=1
|
||||
NoBurnDecay=1
|
||||
IncompleteActivity=1
|
||||
VehicleControl=2
|
||||
Pathfinder=1
|
||||
ClosedContainer=2
|
||||
NoFight=1
|
||||
|
||||
[Physical]
|
||||
Energy=50000
|
||||
Breath=50000
|
||||
Walk=80000
|
||||
Jump=35000
|
||||
Scale=30000
|
||||
Hangle=30000
|
||||
Dig=40000
|
||||
Swim=60000
|
||||
Throw=50000
|
||||
Push=40000
|
||||
Fight=50000
|
||||
CanDig=1
|
||||
[DefCore]
|
||||
id=WOLF
|
||||
Version=4,9,8
|
||||
Category=C4D_Living|C4D_SelectAnimal
|
||||
MaxUserSelect=10
|
||||
TimerCall=Activity
|
||||
ContactCalls=1
|
||||
Width=26
|
||||
Height=18
|
||||
Offset=-13,-9
|
||||
Vertices=6
|
||||
VertexX=0,0,-2,2,-4,4
|
||||
VertexY=-5,8,-2,-2,4,4
|
||||
VertexCNAT=4,8,1,2,1,2
|
||||
VertexFriction=100,100,100,100,100,100
|
||||
Value=15
|
||||
Mass=20
|
||||
Components=RMET=2;WSKN=1;BONE=1
|
||||
Picture=432,0,64,64
|
||||
Collection=-12,-9,24,18
|
||||
ContactIncinerate=1
|
||||
Prey=1
|
||||
Growth=15
|
||||
Collectible=1
|
||||
Float=1
|
||||
BorderBound=1
|
||||
StretchGrowth=1
|
||||
NoBurnDecay=1
|
||||
IncompleteActivity=1
|
||||
VehicleControl=2
|
||||
Pathfinder=1
|
||||
ClosedContainer=2
|
||||
NoFight=1
|
||||
|
||||
[Physical]
|
||||
Energy=50000
|
||||
Breath=50000
|
||||
Walk=80000
|
||||
Jump=35000
|
||||
Scale=30000
|
||||
Hangle=30000
|
||||
Dig=40000
|
||||
Swim=60000
|
||||
Throw=50000
|
||||
Push=40000
|
||||
Fight=50000
|
||||
CanDig=1
|
||||
|
|
|
@ -1 +1 @@
|
|||
Lebenslustige pelzige Beuteltiere.
|
||||
Lebenslustige pelzige Beuteltiere.
|
||||
|
|
|
@ -1 +1 @@
|
|||
Happy little creatures.
|
||||
Happy little creatures.
|
||||
|
|
Before Width: | Height: | Size: 941 KiB After Width: | Height: | Size: 941 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
@ -1,411 +1,411 @@
|
|||
/*-- Wolf --*/
|
||||
|
||||
#strict 2
|
||||
|
||||
#include ANIM
|
||||
|
||||
public func IsPossessible() { return 1; }
|
||||
|
||||
/* Initialize */
|
||||
|
||||
protected func Initialize() { return Birth(); }
|
||||
|
||||
/* TimerCall with AI-control */
|
||||
|
||||
protected func Activity()
|
||||
{
|
||||
// With possession the ai control isn't needed
|
||||
if (GetEffect("PossessionSpell", this)) return;
|
||||
|
||||
// The following actions only outdoor
|
||||
if (Contained()) return;
|
||||
|
||||
// Just when walking or swiming
|
||||
if (GetAction() != "Walk" && GetAction() != "Swim") return;
|
||||
|
||||
// Emerge, if the breath is short
|
||||
if (InLiquid() && GetBreath() <= 25 && GetComDir() != COMD_Up)
|
||||
SetComDir(COMD_Up);
|
||||
|
||||
// Do nothing
|
||||
if (Random(2)) return;
|
||||
|
||||
// Reproduction
|
||||
if (!Random(ReproductionRate()))
|
||||
Reproduction();
|
||||
|
||||
// Jump
|
||||
if (GetAction() == "Walk")
|
||||
if (!Random(3)) return Jump();
|
||||
|
||||
// Turn
|
||||
if (Random(2)) return TurnRight();
|
||||
return TurnLeft();
|
||||
}
|
||||
|
||||
/* Contact */
|
||||
|
||||
protected func ContactLeft()
|
||||
{
|
||||
// With possession the ai control isn't needed
|
||||
if (GetEffect("PossessionSpell", this)) return;
|
||||
|
||||
return TurnRight();
|
||||
}
|
||||
|
||||
protected func ContactRight()
|
||||
{
|
||||
// With possession the ai control isn't needed
|
||||
if (GetEffect("PossessionSpell", this)) return;
|
||||
|
||||
return TurnLeft();
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
|
||||
public func TurnRight()
|
||||
{
|
||||
if (Stuck() || (GetAction() != "Walk" && GetAction() != "Swim")) return;
|
||||
if (GetXDir() < 0) SetXDir(0);
|
||||
SetDir(DIR_Right);
|
||||
SetComDir(COMD_Right);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public func TurnLeft()
|
||||
{
|
||||
if (Stuck() || (GetAction() != "Walk" && GetAction() != "Swim")) return;
|
||||
if (GetXDir() > 0) SetXDir(0);
|
||||
SetDir(DIR_Left);
|
||||
SetComDir(COMD_Left);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private func DigFree()
|
||||
{
|
||||
SetAction("DigFree");
|
||||
SetComDir(3+GetDir()*4);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Damage */
|
||||
|
||||
protected func CatchBlow()
|
||||
{
|
||||
if (GetAction() == "Dead") return 0;
|
||||
if (!Random(3)) Sound("WolfHurt"); // TODO Get Sound
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func Death()
|
||||
{
|
||||
Sound("WolfDead"); // TODO Get Sound
|
||||
SetDir(0);
|
||||
SetAction("Dead");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Reproduction */
|
||||
|
||||
private func ReproductionRate() { return 1000; } // The chance that in one timer invervall a reproduction takes place
|
||||
|
||||
/* Control with possession */
|
||||
|
||||
protected func ControlCommand(szCommand, pTarget, iTx, iTy)
|
||||
{
|
||||
// Move command
|
||||
if (szCommand == "MoveTo")
|
||||
return SetCommand(this(),szCommand, pTarget, iTx, iTy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected func ContainedLeft(object caller)
|
||||
{
|
||||
[$TxtMovement$]
|
||||
SetCommand(this(), "None");
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func ContainedRight(object caller)
|
||||
{
|
||||
[$TxtMovement$]
|
||||
SetCommand(this(), "None");
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func ContainedUp(object caller)
|
||||
{
|
||||
[$TxtMovement$]
|
||||
SetCommand(this(), "None");
|
||||
|
||||
if (GetAction() == "Swim")
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
Jump();
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func ContainedDown(object caller)
|
||||
{
|
||||
[$TxtMovement$]
|
||||
SetCommand(this(), "None");
|
||||
if(Contained()) SetCommand(this, "Exit");
|
||||
if (GetAction() == "Swim")
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* JumpAndRun Control */
|
||||
|
||||
private func ClearDir(bool fX)
|
||||
{
|
||||
if(fX && GetXDir())
|
||||
{
|
||||
if(GetXDir() > 0) SetXDir(Max(GetXDir() - 2, 0));
|
||||
else SetXDir(Min(GetXDir() + 2, 0));
|
||||
}
|
||||
if(!fX && GetYDir())
|
||||
{
|
||||
if(GetYDir() > 0) SetYDir(Max(GetYDir() - 2, 0));
|
||||
else SetYDir(Min(GetYDir() + 2, 0));
|
||||
}
|
||||
}
|
||||
|
||||
public func ContainedUpdate(object self, int comdir, bool dig, bool throw)
|
||||
{
|
||||
if(GetAction() == "Swim")
|
||||
{
|
||||
SetComDir(comdir);
|
||||
ClearScheduleCall(this(), "ClearDir");
|
||||
if(comdir == COMD_Down || comdir == COMD_Up) ScheduleCall(this(), "ClearDir", 1, (Abs(GetXDir())+1)/2, true);
|
||||
if(comdir == COMD_Left || comdir == COMD_Right) ScheduleCall(this(), "ClearDir", 1, (Abs(GetYDir())+1)/2, false);
|
||||
}
|
||||
else if(GetAction() == "Dig")
|
||||
{
|
||||
if(comdir == COMD_Stop && dig) return;
|
||||
SetComDir(comdir);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(comdir == COMD_UpRight || comdir == COMD_DownRight) comdir = COMD_Right;
|
||||
if(comdir == COMD_Up || comdir == COMD_Down) comdir = COMD_Stop;
|
||||
if(comdir == COMD_UpLeft || comdir == COMD_DownLeft) comdir = COMD_Left;
|
||||
|
||||
if(comdir == COMD_Right) TurnRight();
|
||||
else if(comdir == COMD_Left) TurnLeft();
|
||||
else SetComDir(comdir);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func ContainedThrow()
|
||||
{
|
||||
[$TxtDrop$]
|
||||
var iEffectNumber, pSorcerer;
|
||||
if (iEffectNumber = GetEffect("PossessionSpell", this))
|
||||
if (pSorcerer = EffectVar(0, this, iEffectNumber))
|
||||
{
|
||||
if (pSorcerer->Contents()) pSorcerer->Contents()->Exit(0,0,6);
|
||||
AddEffect("IntCollectionDelay", this(), 1, 70);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func ContainedDigDouble()
|
||||
{
|
||||
[$TxtLeave$]
|
||||
RemoveEffect("PossessionSpell", this);
|
||||
return 1;
|
||||
}
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("ActMap", {
|
||||
Walk = {
|
||||
Prototype = Action,
|
||||
Name = "Walk",
|
||||
Procedure = DFA_WALK,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 14,
|
||||
Delay = 20,
|
||||
X = 0,
|
||||
Y = 0,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Walk",
|
||||
Animation = "Walk",
|
||||
},
|
||||
Run = {
|
||||
Prototype = Action,
|
||||
Name = "Run",
|
||||
Procedure = DFA_WALK,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 18,
|
||||
Delay = 15,
|
||||
X = 0,
|
||||
Y = 18,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Run",
|
||||
Animation = "Run",
|
||||
},
|
||||
Jump = {
|
||||
Prototype = Action,
|
||||
Name = "Jump",
|
||||
Procedure = DFA_FLIGHT,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 17,
|
||||
Delay = 1,
|
||||
X = 0,
|
||||
Y = 0,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Hold",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Walk",
|
||||
},
|
||||
Snarl = {
|
||||
Prototype = Action,
|
||||
Name = "Snarl",
|
||||
Procedure = DFA_NONE,
|
||||
Attach = 8,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 12,
|
||||
Delay = 1,
|
||||
X = 0,
|
||||
Y = 18*2,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Hold",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Snarl",
|
||||
},
|
||||
Lunge = {
|
||||
Prototype = Action,
|
||||
Name = "Lunge",
|
||||
Procedure = DFA_FLIGHT,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 22,
|
||||
Delay = 1,
|
||||
X = 0,
|
||||
Y = 18*3,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Hold",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Lunge",
|
||||
},
|
||||
Land = {
|
||||
Prototype = Action,
|
||||
Name = "Land",
|
||||
Procedure = DFA_NONE,
|
||||
Attach = 8,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 17,
|
||||
Delay = 1,
|
||||
X = 0,
|
||||
Y = 18*4,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Walk",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Land",
|
||||
},
|
||||
Swim = {
|
||||
Prototype = Action,
|
||||
Name = "Swim",
|
||||
Procedure = DFA_SWIM,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 16,
|
||||
Delay = 5,
|
||||
X = 0,
|
||||
Y = 0,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Swim",
|
||||
//TurnAction = "Turn",
|
||||
StartCall = "HitCheck",
|
||||
Animation = "Walk",
|
||||
},
|
||||
Wait = {
|
||||
Prototype = Action,
|
||||
Name = "Wait",
|
||||
Procedure = DFA_NONE,
|
||||
Attach = 8,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 10,
|
||||
Delay = 1,
|
||||
X = 0,
|
||||
Y = 18*6,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Walk",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Idle",
|
||||
},
|
||||
Howl = {
|
||||
Prototype = Action,
|
||||
Name = "Howl",
|
||||
Procedure = DFA_NONE,
|
||||
Attach = 8,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 45,
|
||||
Delay = 1,
|
||||
X = 0,
|
||||
Y = 18*7,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Walk",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Howl",
|
||||
},
|
||||
Bite = {
|
||||
Prototype = Action,
|
||||
Name = "Bite",
|
||||
Attach = 8,
|
||||
Procedure = DFA_NONE,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 12,
|
||||
Delay = 15,
|
||||
X = 0,
|
||||
Y = 18*5,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Walk",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Bite",
|
||||
},
|
||||
Dead = {
|
||||
Prototype = Action,
|
||||
Name = "Dead",
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
X = 0,
|
||||
Y = 18*8,
|
||||
Wdt = 18,
|
||||
Hgt = 18,
|
||||
Length = 10,
|
||||
Delay = 3,
|
||||
NextAction = "Hold",
|
||||
NoOtherAction = 1,
|
||||
ObjectDisabled = 1,
|
||||
Animation = "Death",
|
||||
},
|
||||
}, def);
|
||||
SetProperty("Name", "$Name$", def);
|
||||
}
|
||||
/*-- Wolf --*/
|
||||
|
||||
#strict 2
|
||||
|
||||
#include ANIM
|
||||
|
||||
public func IsPossessible() { return 1; }
|
||||
|
||||
/* Initialize */
|
||||
|
||||
protected func Initialize() { return Birth(); }
|
||||
|
||||
/* TimerCall with AI-control */
|
||||
|
||||
protected func Activity()
|
||||
{
|
||||
// With possession the ai control isn't needed
|
||||
if (GetEffect("PossessionSpell", this)) return;
|
||||
|
||||
// The following actions only outdoor
|
||||
if (Contained()) return;
|
||||
|
||||
// Just when walking or swiming
|
||||
if (GetAction() != "Walk" && GetAction() != "Swim") return;
|
||||
|
||||
// Emerge, if the breath is short
|
||||
if (InLiquid() && GetBreath() <= 25 && GetComDir() != COMD_Up)
|
||||
SetComDir(COMD_Up);
|
||||
|
||||
// Do nothing
|
||||
if (Random(2)) return;
|
||||
|
||||
// Reproduction
|
||||
if (!Random(ReproductionRate()))
|
||||
Reproduction();
|
||||
|
||||
// Jump
|
||||
if (GetAction() == "Walk")
|
||||
if (!Random(3)) return Jump();
|
||||
|
||||
// Turn
|
||||
if (Random(2)) return TurnRight();
|
||||
return TurnLeft();
|
||||
}
|
||||
|
||||
/* Contact */
|
||||
|
||||
protected func ContactLeft()
|
||||
{
|
||||
// With possession the ai control isn't needed
|
||||
if (GetEffect("PossessionSpell", this)) return;
|
||||
|
||||
return TurnRight();
|
||||
}
|
||||
|
||||
protected func ContactRight()
|
||||
{
|
||||
// With possession the ai control isn't needed
|
||||
if (GetEffect("PossessionSpell", this)) return;
|
||||
|
||||
return TurnLeft();
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
|
||||
public func TurnRight()
|
||||
{
|
||||
if (Stuck() || (GetAction() != "Walk" && GetAction() != "Swim")) return;
|
||||
if (GetXDir() < 0) SetXDir(0);
|
||||
SetDir(DIR_Right);
|
||||
SetComDir(COMD_Right);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public func TurnLeft()
|
||||
{
|
||||
if (Stuck() || (GetAction() != "Walk" && GetAction() != "Swim")) return;
|
||||
if (GetXDir() > 0) SetXDir(0);
|
||||
SetDir(DIR_Left);
|
||||
SetComDir(COMD_Left);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private func DigFree()
|
||||
{
|
||||
SetAction("DigFree");
|
||||
SetComDir(3+GetDir()*4);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Damage */
|
||||
|
||||
protected func CatchBlow()
|
||||
{
|
||||
if (GetAction() == "Dead") return 0;
|
||||
if (!Random(3)) Sound("WolfHurt"); // TODO Get Sound
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func Death()
|
||||
{
|
||||
Sound("WolfDead"); // TODO Get Sound
|
||||
SetDir(0);
|
||||
SetAction("Dead");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Reproduction */
|
||||
|
||||
private func ReproductionRate() { return 1000; } // The chance that in one timer invervall a reproduction takes place
|
||||
|
||||
/* Control with possession */
|
||||
|
||||
protected func ControlCommand(szCommand, pTarget, iTx, iTy)
|
||||
{
|
||||
// Move command
|
||||
if (szCommand == "MoveTo")
|
||||
return SetCommand(this(),szCommand, pTarget, iTx, iTy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected func ContainedLeft(object caller)
|
||||
{
|
||||
[$TxtMovement$]
|
||||
SetCommand(this(), "None");
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func ContainedRight(object caller)
|
||||
{
|
||||
[$TxtMovement$]
|
||||
SetCommand(this(), "None");
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func ContainedUp(object caller)
|
||||
{
|
||||
[$TxtMovement$]
|
||||
SetCommand(this(), "None");
|
||||
|
||||
if (GetAction() == "Swim")
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
Jump();
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func ContainedDown(object caller)
|
||||
{
|
||||
[$TxtMovement$]
|
||||
SetCommand(this(), "None");
|
||||
if(Contained()) SetCommand(this, "Exit");
|
||||
if (GetAction() == "Swim")
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* JumpAndRun Control */
|
||||
|
||||
private func ClearDir(bool fX)
|
||||
{
|
||||
if(fX && GetXDir())
|
||||
{
|
||||
if(GetXDir() > 0) SetXDir(Max(GetXDir() - 2, 0));
|
||||
else SetXDir(Min(GetXDir() + 2, 0));
|
||||
}
|
||||
if(!fX && GetYDir())
|
||||
{
|
||||
if(GetYDir() > 0) SetYDir(Max(GetYDir() - 2, 0));
|
||||
else SetYDir(Min(GetYDir() + 2, 0));
|
||||
}
|
||||
}
|
||||
|
||||
public func ContainedUpdate(object self, int comdir, bool dig, bool throw)
|
||||
{
|
||||
if(GetAction() == "Swim")
|
||||
{
|
||||
SetComDir(comdir);
|
||||
ClearScheduleCall(this(), "ClearDir");
|
||||
if(comdir == COMD_Down || comdir == COMD_Up) ScheduleCall(this(), "ClearDir", 1, (Abs(GetXDir())+1)/2, true);
|
||||
if(comdir == COMD_Left || comdir == COMD_Right) ScheduleCall(this(), "ClearDir", 1, (Abs(GetYDir())+1)/2, false);
|
||||
}
|
||||
else if(GetAction() == "Dig")
|
||||
{
|
||||
if(comdir == COMD_Stop && dig) return;
|
||||
SetComDir(comdir);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(comdir == COMD_UpRight || comdir == COMD_DownRight) comdir = COMD_Right;
|
||||
if(comdir == COMD_Up || comdir == COMD_Down) comdir = COMD_Stop;
|
||||
if(comdir == COMD_UpLeft || comdir == COMD_DownLeft) comdir = COMD_Left;
|
||||
|
||||
if(comdir == COMD_Right) TurnRight();
|
||||
else if(comdir == COMD_Left) TurnLeft();
|
||||
else SetComDir(comdir);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func ContainedThrow()
|
||||
{
|
||||
[$TxtDrop$]
|
||||
var iEffectNumber, pSorcerer;
|
||||
if (iEffectNumber = GetEffect("PossessionSpell", this))
|
||||
if (pSorcerer = EffectVar(0, this, iEffectNumber))
|
||||
{
|
||||
if (pSorcerer->Contents()) pSorcerer->Contents()->Exit(0,0,6);
|
||||
AddEffect("IntCollectionDelay", this(), 1, 70);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected func ContainedDigDouble()
|
||||
{
|
||||
[$TxtLeave$]
|
||||
RemoveEffect("PossessionSpell", this);
|
||||
return 1;
|
||||
}
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("ActMap", {
|
||||
Walk = {
|
||||
Prototype = Action,
|
||||
Name = "Walk",
|
||||
Procedure = DFA_WALK,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 14,
|
||||
Delay = 20,
|
||||
X = 0,
|
||||
Y = 0,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Walk",
|
||||
Animation = "Walk",
|
||||
},
|
||||
Run = {
|
||||
Prototype = Action,
|
||||
Name = "Run",
|
||||
Procedure = DFA_WALK,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 18,
|
||||
Delay = 15,
|
||||
X = 0,
|
||||
Y = 18,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Run",
|
||||
Animation = "Run",
|
||||
},
|
||||
Jump = {
|
||||
Prototype = Action,
|
||||
Name = "Jump",
|
||||
Procedure = DFA_FLIGHT,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 17,
|
||||
Delay = 1,
|
||||
X = 0,
|
||||
Y = 0,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Hold",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Walk",
|
||||
},
|
||||
Snarl = {
|
||||
Prototype = Action,
|
||||
Name = "Snarl",
|
||||
Procedure = DFA_NONE,
|
||||
Attach = 8,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 12,
|
||||
Delay = 1,
|
||||
X = 0,
|
||||
Y = 18*2,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Hold",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Snarl",
|
||||
},
|
||||
Lunge = {
|
||||
Prototype = Action,
|
||||
Name = "Lunge",
|
||||
Procedure = DFA_FLIGHT,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 22,
|
||||
Delay = 1,
|
||||
X = 0,
|
||||
Y = 18*3,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Hold",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Lunge",
|
||||
},
|
||||
Land = {
|
||||
Prototype = Action,
|
||||
Name = "Land",
|
||||
Procedure = DFA_NONE,
|
||||
Attach = 8,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 17,
|
||||
Delay = 1,
|
||||
X = 0,
|
||||
Y = 18*4,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Walk",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Land",
|
||||
},
|
||||
Swim = {
|
||||
Prototype = Action,
|
||||
Name = "Swim",
|
||||
Procedure = DFA_SWIM,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 16,
|
||||
Delay = 5,
|
||||
X = 0,
|
||||
Y = 0,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Swim",
|
||||
//TurnAction = "Turn",
|
||||
StartCall = "HitCheck",
|
||||
Animation = "Walk",
|
||||
},
|
||||
Wait = {
|
||||
Prototype = Action,
|
||||
Name = "Wait",
|
||||
Procedure = DFA_NONE,
|
||||
Attach = 8,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 10,
|
||||
Delay = 1,
|
||||
X = 0,
|
||||
Y = 18*6,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Walk",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Idle",
|
||||
},
|
||||
Howl = {
|
||||
Prototype = Action,
|
||||
Name = "Howl",
|
||||
Procedure = DFA_NONE,
|
||||
Attach = 8,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 45,
|
||||
Delay = 1,
|
||||
X = 0,
|
||||
Y = 18*7,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Walk",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Howl",
|
||||
},
|
||||
Bite = {
|
||||
Prototype = Action,
|
||||
Name = "Bite",
|
||||
Attach = 8,
|
||||
Procedure = DFA_NONE,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 12,
|
||||
Delay = 15,
|
||||
X = 0,
|
||||
Y = 18*5,
|
||||
Wdt = 26,
|
||||
Hgt = 18,
|
||||
NextAction = "Walk",
|
||||
InLiquidAction = "Swim",
|
||||
Animation = "Bite",
|
||||
},
|
||||
Dead = {
|
||||
Prototype = Action,
|
||||
Name = "Dead",
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
X = 0,
|
||||
Y = 18*8,
|
||||
Wdt = 18,
|
||||
Hgt = 18,
|
||||
Length = 10,
|
||||
Delay = 3,
|
||||
NextAction = "Hold",
|
||||
NoOtherAction = 1,
|
||||
ObjectDisabled = 1,
|
||||
Animation = "Death",
|
||||
},
|
||||
}, def);
|
||||
SetProperty("Name", "$Name$", def);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
TxtMovement=Bewegen
|
||||
TxtDrop=Gegenstand fallen lassen
|
||||
TxtDig=Graben
|
||||
TxtMovement=Bewegen
|
||||
TxtDrop=Gegenstand fallen lassen
|
||||
TxtDig=Graben
|
||||
TxtLeave=Zurückverwandeln
|
|
@ -1,4 +1,4 @@
|
|||
TxtMovement=Move
|
||||
TxtDrop=Drop item
|
||||
TxtDig=Dig
|
||||
TxtMovement=Move
|
||||
TxtDrop=Drop item
|
||||
TxtDig=Dig
|
||||
TxtLeave=Retransform
|
Before Width: | Height: | Size: 161 KiB After Width: | Height: | Size: 161 KiB |