aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/item_inventory
diff options
context:
space:
mode:
authorDBmaoha <56738369+DBmaoha@users.noreply.github.com>2022-11-12 22:06:33 +0800
committerGitHub <noreply@github.com>2022-11-12 14:06:33 +0000
commit85d771e8f971a2ab2a1aca751c51a8202a3dd355 (patch)
tree3d0355edb9e995c5baa1becb3750b5f535da4b44 /Northstar.CustomServers/mod/scripts/vscripts/item_inventory
parentf5e4a7be5b6d48006e5f3b9ac218993aa4ee284e (diff)
downloadNorthstarMods-85d771e8f971a2ab2a1aca751c51a8202a3dd355.tar.gz
NorthstarMods-85d771e8f971a2ab2a1aca751c51a8202a3dd355.zip
Fixed Burn Cards Animations (#511)
* Fixed Burn Cards Animations Burn cards no longer taken right after using * commit fix * adding EndSignal() * Update Northstar.CustomServers/mod/scripts/vscripts/item_inventory/sv_item_inventory.gnut Co-authored-by: uniboi <64006268+uniboi@users.noreply.github.com> * Update Northstar.CustomServers/mod/scripts/vscripts/item_inventory/sv_item_inventory.gnut Co-authored-by: uniboi <64006268+uniboi@users.noreply.github.com> Co-authored-by: uniboi <64006268+uniboi@users.noreply.github.com>
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/item_inventory')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/item_inventory/sv_item_inventory.gnut29
1 files changed, 22 insertions, 7 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/item_inventory/sv_item_inventory.gnut b/Northstar.CustomServers/mod/scripts/vscripts/item_inventory/sv_item_inventory.gnut
index 4e8f85ac..d4ec5879 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/item_inventory/sv_item_inventory.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/item_inventory/sv_item_inventory.gnut
@@ -32,7 +32,7 @@ void function Sv_ItemInventory_OnPlayerGetsNewPilotLoadout( entity player, Pilot
if (playerInventoryStack.len() > 0) {
InventoryItem topInventoryItem = playerInventoryStack[playerInventoryStack.len() - 1]
- PlayerInventory_GiveInventoryItem(player, topInventoryItem)
+ thread PlayerInventory_GiveInventoryItem(player, topInventoryItem)
}
return
@@ -68,13 +68,25 @@ int function PlayerInventory_CountBurnRef( entity player, string burnRef )
void function PlayerInventory_TakeInventoryItem( entity player )
{
+ player.EndSignal( "OnDestroy" )
entity preexistingWeapon = player.GetOffhandWeapon( OFFHAND_INVENTORY )
- if ( IsValid( preexistingWeapon ) )
- player.TakeWeaponNow( preexistingWeapon.GetWeaponClassName() )
+
+ if( !IsValid( preexistingWeapon ) )
+ return
+ preexistingWeapon.EndSignal( "OnDestroy" )
+ if( preexistingWeapon.GetWeaponClassName() == "mp_ability_burncardweapon" )
+ {
+ var fireTime = preexistingWeapon.GetWeaponInfoFileKeyField( "fire_anim_rate" )
+ if( fireTime )
+ wait fireTime
+ }
+ player.TakeWeaponNow( preexistingWeapon.GetWeaponClassName() )
}
void function PlayerInventory_GiveInventoryItem( entity player, InventoryItem inventoryItem )
{
+ player.EndSignal( "OnDestroy" )
+
array<string> mods = []
if ( inventoryItem.itemType == eInventoryItemType.burnmeter ) {
@@ -84,7 +96,10 @@ void function PlayerInventory_GiveInventoryItem( entity player, InventoryItem in
}
// ensure inventory slot isn't full to avoid crash
- PlayerInventory_TakeInventoryItem( player )
+ waitthread PlayerInventory_TakeInventoryItem( player )
+ entity preexistingWeapon = player.GetOffhandWeapon( OFFHAND_INVENTORY ) // defensive fix
+ if( IsValid( preexistingWeapon ) )
+ player.TakeWeaponNow( preexistingWeapon.GetWeaponClassName() )
player.GiveOffhandWeapon( inventoryItem.weaponRef, OFFHAND_INVENTORY, mods )
}
@@ -94,7 +109,7 @@ void function PlayerInventory_PushInventoryItem( entity player, InventoryItem in
file.playerInventoryStacks[ player ].append(inventoryItem)
player.SetPlayerNetInt( "itemInventoryCount", file.playerInventoryStacks[ player ].len() )
- PlayerInventory_GiveInventoryItem(player, inventoryItem)
+ thread PlayerInventory_GiveInventoryItem(player, inventoryItem)
}
void function PlayerInventory_PushInventoryItemByBurnRef( entity player, string burnRef )
@@ -117,9 +132,9 @@ void function PlayerInventory_PopInventoryItem( entity player )
if (playerInventoryStack.len() > 0) {
InventoryItem nextInventoryItem = playerInventoryStack[playerInventoryStack.len() - 1]
- PlayerInventory_GiveInventoryItem(player, nextInventoryItem)
+ thread PlayerInventory_GiveInventoryItem( player, nextInventoryItem )
} else {
- PlayerInventory_TakeInventoryItem( player )
+ waitthread PlayerInventory_TakeInventoryItem( player )
}
}