Ticket #1822: 1822.patch
File 1822.patch, 2.5 KB (added by , 11 years ago) |
---|
-
binaries/data/mods/public/simulation/components/UnitAI.js
878 878 this.SetNextStateAlwaysEntering("MEMBER"); 879 879 }, 880 880 881 "Order.Trade": function(msg) { 882 //this.AddOrder("Trade", { "target": target, "source": source, "force": false }, queued); 883 var cmpFormation = Engine.QueryInterface(this.entity, IID_Formation); 884 // We don't want to rearrange the formation if the individual units are carrying 885 // out a task and one of the members dies/leaves the formation. 886 cmpFormation.SetRearrange(false); 887 cmpFormation.CallMemberFunction("SetupTradeRoute", [msg.data.target, msg.data.source, false]); 888 889 this.SetNextStateAlwaysEntering("MEMBER"); 890 }, 891 881 892 "Order.Pack": function(msg) { 882 893 var cmpFormation = Engine.QueryInterface(this.entity, IID_Formation); 883 894 // We don't want to rearrange the formation if the individual units are carrying … … 3682 3693 3683 3694 break; // and continue the loop 3684 3695 3696 case "Trade": // Added here for formation trading only, but that doesn't make that much sense 3685 3697 case "WalkToTarget": 3686 3698 case "WalkToTargetRange": // This doesn't move to the target (just into range), but a later order will. 3687 3699 case "Flee": … … 3920 3932 } 3921 3933 3922 3934 var cmpTrader = Engine.QueryInterface(this.entity, IID_Trader); 3935 // Formation controller probably (TODO: make this explicit?) 3936 if (!cmpTrader) 3937 { 3938 this.AddOrder("Trade", { "target": target, "source": source, "force": false }, queued); 3939 return; 3940 } 3941 3923 3942 var marketsChanged = cmpTrader.SetTargetMarket(target, source); 3924 3943 if (marketsChanged) 3925 3944 { -
binaries/data/mods/public/simulation/helpers/Commands.js
428 428 break; 429 429 430 430 case "setup-trade-route": 431 for each (var ent in cmd.entities) 432 { 433 var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); 434 if (cmpUnitAI) 435 cmpUnitAI.SetupTradeRoute(cmd.target, cmd.source); 436 } 431 var entities = FilterEntityList(cmd.entities, player, controlAllUnits); 432 GetFormationUnitAIs(entities, player).forEach(function(cmpUnitAI) { 433 cmpUnitAI.SetupTradeRoute(cmd.target,cmd.source, cmd.queued); 434 }); 437 435 break; 438 436 439 437 case "select-trading-goods":