From 85d771e8f971a2ab2a1aca751c51a8202a3dd355 Mon Sep 17 00:00:00 2001 From: DBmaoha <56738369+DBmaoha@users.noreply.github.com> Date: Sat, 12 Nov 2022 22:06:33 +0800 Subject: 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> --- .../mod/scripts/vscripts/burnmeter/_burnmeter.gnut | 2 +- .../vscripts/item_inventory/sv_item_inventory.gnut | 29 ++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) (limited to 'Northstar.CustomServers/mod/scripts') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/burnmeter/_burnmeter.gnut b/Northstar.CustomServers/mod/scripts/vscripts/burnmeter/_burnmeter.gnut index 0d1890178..81f7fbc2a 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/burnmeter/_burnmeter.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/burnmeter/_burnmeter.gnut @@ -264,7 +264,7 @@ void function UseBurnCardWeapon( entity weapon, entity player ) if ( PlayerEarnMeter_IsRewardAvailable( player ) ) PlayerEarnMeter_SetRewardUsed( player ) - PlayerInventory_PopInventoryItem( player ) + thread PlayerInventory_PopInventoryItem( player ) } void function UseBurnCardWeaponInCriticalSection( entity weapon, entity ownerPlayer ) 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 4e8f85aca..d4ec58790 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 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 ) } } -- cgit v1.2.3