#118 created constructors for basic types

This commit is contained in:
Mikayla Fischler
2023-02-14 15:15:34 -05:00
parent 9d5a55bf58
commit 8ebdf2686b
11 changed files with 58 additions and 26 deletions

View File

@@ -1,6 +1,7 @@
local comms = require("scada-common.comms")
local log = require("scada-common.log")
local mqueue = require("scada-common.mqueue")
local types = require("scada-common.types")
local util = require("scada-common.util")
local svqtypes = require("supervisor.session.svqtypes")
@@ -149,8 +150,8 @@ function plc.new_session(id, for_reactor, in_queue, out_queue, timeout)
length = 0,
width = 0,
height = 0,
min_pos = { x = 0, y = 0, z = 0 }, ---@type coordinate
max_pos = { x = 0, y = 0, z = 0 }, ---@type coordinate
min_pos = types.new_zero_coordinate(),
max_pos = types.new_zero_coordinate(),
heat_cap = 0,
fuel_asm = 0,
fuel_sa = 0,

View File

@@ -62,8 +62,8 @@ function boilerv.new(session_id, unit_id, advert, out_queue)
length = 0,
width = 0,
height = 0,
min_pos = { x = 0, y = 0, z = 0 }, ---@type coordinate
max_pos = { x = 0, y = 0, z = 0 }, ---@type coordinate
min_pos = types.new_zero_coordinate(),
max_pos = types.new_zero_coordinate(),
boil_cap = 0.0,
steam_cap = 0,
water_cap = 0,
@@ -80,16 +80,16 @@ function boilerv.new(session_id, unit_id, advert, out_queue)
},
tanks = {
last_update = 0,
steam = { type = "mekanism:empty_gas", amount = 0 }, ---@type tank_fluid
steam = types.new_empty_gas(),
steam_need = 0,
steam_fill = 0.0,
water = { type = "mekanism:empty_gas", amount = 0 }, ---@type tank_fluid
water = types.new_empty_gas(),
water_need = 0,
water_fill = 0.0,
hcool = { type = "mekanism:empty_gas", amount = 0 }, ---@type tank_fluid
hcool = types.new_empty_gas(),
hcool_need = 0,
hcool_fill = 0.0,
ccool = { type = "mekanism:empty_gas", amount = 0 }, ---@type tank_fluid
ccool = types.new_empty_gas(),
ccool_need = 0,
ccool_fill = 0.0
}

View File

@@ -44,7 +44,7 @@ function envd.new(session_id, unit_id, advert, out_queue)
---@class envd_session_db
db = {
last_update = 0,
radiation = { radiation = 0, unit = "nSv" }, ---@type radiation_reading
radiation = types.new_zero_radiation_reading(),
radiation_raw = 0
}
}

View File

@@ -62,8 +62,8 @@ function imatrix.new(session_id, unit_id, advert, out_queue)
length = 0,
width = 0,
height = 0,
min_pos = { x = 0, y = 0, z = 0 }, ---@type coordinate
max_pos = { x = 0, y = 0, z = 0 }, ---@type coordinate
min_pos = types.new_zero_coordinate(),
max_pos = types.new_zero_coordinate(),
max_energy = 0,
transfer_cap = 0,
cells = 0,

View File

@@ -64,10 +64,10 @@ function sna.new(session_id, unit_id, advert, out_queue)
},
tanks = {
last_update = 0,
input = {}, ---@type tank_fluid
input = types.new_empty_gas(),
input_need = 0,
input_fill = 0.0,
output = {}, ---@type tank_fluid
output = types.new_empty_gas(),
output_need = 0,
output_fill = 0.0
}

View File

@@ -62,8 +62,8 @@ function sps.new(session_id, unit_id, advert, out_queue)
length = 0,
width = 0,
height = 0,
min_pos = { x = 0, y = 0, z = 0 }, ---@type coordinate
max_pos = { x = 0, y = 0, z = 0 }, ---@type coordinate
min_pos = types.new_zero_coordinate(),
max_pos = types.new_zero_coordinate(),
coils = 0,
input_cap = 0,
output_cap = 0,
@@ -75,10 +75,10 @@ function sps.new(session_id, unit_id, advert, out_queue)
},
tanks = {
last_update = 0,
input = {}, ---@type tank_fluid
input = types.new_empty_gas(),
input_need = 0,
input_fill = 0.0,
output = {}, ---@type tank_fluid
output = types.new_empty_gas(),
output_need = 0,
output_fill = 0.0,
energy = 0,

View File

@@ -74,8 +74,8 @@ function turbinev.new(session_id, unit_id, advert, out_queue)
length = 0,
width = 0,
height = 0,
min_pos = { x = 0, y = 0, z = 0 }, ---@type coordinate
max_pos = { x = 0, y = 0, z = 0 }, ---@type coordinate
min_pos = types.new_zero_coordinate(),
max_pos = types.new_zero_coordinate(),
blades = 0,
coils = 0,
vents = 0,
@@ -96,7 +96,7 @@ function turbinev.new(session_id, unit_id, advert, out_queue)
},
tanks = {
last_update = 0,
steam = { type = "mekanism:empty_gas", amount = 0 }, ---@type tank_fluid
steam = types.new_empty_gas(),
steam_need = 0,
steam_fill = 0.0,
energy = 0,