Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////////////////////////////////
- // x2dlcinfo
- ///////////////////////////////////////////////////////////
- var config bool bRAT_BLUESCREENTODECK;
- var config bool bEnableLogging;
- // Called on load into a save game strategy layer
- static event OnLoadedSavedGameToStrategy()
- {
- PutBluescreensInDeck();
- }
- static event OnPostTemplatesCreated()
- {
- local X2StrategyElementTemplateManager AllStratElems; //holder for all strat elements
- AllStratElems = class'X2StrategyElementTemplateManager'.static.GetStrategyElementTemplateManager();
- PatchBluescreenTech(AllStratElems);
- }
- /////////////////////////////////////////////////////////////////
- // Makes Bluescreen rounds into the experimental deck
- /////////////////////////////////////////////////////////////////
- //On Load Save Game
- static function PutBluescreensInDeck()
- {
- local X2ItemTemplateManager ItemMgr;
- //Karen, call the manager !!
- ItemMgr = class'X2ItemTemplateManager'.static.GetItemTemplateManager();
- RemoveFromDecks(ItemMgr.FindItemTemplate('BluescreenRounds'));
- RemoveFromDecks(ItemMgr.FindItemTemplate('EMPGrenade'));
- //if tech done place them in the deck
- if (default.bRAT_BLUESCREENTODECK && HasCompletedTechByTemplateName('Bluescreen'))
- {
- AddToDecks(ItemMgr.FindItemTemplate('BluescreenRounds'),'ExperimentalAmmoRewards');
- AddToDecks(ItemMgr.FindItemTemplate('EMPGrenade'), 'ExperimentalGrenadeRewards');
- }
- }
- static function bool HasCompletedTechByTemplateName(name TemplateName)
- {
- local XComGameState_Tech TechState;
- local int i;
- for (i = 0 ; i < `XCOMHQ.TechsResearched.length ; i++)
- {
- TechState = XComGameState_Tech(`XCOMHISTORY.GetGameStateForObjectID(`XCOMHQ.TechsResearched[i].ObjectID));
- //Outdated savegames may contain completed techs that have since been removed. Don't bother checking them.
- if (TechState.GetMyTemplate() == None) continue;
- //if tech name matches our query
- if (TechState.GetMyTemplateName() == TemplateName) return true;
- }
- //for no matches found
- return false;
- }
- static function RemoveFromDecks (X2ItemTemplate Template)
- {
- if (Template != none)
- {
- Template.CanBeBuilt = true;
- Template.RewardDecks.length = 0;
- `LOG("Patched :: "@Template.GetItemFriendlyName() @" :: Moved OUT of Experimental deck",default.bEnableLogging,'WOTC_RAT');
- }
- }
- static function AddToDecks (X2ItemTemplate Template, name RewardDeckName)
- {
- if (Template != none)
- {
- if (!IsDLCInstalled('WOTC_PGOverhaul'))
- {
- Template.CanBeBuilt = false;
- }
- Template.RewardDecks.AddItem(RewardDeckName);
- `LOG("Patched :: "@Template.GetItemFriendlyName() @" :: Moved IN to Experimental Deck",default.bEnableLogging,'WOTC_RAT');
- }
- }
- //OPTC Patch of Tech
- static function PatchBluescreenTech(X2StrategyElementTemplateManager StratMgr)
- {
- local X2TechTemplate TechTemplate;
- local X2StrategyElementTemplate Template;
- Template = StratMgr.FindStrategyElementTemplate('Bluescreen');
- if (default.bRAT_BLUESCREENTODECK && X2TechTemplate(Template) != none)
- {
- TechTemplate = X2TechTemplate(Template);
- TechTemplate.ResearchCompletedFn = PutBluescreensInDeckReward;
- `LOG("Patched :: Bluescreen Template to flip deck items",default.bEnableLogging,'WOTC_RAT');
- }
- }
- static function PutBluescreensInDeckReward(XComGameState NewGameState, XComGameState_Tech TechState)
- {
- local X2ItemTemplateManager ItemMgr;
- //Karen, call the manager !!
- ItemMgr = class'X2ItemTemplateManager'.static.GetItemTemplateManager();
- // place them in the deck
- if (default.bRAT_BLUESCREENTODECK)
- {
- AddToDecks(ItemMgr.FindItemTemplate('BluescreenRounds'),'ExperimentalAmmoRewards');
- AddToDecks(ItemMgr.FindItemTemplate('EMPGrenade'), 'ExperimentalGrenadeRewards');
- }
- }
- //////////////////////////////////////////////////////////////////////////////////////////
- // CHECK FOR DLC/MODS
- //////////////////////////////////////////////////////////////////////////////////////////
- static function bool IsDLCInstalled(name DLCName)
- {
- local XComOnlineEventMgr EventMgr;
- local int i;
- // Return true if no DLC required
- if (DLCName == '')
- {
- return true;
- }
- // Access Online Event Manager
- EventMgr = `ONLINEEVENTMGR;
- // Return true if required DLC is installed
- for (i = 0; i < EventMgr.GetNumDLC(); ++i)
- {
- if (EventMgr.GetDLCNames(i) == DLCName)
- {
- return true;
- }
- }
- return false;
- }
- ////////////////////////////////////////////////////////////
- // PGOv2 config
- ///////////////////////////////////////////////////////////
- [WOTC_PGOverhaul.X2Helpers_PGOverhaulExperimentalItems]
- ; ===== adds the individual unlock techs =====
- +arrUnlockExperimentalItem=(ItemName="BluescreenRounds", TechName="BluescreenRounds_UnlockTech", TechImage="img:///UILibrary_StrategyImages.ResearchTech.TECH_Experimental_Ammo")
- +arrUnlockExperimentalItem=(ItemName="EMPGrenade", TechName="EMPGrenade_UnlockTech", TechImage="img:///UILibrary_StrategyImages.ResearchTech.TECH_Experimental_Grenade")
- ////////////////////////////////////////////////////////////
- // Localisaztion xcomgame.int
- ///////////////////////////////////////////////////////////
- ;***************************************
- ;New PGOv2 Unlocks
- ;***************************************
- [BluescreenRounds_UnlockTech X2TechTemplate]
- DisplayName="Experimental Ammo: Bluescreen Rounds"
- Summary="Iridar WOULD Kill me if this goes public. HotBlooded Bluescreens round to deck works with PGOv2"
- [EMPGrenade_UnlockTech X2TechTemplate]
- DisplayName="Experimental Grenade: EMP"
- Summary="Iridar WOULD Kill me if this goes public. HotBlooded Bluescreens grenades to deck works with PGOv2"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement