Here's a portion of the magic in MAC.lua (No mentions of other macs because this was written for siegemod which just has one giant mac as powerful as 5)
//SiegeMod by Kyle Abent
local function QualificationsForConstruct(self, target)
return target ~= nil and HasMixin(target, "Construct") and not target:GetIsBuilt() and GetAreFriends(self, target)
end
local function QualificationsForWeldable(self, target)
if HasMixin(target, "Construct") and not target:isa("PowerPoint") then return target ~= nil and target:GetWeldPercentage() < 1 and target:GetIsBuilt() and not self.ignorestructurewelds and GetAreFriends(self, target) end
if HasMixin(target, "Construct") and target:isa("PowerPoint") then return target ~= nil and target:GetWeldPercentage() < 1 and target:GetIsBuilt() and not self.ignorepowernodes and GetAreFriends(self, target) end
if target:isa("Player") then return target ~= nil and target:GetWeldPercentage() < 1 and not self.ignoreplayerwelds and GetAreFriends(self, target) end
end
local function GetAutomaticOrder(self)
Shared.Message("LOG - MAC - Getting automatic order")
local target = nil
local orderType = nil
if self.timeOfLastFindSomethingTime == nil or Shared.GetTime() > self.timeOfLastFindSomethingTime + 1 then
//Shared.Message("LOG - MAC - Time between checks verifies, now scanning for weld or construct")
local currentOrder = self:GetCurrentOrder()
local primaryTarget = nil
local constructables = GetEntitiesWithMixinForTeamWithinRange("Weldable", self:GetTeamNumber(), self:GetOrigin(), MAC.kOrderScanRadius)
for c = 1, #constructables do
local constructable = constructables[c]
//Constructing
if QualificationsForConstruct(self, constructable) and not QualificationsForWeldable(self, constructable) then
//Shared.Message("LOG - MAC - Qualified for constructa not weld, determining next step")
if constructable:isa("PowerPoint") and self.ignorepowernodes then Shared.Message("LOG - MAC - Spam Log!") end
if constructable:isa("PowerPoint") and not self.ignorepowernodes then
//Shared.Message("LOG - MAC - is a power node construct, but is not ignoring powernodes, setting powernode construct")
target = constructable
orderType = kTechId.Construct
self.timeOfLastFindSomethingTime = Shared.GetTime()
return target, orderType
end
if not constructable:isa("PowerPoint") and not self.ignoreconstructing then
//Shared.Message("LOG - MAC - is not a powerpoint and not ignore constructing")
target = constructable
orderType = kTechId.Construct
self.timeOfLastFindSomethingTime = Shared.GetTime()
return target, orderType
end
end
//Shared.Message("LOG - MAC - Not valid target or order from construct, nothing eligable, so lets see if we can weld")
if not target or not orderType then
if QualificationsForWeldable(self, constructable) and not QualificationsForConstruct(self, constructable) then
//Shared.Message("LOG - MAC - Scanned for entities and found none available toconstruct, but something eligable to weld")
self.timeOfLastFindSomethingTime = Shared.GetTime()
target = constructable
if target:isa("Player") then
//Shared.Message("LOG - MAC - Found a player with eligable to weld")
orderType = kTechId.FollowAndWeld
orderType = kTechId.AutoWeld
return target, orderType
end
if not target:isa("Player") then
//Shared.Message("LOG - MAC - found a structure eligable to weld, not player")
orderType = kTechId.AutoWeld
return target, orderType
end
//Shared.Message("LOG - MAC - very end of file returning stuff ?")
return target, orderType
end
end
end
end
//Shared.Message("LOG - MAC - very very end of line right before end")
end
So if you're new to SiegeMod, well, it has a Giant Mac, as powerful as 5 with health, speed, size, build/construct rates rather than having 50 tiny macs. So excuse that portion. (I would export Micro Management Mac(the button toggles) into Vanilla ns2, but I really don't feel like modifying
everything in a way that does not overwrite/override, for the sake of working with other mods
Comments
everything in a way that does not overwrite/override, for the sake of working with other mods