The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall
User:OlympusMons/UTData FactoryReplacer
From Unreal Wiki, The Unreal Engine Documentation Site
This page has been proposed for deletion. If you think this page should be kept, please state a reason on its talk page. |
Introduction
Code
- Package:
- MutatorFramework
Enums
FactoryType
Enum to set the type of factory we are dealing with.
- FT_None
- Factory does not have a type.
- FT_Health
- FT_Armour
- FT_Powerup
- FT_SPowerup
- FT_Weapon
- FT_SWeapon
- FT_Vehicle
- FT_SVehicle
Structs
FactoryReplacer
Global Factories to replace.
- FactoryType FactoryGroup
- name ReplacedFactory
- name ReplacedWithFactory
- string ReplacedWithFactoryPath;
MapFactoryReplacerSet
Factories to replace on a Per Map basis - Get from global when not found.
- string Map
- Settings for this Map Named.
- array<UTData_FactoryReplacer#FactoryReplacer> FactoriesToReplace
- Number of channels that are available in this slot.
Functions
Length
function int Length ()
SetupPerMapData
AddDummyMapEntry
function AddDummyMapEntry (string CurrentMap)
AddPerMapEntry
function AddPerMapEntry (int iMap, PickupFactory Factory)
UpdatePerMapEntry
function UpdatePerMapEntry (int iMap, NavigationPoint.UE3:PickupFactory Factory)
[[#{{{1}}}|{{{1}}}]]
Source
//=================================================== // Class: UTData_FactoryReplacer // Creation date: 11/08/2008 15:39 // Last updated: 16/12/2008 00:26 // Contributors: OlympusMons(/d!b\) //--------------------------------------------------- //=================================================== class UTData_FactoryReplacer extends UTData Config(FactoryReplacer); /** Factory Group */ enum FactoryType{ FT_None, FT_Health, FT_Ammo, FT_Armour, FT_Powerup, FT_SPowerup, FT_Weapon, FT_SWeapon, FT_Vehicle, FT_SVehicle }; /** Factories to replace on a Per Map basis - Get from global when not found*/ struct FactoryReplacer{ var FactoryType FactoryGroup; var name ReplacedFactory; var name ReplacedWithFactory; //TODO: ReplaceWith=None var string ReplacedWithFactoryPath; //var name NextFactory, LastFactory; };var config array<FactoryReplacer> ReplacerFactories; /** Global Factories to replace */ struct MapFactoryReplacerSet{ var string Map; var array<FactoryReplacer> FactoriesToReplace; //TODO: Linked list of struct? };var config array<MapFactoryReplacerSet> PM_FactorySet; var bool bCheckMapFactoryList; /// Map is not found on the list, create a new entry in the ini using the defaults. var config bool bUsePerMapSettings; /// This mutator uses Per Map Setting from the FactoryReplacer //--------------------------------------------------- function int Length(){ if(ReplacerFactories.Length > 0) return(ReplacerFactories.Length); else return(PerMapFactorySet.Length); } //TODO: Function which outs ReplacerFactories to ReplaceWith() in GameExpansion //TODO: Parse commandline options for this? function SetupPerMapData(int MapIndex, out optional string Options){ local int iFactory; iFactory = MapFactorySettings[iMap].FactoriesToReplace.Find('ReplacedFactory', Factory.Name); if(iFactory == INDEX_NONE) { //Moves Per Map Settings to the Global Array for use. ReplacerFactories[iFactory].ReplacedFactory = PM_FactorySet[iMap].FactoriesToReplace[iFactory].ReplacedFactory; ReplacerFactories[iFactory].ReplacedWithFactory = PM_FactorySet[iMap].FactoriesToReplace[iFactory].ReplacedWithFactory; ReplacerFactories[iFactory].ReplacedWithFactoryPath = PM_FactorySet[iMap].FactoriesToReplace[iFactory].ReplacedWithFactoryPath; } SaveConfig(); } /** Adds Map Name only entry if none is found! */ function AddDummyMapEntry(string CurrentMap){ local MapFactoryReplacementSettings NewPerMapFactorySet; NewPM_FactorySet.Map = CurrentMap; PM_FactorySet.AddItem(NewPerMapFactorySet); // bCheckMapFactoryList = True; SaveConfig(); } function AddPerMapEntry(int iMap, PickupFactory Factory){ local FactoryReplace NewFactoriesToReplace; if(Factory == None) return; //Factory is not in the list, add it! `logd("FactoryList: "$Factory.Name$" added to Per Map Factory List!",,'FactoryReplacer'); NewFactoriesToReplace.ReplacedFactory = Factory.Name; PM_FactorySet[iMap].FactoriesToReplace.AddItem(NewFactoriesToReplace); SaveConfig(); } function UpdatePerMapEntry(int iMap, PickupFactory Factory){ local int iFactory; if(Factory != None) return; iFactory = PM_FactorySet[iMap].FactoriesToReplace.Find('ReplacedFactory', Factory.Name); if(iFactory == INDEX_NONE) { //Factory is in the list... Change it? :S `logd("FactoryList: "$Factory.Name$" Changed!",,'FactoryReplacer'); PM_FactorySet[iMap].FactoriesToReplace[iFactory].ReplacedFactory = Factory.Name; } SaveConfig(); }