-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* New argument in EOnEditorPlace * Move target visibility handling to EvaluateWeaponAndTarget * Rename damage manager and use new SCR_HijackDamageHandling method
- Loading branch information
Showing
5 changed files
with
49 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
|
||
|
||
//------------------------------------------------------------------------------------------------ | ||
modded class SCR_AICombatComponent : ScriptComponent | ||
{ | ||
override bool SelectTarget(BaseTarget newTarget) | ||
//------------------------------------------------------------------------------------------------ | ||
//! Resets selected target if it is not visible | ||
override void EvaluateWeaponAndTarget(out bool outWeaponEvent, out bool outSelectedTargetChanged, | ||
out BaseTarget outPrevTarget, out BaseTarget outCurrentTarget, | ||
out bool outRetreatTargetChanged, out bool outCompartmentChanged) | ||
{ | ||
// gotta do null check as otherwise we crash, as when there is no targets at spawn, NewTarget is null. So we just call super and call it a day | ||
if (!newTarget) | ||
return super.SelectTarget(newTarget); | ||
BaseTarget prevTarget = m_SelectedTarget; | ||
super.EvaluateWeaponAndTarget(outWeaponEvent, outSelectedTargetChanged, outPrevTarget, outCurrentTarget, outRetreatTargetChanged, outCompartmentChanged); | ||
|
||
// get visibility, if not visible AI can't change to that target, otherwise up to super | ||
bool visible = ODIN_VisibilityHelper.GetVisibility(newTarget.GetTargetEntity()); | ||
if (!visible) | ||
return false; | ||
else | ||
return super.SelectTarget(newTarget); | ||
if (!outCurrentTarget) | ||
return; | ||
|
||
bool visible = ODIN_VisibilityHelper.GetVisibility(outCurrentTarget.GetTargetEntity()); | ||
if (visible) | ||
return; | ||
|
||
m_SelectedTarget = prevTarget; | ||
outCurrentTarget = prevTarget; | ||
outSelectedTargetChanged = false; | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
Scripts/GameCode/ODIN/Components/SCR_DamageManagerComponent.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//------------------------------------------------------------------------------------------------ | ||
modded class SCR_DamageManagerComponent : BaseSCR_DamageManagerComponent | ||
{ | ||
protected bool m_bODIN_isDamageEnabled = true; | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
bool ODIN_IsDamageEnabled() | ||
{ | ||
return m_bODIN_isDamageEnabled; | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
void ODIN_SetDamageEnabled(bool enabled) | ||
{ | ||
m_bODIN_isDamageEnabled = enabled; | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
override bool SCR_HijackDamageHandling(notnull BaseDamageContext damageContext) | ||
{ | ||
if (m_bODIN_isDamageEnabled) | ||
return super.SCR_HijackDamageHandling(damageContext); | ||
|
||
return true; | ||
} | ||
} |
40 changes: 0 additions & 40 deletions
40
Scripts/GameCode/ODIN/Components/ScriptedDamageManagerComponent.c
This file was deleted.
Oops, something went wrong.