diff options
author | DBmaoha <56738369+DBmaoha@users.noreply.github.com> | 2022-11-12 22:06:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-12 14:06:33 +0000 |
commit | 85d771e8f971a2ab2a1aca751c51a8202a3dd355 (patch) | |
tree | 3d0355edb9e995c5baa1becb3750b5f535da4b44 /Northstar.CustomServers/mod/scripts/vscripts | |
parent | f5e4a7be5b6d48006e5f3b9ac218993aa4ee284e (diff) | |
download | NorthstarMods-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')
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/burnmeter/_burnmeter.gnut | 2 | ||||
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/item_inventory/sv_item_inventory.gnut | 29 |
2 files changed, 23 insertions, 8 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/burnmeter/_burnmeter.gnut b/Northstar.CustomServers/mod/scripts/vscripts/burnmeter/_burnmeter.gnut index 0d189017..81f7fbc2 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 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 ) } } |