tutorial 7: fine-tune NPC teleglove control and add fireflies

shapetextures
Maikel de Vries 2015-12-19 11:56:40 +01:00
parent 8247839455
commit 6559ee1ade
2 changed files with 13 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;