MF Line endings
This commit is contained in:
@@ -1,158 +1,158 @@
|
||||
#define PUMP_OUT "out"
|
||||
#define PUMP_IN "in"
|
||||
#define PUMP_MAX_PRESSURE (ONE_ATMOSPHERE * 25)
|
||||
#define PUMP_MIN_PRESSURE (ONE_ATMOSPHERE / 10)
|
||||
#define PUMP_DEFAULT_PRESSURE (ONE_ATMOSPHERE)
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump
|
||||
name = "portable air pump"
|
||||
icon_state = "psiphon:0"
|
||||
density = TRUE
|
||||
|
||||
var/on = FALSE
|
||||
var/direction = PUMP_OUT
|
||||
var/obj/machinery/atmospherics/components/binary/pump/pump
|
||||
|
||||
volume = 1000
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/Initialize()
|
||||
. = ..()
|
||||
pump = new(src, FALSE)
|
||||
pump.on = TRUE
|
||||
pump.stat = 0
|
||||
pump.build_network()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/Destroy()
|
||||
var/turf/T = get_turf(src)
|
||||
T.assume_air(air_contents)
|
||||
air_update_turf()
|
||||
QDEL_NULL(pump)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/update_icon()
|
||||
icon_state = "psiphon:[on]"
|
||||
|
||||
cut_overlays()
|
||||
if(holding)
|
||||
add_overlay("siphon-open")
|
||||
if(connected_port)
|
||||
add_overlay("siphon-connector")
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
pump.airs[1] = null
|
||||
pump.airs[2] = null
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(direction == PUMP_OUT) // Hook up the internal pump.
|
||||
pump.airs[1] = holding ? holding.air_contents : air_contents
|
||||
pump.airs[2] = holding ? air_contents : T.return_air()
|
||||
else
|
||||
pump.airs[1] = holding ? air_contents : T.return_air()
|
||||
pump.airs[2] = holding ? holding.air_contents : air_contents
|
||||
|
||||
pump.process_atmos() // Pump gas.
|
||||
if(!holding)
|
||||
air_update_turf() // Update the environment if needed.
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/emp_act(severity)
|
||||
. = ..()
|
||||
if(. & EMP_PROTECT_SELF)
|
||||
return
|
||||
if(is_operational())
|
||||
if(prob(50 / severity))
|
||||
on = !on
|
||||
if(prob(100 / severity))
|
||||
direction = PUMP_OUT
|
||||
pump.target_pressure = rand(0, 100 * ONE_ATMOSPHERE)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/replace_tank(mob/living/user, close_valve)
|
||||
. = ..()
|
||||
if(.)
|
||||
if(close_valve)
|
||||
if(on)
|
||||
on = FALSE
|
||||
update_icon()
|
||||
else if(on && holding && direction == PUMP_OUT)
|
||||
investigate_log("[key_name(user)] started a transfer into [holding].<br>", INVESTIGATE_ATMOS)
|
||||
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "portable_pump", name, 300, 315, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/ui_data()
|
||||
var/data = list()
|
||||
data["on"] = on
|
||||
data["direction"] = direction == PUMP_IN ? TRUE : FALSE
|
||||
data["connected"] = connected_port ? TRUE : FALSE
|
||||
data["pressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
|
||||
data["target_pressure"] = round(pump.target_pressure ? pump.target_pressure : 0)
|
||||
data["default_pressure"] = round(PUMP_DEFAULT_PRESSURE)
|
||||
data["min_pressure"] = round(PUMP_MIN_PRESSURE)
|
||||
data["max_pressure"] = round(PUMP_MAX_PRESSURE)
|
||||
|
||||
if(holding)
|
||||
data["holding"] = list()
|
||||
data["holding"]["name"] = holding.name
|
||||
data["holding"]["pressure"] = round(holding.air_contents.return_pressure())
|
||||
else
|
||||
data["holding"] = null
|
||||
return data
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("power")
|
||||
on = !on
|
||||
if(on && !holding)
|
||||
var/plasma = air_contents.gases[/datum/gas/plasma]
|
||||
var/n2o = air_contents.gases[/datum/gas/nitrous_oxide]
|
||||
if(n2o || plasma)
|
||||
message_admins("[ADMIN_LOOKUPFLW(usr)] turned on a pump that contains [n2o ? "N2O" : ""][n2o && plasma ? " & " : ""][plasma ? "Plasma" : ""] at [ADMIN_VERBOSEJMP(src)]")
|
||||
log_admin("[key_name(usr)] turned on a pump that contains [n2o ? "N2O" : ""][n2o && plasma ? " & " : ""][plasma ? "Plasma" : ""] at [AREACOORD(src)]")
|
||||
else if(on && direction == PUMP_OUT)
|
||||
investigate_log("[key_name(usr)] started a transfer into [holding].<br>", INVESTIGATE_ATMOS)
|
||||
. = TRUE
|
||||
if("direction")
|
||||
if(direction == PUMP_OUT)
|
||||
direction = PUMP_IN
|
||||
else
|
||||
if(on && holding)
|
||||
investigate_log("[key_name(usr)] started a transfer into [holding].<br>", INVESTIGATE_ATMOS)
|
||||
direction = PUMP_OUT
|
||||
. = TRUE
|
||||
if("pressure")
|
||||
var/pressure = params["pressure"]
|
||||
if(pressure == "reset")
|
||||
pressure = PUMP_DEFAULT_PRESSURE
|
||||
. = TRUE
|
||||
else if(pressure == "min")
|
||||
pressure = PUMP_MIN_PRESSURE
|
||||
. = TRUE
|
||||
else if(pressure == "max")
|
||||
pressure = PUMP_MAX_PRESSURE
|
||||
. = TRUE
|
||||
else if(pressure == "input")
|
||||
pressure = input("New release pressure ([PUMP_MIN_PRESSURE]-[PUMP_MAX_PRESSURE] kPa):", name, pump.target_pressure) as num|null
|
||||
if(!isnull(pressure) && !..())
|
||||
. = TRUE
|
||||
else if(text2num(pressure) != null)
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
pump.target_pressure = CLAMP(round(pressure), PUMP_MIN_PRESSURE, PUMP_MAX_PRESSURE)
|
||||
investigate_log("was set to [pump.target_pressure] kPa by [key_name(usr)].", INVESTIGATE_ATMOS)
|
||||
if("eject")
|
||||
if(holding)
|
||||
holding.forceMove(drop_location())
|
||||
holding = null
|
||||
. = TRUE
|
||||
update_icon()
|
||||
#define PUMP_OUT "out"
|
||||
#define PUMP_IN "in"
|
||||
#define PUMP_MAX_PRESSURE (ONE_ATMOSPHERE * 25)
|
||||
#define PUMP_MIN_PRESSURE (ONE_ATMOSPHERE / 10)
|
||||
#define PUMP_DEFAULT_PRESSURE (ONE_ATMOSPHERE)
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump
|
||||
name = "portable air pump"
|
||||
icon_state = "psiphon:0"
|
||||
density = TRUE
|
||||
|
||||
var/on = FALSE
|
||||
var/direction = PUMP_OUT
|
||||
var/obj/machinery/atmospherics/components/binary/pump/pump
|
||||
|
||||
volume = 1000
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/Initialize()
|
||||
. = ..()
|
||||
pump = new(src, FALSE)
|
||||
pump.on = TRUE
|
||||
pump.stat = 0
|
||||
pump.build_network()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/Destroy()
|
||||
var/turf/T = get_turf(src)
|
||||
T.assume_air(air_contents)
|
||||
air_update_turf()
|
||||
QDEL_NULL(pump)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/update_icon()
|
||||
icon_state = "psiphon:[on]"
|
||||
|
||||
cut_overlays()
|
||||
if(holding)
|
||||
add_overlay("siphon-open")
|
||||
if(connected_port)
|
||||
add_overlay("siphon-connector")
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
pump.airs[1] = null
|
||||
pump.airs[2] = null
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(direction == PUMP_OUT) // Hook up the internal pump.
|
||||
pump.airs[1] = holding ? holding.air_contents : air_contents
|
||||
pump.airs[2] = holding ? air_contents : T.return_air()
|
||||
else
|
||||
pump.airs[1] = holding ? air_contents : T.return_air()
|
||||
pump.airs[2] = holding ? holding.air_contents : air_contents
|
||||
|
||||
pump.process_atmos() // Pump gas.
|
||||
if(!holding)
|
||||
air_update_turf() // Update the environment if needed.
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/emp_act(severity)
|
||||
. = ..()
|
||||
if(. & EMP_PROTECT_SELF)
|
||||
return
|
||||
if(is_operational())
|
||||
if(prob(50 / severity))
|
||||
on = !on
|
||||
if(prob(100 / severity))
|
||||
direction = PUMP_OUT
|
||||
pump.target_pressure = rand(0, 100 * ONE_ATMOSPHERE)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/replace_tank(mob/living/user, close_valve)
|
||||
. = ..()
|
||||
if(.)
|
||||
if(close_valve)
|
||||
if(on)
|
||||
on = FALSE
|
||||
update_icon()
|
||||
else if(on && holding && direction == PUMP_OUT)
|
||||
investigate_log("[key_name(user)] started a transfer into [holding].<br>", INVESTIGATE_ATMOS)
|
||||
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "portable_pump", name, 300, 315, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/ui_data()
|
||||
var/data = list()
|
||||
data["on"] = on
|
||||
data["direction"] = direction == PUMP_IN ? TRUE : FALSE
|
||||
data["connected"] = connected_port ? TRUE : FALSE
|
||||
data["pressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
|
||||
data["target_pressure"] = round(pump.target_pressure ? pump.target_pressure : 0)
|
||||
data["default_pressure"] = round(PUMP_DEFAULT_PRESSURE)
|
||||
data["min_pressure"] = round(PUMP_MIN_PRESSURE)
|
||||
data["max_pressure"] = round(PUMP_MAX_PRESSURE)
|
||||
|
||||
if(holding)
|
||||
data["holding"] = list()
|
||||
data["holding"]["name"] = holding.name
|
||||
data["holding"]["pressure"] = round(holding.air_contents.return_pressure())
|
||||
else
|
||||
data["holding"] = null
|
||||
return data
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("power")
|
||||
on = !on
|
||||
if(on && !holding)
|
||||
var/plasma = air_contents.gases[/datum/gas/plasma]
|
||||
var/n2o = air_contents.gases[/datum/gas/nitrous_oxide]
|
||||
if(n2o || plasma)
|
||||
message_admins("[ADMIN_LOOKUPFLW(usr)] turned on a pump that contains [n2o ? "N2O" : ""][n2o && plasma ? " & " : ""][plasma ? "Plasma" : ""] at [ADMIN_VERBOSEJMP(src)]")
|
||||
log_admin("[key_name(usr)] turned on a pump that contains [n2o ? "N2O" : ""][n2o && plasma ? " & " : ""][plasma ? "Plasma" : ""] at [AREACOORD(src)]")
|
||||
else if(on && direction == PUMP_OUT)
|
||||
investigate_log("[key_name(usr)] started a transfer into [holding].<br>", INVESTIGATE_ATMOS)
|
||||
. = TRUE
|
||||
if("direction")
|
||||
if(direction == PUMP_OUT)
|
||||
direction = PUMP_IN
|
||||
else
|
||||
if(on && holding)
|
||||
investigate_log("[key_name(usr)] started a transfer into [holding].<br>", INVESTIGATE_ATMOS)
|
||||
direction = PUMP_OUT
|
||||
. = TRUE
|
||||
if("pressure")
|
||||
var/pressure = params["pressure"]
|
||||
if(pressure == "reset")
|
||||
pressure = PUMP_DEFAULT_PRESSURE
|
||||
. = TRUE
|
||||
else if(pressure == "min")
|
||||
pressure = PUMP_MIN_PRESSURE
|
||||
. = TRUE
|
||||
else if(pressure == "max")
|
||||
pressure = PUMP_MAX_PRESSURE
|
||||
. = TRUE
|
||||
else if(pressure == "input")
|
||||
pressure = input("New release pressure ([PUMP_MIN_PRESSURE]-[PUMP_MAX_PRESSURE] kPa):", name, pump.target_pressure) as num|null
|
||||
if(!isnull(pressure) && !..())
|
||||
. = TRUE
|
||||
else if(text2num(pressure) != null)
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
pump.target_pressure = CLAMP(round(pressure), PUMP_MIN_PRESSURE, PUMP_MAX_PRESSURE)
|
||||
investigate_log("was set to [pump.target_pressure] kPa by [key_name(usr)].", INVESTIGATE_ATMOS)
|
||||
if("eject")
|
||||
if(holding)
|
||||
holding.forceMove(drop_location())
|
||||
holding = null
|
||||
. = TRUE
|
||||
update_icon()
|
||||
|
||||
@@ -1,146 +1,146 @@
|
||||
/obj/machinery/portable_atmospherics/scrubber
|
||||
name = "portable air scrubber"
|
||||
icon_state = "pscrubber:0"
|
||||
density = TRUE
|
||||
|
||||
var/on = FALSE
|
||||
var/volume_rate = 1000
|
||||
volume = 1000
|
||||
|
||||
var/list/scrubbing = list(/datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitryl, /datum/gas/tritium, /datum/gas/hypernoblium, /datum/gas/water_vapor)
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/Destroy()
|
||||
var/turf/T = get_turf(src)
|
||||
T.assume_air(air_contents)
|
||||
air_update_turf()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/update_icon()
|
||||
icon_state = "pscrubber:[on]"
|
||||
|
||||
cut_overlays()
|
||||
if(holding)
|
||||
add_overlay("scrubber-open")
|
||||
if(connected_port)
|
||||
add_overlay("scrubber-connector")
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
return
|
||||
|
||||
if(holding)
|
||||
scrub(holding.air_contents)
|
||||
else
|
||||
var/turf/T = get_turf(src)
|
||||
scrub(T.return_air())
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/proc/scrub(var/datum/gas_mixture/mixture)
|
||||
var/transfer_moles = min(1, volume_rate / mixture.volume) * mixture.total_moles()
|
||||
|
||||
var/datum/gas_mixture/filtering = mixture.remove(transfer_moles) // Remove part of the mixture to filter.
|
||||
var/datum/gas_mixture/filtered = new
|
||||
if(!filtering)
|
||||
return
|
||||
|
||||
filtered.temperature = filtering.temperature
|
||||
for(var/gas in filtering.gases & scrubbing)
|
||||
filtered.gases[gas] = filtering.gases[gas] // Shuffle the "bad" gasses to the filtered mixture.
|
||||
filtering.gases[gas] = 0
|
||||
GAS_GARBAGE_COLLECT(filtering.gases)
|
||||
|
||||
air_contents.merge(filtered) // Store filtered out gasses.
|
||||
mixture.merge(filtering) // Returned the cleaned gas.
|
||||
if(!holding)
|
||||
air_update_turf()
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/emp_act(severity)
|
||||
. = ..()
|
||||
if(. & EMP_PROTECT_SELF)
|
||||
return
|
||||
if(is_operational())
|
||||
if(prob(50 / severity))
|
||||
on = !on
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "portable_scrubber", name, 320, 335, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/ui_data()
|
||||
var/data = list()
|
||||
data["on"] = on
|
||||
data["connected"] = connected_port ? 1 : 0
|
||||
data["pressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
|
||||
|
||||
data["id_tag"] = -1 //must be defined in order to reuse code between portable and vent scrubbers
|
||||
data["filter_types"] = list()
|
||||
for(var/path in GLOB.meta_gas_ids)
|
||||
data["filter_types"] += list(list("gas_id" = GLOB.meta_gas_ids[path], "gas_name" = GLOB.meta_gas_names[path], "enabled" = (path in scrubbing)))
|
||||
|
||||
if(holding)
|
||||
data["holding"] = list()
|
||||
data["holding"]["name"] = holding.name
|
||||
data["holding"]["pressure"] = round(holding.air_contents.return_pressure())
|
||||
else
|
||||
data["holding"] = null
|
||||
return data
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("power")
|
||||
on = !on
|
||||
. = TRUE
|
||||
if("eject")
|
||||
if(holding)
|
||||
holding.forceMove(drop_location())
|
||||
holding = null
|
||||
. = TRUE
|
||||
if("toggle_filter")
|
||||
scrubbing ^= gas_id2path(params["val"])
|
||||
. = TRUE
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/huge
|
||||
name = "huge air scrubber"
|
||||
icon_state = "scrubber:0"
|
||||
anchored = TRUE
|
||||
active_power_usage = 500
|
||||
idle_power_usage = 10
|
||||
|
||||
volume_rate = 1500
|
||||
volume = 50000
|
||||
|
||||
var/movable = FALSE
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/huge/movable
|
||||
movable = TRUE
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/huge/update_icon()
|
||||
icon_state = "scrubber:[on]"
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/huge/process_atmos()
|
||||
if((!anchored && !movable) || !is_operational())
|
||||
on = FALSE
|
||||
update_icon()
|
||||
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
|
||||
if(!on)
|
||||
return
|
||||
|
||||
..()
|
||||
if(!holding)
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/turf/AT in T.GetAtmosAdjacentTurfs(alldir = TRUE))
|
||||
scrub(AT.return_air())
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/huge/attackby(obj/item/W, mob/user)
|
||||
if(default_unfasten_wrench(user, W))
|
||||
if(!movable)
|
||||
on = FALSE
|
||||
else
|
||||
return ..()
|
||||
/obj/machinery/portable_atmospherics/scrubber
|
||||
name = "portable air scrubber"
|
||||
icon_state = "pscrubber:0"
|
||||
density = TRUE
|
||||
|
||||
var/on = FALSE
|
||||
var/volume_rate = 1000
|
||||
volume = 1000
|
||||
|
||||
var/list/scrubbing = list(/datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitryl, /datum/gas/tritium, /datum/gas/hypernoblium, /datum/gas/water_vapor)
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/Destroy()
|
||||
var/turf/T = get_turf(src)
|
||||
T.assume_air(air_contents)
|
||||
air_update_turf()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/update_icon()
|
||||
icon_state = "pscrubber:[on]"
|
||||
|
||||
cut_overlays()
|
||||
if(holding)
|
||||
add_overlay("scrubber-open")
|
||||
if(connected_port)
|
||||
add_overlay("scrubber-connector")
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
return
|
||||
|
||||
if(holding)
|
||||
scrub(holding.air_contents)
|
||||
else
|
||||
var/turf/T = get_turf(src)
|
||||
scrub(T.return_air())
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/proc/scrub(var/datum/gas_mixture/mixture)
|
||||
var/transfer_moles = min(1, volume_rate / mixture.volume) * mixture.total_moles()
|
||||
|
||||
var/datum/gas_mixture/filtering = mixture.remove(transfer_moles) // Remove part of the mixture to filter.
|
||||
var/datum/gas_mixture/filtered = new
|
||||
if(!filtering)
|
||||
return
|
||||
|
||||
filtered.temperature = filtering.temperature
|
||||
for(var/gas in filtering.gases & scrubbing)
|
||||
filtered.gases[gas] = filtering.gases[gas] // Shuffle the "bad" gasses to the filtered mixture.
|
||||
filtering.gases[gas] = 0
|
||||
GAS_GARBAGE_COLLECT(filtering.gases)
|
||||
|
||||
air_contents.merge(filtered) // Store filtered out gasses.
|
||||
mixture.merge(filtering) // Returned the cleaned gas.
|
||||
if(!holding)
|
||||
air_update_turf()
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/emp_act(severity)
|
||||
. = ..()
|
||||
if(. & EMP_PROTECT_SELF)
|
||||
return
|
||||
if(is_operational())
|
||||
if(prob(50 / severity))
|
||||
on = !on
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "portable_scrubber", name, 320, 335, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/ui_data()
|
||||
var/data = list()
|
||||
data["on"] = on
|
||||
data["connected"] = connected_port ? 1 : 0
|
||||
data["pressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
|
||||
|
||||
data["id_tag"] = -1 //must be defined in order to reuse code between portable and vent scrubbers
|
||||
data["filter_types"] = list()
|
||||
for(var/path in GLOB.meta_gas_ids)
|
||||
data["filter_types"] += list(list("gas_id" = GLOB.meta_gas_ids[path], "gas_name" = GLOB.meta_gas_names[path], "enabled" = (path in scrubbing)))
|
||||
|
||||
if(holding)
|
||||
data["holding"] = list()
|
||||
data["holding"]["name"] = holding.name
|
||||
data["holding"]["pressure"] = round(holding.air_contents.return_pressure())
|
||||
else
|
||||
data["holding"] = null
|
||||
return data
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("power")
|
||||
on = !on
|
||||
. = TRUE
|
||||
if("eject")
|
||||
if(holding)
|
||||
holding.forceMove(drop_location())
|
||||
holding = null
|
||||
. = TRUE
|
||||
if("toggle_filter")
|
||||
scrubbing ^= gas_id2path(params["val"])
|
||||
. = TRUE
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/huge
|
||||
name = "huge air scrubber"
|
||||
icon_state = "scrubber:0"
|
||||
anchored = TRUE
|
||||
active_power_usage = 500
|
||||
idle_power_usage = 10
|
||||
|
||||
volume_rate = 1500
|
||||
volume = 50000
|
||||
|
||||
var/movable = FALSE
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/huge/movable
|
||||
movable = TRUE
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/huge/update_icon()
|
||||
icon_state = "scrubber:[on]"
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/huge/process_atmos()
|
||||
if((!anchored && !movable) || !is_operational())
|
||||
on = FALSE
|
||||
update_icon()
|
||||
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
|
||||
if(!on)
|
||||
return
|
||||
|
||||
..()
|
||||
if(!holding)
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/turf/AT in T.GetAtmosAdjacentTurfs(alldir = TRUE))
|
||||
scrub(AT.return_air())
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/huge/attackby(obj/item/W, mob/user)
|
||||
if(default_unfasten_wrench(user, W))
|
||||
if(!movable)
|
||||
on = FALSE
|
||||
else
|
||||
return ..()
|
||||
|
||||
+226
-226
@@ -1,226 +1,226 @@
|
||||
/obj/machinery/computer/cargo
|
||||
name = "supply console"
|
||||
desc = "Used to order supplies, approve requests, and control the shuttle."
|
||||
icon_screen = "supply"
|
||||
circuit = /obj/item/circuitboard/computer/cargo
|
||||
req_access = list(ACCESS_CARGO)
|
||||
var/requestonly = FALSE
|
||||
var/contraband = FALSE
|
||||
var/safety_warning = "For safety reasons, the automated supply shuttle \
|
||||
cannot transport live organisms, human remains, classified nuclear weaponry \
|
||||
or homing beacons."
|
||||
var/blockade_warning = "Bluespace instability detected. Shuttle movement impossible."
|
||||
|
||||
light_color = "#E2853D"//orange
|
||||
|
||||
/obj/machinery/computer/cargo/request
|
||||
name = "supply request console"
|
||||
desc = "Used to request supplies from cargo."
|
||||
icon_screen = "request"
|
||||
circuit = /obj/item/circuitboard/computer/cargo/request
|
||||
req_access = list()
|
||||
requestonly = TRUE
|
||||
|
||||
/obj/machinery/computer/cargo/Initialize()
|
||||
. = ..()
|
||||
var/obj/item/circuitboard/computer/cargo/board = circuit
|
||||
contraband = board.contraband
|
||||
if (board.obj_flags & EMAGGED)
|
||||
obj_flags |= EMAGGED
|
||||
else
|
||||
obj_flags &= ~EMAGGED
|
||||
|
||||
/obj/machinery/computer/cargo/proc/get_export_categories()
|
||||
. = EXPORT_CARGO
|
||||
if(contraband)
|
||||
. |= EXPORT_CONTRABAND
|
||||
if(obj_flags & EMAGGED)
|
||||
. |= EXPORT_EMAG
|
||||
|
||||
/obj/machinery/computer/cargo/emag_act(mob/user)
|
||||
. = ..()
|
||||
if(obj_flags & EMAGGED)
|
||||
return
|
||||
user.visible_message("<span class='warning'>[user] swipes a suspicious card through [src]!</span>",
|
||||
"<span class='notice'>You adjust [src]'s routing and receiver spectrum, unlocking special supplies and contraband.</span>")
|
||||
|
||||
obj_flags |= EMAGGED
|
||||
contraband = TRUE
|
||||
|
||||
// This also permamently sets this on the circuit board
|
||||
var/obj/item/circuitboard/computer/cargo/board = circuit
|
||||
board.contraband = TRUE
|
||||
board.obj_flags |= EMAGGED
|
||||
req_access = list()
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/computer/cargo/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "cargo", name, 780, 750, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/cargo/ui_data()
|
||||
var/list/data = list()
|
||||
data["requestonly"] = requestonly
|
||||
data["location"] = SSshuttle.supply.getStatusText()
|
||||
data["points"] = SSshuttle.points
|
||||
data["away"] = SSshuttle.supply.getDockedId() == "supply_away"
|
||||
data["docked"] = SSshuttle.supply.mode == SHUTTLE_IDLE
|
||||
data["loan"] = !!SSshuttle.shuttle_loan
|
||||
data["loan_dispatched"] = SSshuttle.shuttle_loan && SSshuttle.shuttle_loan.dispatched
|
||||
var/message = "Remember to stamp and send back the supply manifests."
|
||||
if(SSshuttle.centcom_message)
|
||||
message = SSshuttle.centcom_message
|
||||
if(SSshuttle.supplyBlocked)
|
||||
message = blockade_warning
|
||||
data["message"] = message
|
||||
data["supplies"] = list()
|
||||
for(var/pack in SSshuttle.supply_packs)
|
||||
var/datum/supply_pack/P = SSshuttle.supply_packs[pack]
|
||||
if(!data["supplies"][P.group])
|
||||
data["supplies"][P.group] = list(
|
||||
"name" = P.group,
|
||||
"packs" = list()
|
||||
)
|
||||
if((P.hidden && !(obj_flags & EMAGGED)) || (P.contraband && !contraband) || (P.special && !P.special_enabled) || P.DropPodOnly)
|
||||
continue
|
||||
data["supplies"][P.group]["packs"] += list(list(
|
||||
"name" = P.name,
|
||||
"cost" = P.cost,
|
||||
"id" = pack,
|
||||
"desc" = P.desc || P.name // If there is a description, use it. Otherwise use the pack's name.
|
||||
))
|
||||
|
||||
data["cart"] = list()
|
||||
for(var/datum/supply_order/SO in SSshuttle.shoppinglist)
|
||||
data["cart"] += list(list(
|
||||
"object" = SO.pack.name,
|
||||
"cost" = SO.pack.cost,
|
||||
"id" = SO.id
|
||||
))
|
||||
|
||||
data["requests"] = list()
|
||||
for(var/datum/supply_order/SO in SSshuttle.requestlist)
|
||||
data["requests"] += list(list(
|
||||
"object" = SO.pack.name,
|
||||
"cost" = SO.pack.cost,
|
||||
"orderer" = SO.orderer,
|
||||
"reason" = SO.reason,
|
||||
"id" = SO.id
|
||||
))
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/cargo/ui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
if(!allowed(usr))
|
||||
to_chat(usr, "<span class='notice'>Access denied.</span>")
|
||||
return
|
||||
switch(action)
|
||||
if("send")
|
||||
if(!SSshuttle.supply.canMove())
|
||||
say(safety_warning)
|
||||
return
|
||||
if(SSshuttle.supplyBlocked)
|
||||
say(blockade_warning)
|
||||
return
|
||||
if(SSshuttle.supply.getDockedId() == "supply_home")
|
||||
SSshuttle.supply.export_categories = get_export_categories()
|
||||
SSshuttle.moveShuttle("supply", "supply_away", TRUE)
|
||||
say("The supply shuttle is departing.")
|
||||
investigate_log("[key_name(usr)] sent the supply shuttle away.", INVESTIGATE_CARGO)
|
||||
else
|
||||
investigate_log("[key_name(usr)] called the supply shuttle.", INVESTIGATE_CARGO)
|
||||
say("The supply shuttle has been called and will arrive in [SSshuttle.supply.timeLeft(600)] minutes.")
|
||||
SSshuttle.moveShuttle("supply", "supply_home", TRUE)
|
||||
. = TRUE
|
||||
if("loan")
|
||||
if(!SSshuttle.shuttle_loan)
|
||||
return
|
||||
if(SSshuttle.supplyBlocked)
|
||||
say(blockade_warning)
|
||||
return
|
||||
else if(SSshuttle.supply.mode != SHUTTLE_IDLE)
|
||||
return
|
||||
else if(SSshuttle.supply.getDockedId() != "supply_away")
|
||||
return
|
||||
else
|
||||
SSshuttle.shuttle_loan.loan_shuttle()
|
||||
say("The supply shuttle has been loaned to CentCom.")
|
||||
. = TRUE
|
||||
if("add")
|
||||
var/id = text2path(params["id"])
|
||||
var/datum/supply_pack/pack = SSshuttle.supply_packs[id]
|
||||
if(!istype(pack))
|
||||
return
|
||||
if((pack.hidden && !(obj_flags & EMAGGED)) || (pack.contraband && !contraband) || pack.DropPodOnly)
|
||||
return
|
||||
|
||||
var/name = "*None Provided*"
|
||||
var/rank = "*None Provided*"
|
||||
var/ckey = usr.ckey
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/H = usr
|
||||
name = H.get_authentification_name()
|
||||
rank = H.get_assignment(hand_first = TRUE)
|
||||
else if(issilicon(usr))
|
||||
name = usr.real_name
|
||||
rank = "Silicon"
|
||||
|
||||
var/reason = ""
|
||||
if(requestonly)
|
||||
reason = stripped_input("Reason:", name, "")
|
||||
if(isnull(reason) || ..())
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
var/datum/supply_order/SO = new(pack, name, rank, ckey, reason)
|
||||
SO.generateRequisition(T)
|
||||
if(requestonly)
|
||||
SSshuttle.requestlist += SO
|
||||
else
|
||||
SSshuttle.shoppinglist += SO
|
||||
. = TRUE
|
||||
if("remove")
|
||||
var/id = text2num(params["id"])
|
||||
for(var/datum/supply_order/SO in SSshuttle.shoppinglist)
|
||||
if(SO.id == id)
|
||||
SSshuttle.shoppinglist -= SO
|
||||
. = TRUE
|
||||
break
|
||||
if("clear")
|
||||
SSshuttle.shoppinglist.Cut()
|
||||
. = TRUE
|
||||
if("approve")
|
||||
var/id = text2num(params["id"])
|
||||
for(var/datum/supply_order/SO in SSshuttle.requestlist)
|
||||
if(SO.id == id)
|
||||
SSshuttle.requestlist -= SO
|
||||
SSshuttle.shoppinglist += SO
|
||||
. = TRUE
|
||||
break
|
||||
if("deny")
|
||||
var/id = text2num(params["id"])
|
||||
for(var/datum/supply_order/SO in SSshuttle.requestlist)
|
||||
if(SO.id == id)
|
||||
SSshuttle.requestlist -= SO
|
||||
. = TRUE
|
||||
break
|
||||
if("denyall")
|
||||
SSshuttle.requestlist.Cut()
|
||||
. = TRUE
|
||||
if(.)
|
||||
post_signal("supply")
|
||||
|
||||
/obj/machinery/computer/cargo/proc/post_signal(command)
|
||||
|
||||
var/datum/radio_frequency/frequency = SSradio.return_frequency(FREQ_STATUS_DISPLAYS)
|
||||
|
||||
if(!frequency)
|
||||
return
|
||||
|
||||
var/datum/signal/status_signal = new(list("command" = command))
|
||||
frequency.post_signal(src, status_signal)
|
||||
/obj/machinery/computer/cargo
|
||||
name = "supply console"
|
||||
desc = "Used to order supplies, approve requests, and control the shuttle."
|
||||
icon_screen = "supply"
|
||||
circuit = /obj/item/circuitboard/computer/cargo
|
||||
req_access = list(ACCESS_CARGO)
|
||||
var/requestonly = FALSE
|
||||
var/contraband = FALSE
|
||||
var/safety_warning = "For safety reasons, the automated supply shuttle \
|
||||
cannot transport live organisms, human remains, classified nuclear weaponry \
|
||||
or homing beacons."
|
||||
var/blockade_warning = "Bluespace instability detected. Shuttle movement impossible."
|
||||
|
||||
light_color = "#E2853D"//orange
|
||||
|
||||
/obj/machinery/computer/cargo/request
|
||||
name = "supply request console"
|
||||
desc = "Used to request supplies from cargo."
|
||||
icon_screen = "request"
|
||||
circuit = /obj/item/circuitboard/computer/cargo/request
|
||||
req_access = list()
|
||||
requestonly = TRUE
|
||||
|
||||
/obj/machinery/computer/cargo/Initialize()
|
||||
. = ..()
|
||||
var/obj/item/circuitboard/computer/cargo/board = circuit
|
||||
contraband = board.contraband
|
||||
if (board.obj_flags & EMAGGED)
|
||||
obj_flags |= EMAGGED
|
||||
else
|
||||
obj_flags &= ~EMAGGED
|
||||
|
||||
/obj/machinery/computer/cargo/proc/get_export_categories()
|
||||
. = EXPORT_CARGO
|
||||
if(contraband)
|
||||
. |= EXPORT_CONTRABAND
|
||||
if(obj_flags & EMAGGED)
|
||||
. |= EXPORT_EMAG
|
||||
|
||||
/obj/machinery/computer/cargo/emag_act(mob/user)
|
||||
. = ..()
|
||||
if(obj_flags & EMAGGED)
|
||||
return
|
||||
user.visible_message("<span class='warning'>[user] swipes a suspicious card through [src]!</span>",
|
||||
"<span class='notice'>You adjust [src]'s routing and receiver spectrum, unlocking special supplies and contraband.</span>")
|
||||
|
||||
obj_flags |= EMAGGED
|
||||
contraband = TRUE
|
||||
|
||||
// This also permamently sets this on the circuit board
|
||||
var/obj/item/circuitboard/computer/cargo/board = circuit
|
||||
board.contraband = TRUE
|
||||
board.obj_flags |= EMAGGED
|
||||
req_access = list()
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/computer/cargo/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "cargo", name, 780, 750, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/cargo/ui_data()
|
||||
var/list/data = list()
|
||||
data["requestonly"] = requestonly
|
||||
data["location"] = SSshuttle.supply.getStatusText()
|
||||
data["points"] = SSshuttle.points
|
||||
data["away"] = SSshuttle.supply.getDockedId() == "supply_away"
|
||||
data["docked"] = SSshuttle.supply.mode == SHUTTLE_IDLE
|
||||
data["loan"] = !!SSshuttle.shuttle_loan
|
||||
data["loan_dispatched"] = SSshuttle.shuttle_loan && SSshuttle.shuttle_loan.dispatched
|
||||
var/message = "Remember to stamp and send back the supply manifests."
|
||||
if(SSshuttle.centcom_message)
|
||||
message = SSshuttle.centcom_message
|
||||
if(SSshuttle.supplyBlocked)
|
||||
message = blockade_warning
|
||||
data["message"] = message
|
||||
data["supplies"] = list()
|
||||
for(var/pack in SSshuttle.supply_packs)
|
||||
var/datum/supply_pack/P = SSshuttle.supply_packs[pack]
|
||||
if(!data["supplies"][P.group])
|
||||
data["supplies"][P.group] = list(
|
||||
"name" = P.group,
|
||||
"packs" = list()
|
||||
)
|
||||
if((P.hidden && !(obj_flags & EMAGGED)) || (P.contraband && !contraband) || (P.special && !P.special_enabled) || P.DropPodOnly)
|
||||
continue
|
||||
data["supplies"][P.group]["packs"] += list(list(
|
||||
"name" = P.name,
|
||||
"cost" = P.cost,
|
||||
"id" = pack,
|
||||
"desc" = P.desc || P.name // If there is a description, use it. Otherwise use the pack's name.
|
||||
))
|
||||
|
||||
data["cart"] = list()
|
||||
for(var/datum/supply_order/SO in SSshuttle.shoppinglist)
|
||||
data["cart"] += list(list(
|
||||
"object" = SO.pack.name,
|
||||
"cost" = SO.pack.cost,
|
||||
"id" = SO.id
|
||||
))
|
||||
|
||||
data["requests"] = list()
|
||||
for(var/datum/supply_order/SO in SSshuttle.requestlist)
|
||||
data["requests"] += list(list(
|
||||
"object" = SO.pack.name,
|
||||
"cost" = SO.pack.cost,
|
||||
"orderer" = SO.orderer,
|
||||
"reason" = SO.reason,
|
||||
"id" = SO.id
|
||||
))
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/cargo/ui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
if(!allowed(usr))
|
||||
to_chat(usr, "<span class='notice'>Access denied.</span>")
|
||||
return
|
||||
switch(action)
|
||||
if("send")
|
||||
if(!SSshuttle.supply.canMove())
|
||||
say(safety_warning)
|
||||
return
|
||||
if(SSshuttle.supplyBlocked)
|
||||
say(blockade_warning)
|
||||
return
|
||||
if(SSshuttle.supply.getDockedId() == "supply_home")
|
||||
SSshuttle.supply.export_categories = get_export_categories()
|
||||
SSshuttle.moveShuttle("supply", "supply_away", TRUE)
|
||||
say("The supply shuttle is departing.")
|
||||
investigate_log("[key_name(usr)] sent the supply shuttle away.", INVESTIGATE_CARGO)
|
||||
else
|
||||
investigate_log("[key_name(usr)] called the supply shuttle.", INVESTIGATE_CARGO)
|
||||
say("The supply shuttle has been called and will arrive in [SSshuttle.supply.timeLeft(600)] minutes.")
|
||||
SSshuttle.moveShuttle("supply", "supply_home", TRUE)
|
||||
. = TRUE
|
||||
if("loan")
|
||||
if(!SSshuttle.shuttle_loan)
|
||||
return
|
||||
if(SSshuttle.supplyBlocked)
|
||||
say(blockade_warning)
|
||||
return
|
||||
else if(SSshuttle.supply.mode != SHUTTLE_IDLE)
|
||||
return
|
||||
else if(SSshuttle.supply.getDockedId() != "supply_away")
|
||||
return
|
||||
else
|
||||
SSshuttle.shuttle_loan.loan_shuttle()
|
||||
say("The supply shuttle has been loaned to CentCom.")
|
||||
. = TRUE
|
||||
if("add")
|
||||
var/id = text2path(params["id"])
|
||||
var/datum/supply_pack/pack = SSshuttle.supply_packs[id]
|
||||
if(!istype(pack))
|
||||
return
|
||||
if((pack.hidden && !(obj_flags & EMAGGED)) || (pack.contraband && !contraband) || pack.DropPodOnly)
|
||||
return
|
||||
|
||||
var/name = "*None Provided*"
|
||||
var/rank = "*None Provided*"
|
||||
var/ckey = usr.ckey
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/H = usr
|
||||
name = H.get_authentification_name()
|
||||
rank = H.get_assignment(hand_first = TRUE)
|
||||
else if(issilicon(usr))
|
||||
name = usr.real_name
|
||||
rank = "Silicon"
|
||||
|
||||
var/reason = ""
|
||||
if(requestonly)
|
||||
reason = stripped_input("Reason:", name, "")
|
||||
if(isnull(reason) || ..())
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
var/datum/supply_order/SO = new(pack, name, rank, ckey, reason)
|
||||
SO.generateRequisition(T)
|
||||
if(requestonly)
|
||||
SSshuttle.requestlist += SO
|
||||
else
|
||||
SSshuttle.shoppinglist += SO
|
||||
. = TRUE
|
||||
if("remove")
|
||||
var/id = text2num(params["id"])
|
||||
for(var/datum/supply_order/SO in SSshuttle.shoppinglist)
|
||||
if(SO.id == id)
|
||||
SSshuttle.shoppinglist -= SO
|
||||
. = TRUE
|
||||
break
|
||||
if("clear")
|
||||
SSshuttle.shoppinglist.Cut()
|
||||
. = TRUE
|
||||
if("approve")
|
||||
var/id = text2num(params["id"])
|
||||
for(var/datum/supply_order/SO in SSshuttle.requestlist)
|
||||
if(SO.id == id)
|
||||
SSshuttle.requestlist -= SO
|
||||
SSshuttle.shoppinglist += SO
|
||||
. = TRUE
|
||||
break
|
||||
if("deny")
|
||||
var/id = text2num(params["id"])
|
||||
for(var/datum/supply_order/SO in SSshuttle.requestlist)
|
||||
if(SO.id == id)
|
||||
SSshuttle.requestlist -= SO
|
||||
. = TRUE
|
||||
break
|
||||
if("denyall")
|
||||
SSshuttle.requestlist.Cut()
|
||||
. = TRUE
|
||||
if(.)
|
||||
post_signal("supply")
|
||||
|
||||
/obj/machinery/computer/cargo/proc/post_signal(command)
|
||||
|
||||
var/datum/radio_frequency/frequency = SSradio.return_frequency(FREQ_STATUS_DISPLAYS)
|
||||
|
||||
if(!frequency)
|
||||
return
|
||||
|
||||
var/datum/signal/status_signal = new(list("command" = command))
|
||||
frequency.post_signal(src, status_signal)
|
||||
|
||||
@@ -1,206 +1,206 @@
|
||||
#define MAX_EMAG_ROCKETS 8
|
||||
#define BEACON_COST 5000
|
||||
#define SP_LINKED 1
|
||||
#define SP_READY 2
|
||||
#define SP_LAUNCH 3
|
||||
#define SP_UNLINK 4
|
||||
#define SP_UNREADY 5
|
||||
|
||||
/obj/machinery/computer/cargo/express
|
||||
name = "express supply console"
|
||||
desc = "This console allows the user to purchase a package \
|
||||
with 1/40th of the delivery time: made possible by NanoTrasen's new \"1500mm Orbital Railgun\".\
|
||||
All sales are near instantaneous - please choose carefully"
|
||||
icon_screen = "supply_express"
|
||||
circuit = /obj/item/circuitboard/computer/cargo/express
|
||||
blockade_warning = "Bluespace instability detected. Delivery impossible."
|
||||
req_access = list(ACCESS_QM)
|
||||
var/message
|
||||
var/printed_beacons = 0 //number of beacons printed. Used to determine beacon names.
|
||||
var/list/meme_pack_data
|
||||
var/obj/item/supplypod_beacon/beacon //the linked supplypod beacon
|
||||
var/area/landingzone = /area/quartermaster/storage //where we droppin boys
|
||||
var/podType = /obj/structure/closet/supplypod
|
||||
var/cooldown = 0 //cooldown to prevent printing supplypod beacon spam
|
||||
var/locked = TRUE //is the console locked? unlock with ID
|
||||
var/usingBeacon = FALSE //is the console in beacon mode? exists to let beacon know when a pod may come in
|
||||
|
||||
/obj/machinery/computer/cargo/express/Initialize()
|
||||
. = ..()
|
||||
packin_up()
|
||||
|
||||
/obj/machinery/computer/cargo/express/Destroy()
|
||||
if(beacon)
|
||||
beacon.unlink_console()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/computer/cargo/express/attackby(obj/item/W, mob/living/user, params)
|
||||
if((istype(W, /obj/item/card/id) || istype(W, /obj/item/pda)) && allowed(user))
|
||||
locked = !locked
|
||||
to_chat(user, "<span class='notice'>You [locked ? "lock" : "unlock"] the interface.</span>")
|
||||
return
|
||||
else if(istype(W, /obj/item/disk/cargo/bluespace_pod))
|
||||
podType = /obj/structure/closet/supplypod/bluespacepod
|
||||
to_chat(user, "<span class='notice'>You insert the disk into [src], allowing for advanced supply delivery vehicles.</span>")
|
||||
qdel(W)
|
||||
return TRUE
|
||||
else if(istype(W, /obj/item/supplypod_beacon))
|
||||
var/obj/item/supplypod_beacon/sb = W
|
||||
if (sb.express_console != src)
|
||||
sb.link_console(src, user)
|
||||
return TRUE
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] is already linked to [sb].</span>")
|
||||
..()
|
||||
|
||||
/obj/machinery/computer/cargo/express/emag_act(mob/living/user)
|
||||
. = SEND_SIGNAL(src, COMSIG_ATOM_EMAG_ACT)
|
||||
if(obj_flags & EMAGGED)
|
||||
return
|
||||
user.visible_message("<span class='warning'>[user] swipes a suspicious card through [src]!</span>",
|
||||
"<span class='notice'>You change the routing protocols, allowing the Supply Pod to land anywhere on the station.</span>")
|
||||
obj_flags |= EMAGGED
|
||||
// This also sets this on the circuit board
|
||||
var/obj/item/circuitboard/computer/cargo/board = circuit
|
||||
board.obj_flags |= EMAGGED
|
||||
packin_up()
|
||||
req_access = list()
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/computer/cargo/express/proc/packin_up() // oh shit, I'm sorry
|
||||
meme_pack_data = list() // sorry for what?
|
||||
for(var/pack in SSshuttle.supply_packs) // our quartermaster taught us not to be ashamed of our supply packs
|
||||
var/datum/supply_pack/P = SSshuttle.supply_packs[pack] // specially since they're such a good price and all
|
||||
if(!meme_pack_data[P.group]) // yeah, I see that, your quartermaster gave you good advice
|
||||
meme_pack_data[P.group] = list( // it gets cheaper when I return it
|
||||
"name" = P.group, // mmhm
|
||||
"packs" = list() // sometimes, I return it so much, I rip the manifest
|
||||
) // see, my quartermaster taught me a few things too
|
||||
if((P.hidden) || (P.special)) // like, how not to rip the manifest
|
||||
continue// by using someone else's crate
|
||||
if(!(obj_flags & EMAGGED) && P.contraband) // will you show me?
|
||||
continue // i'd be right happy to
|
||||
meme_pack_data[P.group]["packs"] += list(list(
|
||||
"name" = P.name,
|
||||
"cost" = P.cost,
|
||||
"id" = pack,
|
||||
"desc" = P.desc || P.name // If there is a description, use it. Otherwise use the pack's name.
|
||||
))
|
||||
|
||||
/obj/machinery/computer/cargo/express/ui_interact(mob/living/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) // Remember to use the appropriate state.
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "cargo_express", name, 600, 700, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/cargo/express/ui_data(mob/user)
|
||||
var/canBeacon = beacon && (isturf(beacon.loc) || ismob(beacon.loc))//is the beacon in a valid location?
|
||||
var/list/data = list()
|
||||
data["locked"] = locked//swipe an ID to unlock
|
||||
data["siliconUser"] = user.has_unlimited_silicon_privilege
|
||||
data["beaconzone"] = beacon ? get_area(beacon) : ""//where is the beacon located? outputs in the tgui
|
||||
data["usingBeacon"] = usingBeacon //is the mode set to deliver to the beacon or the cargobay?
|
||||
data["canBeacon"] = !usingBeacon || canBeacon //is the mode set to beacon delivery, and is the beacon in a valid location?
|
||||
data["canBuyBeacon"] = cooldown <= 0 && SSshuttle.points >= BEACON_COST
|
||||
data["beaconError"] = usingBeacon && !canBeacon ? "(BEACON ERROR)" : ""//changes button text to include an error alert if necessary
|
||||
data["hasBeacon"] = beacon != null//is there a linked beacon?
|
||||
data["beaconName"] = beacon ? beacon.name : "No Beacon Found"
|
||||
data["printMsg"] = cooldown > 0 ? "Print Beacon for [BEACON_COST] credits ([cooldown])" : "Print Beacon for [BEACON_COST] credits"//buttontext for printing beacons
|
||||
data["points"] = SSshuttle.points
|
||||
data["supplies"] = list()
|
||||
message = "Sales are near-instantaneous - please choose carefully."
|
||||
if(SSshuttle.supplyBlocked)
|
||||
message = blockade_warning
|
||||
if(usingBeacon && !beacon)
|
||||
message = "BEACON ERROR: BEACON MISSING"//beacon was destroyed
|
||||
else if (usingBeacon && !canBeacon)
|
||||
message = "BEACON ERROR: MUST BE EXPOSED"//beacon's loc/user's loc must be a turf
|
||||
if(obj_flags & EMAGGED)
|
||||
message = "(&!#@ERROR: ROUTING_#PROTOCOL MALF(*CT#ON. $UG%ESTE@ ACT#0N: !^/PULS3-%E)ET CIR*)ITB%ARD."
|
||||
data["message"] = message
|
||||
if(!meme_pack_data)
|
||||
packin_up()
|
||||
stack_trace("You didn't give the cargo tech good advice, and he ripped the manifest. As a result, there was no pack data for [src]")
|
||||
data["supplies"] = meme_pack_data
|
||||
if (cooldown > 0)//cooldown used for printing beacons
|
||||
cooldown--
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/cargo/express/ui_act(action, params, datum/tgui/ui)
|
||||
switch(action)
|
||||
if("LZCargo")
|
||||
usingBeacon = FALSE
|
||||
if (beacon)
|
||||
beacon.update_status(SP_UNREADY) //ready light on beacon will turn off
|
||||
if("LZBeacon")
|
||||
usingBeacon = TRUE
|
||||
if (beacon)
|
||||
beacon.update_status(SP_READY) //turns on the beacon's ready light
|
||||
if("printBeacon")
|
||||
if (SSshuttle.points >= BEACON_COST)
|
||||
cooldown = 10//a ~ten second cooldown for printing beacons to prevent spam
|
||||
var/obj/item/supplypod_beacon/C = new /obj/item/supplypod_beacon(drop_location())
|
||||
C.link_console(src, usr)//rather than in beacon's Initialize(), we can assign the computer to the beacon by reusing this proc)
|
||||
printed_beacons++//printed_beacons starts at 0, so the first one out will be called beacon # 1
|
||||
beacon.name = "Supply Pod Beacon #[printed_beacons]"
|
||||
SSshuttle.points -= BEACON_COST
|
||||
|
||||
if("add")//Generate Supply Order first
|
||||
var/id = text2path(params["id"])
|
||||
var/datum/supply_pack/pack = SSshuttle.supply_packs[id]
|
||||
if(!istype(pack))
|
||||
return
|
||||
var/name = "*None Provided*"
|
||||
var/rank = "*None Provided*"
|
||||
var/ckey = usr.ckey
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/H = usr
|
||||
name = H.get_authentification_name()
|
||||
rank = H.get_assignment(hand_first = TRUE)
|
||||
else if(issilicon(usr))
|
||||
name = usr.real_name
|
||||
rank = "Silicon"
|
||||
var/reason = ""
|
||||
var/list/empty_turfs
|
||||
var/datum/supply_order/SO = new(pack, name, rank, ckey, reason)
|
||||
if(!(obj_flags & EMAGGED))
|
||||
if(SO.pack.cost <= SSshuttle.points)
|
||||
var/LZ
|
||||
if (istype(beacon) && usingBeacon)//prioritize beacons over landing in cargobay
|
||||
LZ = get_turf(beacon)
|
||||
beacon.update_status(SP_LAUNCH)
|
||||
else if (!usingBeacon)//find a suitable supplypod landing zone in cargobay
|
||||
landingzone = GLOB.areas_by_type[/area/quartermaster/storage]
|
||||
if (!landingzone)
|
||||
WARNING("[src] couldnt find a Quartermaster/Storage (aka cargobay) area on the station, and as such it has set the supplypod landingzone to the area it resides in.")
|
||||
landingzone = get_area(src)
|
||||
for(var/turf/open/floor/T in landingzone.contents)//uses default landing zone
|
||||
if(is_blocked_turf(T))
|
||||
continue
|
||||
LAZYADD(empty_turfs, T)
|
||||
CHECK_TICK
|
||||
if(empty_turfs && empty_turfs.len)
|
||||
LZ = pick(empty_turfs)
|
||||
if (SO.pack.cost <= SSshuttle.points && LZ)//we need to call the cost check again because of the CHECK_TICK call
|
||||
SSshuttle.points -= SO.pack.cost
|
||||
new /obj/effect/abstract/DPtarget(LZ, podType, SO)
|
||||
. = TRUE
|
||||
update_icon()
|
||||
else
|
||||
if(SO.pack.cost * (0.72*MAX_EMAG_ROCKETS) <= SSshuttle.points) // bulk discount :^)
|
||||
landingzone = GLOB.areas_by_type[pick(GLOB.the_station_areas)] //override default landing zone
|
||||
for(var/turf/open/floor/T in landingzone.contents)
|
||||
if(is_blocked_turf(T))
|
||||
continue
|
||||
LAZYADD(empty_turfs, T)
|
||||
CHECK_TICK
|
||||
if(empty_turfs && empty_turfs.len)
|
||||
SSshuttle.points -= SO.pack.cost * (0.72*MAX_EMAG_ROCKETS)
|
||||
SO.generateRequisition(get_turf(src))
|
||||
for(var/i in 1 to MAX_EMAG_ROCKETS)
|
||||
var/LZ = pick(empty_turfs)
|
||||
LAZYREMOVE(empty_turfs, LZ)
|
||||
new /obj/effect/abstract/DPtarget(LZ, podType, SO)
|
||||
. = TRUE
|
||||
update_icon()
|
||||
CHECK_TICK
|
||||
#define MAX_EMAG_ROCKETS 8
|
||||
#define BEACON_COST 5000
|
||||
#define SP_LINKED 1
|
||||
#define SP_READY 2
|
||||
#define SP_LAUNCH 3
|
||||
#define SP_UNLINK 4
|
||||
#define SP_UNREADY 5
|
||||
|
||||
/obj/machinery/computer/cargo/express
|
||||
name = "express supply console"
|
||||
desc = "This console allows the user to purchase a package \
|
||||
with 1/40th of the delivery time: made possible by NanoTrasen's new \"1500mm Orbital Railgun\".\
|
||||
All sales are near instantaneous - please choose carefully"
|
||||
icon_screen = "supply_express"
|
||||
circuit = /obj/item/circuitboard/computer/cargo/express
|
||||
blockade_warning = "Bluespace instability detected. Delivery impossible."
|
||||
req_access = list(ACCESS_QM)
|
||||
var/message
|
||||
var/printed_beacons = 0 //number of beacons printed. Used to determine beacon names.
|
||||
var/list/meme_pack_data
|
||||
var/obj/item/supplypod_beacon/beacon //the linked supplypod beacon
|
||||
var/area/landingzone = /area/quartermaster/storage //where we droppin boys
|
||||
var/podType = /obj/structure/closet/supplypod
|
||||
var/cooldown = 0 //cooldown to prevent printing supplypod beacon spam
|
||||
var/locked = TRUE //is the console locked? unlock with ID
|
||||
var/usingBeacon = FALSE //is the console in beacon mode? exists to let beacon know when a pod may come in
|
||||
|
||||
/obj/machinery/computer/cargo/express/Initialize()
|
||||
. = ..()
|
||||
packin_up()
|
||||
|
||||
/obj/machinery/computer/cargo/express/Destroy()
|
||||
if(beacon)
|
||||
beacon.unlink_console()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/computer/cargo/express/attackby(obj/item/W, mob/living/user, params)
|
||||
if((istype(W, /obj/item/card/id) || istype(W, /obj/item/pda)) && allowed(user))
|
||||
locked = !locked
|
||||
to_chat(user, "<span class='notice'>You [locked ? "lock" : "unlock"] the interface.</span>")
|
||||
return
|
||||
else if(istype(W, /obj/item/disk/cargo/bluespace_pod))
|
||||
podType = /obj/structure/closet/supplypod/bluespacepod
|
||||
to_chat(user, "<span class='notice'>You insert the disk into [src], allowing for advanced supply delivery vehicles.</span>")
|
||||
qdel(W)
|
||||
return TRUE
|
||||
else if(istype(W, /obj/item/supplypod_beacon))
|
||||
var/obj/item/supplypod_beacon/sb = W
|
||||
if (sb.express_console != src)
|
||||
sb.link_console(src, user)
|
||||
return TRUE
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] is already linked to [sb].</span>")
|
||||
..()
|
||||
|
||||
/obj/machinery/computer/cargo/express/emag_act(mob/living/user)
|
||||
. = SEND_SIGNAL(src, COMSIG_ATOM_EMAG_ACT)
|
||||
if(obj_flags & EMAGGED)
|
||||
return
|
||||
user.visible_message("<span class='warning'>[user] swipes a suspicious card through [src]!</span>",
|
||||
"<span class='notice'>You change the routing protocols, allowing the Supply Pod to land anywhere on the station.</span>")
|
||||
obj_flags |= EMAGGED
|
||||
// This also sets this on the circuit board
|
||||
var/obj/item/circuitboard/computer/cargo/board = circuit
|
||||
board.obj_flags |= EMAGGED
|
||||
packin_up()
|
||||
req_access = list()
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/computer/cargo/express/proc/packin_up() // oh shit, I'm sorry
|
||||
meme_pack_data = list() // sorry for what?
|
||||
for(var/pack in SSshuttle.supply_packs) // our quartermaster taught us not to be ashamed of our supply packs
|
||||
var/datum/supply_pack/P = SSshuttle.supply_packs[pack] // specially since they're such a good price and all
|
||||
if(!meme_pack_data[P.group]) // yeah, I see that, your quartermaster gave you good advice
|
||||
meme_pack_data[P.group] = list( // it gets cheaper when I return it
|
||||
"name" = P.group, // mmhm
|
||||
"packs" = list() // sometimes, I return it so much, I rip the manifest
|
||||
) // see, my quartermaster taught me a few things too
|
||||
if((P.hidden) || (P.special)) // like, how not to rip the manifest
|
||||
continue// by using someone else's crate
|
||||
if(!(obj_flags & EMAGGED) && P.contraband) // will you show me?
|
||||
continue // i'd be right happy to
|
||||
meme_pack_data[P.group]["packs"] += list(list(
|
||||
"name" = P.name,
|
||||
"cost" = P.cost,
|
||||
"id" = pack,
|
||||
"desc" = P.desc || P.name // If there is a description, use it. Otherwise use the pack's name.
|
||||
))
|
||||
|
||||
/obj/machinery/computer/cargo/express/ui_interact(mob/living/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) // Remember to use the appropriate state.
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "cargo_express", name, 600, 700, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/cargo/express/ui_data(mob/user)
|
||||
var/canBeacon = beacon && (isturf(beacon.loc) || ismob(beacon.loc))//is the beacon in a valid location?
|
||||
var/list/data = list()
|
||||
data["locked"] = locked//swipe an ID to unlock
|
||||
data["siliconUser"] = user.has_unlimited_silicon_privilege
|
||||
data["beaconzone"] = beacon ? get_area(beacon) : ""//where is the beacon located? outputs in the tgui
|
||||
data["usingBeacon"] = usingBeacon //is the mode set to deliver to the beacon or the cargobay?
|
||||
data["canBeacon"] = !usingBeacon || canBeacon //is the mode set to beacon delivery, and is the beacon in a valid location?
|
||||
data["canBuyBeacon"] = cooldown <= 0 && SSshuttle.points >= BEACON_COST
|
||||
data["beaconError"] = usingBeacon && !canBeacon ? "(BEACON ERROR)" : ""//changes button text to include an error alert if necessary
|
||||
data["hasBeacon"] = beacon != null//is there a linked beacon?
|
||||
data["beaconName"] = beacon ? beacon.name : "No Beacon Found"
|
||||
data["printMsg"] = cooldown > 0 ? "Print Beacon for [BEACON_COST] credits ([cooldown])" : "Print Beacon for [BEACON_COST] credits"//buttontext for printing beacons
|
||||
data["points"] = SSshuttle.points
|
||||
data["supplies"] = list()
|
||||
message = "Sales are near-instantaneous - please choose carefully."
|
||||
if(SSshuttle.supplyBlocked)
|
||||
message = blockade_warning
|
||||
if(usingBeacon && !beacon)
|
||||
message = "BEACON ERROR: BEACON MISSING"//beacon was destroyed
|
||||
else if (usingBeacon && !canBeacon)
|
||||
message = "BEACON ERROR: MUST BE EXPOSED"//beacon's loc/user's loc must be a turf
|
||||
if(obj_flags & EMAGGED)
|
||||
message = "(&!#@ERROR: ROUTING_#PROTOCOL MALF(*CT#ON. $UG%ESTE@ ACT#0N: !^/PULS3-%E)ET CIR*)ITB%ARD."
|
||||
data["message"] = message
|
||||
if(!meme_pack_data)
|
||||
packin_up()
|
||||
stack_trace("You didn't give the cargo tech good advice, and he ripped the manifest. As a result, there was no pack data for [src]")
|
||||
data["supplies"] = meme_pack_data
|
||||
if (cooldown > 0)//cooldown used for printing beacons
|
||||
cooldown--
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/cargo/express/ui_act(action, params, datum/tgui/ui)
|
||||
switch(action)
|
||||
if("LZCargo")
|
||||
usingBeacon = FALSE
|
||||
if (beacon)
|
||||
beacon.update_status(SP_UNREADY) //ready light on beacon will turn off
|
||||
if("LZBeacon")
|
||||
usingBeacon = TRUE
|
||||
if (beacon)
|
||||
beacon.update_status(SP_READY) //turns on the beacon's ready light
|
||||
if("printBeacon")
|
||||
if (SSshuttle.points >= BEACON_COST)
|
||||
cooldown = 10//a ~ten second cooldown for printing beacons to prevent spam
|
||||
var/obj/item/supplypod_beacon/C = new /obj/item/supplypod_beacon(drop_location())
|
||||
C.link_console(src, usr)//rather than in beacon's Initialize(), we can assign the computer to the beacon by reusing this proc)
|
||||
printed_beacons++//printed_beacons starts at 0, so the first one out will be called beacon # 1
|
||||
beacon.name = "Supply Pod Beacon #[printed_beacons]"
|
||||
SSshuttle.points -= BEACON_COST
|
||||
|
||||
if("add")//Generate Supply Order first
|
||||
var/id = text2path(params["id"])
|
||||
var/datum/supply_pack/pack = SSshuttle.supply_packs[id]
|
||||
if(!istype(pack))
|
||||
return
|
||||
var/name = "*None Provided*"
|
||||
var/rank = "*None Provided*"
|
||||
var/ckey = usr.ckey
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/H = usr
|
||||
name = H.get_authentification_name()
|
||||
rank = H.get_assignment(hand_first = TRUE)
|
||||
else if(issilicon(usr))
|
||||
name = usr.real_name
|
||||
rank = "Silicon"
|
||||
var/reason = ""
|
||||
var/list/empty_turfs
|
||||
var/datum/supply_order/SO = new(pack, name, rank, ckey, reason)
|
||||
if(!(obj_flags & EMAGGED))
|
||||
if(SO.pack.cost <= SSshuttle.points)
|
||||
var/LZ
|
||||
if (istype(beacon) && usingBeacon)//prioritize beacons over landing in cargobay
|
||||
LZ = get_turf(beacon)
|
||||
beacon.update_status(SP_LAUNCH)
|
||||
else if (!usingBeacon)//find a suitable supplypod landing zone in cargobay
|
||||
landingzone = GLOB.areas_by_type[/area/quartermaster/storage]
|
||||
if (!landingzone)
|
||||
WARNING("[src] couldnt find a Quartermaster/Storage (aka cargobay) area on the station, and as such it has set the supplypod landingzone to the area it resides in.")
|
||||
landingzone = get_area(src)
|
||||
for(var/turf/open/floor/T in landingzone.contents)//uses default landing zone
|
||||
if(is_blocked_turf(T))
|
||||
continue
|
||||
LAZYADD(empty_turfs, T)
|
||||
CHECK_TICK
|
||||
if(empty_turfs && empty_turfs.len)
|
||||
LZ = pick(empty_turfs)
|
||||
if (SO.pack.cost <= SSshuttle.points && LZ)//we need to call the cost check again because of the CHECK_TICK call
|
||||
SSshuttle.points -= SO.pack.cost
|
||||
new /obj/effect/abstract/DPtarget(LZ, podType, SO)
|
||||
. = TRUE
|
||||
update_icon()
|
||||
else
|
||||
if(SO.pack.cost * (0.72*MAX_EMAG_ROCKETS) <= SSshuttle.points) // bulk discount :^)
|
||||
landingzone = GLOB.areas_by_type[pick(GLOB.the_station_areas)] //override default landing zone
|
||||
for(var/turf/open/floor/T in landingzone.contents)
|
||||
if(is_blocked_turf(T))
|
||||
continue
|
||||
LAZYADD(empty_turfs, T)
|
||||
CHECK_TICK
|
||||
if(empty_turfs && empty_turfs.len)
|
||||
SSshuttle.points -= SO.pack.cost * (0.72*MAX_EMAG_ROCKETS)
|
||||
SO.generateRequisition(get_turf(src))
|
||||
for(var/i in 1 to MAX_EMAG_ROCKETS)
|
||||
var/LZ = pick(empty_turfs)
|
||||
LAZYREMOVE(empty_turfs, LZ)
|
||||
new /obj/effect/abstract/DPtarget(LZ, podType, SO)
|
||||
. = TRUE
|
||||
update_icon()
|
||||
CHECK_TICK
|
||||
|
||||
+704
-704
File diff suppressed because it is too large
Load Diff
@@ -1,162 +1,162 @@
|
||||
GLOBAL_LIST(labor_sheet_values)
|
||||
|
||||
/**********************Prisoners' Console**************************/
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console
|
||||
name = "point claim console"
|
||||
desc = "A stacking console with an electromagnetic writer, used to track ore mined by prisoners."
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "console"
|
||||
density = FALSE
|
||||
var/obj/machinery/mineral/stacking_machine/laborstacker/stacking_machine = null
|
||||
var/machinedir = SOUTH
|
||||
var/obj/machinery/door/airlock/release_door
|
||||
var/door_tag = "prisonshuttle"
|
||||
var/obj/item/radio/Radio //needed to send messages to sec radio
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/Initialize()
|
||||
. = ..()
|
||||
Radio = new/obj/item/radio(src)
|
||||
Radio.listening = FALSE
|
||||
locate_stacking_machine()
|
||||
|
||||
if(!GLOB.labor_sheet_values)
|
||||
var/sheet_list = list()
|
||||
for(var/sheet_type in subtypesof(/obj/item/stack/sheet))
|
||||
var/obj/item/stack/sheet/sheet = sheet_type
|
||||
if(!initial(sheet.point_value) || (initial(sheet.merge_type) && initial(sheet.merge_type) != sheet_type)) //ignore no-value sheets and x/fifty subtypes
|
||||
continue
|
||||
sheet_list += list(list("ore" = initial(sheet.name), "value" = initial(sheet.point_value)))
|
||||
GLOB.labor_sheet_values = sortList(sheet_list, /proc/cmp_sheet_list)
|
||||
|
||||
/proc/cmp_sheet_list(list/a, list/b)
|
||||
return a["value"] - b["value"]
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "labor_claim_console", name, 315, 430, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/can_go_home = FALSE
|
||||
|
||||
data["emagged"] = (obj_flags & EMAGGED) ? 1 : 0
|
||||
if(obj_flags & EMAGGED)
|
||||
can_go_home = TRUE
|
||||
|
||||
var/obj/item/card/id/I = user.get_idcard(TRUE)
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/P = I
|
||||
data["id_points"] = P.points
|
||||
if(P.points >= P.goal)
|
||||
can_go_home = TRUE
|
||||
data["status_info"] = "Goal met!"
|
||||
else
|
||||
data["status_info"] = "You are [(P.goal - P.points)] points away."
|
||||
else
|
||||
data["status_info"] = "No Prisoner ID detected."
|
||||
data["id_points"] = 0
|
||||
|
||||
if(stacking_machine)
|
||||
data["unclaimed_points"] = stacking_machine.points
|
||||
|
||||
data["ores"] = GLOB.labor_sheet_values
|
||||
data["can_go_home"] = can_go_home
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("claim_points")
|
||||
var/mob/M = usr
|
||||
var/obj/item/card/id/I = M.get_idcard(TRUE)
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/P = I
|
||||
P.points += stacking_machine.points
|
||||
stacking_machine.points = 0
|
||||
to_chat(usr, "<span class='notice'>Points transferred.</span>")
|
||||
. = TRUE
|
||||
else
|
||||
to_chat(usr, "<span class='alert'>No valid id for point transfer detected.</span>")
|
||||
if("move_shuttle")
|
||||
if(!alone_in_area(get_area(src), usr))
|
||||
to_chat(usr, "<span class='alert'>Prisoners are only allowed to be released while alone.</span>")
|
||||
else
|
||||
switch(SSshuttle.moveShuttle("laborcamp", "laborcamp_home", TRUE))
|
||||
if(1)
|
||||
to_chat(usr, "<span class='alert'>Shuttle not found.</span>")
|
||||
if(2)
|
||||
to_chat(usr, "<span class='alert'>Shuttle already at station.</span>")
|
||||
if(3)
|
||||
to_chat(usr, "<span class='alert'>No permission to dock could be granted.</span>")
|
||||
else
|
||||
if(!(obj_flags & EMAGGED))
|
||||
Radio.set_frequency(FREQ_SECURITY)
|
||||
Radio.talk_into(src, "A prisoner has returned to the station. Minerals and Prisoner ID card ready for retrieval.", FREQ_SECURITY)
|
||||
to_chat(usr, "<span class='notice'>Shuttle received message and will be sent shortly.</span>")
|
||||
. = TRUE
|
||||
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/proc/locate_stacking_machine()
|
||||
stacking_machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir))
|
||||
if(stacking_machine)
|
||||
stacking_machine.CONSOLE = src
|
||||
else
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/emag_act(mob/user)
|
||||
. = ..()
|
||||
if(obj_flags & EMAGGED)
|
||||
return
|
||||
obj_flags |= EMAGGED
|
||||
to_chat(user, "<span class='warning'>PZZTTPFFFT</span>")
|
||||
return TRUE
|
||||
|
||||
/**********************Prisoner Collection Unit**************************/
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/laborstacker
|
||||
force_connect = TRUE
|
||||
var/points = 0 //The unclaimed value of ore stacked.
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/laborstacker/process_sheet(obj/item/stack/sheet/inp)
|
||||
points += inp.point_value * inp.amount
|
||||
..()
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/laborstacker/attackby(obj/item/I, mob/living/user)
|
||||
if(istype(I, /obj/item/stack/sheet) && user.canUnEquip(I))
|
||||
var/obj/item/stack/sheet/inp = I
|
||||
points += inp.point_value * inp.amount
|
||||
return ..()
|
||||
|
||||
/**********************Point Lookup Console**************************/
|
||||
|
||||
/obj/machinery/mineral/labor_points_checker
|
||||
name = "points checking console"
|
||||
desc = "A console used by prisoners to check the progress on their quotas. Simply swipe a prisoner ID."
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "console"
|
||||
density = FALSE
|
||||
|
||||
/obj/machinery/mineral/labor_points_checker/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
user.examinate(src)
|
||||
|
||||
/obj/machinery/mineral/labor_points_checker/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/card/id))
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/prisoner_id = I
|
||||
to_chat(user, "<span class='notice'><B>ID: [prisoner_id.registered_name]</B></span>")
|
||||
to_chat(user, "<span class='notice'>Points Collected:[prisoner_id.points]</span>")
|
||||
to_chat(user, "<span class='notice'>Point Quota: [prisoner_id.goal]</span>")
|
||||
to_chat(user, "<span class='notice'>Collect points by bringing smelted minerals to the Labor Shuttle stacking machine. Reach your quota to earn your release.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Error: Invalid ID</span>")
|
||||
else
|
||||
return ..()
|
||||
GLOBAL_LIST(labor_sheet_values)
|
||||
|
||||
/**********************Prisoners' Console**************************/
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console
|
||||
name = "point claim console"
|
||||
desc = "A stacking console with an electromagnetic writer, used to track ore mined by prisoners."
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "console"
|
||||
density = FALSE
|
||||
var/obj/machinery/mineral/stacking_machine/laborstacker/stacking_machine = null
|
||||
var/machinedir = SOUTH
|
||||
var/obj/machinery/door/airlock/release_door
|
||||
var/door_tag = "prisonshuttle"
|
||||
var/obj/item/radio/Radio //needed to send messages to sec radio
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/Initialize()
|
||||
. = ..()
|
||||
Radio = new/obj/item/radio(src)
|
||||
Radio.listening = FALSE
|
||||
locate_stacking_machine()
|
||||
|
||||
if(!GLOB.labor_sheet_values)
|
||||
var/sheet_list = list()
|
||||
for(var/sheet_type in subtypesof(/obj/item/stack/sheet))
|
||||
var/obj/item/stack/sheet/sheet = sheet_type
|
||||
if(!initial(sheet.point_value) || (initial(sheet.merge_type) && initial(sheet.merge_type) != sheet_type)) //ignore no-value sheets and x/fifty subtypes
|
||||
continue
|
||||
sheet_list += list(list("ore" = initial(sheet.name), "value" = initial(sheet.point_value)))
|
||||
GLOB.labor_sheet_values = sortList(sheet_list, /proc/cmp_sheet_list)
|
||||
|
||||
/proc/cmp_sheet_list(list/a, list/b)
|
||||
return a["value"] - b["value"]
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "labor_claim_console", name, 315, 430, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/can_go_home = FALSE
|
||||
|
||||
data["emagged"] = (obj_flags & EMAGGED) ? 1 : 0
|
||||
if(obj_flags & EMAGGED)
|
||||
can_go_home = TRUE
|
||||
|
||||
var/obj/item/card/id/I = user.get_idcard(TRUE)
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/P = I
|
||||
data["id_points"] = P.points
|
||||
if(P.points >= P.goal)
|
||||
can_go_home = TRUE
|
||||
data["status_info"] = "Goal met!"
|
||||
else
|
||||
data["status_info"] = "You are [(P.goal - P.points)] points away."
|
||||
else
|
||||
data["status_info"] = "No Prisoner ID detected."
|
||||
data["id_points"] = 0
|
||||
|
||||
if(stacking_machine)
|
||||
data["unclaimed_points"] = stacking_machine.points
|
||||
|
||||
data["ores"] = GLOB.labor_sheet_values
|
||||
data["can_go_home"] = can_go_home
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("claim_points")
|
||||
var/mob/M = usr
|
||||
var/obj/item/card/id/I = M.get_idcard(TRUE)
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/P = I
|
||||
P.points += stacking_machine.points
|
||||
stacking_machine.points = 0
|
||||
to_chat(usr, "<span class='notice'>Points transferred.</span>")
|
||||
. = TRUE
|
||||
else
|
||||
to_chat(usr, "<span class='alert'>No valid id for point transfer detected.</span>")
|
||||
if("move_shuttle")
|
||||
if(!alone_in_area(get_area(src), usr))
|
||||
to_chat(usr, "<span class='alert'>Prisoners are only allowed to be released while alone.</span>")
|
||||
else
|
||||
switch(SSshuttle.moveShuttle("laborcamp", "laborcamp_home", TRUE))
|
||||
if(1)
|
||||
to_chat(usr, "<span class='alert'>Shuttle not found.</span>")
|
||||
if(2)
|
||||
to_chat(usr, "<span class='alert'>Shuttle already at station.</span>")
|
||||
if(3)
|
||||
to_chat(usr, "<span class='alert'>No permission to dock could be granted.</span>")
|
||||
else
|
||||
if(!(obj_flags & EMAGGED))
|
||||
Radio.set_frequency(FREQ_SECURITY)
|
||||
Radio.talk_into(src, "A prisoner has returned to the station. Minerals and Prisoner ID card ready for retrieval.", FREQ_SECURITY)
|
||||
to_chat(usr, "<span class='notice'>Shuttle received message and will be sent shortly.</span>")
|
||||
. = TRUE
|
||||
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/proc/locate_stacking_machine()
|
||||
stacking_machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir))
|
||||
if(stacking_machine)
|
||||
stacking_machine.CONSOLE = src
|
||||
else
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/mineral/labor_claim_console/emag_act(mob/user)
|
||||
. = ..()
|
||||
if(obj_flags & EMAGGED)
|
||||
return
|
||||
obj_flags |= EMAGGED
|
||||
to_chat(user, "<span class='warning'>PZZTTPFFFT</span>")
|
||||
return TRUE
|
||||
|
||||
/**********************Prisoner Collection Unit**************************/
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/laborstacker
|
||||
force_connect = TRUE
|
||||
var/points = 0 //The unclaimed value of ore stacked.
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/laborstacker/process_sheet(obj/item/stack/sheet/inp)
|
||||
points += inp.point_value * inp.amount
|
||||
..()
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/laborstacker/attackby(obj/item/I, mob/living/user)
|
||||
if(istype(I, /obj/item/stack/sheet) && user.canUnEquip(I))
|
||||
var/obj/item/stack/sheet/inp = I
|
||||
points += inp.point_value * inp.amount
|
||||
return ..()
|
||||
|
||||
/**********************Point Lookup Console**************************/
|
||||
|
||||
/obj/machinery/mineral/labor_points_checker
|
||||
name = "points checking console"
|
||||
desc = "A console used by prisoners to check the progress on their quotas. Simply swipe a prisoner ID."
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "console"
|
||||
density = FALSE
|
||||
|
||||
/obj/machinery/mineral/labor_points_checker/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
user.examinate(src)
|
||||
|
||||
/obj/machinery/mineral/labor_points_checker/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/card/id))
|
||||
if(istype(I, /obj/item/card/id/prisoner))
|
||||
var/obj/item/card/id/prisoner/prisoner_id = I
|
||||
to_chat(user, "<span class='notice'><B>ID: [prisoner_id.registered_name]</B></span>")
|
||||
to_chat(user, "<span class='notice'>Points Collected:[prisoner_id.points]</span>")
|
||||
to_chat(user, "<span class='notice'>Point Quota: [prisoner_id.goal]</span>")
|
||||
to_chat(user, "<span class='notice'>Collect points by bringing smelted minerals to the Labor Shuttle stacking machine. Reach your quota to earn your release.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Error: Invalid ID</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
+105
-105
@@ -1,105 +1,105 @@
|
||||
/**********************Mint**************************/
|
||||
|
||||
|
||||
/obj/machinery/mineral/mint
|
||||
name = "coin press"
|
||||
icon = 'icons/obj/economy.dmi'
|
||||
icon_state = "coinpress0"
|
||||
density = TRUE
|
||||
var/newCoins = 0 //how many coins the machine made in it's last load
|
||||
var/processing = FALSE
|
||||
var/chosen = MAT_METAL //which material will be used to make coins
|
||||
var/coinsToProduce = 10
|
||||
speed_process = TRUE
|
||||
|
||||
|
||||
/obj/machinery/mineral/mint/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_PLASMA, MAT_SILVER, MAT_GOLD, MAT_URANIUM, MAT_DIAMOND, MAT_BANANIUM), MINERAL_MATERIAL_AMOUNT * 50, FALSE, /obj/item/stack)
|
||||
|
||||
/obj/machinery/mineral/mint/process()
|
||||
var/turf/T = get_step(src, input_dir)
|
||||
if(!T)
|
||||
return
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
for(var/obj/item/stack/sheet/O in T)
|
||||
materials.insert_stack(O, O.amount)
|
||||
|
||||
/obj/machinery/mineral/mint/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
var/dat = "<b>Coin Press</b><br>"
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
for(var/mat_id in materials.materials)
|
||||
var/datum/material/M = materials.materials[mat_id]
|
||||
if(!M.amount && chosen != mat_id)
|
||||
continue
|
||||
dat += "<br><b>[M.name] amount:</b> [M.amount] cm<sup>3</sup> "
|
||||
if (chosen == mat_id)
|
||||
dat += "<b>Chosen</b>"
|
||||
else
|
||||
dat += "<A href='?src=[REF(src)];choose=[mat_id]'>Choose</A>"
|
||||
|
||||
var/datum/material/M = materials.materials[chosen]
|
||||
|
||||
dat += "<br><br>Will produce [coinsToProduce] [lowertext(M.name)] coins if enough materials are available.<br>"
|
||||
dat += "<A href='?src=[REF(src)];chooseAmt=-10'>-10</A> "
|
||||
dat += "<A href='?src=[REF(src)];chooseAmt=-5'>-5</A> "
|
||||
dat += "<A href='?src=[REF(src)];chooseAmt=-1'>-1</A> "
|
||||
dat += "<A href='?src=[REF(src)];chooseAmt=1'>+1</A> "
|
||||
dat += "<A href='?src=[REF(src)];chooseAmt=5'>+5</A> "
|
||||
dat += "<A href='?src=[REF(src)];chooseAmt=10'>+10</A> "
|
||||
|
||||
dat += "<br><br>In total this machine produced <font color='green'><b>[newCoins]</b></font> coins."
|
||||
dat += "<br><A href='?src=[REF(src)];makeCoins=[1]'>Make coins</A>"
|
||||
user << browse(dat, "window=mint")
|
||||
|
||||
/obj/machinery/mineral/mint/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.set_machine(src)
|
||||
src.add_fingerprint(usr)
|
||||
if(processing==1)
|
||||
to_chat(usr, "<span class='notice'>The machine is processing.</span>")
|
||||
return
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
if(href_list["choose"])
|
||||
if(materials.materials[href_list["choose"]])
|
||||
chosen = href_list["choose"]
|
||||
if(href_list["chooseAmt"])
|
||||
coinsToProduce = CLAMP(coinsToProduce + text2num(href_list["chooseAmt"]), 0, 1000)
|
||||
if(href_list["makeCoins"])
|
||||
var/temp_coins = coinsToProduce
|
||||
processing = TRUE
|
||||
icon_state = "coinpress1"
|
||||
var/coin_mat = MINERAL_MATERIAL_AMOUNT * 0.2
|
||||
var/datum/material/M = materials.materials[chosen]
|
||||
if(!M || !M.coin_type)
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
while(coinsToProduce > 0 && materials.use_amount_type(coin_mat, chosen))
|
||||
create_coins(M.coin_type)
|
||||
coinsToProduce--
|
||||
newCoins++
|
||||
src.updateUsrDialog()
|
||||
sleep(5)
|
||||
|
||||
icon_state = "coinpress0"
|
||||
processing = FALSE
|
||||
coinsToProduce = temp_coins
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/mineral/mint/proc/create_coins(P)
|
||||
var/turf/T = get_step(src,output_dir)
|
||||
if(T)
|
||||
var/obj/item/O = new P(src)
|
||||
var/obj/item/storage/bag/money/M = locate(/obj/item/storage/bag/money, T)
|
||||
if(!M)
|
||||
M = new /obj/item/storage/bag/money(src)
|
||||
unload_mineral(M)
|
||||
O.forceMove(M)
|
||||
/**********************Mint**************************/
|
||||
|
||||
|
||||
/obj/machinery/mineral/mint
|
||||
name = "coin press"
|
||||
icon = 'icons/obj/economy.dmi'
|
||||
icon_state = "coinpress0"
|
||||
density = TRUE
|
||||
var/newCoins = 0 //how many coins the machine made in it's last load
|
||||
var/processing = FALSE
|
||||
var/chosen = MAT_METAL //which material will be used to make coins
|
||||
var/coinsToProduce = 10
|
||||
speed_process = TRUE
|
||||
|
||||
|
||||
/obj/machinery/mineral/mint/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_PLASMA, MAT_SILVER, MAT_GOLD, MAT_URANIUM, MAT_DIAMOND, MAT_BANANIUM), MINERAL_MATERIAL_AMOUNT * 50, FALSE, /obj/item/stack)
|
||||
|
||||
/obj/machinery/mineral/mint/process()
|
||||
var/turf/T = get_step(src, input_dir)
|
||||
if(!T)
|
||||
return
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
for(var/obj/item/stack/sheet/O in T)
|
||||
materials.insert_stack(O, O.amount)
|
||||
|
||||
/obj/machinery/mineral/mint/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
var/dat = "<b>Coin Press</b><br>"
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
for(var/mat_id in materials.materials)
|
||||
var/datum/material/M = materials.materials[mat_id]
|
||||
if(!M.amount && chosen != mat_id)
|
||||
continue
|
||||
dat += "<br><b>[M.name] amount:</b> [M.amount] cm<sup>3</sup> "
|
||||
if (chosen == mat_id)
|
||||
dat += "<b>Chosen</b>"
|
||||
else
|
||||
dat += "<A href='?src=[REF(src)];choose=[mat_id]'>Choose</A>"
|
||||
|
||||
var/datum/material/M = materials.materials[chosen]
|
||||
|
||||
dat += "<br><br>Will produce [coinsToProduce] [lowertext(M.name)] coins if enough materials are available.<br>"
|
||||
dat += "<A href='?src=[REF(src)];chooseAmt=-10'>-10</A> "
|
||||
dat += "<A href='?src=[REF(src)];chooseAmt=-5'>-5</A> "
|
||||
dat += "<A href='?src=[REF(src)];chooseAmt=-1'>-1</A> "
|
||||
dat += "<A href='?src=[REF(src)];chooseAmt=1'>+1</A> "
|
||||
dat += "<A href='?src=[REF(src)];chooseAmt=5'>+5</A> "
|
||||
dat += "<A href='?src=[REF(src)];chooseAmt=10'>+10</A> "
|
||||
|
||||
dat += "<br><br>In total this machine produced <font color='green'><b>[newCoins]</b></font> coins."
|
||||
dat += "<br><A href='?src=[REF(src)];makeCoins=[1]'>Make coins</A>"
|
||||
user << browse(dat, "window=mint")
|
||||
|
||||
/obj/machinery/mineral/mint/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.set_machine(src)
|
||||
src.add_fingerprint(usr)
|
||||
if(processing==1)
|
||||
to_chat(usr, "<span class='notice'>The machine is processing.</span>")
|
||||
return
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
if(href_list["choose"])
|
||||
if(materials.materials[href_list["choose"]])
|
||||
chosen = href_list["choose"]
|
||||
if(href_list["chooseAmt"])
|
||||
coinsToProduce = CLAMP(coinsToProduce + text2num(href_list["chooseAmt"]), 0, 1000)
|
||||
if(href_list["makeCoins"])
|
||||
var/temp_coins = coinsToProduce
|
||||
processing = TRUE
|
||||
icon_state = "coinpress1"
|
||||
var/coin_mat = MINERAL_MATERIAL_AMOUNT * 0.2
|
||||
var/datum/material/M = materials.materials[chosen]
|
||||
if(!M || !M.coin_type)
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
while(coinsToProduce > 0 && materials.use_amount_type(coin_mat, chosen))
|
||||
create_coins(M.coin_type)
|
||||
coinsToProduce--
|
||||
newCoins++
|
||||
src.updateUsrDialog()
|
||||
sleep(5)
|
||||
|
||||
icon_state = "coinpress0"
|
||||
processing = FALSE
|
||||
coinsToProduce = temp_coins
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/mineral/mint/proc/create_coins(P)
|
||||
var/turf/T = get_step(src,output_dir)
|
||||
if(T)
|
||||
var/obj/item/O = new P(src)
|
||||
var/obj/item/storage/bag/money/M = locate(/obj/item/storage/bag/money, T)
|
||||
if(!M)
|
||||
M = new /obj/item/storage/bag/money(src)
|
||||
unload_mineral(M)
|
||||
O.forceMove(M)
|
||||
|
||||
@@ -1,98 +1,98 @@
|
||||
|
||||
/**********************Ore box**************************/
|
||||
|
||||
/obj/structure/ore_box
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "orebox"
|
||||
name = "ore box"
|
||||
desc = "A heavy wooden box, which can be filled with a lot of ores."
|
||||
density = TRUE
|
||||
pressure_resistance = 5*ONE_ATMOSPHERE
|
||||
|
||||
/obj/structure/ore_box/attackby(obj/item/W, mob/user, params)
|
||||
if (istype(W, /obj/item/stack/ore))
|
||||
user.transferItemToLoc(W, src)
|
||||
else if(SEND_SIGNAL(W, COMSIG_CONTAINS_STORAGE))
|
||||
SEND_SIGNAL(W, COMSIG_TRY_STORAGE_TAKE_TYPE, /obj/item/stack/ore, src)
|
||||
to_chat(user, "<span class='notice'>You empty the ore in [W] into \the [src].</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/structure/ore_box/crowbar_act(mob/living/user, obj/item/I)
|
||||
if(I.use_tool(src, user, 50, volume=50))
|
||||
user.visible_message("[user] pries \the [src] apart.",
|
||||
"<span class='notice'>You pry apart \the [src].</span>",
|
||||
"<span class='italics'>You hear splitting wood.</span>")
|
||||
deconstruct(TRUE, user)
|
||||
return TRUE
|
||||
|
||||
/obj/structure/ore_box/examine(mob/living/user)
|
||||
if(Adjacent(user) && istype(user))
|
||||
ui_interact(user)
|
||||
return ..()
|
||||
|
||||
/obj/structure/ore_box/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(Adjacent(user))
|
||||
ui_interact(user)
|
||||
|
||||
/obj/structure/ore_box/attack_robot(mob/user)
|
||||
if(Adjacent(user))
|
||||
ui_interact(user)
|
||||
|
||||
/obj/structure/ore_box/proc/dump_box_contents()
|
||||
var/drop = drop_location()
|
||||
for(var/obj/item/stack/ore/O in src)
|
||||
if(QDELETED(O))
|
||||
continue
|
||||
if(QDELETED(src))
|
||||
break
|
||||
O.forceMove(drop)
|
||||
if(TICK_CHECK)
|
||||
stoplag()
|
||||
drop = drop_location()
|
||||
|
||||
/obj/structure/ore_box/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "ore_box", name, 335, 415, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/structure/ore_box/ui_data()
|
||||
var/contents = list()
|
||||
for(var/obj/item/stack/ore/O in src)
|
||||
contents[O.type] += O.amount
|
||||
|
||||
var/data = list()
|
||||
data["materials"] = list()
|
||||
for(var/type in contents)
|
||||
var/obj/item/stack/ore/O = type
|
||||
var/name = initial(O.name)
|
||||
data["materials"] += list(list("name" = name, "amount" = contents[type], "id" = type))
|
||||
|
||||
return data
|
||||
|
||||
/obj/structure/ore_box/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
if(!Adjacent(usr))
|
||||
return
|
||||
add_fingerprint(usr)
|
||||
usr.set_machine(src)
|
||||
switch(action)
|
||||
if("removeall")
|
||||
dump_box_contents()
|
||||
to_chat(usr, "<span class='notice'>You open the release hatch on the box..</span>")
|
||||
|
||||
/obj/structure/ore_box/deconstruct(disassembled = TRUE, mob/user)
|
||||
var/obj/item/stack/sheet/mineral/wood/WD = new (loc, 4)
|
||||
if(user)
|
||||
WD.add_fingerprint(user)
|
||||
dump_box_contents()
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/ore_box/onTransitZ()
|
||||
return
|
||||
|
||||
/**********************Ore box**************************/
|
||||
|
||||
/obj/structure/ore_box
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "orebox"
|
||||
name = "ore box"
|
||||
desc = "A heavy wooden box, which can be filled with a lot of ores."
|
||||
density = TRUE
|
||||
pressure_resistance = 5*ONE_ATMOSPHERE
|
||||
|
||||
/obj/structure/ore_box/attackby(obj/item/W, mob/user, params)
|
||||
if (istype(W, /obj/item/stack/ore))
|
||||
user.transferItemToLoc(W, src)
|
||||
else if(SEND_SIGNAL(W, COMSIG_CONTAINS_STORAGE))
|
||||
SEND_SIGNAL(W, COMSIG_TRY_STORAGE_TAKE_TYPE, /obj/item/stack/ore, src)
|
||||
to_chat(user, "<span class='notice'>You empty the ore in [W] into \the [src].</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/structure/ore_box/crowbar_act(mob/living/user, obj/item/I)
|
||||
if(I.use_tool(src, user, 50, volume=50))
|
||||
user.visible_message("[user] pries \the [src] apart.",
|
||||
"<span class='notice'>You pry apart \the [src].</span>",
|
||||
"<span class='italics'>You hear splitting wood.</span>")
|
||||
deconstruct(TRUE, user)
|
||||
return TRUE
|
||||
|
||||
/obj/structure/ore_box/examine(mob/living/user)
|
||||
if(Adjacent(user) && istype(user))
|
||||
ui_interact(user)
|
||||
return ..()
|
||||
|
||||
/obj/structure/ore_box/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(Adjacent(user))
|
||||
ui_interact(user)
|
||||
|
||||
/obj/structure/ore_box/attack_robot(mob/user)
|
||||
if(Adjacent(user))
|
||||
ui_interact(user)
|
||||
|
||||
/obj/structure/ore_box/proc/dump_box_contents()
|
||||
var/drop = drop_location()
|
||||
for(var/obj/item/stack/ore/O in src)
|
||||
if(QDELETED(O))
|
||||
continue
|
||||
if(QDELETED(src))
|
||||
break
|
||||
O.forceMove(drop)
|
||||
if(TICK_CHECK)
|
||||
stoplag()
|
||||
drop = drop_location()
|
||||
|
||||
/obj/structure/ore_box/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "ore_box", name, 335, 415, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/structure/ore_box/ui_data()
|
||||
var/contents = list()
|
||||
for(var/obj/item/stack/ore/O in src)
|
||||
contents[O.type] += O.amount
|
||||
|
||||
var/data = list()
|
||||
data["materials"] = list()
|
||||
for(var/type in contents)
|
||||
var/obj/item/stack/ore/O = type
|
||||
var/name = initial(O.name)
|
||||
data["materials"] += list(list("name" = name, "amount" = contents[type], "id" = type))
|
||||
|
||||
return data
|
||||
|
||||
/obj/structure/ore_box/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
if(!Adjacent(usr))
|
||||
return
|
||||
add_fingerprint(usr)
|
||||
usr.set_machine(src)
|
||||
switch(action)
|
||||
if("removeall")
|
||||
dump_box_contents()
|
||||
to_chat(usr, "<span class='notice'>You open the release hatch on the box..</span>")
|
||||
|
||||
/obj/structure/ore_box/deconstruct(disassembled = TRUE, mob/user)
|
||||
var/obj/item/stack/sheet/mineral/wood/WD = new (loc, 4)
|
||||
if(user)
|
||||
WD.add_fingerprint(user)
|
||||
dump_box_contents()
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/ore_box/onTransitZ()
|
||||
return
|
||||
|
||||
+123
-123
@@ -1,123 +1,123 @@
|
||||
//modular computer program version is located in code\modules\modular_computers\file_system\programs\powermonitor.dm, /datum/computer_file/program/power_monitor
|
||||
|
||||
/obj/machinery/computer/monitor
|
||||
name = "power monitoring console"
|
||||
desc = "It monitors power levels across the station."
|
||||
icon_screen = "power"
|
||||
icon_keyboard = "power_key"
|
||||
light_color = LIGHT_COLOR_YELLOW
|
||||
use_power = ACTIVE_POWER_USE
|
||||
idle_power_usage = 20
|
||||
active_power_usage = 100
|
||||
circuit = /obj/item/circuitboard/computer/powermonitor
|
||||
|
||||
var/obj/structure/cable/attached_wire
|
||||
var/obj/machinery/power/apc/local_apc
|
||||
|
||||
var/list/history = list()
|
||||
var/record_size = 60
|
||||
var/record_interval = 50
|
||||
var/next_record = 0
|
||||
var/is_secret_monitor = FALSE
|
||||
tgui_id = "power_monitor"
|
||||
ui_style = "ntos"
|
||||
|
||||
/obj/machinery/computer/monitor/secret //Hides the power monitor (such as ones on ruins & CentCom) from PDA's to prevent metagaming.
|
||||
name = "outdated power monitoring console"
|
||||
desc = "It monitors power levels across the local powernet."
|
||||
circuit = /obj/item/circuitboard/computer/powermonitor/secret
|
||||
is_secret_monitor = TRUE
|
||||
|
||||
/obj/machinery/computer/monitor/secret/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>It's operating system seems quite outdated... It doesn't seem like it'd be compatible with the latest remote NTOS monitoring systems.</span>"
|
||||
|
||||
/obj/machinery/computer/monitor/Initialize()
|
||||
. = ..()
|
||||
search()
|
||||
history["supply"] = list()
|
||||
history["demand"] = list()
|
||||
|
||||
/obj/machinery/computer/monitor/process()
|
||||
if(!get_powernet())
|
||||
use_power = IDLE_POWER_USE
|
||||
search()
|
||||
else
|
||||
use_power = ACTIVE_POWER_USE
|
||||
record()
|
||||
|
||||
/obj/machinery/computer/monitor/proc/search() //keep in sync with /datum/computer_file/program/power_monitor's version
|
||||
var/turf/T = get_turf(src)
|
||||
attached_wire = locate(/obj/structure/cable) in T
|
||||
if(attached_wire)
|
||||
return
|
||||
var/area/A = get_area(src) //if the computer isn't directly connected to a wire, attempt to find the APC powering it to pull it's powernet instead
|
||||
if(!A)
|
||||
return
|
||||
local_apc = A.get_apc()
|
||||
if(!local_apc)
|
||||
return
|
||||
if(!local_apc.terminal) //this really shouldn't happen without badminnery.
|
||||
local_apc = null
|
||||
|
||||
/obj/machinery/computer/monitor/proc/get_powernet() //keep in sync with /datum/computer_file/program/power_monitor's version
|
||||
if(attached_wire || (local_apc && local_apc.terminal))
|
||||
return attached_wire ? attached_wire.powernet : local_apc.terminal.powernet
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/computer/monitor/proc/record() //keep in sync with /datum/computer_file/program/power_monitor's version
|
||||
if(world.time >= next_record)
|
||||
next_record = world.time + record_interval
|
||||
|
||||
var/datum/powernet/connected_powernet = get_powernet()
|
||||
|
||||
var/list/supply = history["supply"]
|
||||
if(connected_powernet)
|
||||
supply += connected_powernet.viewavail
|
||||
if(supply.len > record_size)
|
||||
supply.Cut(1, 2)
|
||||
|
||||
var/list/demand = history["demand"]
|
||||
if(connected_powernet)
|
||||
demand += connected_powernet.viewload
|
||||
if(demand.len > record_size)
|
||||
demand.Cut(1, 2)
|
||||
|
||||
/obj/machinery/computer/monitor/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, tgui_id, name, 550, 700, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/monitor/ui_data()
|
||||
var/datum/powernet/connected_powernet = get_powernet()
|
||||
var/list/data = list()
|
||||
data["stored"] = record_size
|
||||
data["interval"] = record_interval / 10
|
||||
data["attached"] = connected_powernet ? TRUE : FALSE
|
||||
data["history"] = history
|
||||
data["areas"] = list()
|
||||
|
||||
if(connected_powernet)
|
||||
data["supply"] = DisplayPower(connected_powernet.viewavail)
|
||||
data["demand"] = DisplayPower(connected_powernet.viewload)
|
||||
for(var/obj/machinery/power/terminal/term in connected_powernet.nodes)
|
||||
var/obj/machinery/power/apc/A = term.master
|
||||
if(istype(A))
|
||||
var/cell_charge
|
||||
if(!A.cell)
|
||||
cell_charge = 0
|
||||
else
|
||||
cell_charge = A.cell.percent()
|
||||
data["areas"] += list(list(
|
||||
"name" = A.area.name,
|
||||
"charge" = cell_charge,
|
||||
"load" = DisplayPower(A.lastused_total),
|
||||
"charging" = A.charging,
|
||||
"eqp" = A.equipment,
|
||||
"lgt" = A.lighting,
|
||||
"env" = A.environ
|
||||
))
|
||||
|
||||
return data
|
||||
//modular computer program version is located in code\modules\modular_computers\file_system\programs\powermonitor.dm, /datum/computer_file/program/power_monitor
|
||||
|
||||
/obj/machinery/computer/monitor
|
||||
name = "power monitoring console"
|
||||
desc = "It monitors power levels across the station."
|
||||
icon_screen = "power"
|
||||
icon_keyboard = "power_key"
|
||||
light_color = LIGHT_COLOR_YELLOW
|
||||
use_power = ACTIVE_POWER_USE
|
||||
idle_power_usage = 20
|
||||
active_power_usage = 100
|
||||
circuit = /obj/item/circuitboard/computer/powermonitor
|
||||
|
||||
var/obj/structure/cable/attached_wire
|
||||
var/obj/machinery/power/apc/local_apc
|
||||
|
||||
var/list/history = list()
|
||||
var/record_size = 60
|
||||
var/record_interval = 50
|
||||
var/next_record = 0
|
||||
var/is_secret_monitor = FALSE
|
||||
tgui_id = "power_monitor"
|
||||
ui_style = "ntos"
|
||||
|
||||
/obj/machinery/computer/monitor/secret //Hides the power monitor (such as ones on ruins & CentCom) from PDA's to prevent metagaming.
|
||||
name = "outdated power monitoring console"
|
||||
desc = "It monitors power levels across the local powernet."
|
||||
circuit = /obj/item/circuitboard/computer/powermonitor/secret
|
||||
is_secret_monitor = TRUE
|
||||
|
||||
/obj/machinery/computer/monitor/secret/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>It's operating system seems quite outdated... It doesn't seem like it'd be compatible with the latest remote NTOS monitoring systems.</span>"
|
||||
|
||||
/obj/machinery/computer/monitor/Initialize()
|
||||
. = ..()
|
||||
search()
|
||||
history["supply"] = list()
|
||||
history["demand"] = list()
|
||||
|
||||
/obj/machinery/computer/monitor/process()
|
||||
if(!get_powernet())
|
||||
use_power = IDLE_POWER_USE
|
||||
search()
|
||||
else
|
||||
use_power = ACTIVE_POWER_USE
|
||||
record()
|
||||
|
||||
/obj/machinery/computer/monitor/proc/search() //keep in sync with /datum/computer_file/program/power_monitor's version
|
||||
var/turf/T = get_turf(src)
|
||||
attached_wire = locate(/obj/structure/cable) in T
|
||||
if(attached_wire)
|
||||
return
|
||||
var/area/A = get_area(src) //if the computer isn't directly connected to a wire, attempt to find the APC powering it to pull it's powernet instead
|
||||
if(!A)
|
||||
return
|
||||
local_apc = A.get_apc()
|
||||
if(!local_apc)
|
||||
return
|
||||
if(!local_apc.terminal) //this really shouldn't happen without badminnery.
|
||||
local_apc = null
|
||||
|
||||
/obj/machinery/computer/monitor/proc/get_powernet() //keep in sync with /datum/computer_file/program/power_monitor's version
|
||||
if(attached_wire || (local_apc && local_apc.terminal))
|
||||
return attached_wire ? attached_wire.powernet : local_apc.terminal.powernet
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/computer/monitor/proc/record() //keep in sync with /datum/computer_file/program/power_monitor's version
|
||||
if(world.time >= next_record)
|
||||
next_record = world.time + record_interval
|
||||
|
||||
var/datum/powernet/connected_powernet = get_powernet()
|
||||
|
||||
var/list/supply = history["supply"]
|
||||
if(connected_powernet)
|
||||
supply += connected_powernet.viewavail
|
||||
if(supply.len > record_size)
|
||||
supply.Cut(1, 2)
|
||||
|
||||
var/list/demand = history["demand"]
|
||||
if(connected_powernet)
|
||||
demand += connected_powernet.viewload
|
||||
if(demand.len > record_size)
|
||||
demand.Cut(1, 2)
|
||||
|
||||
/obj/machinery/computer/monitor/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, tgui_id, name, 550, 700, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/monitor/ui_data()
|
||||
var/datum/powernet/connected_powernet = get_powernet()
|
||||
var/list/data = list()
|
||||
data["stored"] = record_size
|
||||
data["interval"] = record_interval / 10
|
||||
data["attached"] = connected_powernet ? TRUE : FALSE
|
||||
data["history"] = history
|
||||
data["areas"] = list()
|
||||
|
||||
if(connected_powernet)
|
||||
data["supply"] = DisplayPower(connected_powernet.viewavail)
|
||||
data["demand"] = DisplayPower(connected_powernet.viewload)
|
||||
for(var/obj/machinery/power/terminal/term in connected_powernet.nodes)
|
||||
var/obj/machinery/power/apc/A = term.master
|
||||
if(istype(A))
|
||||
var/cell_charge
|
||||
if(!A.cell)
|
||||
cell_charge = 0
|
||||
else
|
||||
cell_charge = A.cell.percent()
|
||||
data["areas"] += list(list(
|
||||
"name" = A.area.name,
|
||||
"charge" = cell_charge,
|
||||
"load" = DisplayPower(A.lastused_total),
|
||||
"charging" = A.charging,
|
||||
"eqp" = A.equipment,
|
||||
"lgt" = A.lighting,
|
||||
"env" = A.environ
|
||||
))
|
||||
|
||||
return data
|
||||
|
||||
Reference in New Issue
Block a user