forked from Mirrors/openclonk
Added placement and dying to insects.
parent
0e48f2baaa
commit
23bbf666c6
|
@ -106,6 +106,13 @@ private func GetRestingPlace(proplist coordinates)
|
|||
return false;
|
||||
}
|
||||
|
||||
private func Death()
|
||||
{
|
||||
_inherited();
|
||||
fly_anim = PlayAnimation("Fly", 1, Anim_Linear(GetAnimationPosition(fly_anim), 0, GetAnimationLength("Fly")/2, 10, ANIM_Hold), Anim_Const(1000));
|
||||
SetAction("Dead");
|
||||
}
|
||||
|
||||
/* Movement */
|
||||
|
||||
private func CheckTurn()
|
||||
|
@ -193,6 +200,15 @@ local ActMap = {
|
|||
Delay = 1,
|
||||
NextAction = "SlowFly",
|
||||
},
|
||||
Dead = {
|
||||
Prototype = Action,
|
||||
Name = "Dead",
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 1,
|
||||
Delay = 1,
|
||||
NoOtherAction = 1,
|
||||
},
|
||||
};
|
||||
|
||||
local Name = "Butterfly";
|
||||
|
|
|
@ -6,6 +6,30 @@
|
|||
@author Clonkonaut
|
||||
--*/
|
||||
|
||||
public func Place(int amount, proplist rectangle)
|
||||
{
|
||||
// No calls to objects, only definitions
|
||||
if (GetType(this) == C4V_C4Object) return;
|
||||
|
||||
if (!rectangle)
|
||||
rectangle = Rectangle(0,0, LandscapeWidth(), LandscapeHeight());
|
||||
|
||||
var insects = CreateArray(), insect, position;
|
||||
for (var i = 0 ; i < amount ; i++)
|
||||
{
|
||||
position = FindLocation(Loc_InRect(rectangle), Loc_Wall(CNAT_Bottom), Loc_Sky());
|
||||
if (position)
|
||||
{
|
||||
insect = CreateObjectAbove(this, position.x, position.y, NO_OWNER);
|
||||
if (insect->Stuck()) insect->RemoveObject();
|
||||
if (insect) insects[GetLength(insects)] = insect;
|
||||
}
|
||||
insect = nil;
|
||||
position = nil;
|
||||
}
|
||||
return insects;
|
||||
}
|
||||
|
||||
/** Maximum travelling distance for one 'mission' (random target point).
|
||||
0 = a random point of the whole landscape
|
||||
*/
|
||||
|
@ -152,6 +176,19 @@ private func Initialize()
|
|||
MoveToTarget();
|
||||
}
|
||||
|
||||
private func Death()
|
||||
{
|
||||
RemoveTimer("Activity");
|
||||
SetCommand("None");
|
||||
SetComDir(COMD_None);
|
||||
}
|
||||
|
||||
// Insects are to tiny to be thrown at!
|
||||
private func QueryCatchBlow()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private func Activity()
|
||||
{
|
||||
if (Contained()) return;
|
||||
|
|
Loading…
Reference in New Issue