Esempio n. 1
0
// Returns the object that determines the movement of the target.
// For example the object the target is attached to or contained in.
private func GetTargetMovementObject(object target)
{
	// If attached: return the object the target is attached to.
	if (target->GetProcedure() == DFA_ATTACH)
		if (target->GetActionTarget())
			return target->GetActionTarget();
	// Default: return the target itself.
	return target;
}
Esempio n. 2
0
// Add AI execution timer to target Clonk
func AddAI(object clonk)
{
	var fx = GetEffect("S2AI", clonk);
	if (!fx) fx = AddEffect("S2AI", clonk, 1, 3, nil, S2AI);
	if (!fx || !clonk) return nil;
	fx.ai = S2AI;
	clonk.ExecuteS2AI = S2AI.Execute;
	if (clonk->GetProcedure() == "PUSH") fx.vehicle = clonk->GetActionTarget();
	BindInventory(clonk);
	SetHome(clonk);
	SetGuardRange(clonk, fx.home_x-S2AI_DefGuardRangeX, fx.home_y-S2AI_DefGuardRangeY, S2AI_DefGuardRangeX*2, S2AI_DefGuardRangeY*2);
	SetMaxAggroDistance(clonk, S2AI_DefMaxAggroDistance);
	return fx;
}
Esempio n. 3
0
global func FixElevator(object elev, iDig)
{
    var fBurned = GetID(elev)==ELVB;
    var x=GetX(elev), y=GetDefBottom(elev);
    elev->RemoveObject();
    elev = CreateConstruction(ELEV, x,y, -1, 100, true); // Fürs Fundament...
    elev->CreateShaft(iDig);
    AddEffect("NoEnergyNeed", elev, 1, 1);
    if(!fBurned) elev->GetActionTarget()->SetComDir(COMD_Down);
    else
    {
        RemoveObject(LocalN("pCase", elev));
        elev->ChangeDef(ELVB);
        SetCategory(1, elev);
        SetObjectLayer(elev, elev);
        SetCon(100, elev);
        AddEffect("Rebuild", elev, 1, 1);
    }
}