예제 #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;
}
예제 #2
0
public func RejectUse(object clonk)
{
	// General inability?
	if(clonk->GetProcedure() != "WALK") return true;
	if (GBackSemiSolid(0, 0)) return true;
	/*
	This check might make sense, so that you can just hold the button and walk over the ground until the soil is fitting.
	However, you would never get the $NoSuitableGround$ message in that case.
	// Check soil below the Clonk's feet
	var ground_y = clonk->GetDefBottom() - clonk->GetY() + 1;
	if (GetMaterialVal("Soil", "Material", GetMaterial(0, ground_y)) == 0) return true;
	*/
	return false;
}
예제 #3
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;
}