Skip to content

Commit

Permalink
add RAS toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
CookieNoob committed May 31, 2018
1 parent 6945125 commit 610b90c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
39 changes: 30 additions & 9 deletions units/INU0001/INU0001_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ INU0001 = Class(ACUUnit) {

self.Sync.Abilities = self:GetBlueprint().Abilities
self:HasCapacitorAbility(false)

--TODO:set these to actual bp values like bp.Enhancements.ResourceAllocation.ProductionPerSecondEnergy
self.MassProduction = 30
self.EnergyProduction = 3000

end,

OnStopBeingBuilt = function(self, builder, layer)
Expand Down Expand Up @@ -514,17 +519,15 @@ INU0001 = Class(ACUUnit) {
-- RESOURCE ALLOCATION
-- ---------------------------------------------------------------------------------------

elseif enh =='ResourceAllocation' then

local bpEcon = self:GetBlueprint().Economy
self:SetProductionPerSecondEnergy(bp.ProductionPerSecondEnergy + bpEcon.ProductionPerSecondEnergy or 0)
self:SetProductionPerSecondMass(bp.ProductionPerSecondMass + bpEcon.ProductionPerSecondMass or 0)
elseif enh =='ResourceAllocation' then
self:AddToggleCap('RULEUTC_ProductionToggle')
self:SetProductionPerSecondEnergy(self.EnergyProduction)


elseif enh == 'ResourceAllocationRemove' then

local bpEcon = self:GetBlueprint().Economy
self:SetProductionPerSecondEnergy(bpEcon.ProductionPerSecondEnergy or 0)
self:SetProductionPerSecondMass(bpEcon.ProductionPerSecondMass or 0)
self:RemoveToggleCap('RULEUTC_ProductionToggle')
self:SetProductionPerSecondEnergy(20)
self:SetProductionPerSecondmass(1)

-- ---------------------------------------------------------------------------------------
-- RAPID REPAIR
Expand Down Expand Up @@ -766,6 +769,24 @@ INU0001 = Class(ACUUnit) {
OnAmmoCountIncreased = function(self, amount)
self:GetAIBrain():EnableSpecialAbility( 'NomadsAreaBombardment', true)
end,

OnScriptBitSet = function(self, bit)
if bit == 4 then -- Production toggle
self:SetProductionPerSecondMass(self.MassProduction)
self:SetProductionPerSecondEnergy(20)
else
ACUUnit.OnScriptBitSet(self, bit)
end
end,

OnScriptBitClear = function(self, bit)
if bit == 4 then -- Production toggle
self:SetProductionPerSecondMass(1)
self:SetProductionPerSecondEnergy(self.EnergyProduction)
else
ACUUnit.OnScriptBitClear(self, bit)
end
end,

}

Expand Down
2 changes: 1 addition & 1 deletion units/INU0001/INU0001_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ UnitBlueprint {
BuildTime = 2800,
Icon = 'isb',
Name = '<LOC enhancements_0045>Resource Allocation System',
ProductionPerSecondEnergy = 1400,
ProductionPerSecondEnergy = 3000, --these stats don't change anything try edit script
ProductionPerSecondMass = 20,
ShowBones = {
'upgrade_back',
Expand Down

0 comments on commit 610b90c

Please sign in to comment.