So here's some background on how the PCS slot works...
The PCS slot is handled pretty much like any other inventory slot (e.g. armor, primary weapon, secondary weapons, utility). However, it has its own slot type
Code: Select all
eInvSlot_CombatSim
Code: Select all
StatType=eStat_CombatSims,StatAmount=1
Making the situation stranger yet, the XCGS_Unit GetPCSRanks function has the following :
Code: Select all
// Does not matter which class we grab, all should have same combat sim stats
SoldierClassTemplate = class'X2SoldierClassTemplateManager'.static.GetSoldierClassTemplateManager().FindSoldierClassTemplate('Ranger');
Even though in theory the stat could go above 1, in practice the code and the UI don't support multiple PCSs (we considered this, but it would have been a fair amount of work so we pushed more in other areas). Instead, this data is reduced to a boolean using the function :
Code: Select all
function bool IsSufficientRankToEquipPCS()
This rank requirement gets combined with other requirements in the UIUtilities_Strategies class function
Code: Select all
simulated static function GetPCSAvailability(XComGameState_Unit Unit, out TPCSAvailabilityData PCSAvailabilityData)
1) How many PCS are currently equipped?:
Code: Select all
EquippedImplants = Unit.GetAllItemsInSlot(eInvSlot_CombatSim);
Code: Select all
AvailableSlots = Unit.GetCurrentStat(eStat_CombatSims);
Code: Select all
PCSAvailabilityData.bHasCombatSimsSlotsAvailable = ( AvailableSlots > EquippedImplants.Length );
Code: Select all
PCSAvailabilityData.bHasNeurochipImplantsInInventory = XComHQ.HasCombatSimsInInventory();
Code: Select all
PCSAvailabilityData.bHasAchievedCombatSimsRank = Unit.IsSufficientRankToEquipPCS();
Code: Select all
PCSAvailabilityData.bHasGTS = XComHQ.HasFacilityByName('OfficerTrainingSchool');
Code: Select all
PCSAvailabilityData.bCanEquipCombatSims = (AvailableSlots > 0);
---------------------------------------------------------------------------------
The application/removal is almost entirely initiated within the class UIInventory_Implants.
This class has functions RemoveImplant and InstallImplant. Both of these functions appear (from code-read) to create and submit a changestate to the history (which would be the most other most likely case of items disappearing). In particular if a PCS is "disappearing", it would have to be applied to the unit, but not persist in the unit inventory through a save/load cycle. The addition of a new PCS to a unit inventory inside of UIInventory_Implants.InstallImplant is handled via :
Code: Select all
UpdatedUnit.AddItemToInventory(UpdatedImplant, eInvSlot_CombatSim, UpdatedState);
A unit's inventory is pretty much just an array of references to XComGameState_Item objects in the history. The class variable for unit inventory is :
Code: Select all
var() protectedwrite array<StateObjectReference> InventoryItems; //Items this units is carrying
Code: Select all
InventoryItems.AddItem(Item.GetReference());