Ticket #1907: corral-v4.diff
File corral-v4.diff, 25.1 KB (added by , 11 years ago) |
---|
-
binaries/data/mods/public/gui/session/session.xml
997 997 <object size="90 -2 126 34" name="attackAndArmorStats" type="image" sprite="stretched:session/icons/stances/defensive.png" tooltip="Attack and Armor" tooltip_style="sessionToolTip"/> 998 998 999 999 <!-- Resource carrying icon/counter --> 1000 <!-- Used also for number of gatherers/builders -->1000 <!-- Used also for number of gatherers/builders/corraled --> 1001 1001 <object size="100%-98 -2 100%-28 34" type="text" name="resourceCarryingText" style="CarryingTextRight"/> 1002 1002 <object size="100%-36 -2 100% 34" type="image" name="resourceCarryingIcon" tooltip_style="sessionToolTip"/> 1003 1003 </object> -
binaries/data/mods/public/gui/session/selection_details.js
166 166 getGUIObjectByName("resourceCarryingText").caption = entState.resourceSupply.gatherers.length + " / " + entState.resourceSupply.maxGatherers + " "; 167 167 getGUIObjectByName("resourceCarryingIcon").tooltip = "Current/max gatherers"; 168 168 } 169 // And for number of corraled animals 170 else if (entState.corral) 171 { 172 getGUIObjectByName("resourceCarryingIcon").hidden = false; 173 getGUIObjectByName("resourceCarryingText").hidden = false; 174 getGUIObjectByName("resourceCarryingIcon").sprite = "stretched:session/icons/corral.png"; 175 getGUIObjectByName("resourceCarryingText").caption = entState.corral.entities.length + " / " + entState.corral.capacity + " "; 176 getGUIObjectByName("resourceCarryingIcon").tooltip = "Current/max corraled animals"; 177 if (entState.corral.type) 178 { 179 getGUIObjectByName("resourceCarryingIcon").tooltip += "\n(income: " + entState.corral.rate + " " + entState.corral.type + "/s"; 180 if (entState.corral.bonusClass) 181 getGUIObjectByName("resourceCarryingIcon").tooltip += " and reduced build time for " + entState.corral.bonusClass + " units)"; 182 else 183 getGUIObjectByName("resourceCarryingIcon").tooltip += ")"; 184 } 185 } 169 186 else 170 187 { 171 188 getGUIObjectByName("resourceCarryingIcon").hidden = true; -
binaries/data/mods/public/gui/session/input.js
248 248 if (targetState.garrisonHolder.entities.length >= targetState.garrisonHolder.capacity) 249 249 tooltip = "[color=\"orange\"]" + tooltip + "[/color]"; 250 250 } 251 else if (targetState.corral) 252 { 253 data.command = "corral"; 254 data.target = target; 255 cursor = "action-gather-milk"; 256 tooltip = "Current corraled: " + targetState.corral.entities.length 257 + "/" + targetState.corral.capacity; 258 if (targetState.corral.entities.length >= targetState.corral.capacity) 259 tooltip = "[color=\"orange\"]" + tooltip + "[/color]"; 260 } 251 261 else if (targetState.resourceSupply) 252 262 { 253 263 var resourceType = targetState.resourceSupply.type; … … 349 359 } 350 360 } 351 361 break; 362 case "corral": 363 if (hasClass(entState, "Unit") && targetState.corral) 364 { 365 var tooltip = "Current corraled: " + targetState.corral.entities.length 366 + "/" + targetState.corral.capacity; 367 if (targetState.corral.entities.length >= targetState.corral.capacity) 368 tooltip = "[color=\"orange\"]" + tooltip + "[/color]"; 369 return {"possible": Engine.GuiInterfaceCall("CanBeCorraled", {"entity": entState.id, "corral": target}), "tooltip": tooltip}; 370 } 371 break; 352 372 case "setup-trade-route": 353 373 // If ground or sea trade possible 354 374 if (!targetState.foundation && ((entState.trader && hasClass(entState, "Organic") && (playerOwned || allyOwned) && hasClass(targetState, "Market")) || … … 539 559 return {"type": "attack", "cursor": "action-attack", "target": target}; 540 560 else if (getActionInfo("unset-rallypoint", target).possible) 541 561 return {"type": "unset-rallypoint"}; 562 else if ((actionInfo = getActionInfo("corral", target)).possible) 563 return {"type": "corral", "cursor": "action-gather-milk", "tooltip": actionInfo.tooltip, "target": target}; 542 564 else if (getActionInfo("move", target).possible) 543 565 return {"type": "move"}; 544 566 } … … 1397 1419 Engine.GuiInterfaceCall("PlaySound", { "name": "order_garrison", "entity": selection[0] }); 1398 1420 return true; 1399 1421 1422 case "corral": 1423 Engine.PostNetworkCommand({"type": "corral", "entities": selection, "target": action.target, "queued": queued}); 1424 Engine.GuiInterfaceCall("PlaySound", { "name": "order_corral", "entity": selection[0] }); 1425 return true; 1426 1400 1427 case "set-rallypoint": 1401 1428 var pos = undefined; 1402 1429 // if there is a position set in the action then use this so that when setting a -
binaries/data/mods/public/simulation/templates/gaia/fauna_goat.xml
17 17 <ResourceSupply> 18 18 <Amount>120</Amount> 19 19 <Type>food.meat</Type> 20 20 <MaxGatherers>6</MaxGatherers> 21 21 </ResourceSupply> 22 <CorralSupply> 23 <Type>food</Type> 24 <Rate>0.4</Rate> 25 </CorralSupply> 22 26 <VisualActor> 23 27 <Actor>fauna/goat.xml</Actor> 24 28 </VisualActor> -
binaries/data/mods/public/simulation/templates/gaia/fauna_pig.xml
5 5 <SpecificName>Pig</SpecificName> 6 6 <Icon>gaia/fauna_pig.png</Icon> 7 7 </Identity> 8 <CorralSupply> 9 <Type>food</Type> 10 <Rate>0.4</Rate> 11 </CorralSupply> 8 12 <Position> 9 13 <Anchor>pitch</Anchor> 10 14 </Position> -
binaries/data/mods/public/simulation/templates/gaia/fauna_sheep.xml
12 12 <Classes datatype="tokens">Domestic</Classes> 13 13 <Icon>gaia/fauna_sheep.png</Icon> 14 14 </Identity> 15 <CorralSupply> 16 <Type>food</Type> 17 <Rate>0.4</Rate> 18 </CorralSupply> 15 19 <Position> 16 20 <Anchor>pitch</Anchor> 17 21 </Position> -
binaries/data/mods/public/simulation/templates/gaia/fauna_horse.xml
18 18 <ResourceSupply> 19 19 <Amount>200</Amount> 20 20 </ResourceSupply> 21 <CorralSupply> 22 <Type>metal</Type> 23 <Rate>0.1</Rate> 24 <BonusClass>Cavalry</BonusClass> 25 </CorralSupply> 21 26 <Sound> 22 27 <SoundGroups> 23 28 <select>actor/fauna/animal/horse_select.xml</select> -
binaries/data/mods/public/simulation/templates/template_structure_resource_corral.xml
10 10 <Square width="12.0" depth="22.0"/> 11 11 <Height>5.0</Height> 12 12 </Footprint> 13 <GarrisonHolder> 14 <Max>10</Max> 15 <EjectHealth>0.1</EjectHealth> 16 <EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy> 17 <List datatype="tokens">Animal</List> 18 <BuffHeal>1</BuffHeal> 19 <LoadingRange>2</LoadingRange> 20 </GarrisonHolder> 13 <Corral> 14 <MaxCapacity>10</MaxCapacity> 15 <Range>4</Range> 16 </Corral> 21 17 <Health> 22 18 <Max>500</Max> 23 19 <SpawnEntityOnDeath>rubble/rubble_2x4</SpawnEntityOnDeath> -
binaries/data/mods/public/simulation/helpers/Commands.js
319 319 } 320 320 break; 321 321 322 case "corral": 323 GetFormationUnitAIs(entities, player).forEach(function(cmpUnitAI) { 324 cmpUnitAI.SetCorraled(cmd.target, cmd.queued); 325 }); 326 break; 327 322 328 case "stop": 323 329 GetFormationUnitAIs(entities, player).forEach(function(cmpUnitAI) { 324 330 cmpUnitAI.Stop(cmd.queued); -
binaries/data/mods/public/simulation/helpers/RallyPointCommands.js
60 60 "queued": true 61 61 }); 62 62 break; 63 case "corral": 64 ret.push( { 65 "type": "corral", 66 "entities": spawnedEnts, 67 "target": data[i].target, 68 "queued": true 69 }); 70 break; 63 71 case "trade": 64 72 ret.push( { 65 73 "type": "setup-trade-route", -
binaries/data/mods/public/simulation/components/UnitAI.js
620 620 } 621 621 }, 622 622 623 "Order.Corral": function(msg) { 624 var cmpCorral = Engine.QueryInterface(msg.data.target, IID_Corral); 625 if (!cmpCorral) 626 { 627 this.FinishOrder(); 628 return; 629 } 630 631 var range = cmpCorral.GetRange(); 632 if (this.MoveToTargetRangeExplicit(this.order.data.target, 0, range)) 633 { 634 this.SetNextState("ANIMAL.CORRAL.APPROACHING"); 635 } 636 else 637 { 638 this.StopMoving(); 639 this.SetNextState("ANIMAL.CORRAL.CORRALED"); 640 } 641 }, 642 623 643 "Order.Cheering": function(msg) { 624 644 this.SetNextState("INDIVIDUAL.CHEERING"); 625 645 }, … … 905 925 this.SetNextStateAlwaysEntering("MEMBER"); 906 926 }, 907 927 928 "Order.Corral": function(msg) { 929 var cmpFormation = Engine.QueryInterface(this.entity, IID_Formation); 930 cmpFormation.SetRearrange(false); 931 cmpFormation.CallMemberFunction("SetCorraled", [msg.data.target, false]); 932 933 this.SetNextStateAlwaysEntering("MEMBER"); 934 }, 935 908 936 "IDLE": { 909 937 }, 910 938 … … 2382 2410 this.SetNextState("FLEEING"); 2383 2411 }, 2384 2412 2413 2414 "Order.Corral": function(msg) { 2415 var cmpCorral = Engine.QueryInterface(msg.data.target, IID_Corral); 2416 if (!cmpCorral) 2417 { 2418 this.FinishOrder(); 2419 return; 2420 } 2421 2422 var range = cmpCorral.GetRange(); 2423 if (this.MoveToTargetRangeExplicit(this.order.data.target, 0, range)) 2424 { 2425 this.SetNextState("ANIMAL.CORRAL.APPROACHING"); 2426 } 2427 else 2428 { 2429 this.StopMoving(); 2430 this.SetNextState("ANIMAL.CORRAL.CORRALED"); 2431 } 2432 }, 2433 2385 2434 "IDLE": { 2386 2435 // (We need an IDLE state so that FinishOrder works) 2387 2436 … … 2392 2441 }, 2393 2442 }, 2394 2443 2444 'CORRAL': { 2445 'APPROACHING': { 2446 "MoveCompleted": function() { 2447 var cmpCorral = Engine.QueryInterface(this.order.data.target, IID_Corral); 2448 if (cmpCorral) 2449 { 2450 var range = cmpCorral.GetRange(); 2451 var cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion); 2452 if (cmpUnitMotion.IsInTargetRange(this.order.data.target, 0, range)) 2453 { 2454 this.SetNextState("ANIMAL.CORRAL.CORRALED"); 2455 return; 2456 } 2457 } 2458 this.FinishOrder(); 2459 }, 2460 }, 2461 2462 'CORRALED': { 2463 "enter": function() { 2464 this.corral = this.order.data.target; 2465 var cmpCorral = Engine.QueryInterface(this.corral, IID_Corral); 2466 if (!cmpCorral || !cmpCorral.AddCorraled(this.entity)) 2467 { 2468 this.SetNextState("ROAMING"); 2469 return true; 2470 } 2471 this.SelectAnimation("feeding"); 2472 return false; 2473 }, 2474 2475 "Order.UnsetCorraled": function() { 2476 this.FinishOrder(); 2477 }, 2478 2479 "leave": function() { 2480 if (this.corral) 2481 { 2482 var cmpCorral = Engine.QueryInterface(this.corral, IID_Corral); 2483 if (cmpCorral) 2484 cmpCorral.RemoveCorraled(this.entity); 2485 delete this.corral; 2486 } 2487 }, 2488 }, 2489 }, 2490 2395 2491 "ROAMING": { 2396 2492 "enter": function() { 2397 2493 // Walk in a random direction … … 3781 3877 case "ReturnResource": 3782 3878 case "Repair": 3783 3879 case "Garrison": 3880 case "Corral": 3784 3881 // Find the target unit's position 3785 3882 var cmpTargetPosition = Engine.QueryInterface(order.data.target, IID_Position); 3786 3883 if (!cmpTargetPosition || !cmpTargetPosition.IsInWorld()) … … 4521 4618 4522 4619 //// Animal specific functions //// 4523 4620 4621 /** 4622 * Adds setcorraled order to the queue, forced by the player. 4623 */ 4624 UnitAI.prototype.SetCorraled = function(target, queued) 4625 { 4626 var cmpCorral = Engine.QueryInterface(target, IID_Corral); 4627 if (!cmpCorral || !cmpCorral.CanBeCorraled(this.entity)) 4628 { 4629 this.WalkToTarget(target, queued); 4630 return; 4631 } 4632 this.AddOrder("Corral", { "target": target, "force": true }, queued); 4633 }; 4634 4635 /** 4636 * Adds unsetcorraled order to the queue. 4637 */ 4638 UnitAI.prototype.UnsetCorraled = function() 4639 { 4640 if (this.corral) 4641 this.AddOrder("UnsetCorraled", null, false); 4642 }; 4643 4524 4644 UnitAI.prototype.MoveRandomly = function(distance) 4525 4645 { 4526 4646 // We want to walk in a random direction, but avoid getting stuck -
binaries/data/mods/public/simulation/components/Player.js
34 34 this.cheatsEnabled = false; 35 35 this.cheatTimeMultiplier = 1; 36 36 this.heroes = []; 37 this.corralBonuses = []; // list of Bonuses given by the corraled animals 37 38 }; 38 39 39 40 Player.prototype.SetPlayerID = function(id) … … 602 603 cmpGUIInterface.PushNotification(notification); 603 604 }; 604 605 606 Player.prototype.UpdateCorralBonus = function(bonusClass, increment) 607 { 608 for (var i=0; i<this.corralBonuses.length; ++i) 609 { 610 if (this.corralBonuses[i].bonusClass != bonusClass) 611 continue; 612 this.corralBonuses[i].count += increment; 613 if (this.corralBonuses[i].count <= 0) 614 this.corralBonuses.splice(i, 1); 615 return; 616 } 617 // new bonusClass 618 this.corralBonuses.push({"bonusClass": bonusClass, "count": 1}); 619 }; 620 605 621 Engine.RegisterComponentType(IID_Player, "Player", Player); -
binaries/data/mods/public/simulation/components/GuiInterface.js
291 291 } 292 292 293 293 var cmpResourceSupply = Engine.QueryInterface(ent, IID_ResourceSupply); 294 if (cmpResourceSupply) 294 if (cmpResourceSupply) 295 { 296 ret.resourceSupply = { 297 "isInfinite": cmpResourceSupply.IsInfinite(), 298 "max": cmpResourceSupply.GetMaxAmount(), 299 "amount": cmpResourceSupply.GetCurrentAmount(), 300 "type": cmpResourceSupply.GetType(), 301 "killBeforeGather": cmpResourceSupply.GetKillBeforeGather(), 302 "maxGatherers": cmpResourceSupply.GetMaxGatherers(), 303 "gatherers": cmpResourceSupply.GetGatherers() 304 }; 305 } 306 307 var cmpCorral = Engine.QueryInterface(ent, IID_Corral); 308 if (cmpCorral) 295 309 { 296 ret.resourceSupply = { 297 "isInfinite": cmpResourceSupply.IsInfinite(), 298 "max": cmpResourceSupply.GetMaxAmount(), 299 "amount": cmpResourceSupply.GetCurrentAmount(), 300 "type": cmpResourceSupply.GetType(), 301 "killBeforeGather": cmpResourceSupply.GetKillBeforeGather(), 302 "maxGatherers": cmpResourceSupply.GetMaxGatherers(), 303 "gatherers": cmpResourceSupply.GetGatherers() 304 }; 305 } 310 ret.corral = { 311 "entities": cmpCorral.GetEntities(), 312 "capacity": cmpCorral.GetCapacity(), 313 "rate": cmpCorral.GetRate().toFixed(2), 314 "type": cmpCorral.GetType(), 315 "bonusClass": cmpCorral.GetBonusClass() 316 }; 317 } 306 318 307 319 var cmpResourceGatherer = Engine.QueryInterface(ent, IID_ResourceGatherer); 308 320 if (cmpResourceGatherer) … … 1716 1728 return cmpAttack.CanAttack(data.target); 1717 1729 }; 1718 1730 1731 GuiInterface.prototype.CanBeCorraled = function(player, data) 1732 { 1733 var cmpCorral = Engine.QueryInterface(data.corral, IID_Corral); 1734 if (!cmpCorral) 1735 return false; 1736 1737 return cmpCorral.CanBeCorraled(data.entity); 1738 }; 1739 1719 1740 /* 1720 1741 * Returns batch build time. 1721 1742 */ … … 1801 1822 "GetTradingRouteGain": 1, 1802 1823 "GetTradingDetails": 1, 1803 1824 "CanAttack": 1, 1825 "CanBeCorraled": 1, 1804 1826 "GetBatchTime": 1, 1805 1827 1806 1828 "SetPathfinderDebugOverlay": 1, -
binaries/data/mods/public/simulation/components/interfaces/Corral.js
1 Engine.RegisterInterface("Corral"); 2 3 // Message of the form { "increment": 1, "bonusClass": bonusClass }, 4 // sent to the current entity whenever the corraled units change. 5 Engine.RegisterMessageType("CorraledUnitsChanged"); -
binaries/data/mods/public/simulation/components/interfaces/CorralSupply.js
1 Engine.RegisterInterface("CorralSupply"); -
binaries/data/mods/public/simulation/components/Corral.js
1 function Corral() {} 2 3 Corral.prototype.Schema = 4 "<element name='MaxCapacity' a:help='Maximum number of corraled units'>" + 5 "<ref name='nonNegativeDecimal'/>" + 6 "</element>" + 7 "<element name='Range' a:help='Range distance of corraled units'>" + 8 "<ref name='nonNegativeDecimal'/>" + 9 "</element>"; 10 11 Corral.prototype.Init = function() 12 { 13 this.entities = []; 14 this.increment = 1; 15 this.timer = undefined; 16 }; 17 18 Corral.prototype.GetCapacity = function() 19 { 20 return +this.template.MaxCapacity; 21 }; 22 23 Corral.prototype.GetEntities = function() 24 { 25 return this.entities; 26 }; 27 28 Corral.prototype.GetRange = function() 29 { 30 return +this.template.Range; 31 }; 32 33 Corral.prototype.GetRate = function() 34 { 35 var rate = 0; 36 for each (var ent in this.entities) 37 { 38 var cmpCorralSupply = Engine.QueryInterface(ent, IID_CorralSupply); 39 rate += cmpCorralSupply.GetRate(); 40 } 41 rate = ApplyTechModificationsToEntity("Corral/Rate", rate, this.entity); 42 return rate; 43 }; 44 45 Corral.prototype.GetType = function() 46 { 47 var type = null; 48 if (this.entities.length > 0) 49 { 50 var cmpCorralSupply = Engine.QueryInterface(this.entities[0], IID_CorralSupply); 51 type = cmpCorralSupply.GetType(); 52 } 53 return type; 54 }; 55 56 Corral.prototype.GetBonusClass = function() 57 { 58 var bonus = null; 59 if (this.entities.length > 0) 60 { 61 var cmpCorralSupply = Engine.QueryInterface(this.entities[0], IID_CorralSupply); 62 bonus = cmpCorralSupply.GetBonusClass(); 63 } 64 return bonus; 65 }; 66 67 /** 68 * Returns true if the entity ent can be corraled inside, 69 */ 70 Corral.prototype.CanBeCorraled = function(ent) 71 { 72 // Formation controllers should always respond to commands 73 var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); 74 if (cmpUnitAI && cmpUnitAI.IsFormationController()) 75 return true; 76 77 var cmpCorralSupply = Engine.QueryInterface(ent, IID_CorralSupply); 78 if (!cmpCorralSupply) 79 return false; 80 81 if (this.entities.length > 0) 82 { 83 // if there is already a corraled unit, it must have the same type 84 if (cmpCorralSupply.GetType() != this.GetType()) 85 return false; 86 // and the same bonusClass if any 87 if (cmpCorralSupply.GetBonusClass() != this.GetBonusClass()) 88 return false; 89 } 90 91 return true; 92 }; 93 94 Corral.prototype.AddCorraled = function(ent) 95 { 96 if (!this.CanBeCorraled(ent)) 97 return false; 98 if (this.entities.indexOf(ent) != -1 || this.entities.length >= this.GetCapacity()) 99 return false; 100 this.entities.push(ent); 101 var bonusClass = Engine.QueryInterface(ent, IID_CorralSupply).GetBonusClass(); 102 Engine.PostMessage(this.entity, MT_CorraledUnitsChanged, { "increment": 1, "bonusClass": bonusClass }); 103 return true; 104 }; 105 106 Corral.prototype.RemoveCorraled = function(ent) 107 { 108 if (this.entities.indexOf(ent) == -1) 109 return; 110 this.entities.splice(this.entities.indexOf(ent), 1); 111 var bonusClass = Engine.QueryInterface(ent, IID_CorralSupply).GetBonusClass(); 112 Engine.PostMessage(this.entity, MT_CorraledUnitsChanged, { "increment": -1, "bonusClass": bonusClass }); 113 }; 114 115 Corral.prototype.Timeout = function(data) 116 { 117 var type = this.GetType(); 118 var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); 119 if (type != null) 120 { 121 var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player); 122 cmpPlayer.AddResource(type, this.increment); 123 var cmpStatisticsTracker = QueryOwnerInterface(this.entity, IID_StatisticsTracker); 124 if (cmpStatisticsTracker) 125 cmpStatisticsTracker.IncreaseResourceGatheredCounter(type, this.increment); 126 127 var rate = this.GetRate(); 128 this.increment = this.entities.length; 129 this.timer = cmpTimer.SetTimeout(this.entity, IID_Corral, "Timeout", this.increment*1000/rate, {}); 130 } 131 else 132 { 133 cmpTimer.CancelTimer(this.timer); 134 this.timer = undefined; 135 } 136 }; 137 138 Corral.prototype.OnCorraledUnitsChanged = function(msg) 139 { 140 // first clear the cache for technology modifications (the total rate has changed) 141 var cmpTechMan = QueryOwnerInterface(this.entity, IID_TechnologyManager); 142 if (cmpTechMan) 143 cmpTechMan.clearModificationCache(this.entity); 144 145 // update the timer state 146 if (this.entities.length > 0 && !this.timer) 147 { 148 var rate = this.GetRate(); 149 this.increment = this.entities.length; 150 var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); 151 this.timer = cmpTimer.SetTimeout(this.entity, IID_Corral, "Timeout", this.increment*1000/rate, {}); 152 } 153 else if (this.entities.length == 0 && this.timer) 154 { 155 var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); 156 cmpTimer.CancelTimer(this.timer); 157 this.timer = undefined; 158 } 159 160 // update the list of bonuses 161 if (msg.bonusClass) 162 { 163 var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player); 164 cmpPlayer.UpdateCorralBonus(msg.bonusClass, msg.increment); 165 } 166 }; 167 168 Corral.prototype.OnDestroy = function() 169 { 170 if (this.timer) 171 { 172 var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); 173 cmpTimer.CancelTimer(this.timer); 174 } 175 176 for (var i = this.entities.length; i > 0; --i) 177 { 178 var cmpUnitAI = Engine.QueryInterface(this.entities[i-1], IID_UnitAI); 179 if (cmpUnitAI) 180 cmpUnitAI.UnsetCorraled(); 181 } 182 }; 183 184 Engine.RegisterComponentType(IID_Corral, "Corral", Corral); -
binaries/data/mods/public/simulation/components/CorralSupply.js
1 function CorralSupply() {} 2 3 CorralSupply.prototype.Schema = 4 "<element name='Type' a:help='Production type when corraled'>" + 5 "<choice>" + 6 "<value>food</value>" + 7 "<value>metal</value>" + 8 "</choice>" + 9 "</element>" + 10 "<element name='Rate' a:help='Production rate per sec when corraled'>" + 11 "<ref name='positiveDecimal'/>" + 12 "</element>" + 13 "<optional>" + 14 "<element name='BonusClass' a:help='If an entity has this class, its time cost will be reduced'>" + 15 "<text/>" + 16 "</element>" + 17 "</optional>"; 18 19 CorralSupply.prototype.Init = function() 20 { 21 }; 22 23 CorralSupply.prototype.GetRate = function() 24 { 25 return +(this.template.Rate); 26 }; 27 28 CorralSupply.prototype.GetType = function() 29 { 30 return this.template.Type; 31 }; 32 33 CorralSupply.prototype.GetBonusClass = function() 34 { 35 return (this.template.BonusClass || ""); 36 }; 37 38 Engine.RegisterComponentType(IID_CorralSupply, "CorralSupply", CorralSupply); -
binaries/data/mods/public/art/textures/ui/session/icons/corral.png
Impossible d'afficher : fichier considéré comme binaire. svn:mime-type = application/octet-stream