diff options
Diffstat (limited to 'Northstar.Custom/mod/scripts')
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/melee/sh_melee.gnut | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/melee/sh_melee.gnut b/Northstar.Custom/mod/scripts/vscripts/melee/sh_melee.gnut index dfd957e1..95ab3915 100644 --- a/Northstar.Custom/mod/scripts/vscripts/melee/sh_melee.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/melee/sh_melee.gnut @@ -27,6 +27,7 @@ global function IsInExecutionMeleeState global function GetLungeTargetForPlayer global function Melee_IsAllowed global function IsAttackerRef +global function AddCallback_IsValidMeleeExecutionTarget #if SERVER global function Melee_Enable @@ -88,7 +89,7 @@ struct table<string, table<string,SyncedMeleeChooser> > syncedMeleeChoosers table<SyncedMeleeChooser, array<void functionref( SyncedMeleeChooser actions, SyncedMelee action, entity player, entity target )> > syncedMeleeServerCallbacks table<SyncedMeleeChooser, bool functionref( SyncedMelee action, entity player, entity target ) > syncedMeleeServerThink - + array<bool functionref(entity attacker, entity target)> isValidMeleeExecutionTargetCallBacks string lastExecutionUsed = "" } file @@ -183,6 +184,11 @@ vector function GetEyeOrigin( entity ent ) return ent.EyePosition() } +void function AddCallback_IsValidMeleeExecutionTarget( bool functionref( entity attacker, entity target ) callbackFunc ) +{ + file.isValidMeleeExecutionTargetCallBacks.append( callbackFunc ) +} + //Called after pressing the melee button to recheck for targets bool function CodeCallback_IsValidMeleeExecutionTarget( entity attacker, entity target ) { @@ -310,6 +316,14 @@ bool function CodeCallback_IsValidMeleeExecutionTarget( entity attacker, entity if ( !PlayerMelee_IsExecutionReachable( attacker, target, 0.3 ) ) return false + foreach ( callbackFunc in file.isValidMeleeExecutionTargetCallBacks ) + { + if ( !callbackFunc( attacker, target ) ) + { + return false + } + } + return true } |