diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-06-22 14:30:49 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-06-22 14:30:49 +0100 |
commit | 207facbc402f5639cbcd31f079214351ef605cf2 (patch) | |
tree | 4710b2a88dd64f3dfea1609d31a5de9141640951 /Northstar.CustomServers/scripts/vscripts/melee/_melee.gnut | |
parent | c2d438568df6d98cf731807e30eaa7da31e5ea52 (diff) | |
download | NorthstarMods-207facbc402f5639cbcd31f079214351ef605cf2.tar.gz NorthstarMods-207facbc402f5639cbcd31f079214351ef605cf2.zip |
initial commit after moving to new repo
Diffstat (limited to 'Northstar.CustomServers/scripts/vscripts/melee/_melee.gnut')
-rw-r--r-- | Northstar.CustomServers/scripts/vscripts/melee/_melee.gnut | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/Northstar.CustomServers/scripts/vscripts/melee/_melee.gnut b/Northstar.CustomServers/scripts/vscripts/melee/_melee.gnut new file mode 100644 index 00000000..035caf9e --- /dev/null +++ b/Northstar.CustomServers/scripts/vscripts/melee/_melee.gnut @@ -0,0 +1,89 @@ +global function Melee_Init + +//global function CodeCallback_NPCMeleeChargedPlayerOrNPC +global function CodeCallback_OnMeleeKilled +global function EnablePlantingOnEntity + +void function Melee_Init() +{ + MeleeShared_Init() +} + +//File is pretty sparse for now. In all honesty a lot of existing functionality in _melee_shared should +//belong here instead, but we'll wait until we try to do prediction (which requires running the same code +//on client and server) before we try to split up functionality in the different script files any better. + +/* +void function CodeCallback_NPCMeleeChargedPlayerOrNPC( entity ent, var damageInfo ) +{ + vector damageForce = DamageInfo_GetDamageForce( damageInfo ) + + if ( DamageInfo_GetDamage( damageInfo ) > 0 ) + { + vector dmgVelocity = damageForce + dmgVelocity.z *= 0.25 + + const float maxAdditionalVelocity = 1200.0 + if ( LengthSqr( dmgVelocity ) > ( maxAdditionalVelocity * maxAdditionalVelocity ) ) + { + dmgVelocity = Normalize( dmgVelocity ) + dmgVelocity *= maxAdditionalVelocity + } + + ent.SetVelocity( ent.GetVelocity() + dmgVelocity ) + } +} +*/ + +void function CodeCallback_OnMeleeKilled( entity target ) +{ + if ( !IsAlive( target ) ) + return + + target.ClearInvulnerable() + + int damageSourceId + if ( target.IsTitan() ) + { + // I don't think this branch ever gets hit. Titan executions do something else. + damageSourceId = eDamageSourceId.titan_execution + } + else + { + damageSourceId = eDamageSourceId.human_execution + } + + entity attacker + if ( IsValid( target.e.syncedMeleeAttacker ) ) + { + attacker = target.e.syncedMeleeAttacker + } + else if ( IsValid( target.e.lastSyncedMeleeAttacker ) ) + { + attacker = target.e.lastSyncedMeleeAttacker + } + else + { + attacker = null + } + + + int damageAmount = target.GetMaxHealth() + 1 + target.TakeDamage( damageAmount , attacker, attacker, { forceKill = true, damageType = DMG_MELEE_EXECUTION, damageSourceId = damageSourceId, scriptType = DF_NO_INDICATOR } ) +} + + +void function EnablePlantingOnEntity( entity titan ) +{ + entity parentEnt = titan.GetParent() + + if ( parentEnt == null ) + return + + if ( titan.GetGroundEntity() && titan.GetGroundEntity().HasPusherRootParent() ) + return + + titan.ClearParent() + PutEntityInSafeSpot( titan, parentEnt, null, parentEnt.GetOrigin(), titan.GetOrigin() ) + titan.Anim_EnablePlanting() +} |