Ticket #3791: sharedDropsites.patch
File sharedDropsites.patch, 5.7 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/simulation/components/Player.js
3 3 Player.prototype.Schema = 4 4 "<element name='SharedLosTech' a:help='Allies will share los when this technology is researched. Leave empty to never share LOS.'>" + 5 5 "<text/>" + 6 "</element>" + 7 "<element name='SharedDropsitesTech' a:help='Allies will share dropsites when this technology is researched. Leave empty to never share dropsites.'>" + 8 "<text/>" + 6 9 "</element>"; 7 10 8 11 Player.prototype.Init = function() … … 31 34 this.teamsLocked = false; 32 35 this.state = "active"; // game state - one of "active", "defeated", "won" 33 36 this.diplomacy = []; // array of diplomatic stances for this player with respect to other players (including gaia and self) 37 this.sharedDropsites = false; 34 38 this.formations = []; 35 39 this.startCam = undefined; 36 40 this.controlAllUnits = false; … … 509 513 return (this.startCam !== undefined); 510 514 }; 511 515 516 Player.prototype.HasSharedDropsites = function() 517 { 518 return this.sharedDropsites; 519 }; 520 512 521 Player.prototype.SetControlAllUnits = function(c) 513 522 { 514 523 this.controlAllUnits = c; … … 679 688 { 680 689 if (msg.tech == this.template.SharedLosTech) 681 690 this.UpdateSharedLos(); 691 else if (msg.tech == this.template.SharedDropsitesTech) 692 this.sharedDropsites = true; 682 693 }; 683 694 684 695 Player.prototype.OnDiplomacyChanged = function() -
binaries/data/mods/public/simulation/components/UnitAI.js
4070 4070 if (!cmpOwnership || cmpOwnership.GetOwner() == -1) 4071 4071 return undefined; 4072 4072 4073 // Find dropsites owned by this unit's player 4073 // Find dropsites owned by this unit's player or allied ones if allowed 4074 4074 var players = [cmpOwnership.GetOwner()]; 4075 var cmpPlayer = QueryOwnerInterface(this.entity); 4076 if (cmpPlayer && cmpPlayer.HasSharedDropsites()) 4077 { 4078 let cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager); 4079 for (let i = 1; i < cmpPlayerManager.GetNumPlayers(); ++i) 4080 if (i != players[0] && cmpPlayer.IsMutualAlly(i)) 4081 players.push(i); 4082 } 4075 4083 4076 4084 var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); 4077 4085 var nearby = cmpRangeManager.ExecuteQuery(this.entity, 0, -1, players, IID_ResourceDropsite); … … 5758 5766 5759 5767 // Verify that the dropsite is owned by this entity's player 5760 5768 var cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership); 5761 return cmpOwnership && IsOwnedByPlayer(cmpOwnership.GetOwner(), target); 5769 var cmpPlayer = QueryOwnerInterface(this.entity); 5770 if (!cmpPlayer || !cmpPlayer.HasSharedDropsites()) 5771 return cmpOwnership && IsOwnedByPlayer(cmpOwnership.GetOwner(), target); 5772 else 5773 return cmpOwnership && IsOwnedByMutualAllyOfPlayer(cmpOwnership.GetOwner(), target); 5762 5774 }; 5763 5775 5764 5776 UnitAI.prototype.CanTrade = function(target) -
binaries/data/mods/public/simulation/data/technologies/unlock_shared_dropsites.json
1 { 2 "genericName": "Coinage", 3 "description": "Coinage increases the exchange of merchandises between civilizations.", 4 "cost": {"food": 200, "wood": 200, "stone": 100, "metal": 0}, 5 "requirements": {"tech": "phase_town"}, 6 "requirementsTooltip": "Unlocked in Town Phase.", 7 "icon": "coinage.png", 8 "researchTime": 40, 9 "tooltip": "Player can use his allies dropsites.", 10 "modifications": [{"value": "Player/sharedDropsites", "replace": true}], 11 "soundComplete": "interface/alarm/alarm_upgradearmory.xml" 12 } -
binaries/data/mods/public/simulation/templates/special/player.xml
49 49 </LimitRemovers> 50 50 </EntityLimits> 51 51 <Player> 52 <SharedLosTech>unlock_shared_los</SharedLosTech> 52 <SharedLosTech>unlock_shared_los</SharedLosTech> 53 <SharedDropsitesTech>unlock_shared_dropsites</SharedDropsitesTech> 53 54 </Player> 54 55 <StatisticsTracker/> 55 56 <TechnologyManager/> -
binaries/data/mods/public/simulation/templates/special/player_gaia.xml
2 2 <Entity> 3 3 <Player> 4 4 <SharedLosTech/> 5 <SharedDropsitesTech/> 5 6 </Player> 6 7 </Entity> -
binaries/data/mods/public/simulation/templates/template_structure_economic_market.xml
51 51 <BatchTimeModifier>0.7</BatchTimeModifier> 52 52 <Technologies datatype="tokens"> 53 53 unlock_shared_los 54 unlock_shared_dropsites 54 55 trade_convoys_speed 55 56 trade_convoys_armor 56 57 trade_gain_01