lots of rewrite

This commit is contained in:
Paul Liverman
2015-05-06 23:13:50 -07:00
parent 013e24e285
commit da9e427512
10 changed files with 916 additions and 189 deletions

View File

@@ -1,18 +1,21 @@
local Node = require "ships.Node"
math.randomseed(os.time())
math.random() math.random()
local class = require "lib.middleclass"
local Ship = require "ships.Ship"
local Node = require "ships.Node"
local ninety = 90 * math.pi / 180
return function(x, y, rotation)
local self = {}
local BSG = class('BSG', Ship)
function BSG:initialize(x, y, rotation)
Ship.initialize(self, x, y, rotation)
self.img = "bsg"
--offsets
self.ox = 31.5
self.oy = 67
self.x = x or 0
self.y = y or 0
self.rotation = rotation or 0
--[[
self.selection = {
w = 54,
@@ -34,33 +37,50 @@ return function(x, y, rotation)
Node(-23, 16.5, -ninety)
}
self.dock = function(self, ship, node)
if self.node[node].docked or ship.isDocked then return false end
self.Resources.maxAmmo = 1000000
self.Resources.maxFuel = 1300000
self.Resources.maxSupplies = 40000
--what the fuck are jp's ?
-- http://www.traditionaloven.com/culinary-arts/cooking/shortening/convert-japanese-cup-measure-of-shortening-to-fluid-ounce-floz-shortening.html
-- From show "10 mil JPs water lost, almost 60%"
self.Resources.maxWater = 16000000
self.Resources.maxFood = 51000
self.Resources.maxMetal = 80000
--self.Resources.maxOre = 0
self.Resources.maxCrew = 5100
ship.x = self.node[node].x
ship.y = self.node[node].y
ship.rotation = self.node[node].rotation
self.Resources.ammo = math.random(100, 1300)
self.Resources.fuel = math.random(496000, 512000)
self.Resources.supplies = math.random(18000,21000)
self.Resources.water = math.random(14186500, 14989900)
self.Resources.food = math.random(34700, 39200)
self.Resources.metal = math.random(19200,21600)
--self.Resources.ore = 0
self.Resources.crew = math.random(2870, 2960)
self.node[node].docked = ship
ship.isDocked = true
ship.dockedTo = self
ship.dockedNode = node
return true
end
self.Resources.missiles = math.random(5, 11)
--self.Resources.nukes = 0
self.undock = function(self, node)
if not self.node[node].docked then return false end
local ship = self.node[node].docked
ship.isDocked = false
ship.dockedTo = false
ship.dockedNode = false
self.node[node].docked = false
return ship
end
self.moveTo = function() end
return self
--self.Resources.ammoUse = 0
-- a year is 31,556,900 seconds
-- for 17 mil water to last ?
-- How about 1 water per second?
-- 195 days
self.Resources.fuelUseIdle = 0.04
self.Resources.fuelUseMoving = 0.54
self.Resources.fuelUseJump = 4000
self.Resources.suppliesUse = 0.0013
self.Resources.waterUse = 1
-- 45k civs = 82+85+119+304 (590) tons food
-- 2.5 mil JPs water
-- these are per week numbers
-- 604800 seconds, 4.13 water per second
-- 1 ton = 2000 pounds
-- 1180000 pounds / sec = 1.95 food per second
self.Resources.foodUse = 0.099
--self.Resources.metalUse = 0.002 -- this # assumes normal repairs, which I'm ignoring for this
--self.Resources.oreUse = 0
--self.Resources.crewUse = 0
end
return BSG