aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/mp
diff options
context:
space:
mode:
authorDBmaoha <56738369+DBmaoha@users.noreply.github.com>2022-11-01 07:18:38 +0800
committerGitHub <noreply@github.com>2022-10-31 23:18:38 +0000
commit919acdacd2ef8b230df5d75d125e074d31c75f17 (patch)
tree262aba27bf41bd43bec3ba454723e2563b63b9e6 /Northstar.CustomServers/mod/scripts/vscripts/mp
parentc5166f21fef4796d3066c59f4b2f2bdb7c1c4d74 (diff)
downloadNorthstarMods-919acdacd2ef8b230df5d75d125e074d31c75f17.tar.gz
NorthstarMods-919acdacd2ef8b230df5d75d125e074d31c75f17.zip
Better Decloaking Check to Support Modding (#514)
* Better Decloaking Check to Support Modding Respawn hardcoded decloaking which messed up many things, this will make vanilla cloak to behave properly in any offhand slot and have a better support for modded cloak * commit fix
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/mp')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype.gnut29
1 files changed, 21 insertions, 8 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype.gnut
index a4c6e187..362407b3 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype.gnut
@@ -1412,15 +1412,28 @@ void function CodeCallback_WeaponFireInCloak( entity player )
//player.SetCloakFlicker( 1.0, 2.0 )
DisableCloak( player, 0.5 )
- entity weapon = player.GetOffhandWeapon( OFFHAND_LEFT )
- //printt( "weapon", weapon.GetWeaponClassName() )
- // JFS; need code feature to properly reset next attack time/cooldown stuff
- if ( IsValid( weapon ) && weapon.GetWeaponClassName() == "mp_ability_cloak" )
+ entity cloakWeapon
+ int offhandSlot
+ for ( int i = 0; i <= OFFHAND_MELEE; i++ ) // OFFHAND_MELEE is the largest
{
- player.TakeOffhandWeapon( OFFHAND_LEFT )
- player.GiveOffhandWeapon( "mp_ability_cloak", OFFHAND_LEFT )
- weapon = player.GetOffhandWeapon( OFFHAND_LEFT )
- weapon.SetWeaponPrimaryClipCountAbsolute( 0 )
+ entity nowWeapon = player.GetOffhandWeapon( i )
+ if( IsValid( nowWeapon ))
+ {
+ if( nowWeapon.GetWeaponClassName() == "mp_ability_cloak" )
+ {
+ cloakWeapon = nowWeapon
+ offhandSlot = i
+ }
+ }
+ }
+ if( IsValid( cloakWeapon ) )
+ {
+ array<string> mods = cloakWeapon.GetMods()
+ // can't reset cooldown properly in script, let's give player a empty one
+ player.TakeWeapon( "mp_ability_cloak" ) // not using TakeWeaponNow() to fit vanilla behavior
+ player.GiveOffhandWeapon( "mp_ability_cloak", offhandSlot, mods )
+ cloakWeapon = player.GetOffhandWeapon( offhandSlot )
+ cloakWeapon.SetWeaponPrimaryClipCountAbsolute( 0 )
}
}
else