aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Client/mod/scripts/vscripts/ui
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts/ui')
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_edit_pilot_loadouts.nut5
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_pilot_loadouts_shared.nut22
2 files changed, 24 insertions, 3 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_edit_pilot_loadouts.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_edit_pilot_loadouts.nut
index e785b067..89479a76 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/menu_edit_pilot_loadouts.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_edit_pilot_loadouts.nut
@@ -82,6 +82,11 @@ void function OnLoadoutButton_Focused( var button )
{
int index = expect int( button.s.rowIndex )
+ // update the editingLoadoutIndex on focus so that it always matches
+ // with the pilot loadout panel
+ uiGlobal.editingLoadoutIndex = index
+ uiGlobal.editingLoadoutType = "pilot"
+
UpdatePilotLoadout( index )
string pilotLoadoutRef = "pilot_loadout_" + ( index + 1 )
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_pilot_loadouts_shared.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_pilot_loadouts_shared.nut
index 122403a3..f0139e04 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/menu_pilot_loadouts_shared.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_pilot_loadouts_shared.nut
@@ -86,7 +86,7 @@ void function UpdatePilotLoadoutPanel( var loadoutPanel, PilotLoadoutDef loadout
else if ( loadout.primarySkinIndex == 1 ) // camo
primaryAppearanceImage = CamoSkin_GetImage( CamoSkins_GetByIndex( loadout.primaryCamoIndex ) )
else // warpaint skin
- primaryAppearanceImage = GetItemImage( GetSkinRefFromWeaponRefAndPersistenceValue( loadout.primary, loadout.primarySkinIndex ) )
+ primaryAppearanceImage = GetItemImageFromWeaponRefAndPersistenceValue( loadout.primary, loadout.primarySkinIndex, "primarySkinIndex" )
asset secondaryAppearanceImage
if ( loadout.secondarySkinIndex == 0 ) // default skin
@@ -94,7 +94,7 @@ void function UpdatePilotLoadoutPanel( var loadoutPanel, PilotLoadoutDef loadout
else if ( loadout.secondarySkinIndex == 1 ) // camo
secondaryAppearanceImage = CamoSkin_GetImage( CamoSkins_GetByIndex( loadout.secondaryCamoIndex ) )
else // warpaint skin
- secondaryAppearanceImage = GetItemImage( GetSkinRefFromWeaponRefAndPersistenceValue( loadout.secondary, loadout.secondarySkinIndex ) )
+ secondaryAppearanceImage = GetItemImageFromWeaponRefAndPersistenceValue( loadout.secondary, loadout.secondarySkinIndex, "secondarySkinIndex" )
asset weapon3AppearanceImage
if ( loadout.weapon3SkinIndex == 0 ) // default skin
@@ -102,7 +102,7 @@ void function UpdatePilotLoadoutPanel( var loadoutPanel, PilotLoadoutDef loadout
else if ( loadout.weapon3SkinIndex == 1 ) // camo
weapon3AppearanceImage = CamoSkin_GetImage( CamoSkins_GetByIndex( loadout.weapon3CamoIndex ) )
else // warpaint skin
- weapon3AppearanceImage = GetItemImage( GetSkinRefFromWeaponRefAndPersistenceValue( loadout.weapon3, loadout.weapon3SkinIndex ) )
+ weapon3AppearanceImage = GetItemImageFromWeaponRefAndPersistenceValue( loadout.weapon3, loadout.weapon3SkinIndex, "weapon3SkinIndex" )
RuiSetImage( Hud_GetRui( Hud_GetChild( loadoutPanel, "ButtonPilotCamo" ) ), "camoImage", pilotAppearanceImage )
RuiSetImage( Hud_GetRui( Hud_GetChild( loadoutPanel, "ButtonPrimarySkin" ) ), "camoImage", primaryAppearanceImage )
@@ -282,3 +282,19 @@ void function UpdatePilotLoadoutPanelBinds( var loadoutPanel )
//SetLabelRuiText( Hud_GetChild( loadoutPanel, "TacticalBind" ), Localize( "%offhand1%" ) )
//SetLabelRuiText( Hud_GetChild( loadoutPanel, "OrdnanceBind" ), Localize( "%offhand0%" ) )
}
+
+asset function GetItemImageFromWeaponRefAndPersistenceValue(string weaponRef, int persistenceValue, string loadoutProperty)
+{
+ string skinRef = GetSkinRefFromWeaponRefAndPersistenceValue( weaponRef, persistenceValue )
+ if (!IsRefValid(skinRef))
+ {
+ if (uiGlobal.editingLoadoutIndex != -1)
+ {
+ printt( "Resetting invalid " + loadoutProperty + " for weapon " + weaponRef )
+ SetCachedLoadoutValue(GetUIPlayer(), "pilot", uiGlobal.editingLoadoutIndex, loadoutProperty, "0")
+ }
+ return $"rui/menu/common/appearance_button_swatch"
+ }
+
+ return GetItemImage( skinRef )
+}