TONS of HUD
This commit is contained in:
333
src/hud.lua
333
src/hud.lua
@@ -15,9 +15,96 @@ local timeDividerRadius = timeSegmentRadius / 2
|
||||
|
||||
local lg = love.graphics
|
||||
|
||||
--[[
|
||||
local function brighten(color)
|
||||
if color[cycle] == true then
|
||||
if color[1] < 251 then
|
||||
color[1] = color[1] + 5
|
||||
else
|
||||
color[1] = 255
|
||||
end
|
||||
if color[2] < 251 then
|
||||
color[2] = color[2] + 5
|
||||
else
|
||||
color[2] = 255
|
||||
end
|
||||
if color[3] < 251 then
|
||||
color[3] = color[3] + 5
|
||||
else
|
||||
color[3] = 255
|
||||
end
|
||||
if color[1] == 255 and color[2] == 255 and color[3] == 255 then
|
||||
color[cycle] = false
|
||||
end
|
||||
else
|
||||
if color[1] > 4 then
|
||||
color[1] = color[1] - 5
|
||||
else
|
||||
color[1] = 0
|
||||
end
|
||||
if color[2] > 4 then
|
||||
color[2] = color[2] - 5
|
||||
else
|
||||
color[2] = 0
|
||||
end
|
||||
if color[3] > 4 then
|
||||
color[3] = color[3] - 5
|
||||
else
|
||||
color[3] = 0
|
||||
end
|
||||
if color[1] == 0 and color[2] == 0 and color[3] == 0 then
|
||||
color[cycle] = true
|
||||
end
|
||||
end
|
||||
lg.setColor(color)
|
||||
return color
|
||||
end
|
||||
--]]
|
||||
|
||||
return function(stats)
|
||||
lg.setColor(255, 102, 0)
|
||||
if stats.time > 0 then
|
||||
--[[ for seeing warnings
|
||||
stats.ammo = 3
|
||||
stats.fuel = 2
|
||||
stats.supplies = 1
|
||||
stats.water = 4
|
||||
stats.food = 5
|
||||
stats.metal = 1
|
||||
stats.ore = 2
|
||||
--]]
|
||||
local tCalc = stats.time * 10
|
||||
stats.time = math.floor(stats.time)
|
||||
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x, y, r, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
--local timeColor = {165, 52, 0, cycle = true}
|
||||
lg.setColor(165, 52, 0)
|
||||
if stats.time > 120 then
|
||||
lg.setColor(255, 210, 110)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x, y, r, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
--lg.setColor(40, 60, 100)
|
||||
if tCalc%32 < 16 then
|
||||
lg.setColor(165, 52, 0)
|
||||
else
|
||||
lg.setColor(0, 45, 145)
|
||||
end
|
||||
--lg.setColor(0, 45, 145)
|
||||
for i=1,(stats.time-120)/5+1 do
|
||||
lg.arc("fill", x, y, r, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
elseif stats.time > 60 then
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x, y, r, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
lg.setColor(255, 210, 110)
|
||||
for i=1,stats.time-60 do
|
||||
--timeColor = brighten(timeColor)
|
||||
lg.arc("fill", x, y, r, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
elseif stats.time > 0 then
|
||||
for i=1,stats.time do
|
||||
lg.arc("fill", x, y, r, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
@@ -26,31 +113,95 @@ return function(stats)
|
||||
lg.arc("fill", x, y, r, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
|
||||
lg.setColor(0, 0, 0)
|
||||
lg.circle("fill", x, y, r*4/5 + edge/2)
|
||||
|
||||
lg.setColor(255, 0, 0)
|
||||
for i=1,stats.ammo do
|
||||
lg.arc("fill", x, y, r*4/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
if stats.ammo < 2 then
|
||||
if tCalc%4 < 2 then
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x, y, r*4/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x, y, r*4/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
if stats.ammo < 6 then
|
||||
if tCalc%8 < 4 then
|
||||
lg.setColor(255, 0, 0)
|
||||
for i=1,stats.ammo do
|
||||
lg.arc("fill", x, y, r*4/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(255, 0, 0)
|
||||
for i=1,stats.ammo do
|
||||
lg.arc("fill", x, y, r*4/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
|
||||
lg.setColor(0, 0, 0)
|
||||
lg.circle("fill", x, y, r*3/5 + edge/2)
|
||||
|
||||
lg.setColor(255, 255, 0)
|
||||
for i=1,stats.fuel do
|
||||
lg.arc("fill", x, y, r*3/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
---[[tmp to see warnings]] stats.fuel = 1
|
||||
if stats.fuel < 2 then
|
||||
if (tCalc+1)%4 < 2 then
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x, y, r*3/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x, y, r*3/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
if stats.fuel < 6 then
|
||||
if (tCalc+1)%8 < 4 then
|
||||
lg.setColor(255, 255, 0)
|
||||
for i=1,stats.fuel do
|
||||
lg.arc("fill", x, y, r*3/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(255, 255, 0)
|
||||
for i=1,stats.fuel do
|
||||
lg.arc("fill", x, y, r*3/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
|
||||
lg.setColor(0, 0, 0)
|
||||
lg.circle("fill", x, y, r*2/5 + edge/2)
|
||||
|
||||
lg.setColor(0, 0, 255)
|
||||
for i=1,stats.supplies do
|
||||
lg.arc("fill", x, y, r*2/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
---[[tmp to see warnings]] stats.supplies = 1
|
||||
if stats.supplies < 2 then
|
||||
if (tCalc+2)%4 < 2 then
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x, y, r*2/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x, y, r*2/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
if stats.supplies < 6 then
|
||||
if (tCalc+2)%8 < 4 then
|
||||
lg.setColor(0, 255, 255)
|
||||
for i=1,stats.supplies do
|
||||
lg.arc("fill", x, y, r*2/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(0, 255, 255)
|
||||
for i=1,stats.supplies do
|
||||
lg.arc("fill", x, y, r*2/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
|
||||
lg.setColor(0, 0, 0)
|
||||
lg.circle("fill", x, y, r*1/5 + edge/2)
|
||||
|
||||
@@ -61,46 +212,158 @@ return function(stats)
|
||||
1 Time orange
|
||||
2 Ammo red
|
||||
3 Fuel yellow
|
||||
4 Supplies blue ?
|
||||
4 Supplies teal
|
||||
|
||||
5 Water teal ?
|
||||
5 Water blue
|
||||
6 Food green
|
||||
7 Metal silver
|
||||
8 Ore brown
|
||||
]]
|
||||
|
||||
lg.setColor(0, 255, 255)
|
||||
for i=1,stats.water do
|
||||
lg.arc("fill", x2, y2, r, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
---[[tmp to see warnings]] stats.water = 1
|
||||
if stats.water < 2 then
|
||||
if (tCalc+3)%4 < 2 then
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x2, y2, r, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x2, y2, r, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
if stats.water < 6 then
|
||||
if (tCalc+3)%8 < 4 then
|
||||
lg.setColor(0, 0, 255)
|
||||
for i=1,stats.water do
|
||||
lg.arc("fill", x2, y2, r, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(0, 0, 255)
|
||||
for i=1,stats.water do
|
||||
lg.arc("fill", x2, y2, r, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
|
||||
lg.setColor(0, 0, 0)
|
||||
lg.circle("fill", x2, y2, r*4/5 + edge/2)
|
||||
|
||||
lg.setColor(0, 255, 0)
|
||||
for i=1,stats.food do
|
||||
lg.arc("fill", x2, y2, r*4/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
---[[tmp to see warnings]] stats.food = 1
|
||||
if stats.food < 2 then
|
||||
if tCalc%4 < 2 then
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x2, y2, r*4/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x2, y2, r*4/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
if stats.food < 6 then
|
||||
if tCalc%8 < 4 then
|
||||
lg.setColor(0, 160, 0)
|
||||
for i=1,stats.food do
|
||||
lg.arc("fill", x2, y2, r*4/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(0, 160, 0)
|
||||
for i=1,stats.food do
|
||||
lg.arc("fill", x2, y2, r*4/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
|
||||
lg.setColor(0, 0, 0)
|
||||
lg.circle("fill", x2, y2, r*3/5 + edge/2)
|
||||
|
||||
lg.setColor(100, 100, 100)
|
||||
for i=1,stats.metal do
|
||||
lg.arc("fill", x2, y2, r*3/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
---[[tmp to see warnings]] stats.metal = 1
|
||||
if stats.metal < 2 then
|
||||
if (tCalc+1)%4 < 2 then
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x2, y2, r*3/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x2, y2, r*3/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
if stats.metal < 6 then
|
||||
if (tCalc+1)%8 < 4 then
|
||||
lg.setColor(100, 100, 100)
|
||||
for i=1,stats.metal do
|
||||
lg.arc("fill", x2, y2, r*3/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(100, 100, 100)
|
||||
for i=1,stats.metal do
|
||||
lg.arc("fill", x2, y2, r*3/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
|
||||
lg.setColor(0, 0, 0)
|
||||
lg.circle("fill", x2, y2, r*2/5 + edge/2)
|
||||
|
||||
lg.setColor(107, 66, 38)
|
||||
for i=1,stats.ore do
|
||||
lg.arc("fill", x2, y2, r*2/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
---[[tmp to see warnings]] stats.ore = 1
|
||||
if stats.ore < 2 then
|
||||
if (tCalc+2)%4 < 2 then
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x2, y2, r*2/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(10, 20, 30)
|
||||
for i=1,60 do
|
||||
lg.arc("fill", x2, y2, r*2/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
if stats.ore < 7 then
|
||||
if (tCalc+2)%8 < 4 then
|
||||
lg.setColor(107, 66, 38)
|
||||
for i=1,stats.ore do
|
||||
lg.arc("fill", x2, y2, r*2/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
else
|
||||
lg.setColor(107, 66, 38)
|
||||
for i=1,stats.ore do
|
||||
lg.arc("fill", x2, y2, r*2/5 - edge/2, (i-1)*timeSegmentRadius - verticalOffset, i*timeSegmentRadius - timeDividerRadius - verticalOffset)
|
||||
end
|
||||
end
|
||||
|
||||
lg.setColor(0, 0, 0)
|
||||
lg.circle("fill", x2, y2, r*1/5 + edge/2)
|
||||
|
||||
lg.setColor(255, 255, 255)
|
||||
lg.print(stats.time, x, y)
|
||||
--lg.setColor(255, 255, 255)
|
||||
if stats.time < 0 then
|
||||
lg.setColor(255, 102, 0)
|
||||
elseif stats.time < 6 then
|
||||
if tCalc%4 < 2 then
|
||||
lg.setColor(255, 102, 0)
|
||||
else
|
||||
lg.setColor(255, 255, 255)
|
||||
end
|
||||
elseif stats.time < 31 then
|
||||
if tCalc%8 < 4 then
|
||||
lg.setColor(255, 102, 0)
|
||||
else
|
||||
lg.setColor(255, 255, 255)
|
||||
end
|
||||
else
|
||||
if tCalc%16 < 8 then
|
||||
lg.setColor(255, 255, 255)
|
||||
else
|
||||
lg.setColor(255, 210, 110)
|
||||
--lg.setColor(255, 102, 0)
|
||||
end
|
||||
end
|
||||
--stats.time = math.floor(stats.time)
|
||||
local font = lg.getFont();
|
||||
lg.print(stats.time, x - font:getWidth(stats.time)/2, y - font:getHeight()/2)
|
||||
end
|
||||
|
42
src/main.lua
42
src/main.lua
@@ -4,7 +4,7 @@ local inspect = require "lib.inspect"
|
||||
local lg = love.graphics
|
||||
|
||||
local hx, hy = lg.getWidth() / 2, lg.getHeight() / 2
|
||||
local scale = 8
|
||||
local scale = 2
|
||||
|
||||
local images = {}
|
||||
local fleet = {}
|
||||
@@ -30,6 +30,7 @@ function love.load()
|
||||
local v = viper()
|
||||
table.insert(fleet, v)
|
||||
fleet[1]:dock(v, i)
|
||||
v.engineStatus = "off"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -119,8 +120,11 @@ local function getStats()
|
||||
ore = math.floor(ore)
|
||||
}
|
||||
end
|
||||
local timing = -60
|
||||
local timing = -33
|
||||
local paused = false
|
||||
function love.update(dt)
|
||||
if paused then return end
|
||||
dt = dt * 10 --temporary accelerated
|
||||
timer = timer + dt
|
||||
if timer >= 1 then
|
||||
timer = timer - 1
|
||||
@@ -141,11 +145,17 @@ function love.update(dt)
|
||||
end
|
||||
|
||||
timing = timing + dt
|
||||
if timing >= 60 then
|
||||
timing = timing -120
|
||||
--[[
|
||||
if timing >= 121 then
|
||||
timing = timing -181+60-33
|
||||
end
|
||||
--]]
|
||||
|
||||
stats.time = math.floor(timing) --TMP
|
||||
stats.time = timing --TMP ?
|
||||
|
||||
for i=1,#fleet do
|
||||
fleet[i]:update(dt)
|
||||
end
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
@@ -163,10 +173,32 @@ function love.draw()
|
||||
end
|
||||
|
||||
hud(stats)
|
||||
|
||||
---[[temporary, raw Resource stats of Galactica
|
||||
local r = fleet[1].Resources
|
||||
lg.setColor(255, 255, 255)
|
||||
lg.print("Ammo: " .. math.floor(r.ammo/r.maxAmmo*100) .. "% " .. r.ammo, -300, -200)
|
||||
lg.print("Fuel: " .. math.floor(r.fuel/r.maxFuel*100) .. "% " .. r.fuel, -300, -190)
|
||||
lg.print("Supplies: " .. math.floor(r.supplies/r.maxSupplies*100) .. "% " .. r.supplies, -300, -180)
|
||||
lg.print("Food: " .. math.floor(r.food/r.maxFood*100) .. "% " .. r.food, -300, -170)
|
||||
lg.print("Water: " .. math.floor(r.water/r.maxWater*100) .. "% " .. r.water, -300, -160)
|
||||
lg.print("Metal: " .. math.floor(r.metal/r.maxMetal*100) .. "% " .. r.metal, -300, -150)
|
||||
lg.print("Ore: " .. math.floor(r.ore/r.maxOre*100) .. "% " .. r.ore, -300, -140)
|
||||
--]]
|
||||
|
||||
--[[tmp, printing total time as hours/minutes/seconds]]
|
||||
lg.print("Time elapsed: " .. math.floor(timing/60/60) .. ":" .. math.floor(timing/60)%60 .. ":" .. math.floor(timing)%60, -300, -120)
|
||||
local result = 0
|
||||
for i=2,#fleet do
|
||||
result = result + fleet[i].Resources.fuel
|
||||
end
|
||||
lg.print("Viper fuel: " .. result, -300, -110)
|
||||
end
|
||||
|
||||
function love.keypressed(key, unicode)
|
||||
if key == "escape" then
|
||||
love.event.quit()
|
||||
elseif key == " " then
|
||||
paused = not paused
|
||||
end
|
||||
end
|
||||
|
@@ -1,3 +1,5 @@
|
||||
local resourceConsumptionMultiplier = 500 --does not apply to ammo or crew
|
||||
|
||||
local class = require "lib.middleclass"
|
||||
|
||||
local Resources = class('Resources')
|
||||
@@ -25,6 +27,7 @@ function Resources:initialize()
|
||||
self.maxCrew = 0
|
||||
|
||||
self.ammoUse = 0
|
||||
self.fuelUseOff = 0
|
||||
self.fuelUseIdle = 0
|
||||
self.fuelUseMoving = 0
|
||||
self.fuelUseJump = 0
|
||||
@@ -38,18 +41,20 @@ end
|
||||
|
||||
function Resources:update(dt, engineStatus)
|
||||
self.ammo = self.ammo - self.ammoUse * dt
|
||||
if engineStatus == "idle" then
|
||||
self.fuel = self.fuel - self.fuelUseIdle * dt
|
||||
if engineStatus == "off" then
|
||||
self.fuel = self.fuel - self.fuelUseOff * dt * resourceConsumptionMultiplier
|
||||
elseif engineStatus == "idle" then
|
||||
self.fuel = self.fuel - self.fuelUseIdle * dt * resourceConsumptionMultiplier
|
||||
elseif engineStatus == "moving" then
|
||||
self.fuel = self.fuel - self.fuelUseMoving * dt
|
||||
self.fuel = self.fuel - self.fuelUseMoving * dt * resourceConsumptionMultiplier
|
||||
else
|
||||
error("Invalid engineStatus!")
|
||||
end
|
||||
self.supplies = self.supplies - self.suppliesUse * dt
|
||||
self.water = self.water - self.waterUse * dt
|
||||
self.food = self.food - self.foodUse * dt
|
||||
self.metal = self.metal - self.metalUse * dt
|
||||
self.ore = self.ore - self.oreUse * dt
|
||||
self.supplies = self.supplies - self.suppliesUse * dt * resourceConsumptionMultiplier
|
||||
self.water = self.water - self.waterUse * dt * resourceConsumptionMultiplier
|
||||
self.food = self.food - self.foodUse * dt * resourceConsumptionMultiplier
|
||||
self.metal = self.metal - self.metalUse * dt * resourceConsumptionMultiplier
|
||||
self.ore = self.ore - self.oreUse * dt * resourceConsumptionMultiplier
|
||||
self.crew = self.crew - self.crewUse * dt
|
||||
|
||||
--TODO check if running out of anything, and do whatever is appropriate
|
||||
|
@@ -1,11 +1,12 @@
|
||||
math.randomseed(os.time())
|
||||
math.random() math.random()
|
||||
|
||||
local ninety = 90 * math.pi / 180
|
||||
|
||||
local class = require "lib.middleclass"
|
||||
|
||||
local Ship = require "ships.Ship"
|
||||
local Node = require "ships.Node"
|
||||
local ninety = 90 * math.pi / 180
|
||||
|
||||
local BSG = class('BSG', Ship)
|
||||
|
||||
|
Reference in New Issue
Block a user