Ticket #2877: limit.diff
File limit.diff, 5.8 KB (added by , 10 years ago) |
---|
-
binaries/data/mods/public/simulation/components/EntityLimits.js
13 13 "</Limits>" + 14 14 "<LimitChangers>" + 15 15 "<Monument>" + 16 "<Civ Centre>2</CivCentre>" +16 "<CivilCentre>2</CivilCentre>" + 17 17 "</Monument>" + 18 18 "</LimitChangers>" + 19 "<LimitRemovers>" + 20 "<CivilCentre>town_phase</CivilCentre>" + 21 "</LimitRemovers>" + 19 22 "</a:example>" + 20 23 "<element name='Limits'>" + 21 24 "<zeroOrMore>" + … … 37 40 "</zeroOrMore>" + 38 41 "</element>" + 39 42 "</zeroOrMore>" + 43 "</element>" + 44 "<element name='LimitRemovers'>" + 45 "<zeroOrMore>" + 46 "<element a:help='Specifies a category of building/unit on which to apply this limit. See BuildRestrictions/TrainingRestrictions for possible categories'>" + 47 "<anyName />" + 48 "<text/>" + 49 "</element>" + 50 "</zeroOrMore>" + 40 51 "</element>"; 41 52 42 53 … … 52 63 this.limit = {}; 53 64 this.count = {}; 54 65 this.changers = {}; 66 this.removers = {}; 55 67 for (var category in this.template.Limits) 56 68 { 57 69 this.limit[category] = +this.template.Limits[category]; 58 70 this.count[category] = 0; 59 if (!(category in this.template.LimitChangers)) 60 continue; 61 this.changers[category] = {}; 62 for (var c in this.template.LimitChangers[category]) 63 this.changers[category][c] = +this.template.LimitChangers[category][c]; 71 if (category in this.template.LimitChangers) 72 { 73 this.changers[category] = {}; 74 for (var c in this.template.LimitChangers[category]) 75 this.changers[category][c] = +this.template.LimitChangers[category][c]; 76 } 77 if (category in this.template.LimitRemovers) 78 this.removers[category] = this.template.LimitRemovers[category]; 64 79 } 65 80 }; 66 81 … … 178 193 this.ChangeLimit(category, modifier * this.changers[category][c]); 179 194 }; 180 195 196 EntityLimits.prototype.RemoveLimits = function(tech) 197 { 198 for (var category in this.removers) 199 if (this.removers[category] === tech) 200 this.limit[category] = undefined; 201 }; 202 181 203 Engine.RegisterComponentType(IID_EntityLimits, "EntityLimits", EntityLimits); -
binaries/data/mods/public/simulation/components/TechnologyManager.js
346 346 var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); 347 347 var ents = cmpRangeManager.GetEntitiesByPlayer(playerID); 348 348 349 // Change the EntityLimit if any 350 var cmpPlayerEntityLimits = QueryPlayerIDInterface(playerID, IID_EntityLimits); 351 if (cmpPlayerEntityLimits) 352 cmpPlayerEntityLimits.RemoveLimits(tech); 353 349 354 // Call the related trigger event 350 355 var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); 351 356 cmpTrigger.CallEvent("ResearchFinished", {"player": playerID, "tech": tech}); -
binaries/data/mods/public/simulation/templates/special/player.xml
15 15 </BattleDetection> 16 16 <EntityLimits> 17 17 <Limits> 18 <CivilCentre>1</CivilCentre> 18 19 <DefenseTower>30</DefenseTower> 19 20 <Fortress>10</Fortress> 20 21 <Wonder>1</Wonder> … … 41 42 <PtolemyIV>4</PtolemyIV> 42 43 </Juggernaut> 43 44 </LimitChangers> 45 <LimitRemovers> 46 <CivilCentre>phase_town</CivilCentre> 47 </LimitRemovers> 44 48 </EntityLimits> 45 49 <Player/> 46 50 <StatisticsTracker/> -
binaries/data/mods/public/simulation/templates/structures/ptol_military_colony.xml
34 34 - Train settler-soldiers of various nationalities. 35 35 - Min. distance from other Military Colonies: 100 meters.</Tooltip> 36 36 <Icon>structures/military_settlement.png</Icon> 37 <RequiredTechnology>phase_town</RequiredTechnology>38 37 </Identity> 39 38 <Obstruction> 40 39 <Static width="23.0" depth="23.0"/> -
binaries/data/mods/public/simulation/templates/structures/sele_military_colony.xml
34 34 - Train settler-soldiers of various nationalities. 35 35 - Min. distance from other Military Colonies: 120 meters.</Tooltip> 36 36 <Icon>structures/military_settlement.png</Icon> 37 <RequiredTechnology>phase_town</RequiredTechnology>38 37 </Identity> 39 38 <Obstruction> 40 39 <Static width="23.0" depth="23.0"/> -
binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml
70 70 </Classes> 71 71 <VisibleClasses datatype="tokens">CivilCentre</VisibleClasses> 72 72 <Icon>structures/civic_centre.png</Icon> 73 <RequiredTechnology>phase_town</RequiredTechnology>74 73 </Identity> 75 74 <Loot> 76 75 <xp>200</xp>