forked from Mirrors/openclonk
tutorial 7: fine-tune NPC teleglove control and add fireflies
parent
8247839455
commit
6559ee1ade
|
@ -119,6 +119,15 @@ private func InitAnimals()
|
|||
bat.MaxEnergy = 7000;
|
||||
bat->DoEnergy(bat.MaxEnergy - bat->GetEnergy());
|
||||
}
|
||||
// Some fireflies attracted to trees on two islands.
|
||||
var count = 0;
|
||||
for (var tree in FindObjects(Find_ID(Tree_Deciduous), Find_Or(Find_AtRect(200, 100, 300, 200), Find_AtRect(300, 300, 200, 200)), Sort_Random()))
|
||||
{
|
||||
Firefly->SpawnSwarm(tree, RandomX(6, 12));
|
||||
count++;
|
||||
if (count > 4)
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,8 +76,12 @@ public func FxIntPilotTimer(object target, proplist effect, int time)
|
|||
{
|
||||
var to_x = lorry->GetX();
|
||||
var to_y = lorry->GetY();
|
||||
// Only if the gem is not stuck and the path to the lorry is free.
|
||||
if (!PathFree(gem->GetX(), gem->GetY(), to_x, to_y) || gem->Stuck())
|
||||
continue;
|
||||
// Only if the gem is not controlled by another glove.
|
||||
if (GetEffect("TeleGloveWeight", gem))
|
||||
continue;
|
||||
if (!GetEffect("IntControlGem", target))
|
||||
AddEffect("IntControlGem", target, 100, 1, this, nil, gem, effect.glove);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue