aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-11-07 03:53:07 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-11-07 03:53:07 +0000
commit35dfd937798d105238db23ea86f90f21be46694b (patch)
treed0e1ee639bc6177649dbcbde054f1e6094fc054c /Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut
parente79a58640e1ef1ea1c3c954aefccd36c3cb55286 (diff)
downloadNorthstarMods-35dfd937798d105238db23ea86f90f21be46694b.tar.gz
NorthstarMods-35dfd937798d105238db23ea86f90f21be46694b.zip
code cleanup, xp, postgame and some small changes
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut27
1 files changed, 26 insertions, 1 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut
index 37b89169..f495e587 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut
@@ -1 +1,26 @@
-//fuck \ No newline at end of file
+untyped
+global function AddWeaponXP
+
+void function AddWeaponXP( entity player, int amount )
+{
+ entity activeWeapon = player.GetActiveWeapon()
+ string weaponClassname = activeWeapon.GetWeaponClassName()
+ int oldLevel = WeaponGetLevel( player, weaponClassname )
+
+ // increment xp
+ player.SetPersistentVar( GetItemPersistenceStruct( weaponClassname ) + ".weaponXP", min( WeaponGetXP( player, weaponClassname ) + amount, WeaponGetMaxXP( weaponClassname ) ) )
+
+ // level up notif
+ if ( WeaponGetLevel( player, weaponClassname ) != oldLevel )
+ Remote_CallFunction_NonReplay( player, "ServerCallback_WeaponLeveledUp", shWeaponXP.weaponClassNames.find( weaponClassname ), WeaponGetGen( player, weaponClassname ), WeaponGetLevel( player, weaponClassname ) )
+
+ // proscreen
+ if ( player == activeWeapon.GetProScreenOwner() )
+ {
+ player.SetPersistentVar( GetItemPersistenceStruct( weaponClassname ) + ".proScreenKills", WeaponGetProScreenKills( player, weaponClassname ) + amount )
+
+ // not currently used rn, but adding a script var so scripts can handle proscreen values manually if wanted
+ if ( "manualProscreenControl" in activeWeapon.s && activeWeapon.s.manualProscreenControl )
+ activeWeapon.SetProScreenIntValForIndex( 0, WeaponGetProScreenKills( player, weaponClassname ) )
+ }
+} \ No newline at end of file