forked from Mirrors/openclonk
Replace .control references
Same argument as renaming the control effect. Is optional, thoughinstall-platforms
parent
6440b16387
commit
c64670c7d5
|
@ -17,7 +17,7 @@ public func FindTarget(effect fx)
|
|||
{
|
||||
var target = _inherited(fx, ...);
|
||||
// Focus on defense target if normal target is too far away.
|
||||
if (!target || ObjectDistance(target, fx.Target) > fx.control.AltTargetDistance)
|
||||
if (!target || ObjectDistance(target, fx.Target) > fx->GetControl().AltTargetDistance)
|
||||
{
|
||||
if (fx.is_siege)
|
||||
target = GetRandomSiegeTarget(fx.Target);
|
||||
|
|
|
@ -14,7 +14,7 @@ local AttackMessageRate = 80; // Likelihood of displaying an attack message in p
|
|||
public func ExecuteAppearance(effect fx)
|
||||
{
|
||||
// Do a random attack message.
|
||||
if (!Random(5) && Random(100) >= 100 - fx.control.AttackMessageRate)
|
||||
if (!Random(5) && Random(100) >= 100 - fx->GetControl().AttackMessageRate)
|
||||
this->ExecuteAttackMessage(fx);
|
||||
return true;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public func ExecuteAttackMessage(effect fx)
|
|||
var ai = clonk->~GetAI();
|
||||
if (!ai)
|
||||
continue;
|
||||
if (ai.last_message != nil && FrameCounter() - ai.last_message < fx.control.AttackMessageWaitTime)
|
||||
if (ai.last_message != nil && FrameCounter() - ai.last_message < fx->GetControl().AttackMessageWaitTime)
|
||||
continue;
|
||||
group_cnt++;
|
||||
}
|
||||
|
|
|
@ -135,14 +135,14 @@ public func OnSaveScenarioAI(proplist fx_ai, proplist props)
|
|||
_inherited(fx_ai, props);
|
||||
|
||||
if (fx_ai.ally_alert_range)
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai.control, "SetAllyAlertRange", fx_ai.Target, fx_ai.ally_alert_range);
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai.control, "SetGuardRange", fx_ai.Target, fx_ai.guard_range.x, fx_ai.guard_range.y, fx_ai.guard_range.wdt, fx_ai.guard_range.hgt);
|
||||
if (fx_ai.max_aggro_distance != fx_ai.control.MaxAggroDistance)
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai.control, "SetMaxAggroDistance", fx_ai.Target, fx_ai.max_aggro_distance);
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai->GetControl(), "SetAllyAlertRange", fx_ai.Target, fx_ai.ally_alert_range);
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai->GetControl(), "SetGuardRange", fx_ai.Target, fx_ai.guard_range.x, fx_ai.guard_range.y, fx_ai.guard_range.wdt, fx_ai.guard_range.hgt);
|
||||
if (fx_ai.max_aggro_distance != fx_ai->GetControl().MaxAggroDistance)
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai->GetControl(), "SetMaxAggroDistance", fx_ai.Target, fx_ai.max_aggro_distance);
|
||||
if (!fx_ai.auto_search_target)
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai.control, "SetAutoSearchTarget", fx_ai.Target, false);
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai->GetControl(), "SetAutoSearchTarget", fx_ai.Target, false);
|
||||
if (fx_ai.encounter_cb)
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai.control, "SetEncounterCB", fx_ai.Target, Format("%v", fx_ai.encounter_cb));
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai->GetControl(), "SetEncounterCB", fx_ai.Target, Format("%v", fx_ai.encounter_cb));
|
||||
}
|
||||
|
||||
/*-- Editor Properties --*/
|
||||
|
|
|
@ -24,7 +24,7 @@ public func OnSaveScenarioAI(proplist fx_ai, proplist props)
|
|||
_inherited(fx_ai, props);
|
||||
|
||||
if (fx_ai.attack_mode.Identifier != "Default")
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai.control, "SetAttackMode", fx_ai.Target, Format("%v", fx_ai.attack_mode.Identifier));
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai->GetControl(), "SetAttackMode", fx_ai.Target, Format("%v", fx_ai.attack_mode.Identifier));
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,7 +46,7 @@ public func EditorDelegate_SetAttackMode(proplist attack_mode)
|
|||
{
|
||||
// Called by editor delegate when attack mode is changed.
|
||||
// For now, attack mode parameter delegates are not supported. Just set by name.
|
||||
return this.control->SetAttackMode(this.Target, attack_mode.Identifier);
|
||||
return this->GetControl()->SetAttackMode(this.Target, attack_mode.Identifier);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ local DebugLoggingOn = false; // Whether or not debug logging is turned on.
|
|||
|
||||
public func LogAI(effect fx, string message)
|
||||
{
|
||||
if (fx.control.DebugLoggingOn)
|
||||
if (fx->GetControl().DebugLoggingOn)
|
||||
Log("[%d]AI WARNING (%v): %s", FrameCounter(), fx.Target, message);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public func OnSaveScenarioAI(proplist fx_ai, proplist props)
|
|||
_inherited(fx_ai, props);
|
||||
|
||||
if (fx_ai.home_x != fx_ai.Target->GetX() || fx_ai.home_y != fx_ai.Target->GetY() || fx_ai.home_dir != fx_ai.Target->GetDir())
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai.control, "SetHome", fx_ai.Target, fx_ai.home_x, fx_ai.home_y, GetConstantNameByValueSafe(fx_ai.home_dir, "DIR_"));
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai->GetControl(), "SetHome", fx_ai.Target, fx_ai.home_x, fx_ai.home_y, GetConstantNameByValueSafe(fx_ai.home_dir, "DIR_"));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public func OnSaveScenarioAI(proplist fx_ai, proplist props)
|
|||
_inherited(fx_ai, props);
|
||||
|
||||
if (fx_ai.attack_path)
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai.control, "SetAttackPath", fx_ai.Target, fx_ai.attack_path);
|
||||
props->AddCall(SAVESCEN_ID_AI, fx_ai->GetControl(), "SetAttackPath", fx_ai.Target, fx_ai.attack_path);
|
||||
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ func EditorDelegate_SetAttackPath(array attack_path)
|
|||
{
|
||||
// Called by editor delegate when attack mode is changed.
|
||||
// For now, attack mode parameter delegates are not supported. Just set by name.
|
||||
return this.control->SetAttackPath(this.Target, attack_path);
|
||||
return this->GetControl()->SetAttackPath(this.Target, attack_path);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ public func ExecuteProtection(effect fx)
|
|||
fx.target = nil; //this->FindEmergencyTarget(fx);
|
||||
if (fx.target)
|
||||
fx.alert = fx.time;
|
||||
else if (fx.time - fx.alert > fx.control.AlertTime)
|
||||
else if (fx.time - fx.alert > fx->GetControl().AlertTime)
|
||||
fx.alert = nil;
|
||||
// If not evading the AI may try to heal.
|
||||
if (ExecuteHealing(fx))
|
||||
|
@ -126,7 +126,7 @@ public func ExecuteHealing(effect fx)
|
|||
var hp_needed = fx.Target->GetMaxEnergy() - hp;
|
||||
// Only heal when alert if health drops below the healing threshold.
|
||||
// If not alert also heal if more than 40 hitpoints of health are lost.
|
||||
if (hp >= fx.control.HealingHitPointsThreshold && (fx.alert || hp_needed <= 40))
|
||||
if (hp >= fx->GetControl().HealingHitPointsThreshold && (fx.alert || hp_needed <= 40))
|
||||
return false;
|
||||
// Don't heal if already healing. One can speed up healing by healing multiple times, but we don't.
|
||||
if (GetEffect("HealingOverTime", fx.Target))
|
||||
|
|
|
@ -159,7 +159,7 @@ public func ExecuteAirship(effect fx)
|
|||
if (fx.Target->GetProcedure() != "PUSH" || fx.Target->GetActionTarget() != fx.vehicle)
|
||||
{
|
||||
// Try to find a new pilot if the current pilot lost the airship.
|
||||
if (fx.Target->ObjectDistance(fx.vehicle) > fx.control.AirshipLostDistance)
|
||||
if (fx.Target->ObjectDistance(fx.vehicle) > fx->GetControl().AirshipLostDistance)
|
||||
{
|
||||
this->PromoteNewAirshipCaptain(fx);
|
||||
fx.strategy = nil;
|
||||
|
@ -190,8 +190,8 @@ public func ExecuteAirship(effect fx)
|
|||
tx = fx.home_x;
|
||||
ty = fx.home_y;
|
||||
}
|
||||
if (Distance(fx.vehicle->GetX(), fx.vehicle->GetY(), tx, ty) < fx.control.AirshipBoardDistance
|
||||
&& Inside(fx.vehicle->GetY() - ty, -fx.control.AirshipBoardDistance / 2, 0))
|
||||
if (Distance(fx.vehicle->GetX(), fx.vehicle->GetY(), tx, ty) < fx->GetControl().AirshipBoardDistance
|
||||
&& Inside(fx.vehicle->GetY() - ty, -fx->GetControl().AirshipBoardDistance / 2, 0))
|
||||
{
|
||||
// Unboard the crew and let go of airship.
|
||||
for (var clonk in this->GetCommanderCrew(fx))
|
||||
|
|
Loading…
Reference in New Issue