Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////////////////////////////////////////////
- // FUNCTION TO ALLOW TRAINED SOLDIERS TO USE PSIONIC WEAPONS
- // NOT RELIANT ON XCOMCLASSDATA.INI CHANGES !!
- // MANY THANKS TO IRIDAR AND SOLARNOUGAT AND ROBOJUMPER
- // **** NOT WORKING -- CRASHES ON (ROBOJUMPERS) SQUAD SELECT ON ANY CHANGE TO SOLDIER LINEUP ****
- // **** WORKS FINE IN ARMOURY *****
- ////////////////////////////////////////////////////////////////////////
- static function bool CanAddItemToInventory_CH_Improved( out int bCanAddItem, const EInventorySlot Slot, const X2ItemTemplate ItemTemplate, int Quantity, XComGameState_Unit UnitState, optional XComGameState CheckGameState, optional out string DisabledReason, optional XComGameState_Item ItemState)
- {
- local name PsiAbilityName;
- local array<name> PSI_IDENTIFIER_SKILLS;
- local bool OverrideNormalBehavior;
- local bool DoNotOverrideNormalBehavior;
- OverrideNormalBehavior = CheckGameState != none; //change things
- DoNotOverrideNormalBehavior = CheckGameState == none; //not change things
- if(DisabledReason != "")
- {
- return DoNotOverrideNormalBehavior;
- }
- //Check/confirm slot
- if (Slot != eInvSlot_PrimaryWeapon)
- {
- return DoNotOverrideNormalBehavior;
- }
- //check confirm weapons
- if (ItemTemplate.DataName != 'Weapon_AshXcomPsionicReaper' || ItemTemplate.DataName != 'GatlingVorpalRifle_XC')
- {
- return DoNotOverrideNormalBehavior;
- }
- //check/confirm class
- if ( UnitState.GetSoldierClassTemplateName() == 'Templar'
- || UnitState.GetSoldierClassTemplateName() == 'Stormrider'
- || UnitState.GetSoldierClassTemplateName() == 'Samurai'
- || UnitState.GetSoldierClassTemplateName() == 'Jedi'
- || UnitState.GetSoldierClassTemplateName() == 'Akimbo'
- )
- {
- //not a class we're interested in -- do nothing (not equip, or as per classdata.ini)
- return DoNotOverrideNormalBehavior;
- }
- //create the psi identifier array
- PSI_IDENTIFIER_SKILLS.AddItem('PexM_TestBoost_Standard');
- PSI_IDENTIFIER_SKILLS.AddItem('PexM_TestBoost_Average');
- PSI_IDENTIFIER_SKILLS.AddItem('PexM_TestBoost_Gifted');
- PSI_IDENTIFIER_SKILLS.AddItem('PexM_TestBoost_Genius');
- PSI_IDENTIFIER_SKILLS.AddItem('PexM_TestBoost_Savant');
- //check/confirm psi training skills
- foreach PSI_IDENTIFIER_SKILLS(PsiAbilityName)
- {
- if (UnitState.HasSoldierAbility(PsiAbilityName, true))
- {
- `LOG("Weapon Equip Override for soldier :: " @UnitState.GetFullName() @" :: Psi Skill Confirmed :: " @PsiAbilityName @" :: Weapon :: " @ItemTemplate.DataName,default.bEnablePexMLogging,'PsionicsExMachina');
- //slot correct, class correct, weapon correct, psi ability correct -- allow equip
- bCanAddItem = 1;
- return OverrideNormalBehavior;
- }
- //slot correct, weapon correct, psi ability not -- disable equip
- DisabledReason = class'UIUtilities_Text'.static.CapsCheckForGermanScharfesS(default.m_strNeedsPsionicUnit);
- }
- if (DisabledReason != "")
- {
- bCanAddItem = 0;
- return OverrideNormalBehavior;
- }
- //not an item or slot or class or ability we're interested in -- do nothing
- return DoNotOverrideNormalBehavior;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement