From 0a425b8a75403adb1f7bdd81a46101bb529f6d7a Mon Sep 17 00:00:00 2001 From: Iridar Date: Sun, 21 May 2023 21:18:29 +0600 Subject: [PATCH] Revert #783 --- .../XComGame/Classes/XGCharacterGenerator.uc | 54 +++---------------- .../Classes/XGCharacterGenerator_Reaper.uc | 25 ++------- .../XGCharacterGenerator_Skirmisher.uc | 26 +++------ .../Classes/XGCharacterGenerator_Templar.uc | 25 ++------- 4 files changed, 22 insertions(+), 108 deletions(-) diff --git a/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator.uc b/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator.uc index db14019d9..dd029aecb 100644 --- a/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator.uc +++ b/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator.uc @@ -122,13 +122,11 @@ var config float DLCPartPackDefaultChance; var int m_iHairType; // temporary variable for soldier creation, used by TemplateMgr filter functions -// Start unprotect variables for issue #783 -var /*protected*/ TSoldier kSoldier; -var /*protected*/ X2BodyPartTemplate kTorsoTemplate; -var /*protected*/ name MatchCharacterTemplateForTorso; -var /*protected*/ name MatchArmorTemplateForTorso; -var /*protected*/ array DLCNames; //List of DLC packs to pull parts from for the currently generating soldier. -// End unprotect variables for issue #783 +var protected TSoldier kSoldier; +var protected X2BodyPartTemplate kTorsoTemplate; +var protected name MatchCharacterTemplateForTorso; +var protected name MatchArmorTemplateForTorso; +var protected array DLCNames; //List of DLC packs to pull parts from for the currently generating soldier. // Store a country name to be use in bios for soldiers that force a unique country var name BioCountryName; @@ -141,11 +139,6 @@ var X2CharacterTemplate m_CharTemplate; // New variable for issue #397 var config(Content) int iDefaultWeaponTint; -// Start issue #783 -var XComGameState_Unit GenerateAppearanceForUnitState; -var XComGameState GenerateAppearanceForGameState; -// End issue #783 - function GenerateName( int iGender, name CountryName, out string strFirst, out string strLast, optional int iRace = -1 ) { local X2StrategyElementTemplateManager StratMgr; @@ -301,26 +294,10 @@ function TSoldier CreateTSoldierFromUnit( XComGameState_Unit Unit, XComGameState { local XComGameState_Item ArmorItem; local name ArmorName; - // Variable for issue #783 - local TSoldier CreatedTSoldier; ArmorItem = Unit.GetItemInSlot(eInvSlot_Armor, UseGameState, true); ArmorName = ArmorItem == none ? '' : ArmorItem.GetMyTemplateName(); - - // Start issue #783 - GenerateAppearanceForUnitState = Unit; - GenerateAppearanceForGameState = UseGameState; - - CreatedTSoldier = CreateTSoldier( Unit.GetMyTemplateName(), EGender(Unit.kAppearance.iGender), Unit.kAppearance.nmFlag, Unit.kAppearance.iRace, ArmorName ); - - // Blank the properties just in case this instance of the Character Generator will be used to also call CreateTSoldier() separately, - // which would trigger the 'PostUnitAppearanceGenerated' event another time, but it would still pass the same Unit State and Game State from the time CreateTSoldierFromUnit() - // was called. So we blank them out to make sure we're not passing irrelevant information with the event. - GenerateAppearanceForUnitState = none; - GenerateAppearanceForGameState = none; - - return CreatedTSoldier; - // End issue #783 + return CreateTSoldier( Unit.GetMyTemplateName(), EGender(Unit.kAppearance.iGender), Unit.kAppearance.nmFlag, Unit.kAppearance.iRace, ArmorName ); } delegate bool FilterCallback(X2BodyPartTemplate Template); @@ -403,28 +380,9 @@ function TSoldier CreateTSoldier( optional name CharacterTemplateName, optional BioCountryName = kSoldier.nmCountry; - // Start issue #783 - ModifyGeneratedUnitAppearance(CharacterTemplateName, eForceGender, nmCountry, iRace, ArmorName); - // End issue #783 - return kSoldier; } -// Start issue #783 -private function ModifyGeneratedUnitAppearance(optional name CharacterTemplateName, optional EGender eForceGender, optional name nmCountry = '', optional int iRace = -1, optional name ArmorName) -{ - local array DLCInfos; - local int i; - - /// HL-Docs: ref:ModifyGeneratedUnitAppearance; issue:783 - DLCInfos = `ONLINEEVENTMGR.GetDLCInfos(false); - for (i = 0; i < DLCInfos.Length; i++) - { - DLCInfos[i].ModifyGeneratedUnitAppearance(self, CharacterTemplateName, eForceGender, nmCountry, iRace, ArmorName, GenerateAppearanceForUnitState, GenerateAppearanceForGameState); - } -} -// End issue #783 - static function Name GetLanguageByString(optional string strLanguage="") { if (len(strLanguage) == 0) diff --git a/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator_Reaper.uc b/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator_Reaper.uc index 210ab48cf..20ac2b078 100644 --- a/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator_Reaper.uc +++ b/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator_Reaper.uc @@ -26,34 +26,19 @@ function X2CharacterTemplate SetCharacterTemplate(name CharacterTemplateName, na return class'X2CharacterTemplateManager'.static.GetCharacterTemplateManager().FindCharacterTemplate('ReaperSoldier'); } -// Start issue #783 -// Normally this function calls the super.CreateTSoldier, and then manually sets the country and nickname. -// In order to make the DLC hook for this issue more compatible with resistance faction soldiers, -// this functionality has been moved into SetCountry() and GenerateName() methods which will be called by super.CreateTSoldier. function TSoldier CreateTSoldier(optional name CharacterTemplateName, optional EGender eForceGender, optional name nmCountry = '', optional int iRace = -1, optional name ArmorName) -{ - kSoldier = super.CreateTSoldier('ReaperSoldier', eForceGender, nmCountry, iRace, ArmorName); - return kSoldier; -} - -function SetCountry(name nmCountry) -{ - kSoldier.nmCountry = 'Country_Reaper'; - kSoldier.kAppearance.nmFlag = kSoldier.nmCountry; // needs to be copied here for pawns -- jboswell -} - -function GenerateName(int iGender, name CountryName, out string strFirst, out string strLast, optional int iRace = -1) { local X2SoldierClassTemplateManager ClassMgr; local X2SoldierClassTemplate ClassTemplate; - super.GenerateName(kSoldier.kAppearance.iGender, kSoldier.nmCountry, kSoldier.strFirstName, kSoldier.strLastName, kSoldier.kAppearance.iRace); - + kSoldier = super.CreateTSoldier('ReaperSoldier', eForceGender, nmCountry, iRace, ArmorName); + SetCountry('Country_Reaper'); ClassMgr = class'X2SoldierClassTemplateManager'.static.GetSoldierClassTemplateManager(); ClassTemplate = ClassMgr.FindSoldierClassTemplate('Reaper'); kSoldier.strNickName = GenerateNickname(ClassTemplate, kSoldier.kAppearance.iGender); + + return kSoldier; } -// End issue #783 function SetRace(int iRace) { @@ -130,4 +115,4 @@ function SetVoice(name CharacterTemplateName, name CountryName) } } } -} +} \ No newline at end of file diff --git a/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator_Skirmisher.uc b/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator_Skirmisher.uc index e4e4d226b..086c421be 100644 --- a/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator_Skirmisher.uc +++ b/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator_Skirmisher.uc @@ -19,34 +19,20 @@ function X2CharacterTemplate SetCharacterTemplate(name CharacterTemplateName, na return class'X2CharacterTemplateManager'.static.GetCharacterTemplateManager().FindCharacterTemplate('SkirmisherSoldier'); } -// Start issue #783 -// Normally this function calls the super.CreateTSoldier, and then manually sets the country and nickname. -// In order to make the DLC hook for this issue more compatible with resistance faction soldiers, -// this functionality has been moved into SetCountry() and GenerateName() methods which will be called by super.CreateTSoldier. function TSoldier CreateTSoldier(optional name CharacterTemplateName, optional EGender eForceGender, optional name nmCountry = '', optional int iRace = -1, optional name ArmorName) -{ - kSoldier = super.CreateTSoldier('SkirmisherSoldier', eForceGender, nmCountry, iRace, ArmorName); - return kSoldier; -} - -function SetCountry(name nmCountry) -{ - kSoldier.nmCountry = 'Country_Skirmisher'; - kSoldier.kAppearance.nmFlag = kSoldier.nmCountry; // needs to be copied here for pawns -- jboswell -} - -function GenerateName( int iGender, name CountryName, out string strFirst, out string strLast, optional int iRace = -1 ) { local X2SoldierClassTemplateManager ClassMgr; local X2SoldierClassTemplate ClassTemplate; - super.GenerateName( kSoldier.kAppearance.iGender, kSoldier.nmCountry, kSoldier.strFirstName, kSoldier.strLastName, kSoldier.kAppearance.iRace ); - + kSoldier = super.CreateTSoldier('SkirmisherSoldier', eForceGender, nmCountry, iRace, ArmorName); + SetCountry('Country_Skirmisher'); + GenerateName(kSoldier.kAppearance.iGender, kSoldier.nmCountry, kSoldier.strFirstName, kSoldier.strLastName, kSoldier.kAppearance.iRace); ClassMgr = class'X2SoldierClassTemplateManager'.static.GetSoldierClassTemplateManager(); ClassTemplate = ClassMgr.FindSoldierClassTemplate('Skirmisher'); kSoldier.strNickName = GenerateNickname(ClassTemplate, kSoldier.kAppearance.iGender); + + return kSoldier; } -// End issue #783 function SetAccessories(X2SimpleBodyPartFilter BodyPartFilter, name CharacterTemplateName) { @@ -104,4 +90,4 @@ function SetVoice(name CharacterTemplateName, name CountryName) } } } -} +} \ No newline at end of file diff --git a/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator_Templar.uc b/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator_Templar.uc index 93676ad6f..7b484dae2 100644 --- a/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator_Templar.uc +++ b/X2WOTCCommunityHighlander/Src/XComGame/Classes/XGCharacterGenerator_Templar.uc @@ -21,34 +21,19 @@ function X2CharacterTemplate SetCharacterTemplate(name CharacterTemplateName, na return class'X2CharacterTemplateManager'.static.GetCharacterTemplateManager().FindCharacterTemplate(CharacterTemplateName); } -// Start issue #783 -// Normally this function calls the super.CreateTSoldier, and then manually sets the country and nickname. -// In order to make the DLC hook for this issue more compatible with resistance faction soldiers, -// this functionality has been moved into SetCountry() and GenerateName() methods which will be called by super.CreateTSoldier. function TSoldier CreateTSoldier(optional name CharacterTemplateName, optional EGender eForceGender, optional name nmCountry = '', optional int iRace = -1, optional name ArmorName) -{ - kSoldier = super.CreateTSoldier('TemplarSoldier', eForceGender, nmCountry, iRace, ArmorName); - return kSoldier; -} - -function SetCountry(name nmCountry) -{ - kSoldier.nmCountry = 'Country_Templar'; - kSoldier.kAppearance.nmFlag = kSoldier.nmCountry; // needs to be copied here for pawns -- jboswell -} - -function GenerateName( int iGender, name CountryName, out string strFirst, out string strLast, optional int iRace = -1 ) { local X2SoldierClassTemplateManager ClassMgr; local X2SoldierClassTemplate ClassTemplate; - super.GenerateName( kSoldier.kAppearance.iGender, kSoldier.nmCountry, kSoldier.strFirstName, kSoldier.strLastName, kSoldier.kAppearance.iRace ); - + kSoldier = super.CreateTSoldier('TemplarSoldier', eForceGender, nmCountry, iRace, ArmorName); + SetCountry('Country_Templar'); ClassMgr = class'X2SoldierClassTemplateManager'.static.GetSoldierClassTemplateManager(); ClassTemplate = ClassMgr.FindSoldierClassTemplate('Templar'); kSoldier.strNickName = GenerateNickname(ClassTemplate, kSoldier.kAppearance.iGender); + + return kSoldier; } -// End issue #783 function SetRace(int iRace) { @@ -114,4 +99,4 @@ function SetVoice(name CharacterTemplateName, name CountryName) function SetAttitude() { kSoldier.kAppearance.iAttitude = 0; // Should correspond with Personality_ByTheBook -} +} \ No newline at end of file