Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions code/game/machinery/Sleeper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
var/pump_speed
var/stasis_power = 5 KILOWATTS
var/list/loaded_canisters
var/list/starter_canisters
var/max_canister_capacity = 5
var/static/list/banned_chem_types = list(
/decl/material/liquid/bromide,
Expand All @@ -34,20 +35,20 @@
var/open_sound = 'sound/machines/podopen.ogg'
var/close_sound = 'sound/machines/podclose.ogg'

/obj/machinery/sleeper/standard/Initialize(mapload, d, populate_parts)
/obj/machinery/sleeper/Initialize(mapload, d, populate_parts)
. = ..()
add_reagent_canister(null, new /obj/item/chems/chem_disp_cartridge/stabilizer())
add_reagent_canister(null, new /obj/item/chems/chem_disp_cartridge/sedatives())
add_reagent_canister(null, new /obj/item/chems/chem_disp_cartridge/painkillers())
add_reagent_canister(null, new /obj/item/chems/chem_disp_cartridge/antitoxins())
add_reagent_canister(null, new /obj/item/chems/chem_disp_cartridge/oxy_meds())
add_starter_canisters()

/obj/machinery/sleeper/Destroy()
QDEL_NULL(beaker)
QDEL_NULL_LIST(loaded_canisters)
go_out()
. = ..()

/obj/machinery/sleeper/proc/add_starter_canisters()
for(var/canister_type in starter_canisters)
add_reagent_canister(null, new canister_type)

/obj/machinery/sleeper/proc/add_reagent_canister(var/mob/user, var/obj/item/chems/chem_disp_cartridge/canister)
if(!istype(canister))
to_chat(user, SPAN_WARNING("\The [src] can only be loaded with chemical canisters."))
Expand Down Expand Up @@ -455,3 +456,10 @@
/obj/machinery/sleeper/emag_act(var/remaining_charges, var/mob/user)
emagged = !emagged
to_chat(user, SPAN_DANGER("You [emagged ? "disable" : "enable"] \the [src]'s chemical injection safety checks."))

/obj/machinery/sleeper/standard
starter_canisters = list(/obj/item/chems/chem_disp_cartridge/stabilizer,
/obj/item/chems/chem_disp_cartridge/sedatives,
/obj/item/chems/chem_disp_cartridge/painkillers,
/obj/item/chems/chem_disp_cartridge/antitoxins,
/obj/item/chems/chem_disp_cartridge/oxy_meds)
91 changes: 49 additions & 42 deletions code/modules/atmospherics/components/omni_devices/omni_base.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
var/overlays_error[2]
var/underlays_current[4]

var/list/ports = new()
var/list/ports = list()

connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_FUEL

Expand All @@ -44,52 +44,16 @@
/obj/machinery/atmospherics/omni/Initialize()
icon_state = "base"

ports = new()
for(var/d in global.cardinal)
var/datum/omni_port/new_port = new(src, d)
switch(d)
if(NORTH)
new_port.mode = tag_north
if(new_port.mode == ATM_FILTER && tag_filter_gas_north)
if(!istext(tag_filter_gas_north))
CRASH("The tag_filter_gas_north var of [src] ([x],[y],[z]) was not set to a material uid string! Got : '[tag_filter_gas_north]'.")
new_port.filtering = decls_repository.get_decl_path_by_id(tag_filter_gas_north)
if(tag_north >= 3 && tag_north < 8)
new_port.filtering = handle_legacy_gas_filtering(tag_north)
new_port.mode = ATM_FILTER
if(SOUTH)
new_port.mode = tag_south
if(new_port.mode == ATM_FILTER && tag_filter_gas_south)
if(!istext(tag_filter_gas_south))
CRASH("The tag_filter_gas_south var of [src] ([x],[y],[z]) was not set to a material uid string! Got : '[tag_filter_gas_south]'.")
new_port.filtering = decls_repository.get_decl_path_by_id(tag_filter_gas_south)
if(tag_south >= 3 && tag_south < 8)
new_port.filtering = handle_legacy_gas_filtering(tag_south)
new_port.mode = ATM_FILTER
if(EAST)
new_port.mode = tag_east
if(new_port.mode == ATM_FILTER && tag_filter_gas_east)
if(!istext(tag_filter_gas_east))
CRASH("The tag_filter_gas_east var of [src] ([x],[y],[z]) was not set to a material uid string! Got : '[tag_filter_gas_east]'.")
new_port.filtering = decls_repository.get_decl_path_by_id(tag_filter_gas_east)
if(tag_east >= 3 && tag_east < 8)
new_port.filtering = handle_legacy_gas_filtering(tag_east)
new_port.mode = ATM_FILTER
if(WEST)
new_port.mode = tag_west
if(new_port.mode == ATM_FILTER && tag_filter_gas_west)
if(!istext(tag_filter_gas_west))
CRASH("The tag_filter_gas_west var of [src] ([x],[y],[z]) was not set to a material uid string! Got : '[tag_filter_gas_west]'.")
new_port.filtering = decls_repository.get_decl_path_by_id(tag_filter_gas_west)
if(tag_west >= 3 && tag_west < 8)
new_port.filtering = handle_legacy_gas_filtering(tag_west)
new_port.mode = ATM_FILTER
ports += new_port
initialize_ports(TRUE)

. = ..()

build_icons()

/obj/machinery/atmospherics/omni/Destroy()
QDEL_NULL_LIST(ports)
. = ..()

/obj/machinery/atmospherics/omni/proc/handle_legacy_gas_filtering(var/input)
switch(input)
if(3)
Expand Down Expand Up @@ -227,6 +191,49 @@
P.update = 1
update_ports()

/obj/machinery/atmospherics/omni/proc/initialize_ports(var/initial)
QDEL_LIST(ports)
for(var/d in global.cardinal)
var/datum/omni_port/new_port = new(src, d)
switch(d)
if(NORTH)
new_port.mode = tag_north
if(new_port.mode == ATM_FILTER && tag_filter_gas_north)
if(!istext(tag_filter_gas_north))
CRASH("The tag_filter_gas_north var of [src] ([x],[y],[z]) was not set to a material uid string! Got : '[tag_filter_gas_north]'.")
new_port.filtering = decls_repository.get_decl_path_by_id(tag_filter_gas_north)
if(tag_north >= 3 && tag_north < 8)
new_port.filtering = handle_legacy_gas_filtering(tag_north)
new_port.mode = ATM_FILTER
if(SOUTH)
new_port.mode = tag_south
if(new_port.mode == ATM_FILTER && tag_filter_gas_south)
if(!istext(tag_filter_gas_south))
CRASH("The tag_filter_gas_south var of [src] ([x],[y],[z]) was not set to a material uid string! Got : '[tag_filter_gas_south]'.")
new_port.filtering = decls_repository.get_decl_path_by_id(tag_filter_gas_south)
if(tag_south >= 3 && tag_south < 8)
new_port.filtering = handle_legacy_gas_filtering(tag_south)
new_port.mode = ATM_FILTER
if(EAST)
new_port.mode = tag_east
if(new_port.mode == ATM_FILTER && tag_filter_gas_east)
if(!istext(tag_filter_gas_east))
CRASH("The tag_filter_gas_east var of [src] ([x],[y],[z]) was not set to a material uid string! Got : '[tag_filter_gas_east]'.")
new_port.filtering = decls_repository.get_decl_path_by_id(tag_filter_gas_east)
if(tag_east >= 3 && tag_east < 8)
new_port.filtering = handle_legacy_gas_filtering(tag_east)
new_port.mode = ATM_FILTER
if(WEST)
new_port.mode = tag_west
if(new_port.mode == ATM_FILTER && tag_filter_gas_west)
if(!istext(tag_filter_gas_west))
CRASH("The tag_filter_gas_west var of [src] ([x],[y],[z]) was not set to a material uid string! Got : '[tag_filter_gas_west]'.")
new_port.filtering = decls_repository.get_decl_path_by_id(tag_filter_gas_west)
if(tag_west >= 3 && tag_west < 8)
new_port.filtering = handle_legacy_gas_filtering(tag_west)
new_port.mode = ATM_FILTER
ports += new_port

/obj/machinery/atmospherics/omni/proc/update_ports()
sort_ports()
update_port_icons()
Expand Down
1 change: 1 addition & 0 deletions mods/persistence/_persistence.dme
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include "game\machinery\machinery.dm"
#include "game\machinery\mantrap.dm"
#include "game\machinery\resleever.dm"
#include "game\machinery\Sleeper.dm"
#include "game\machinery\_machines_base\stock_parts\_stock_parts.dm"
#include "game\machinery\_machines_base\stock_parts\network_lock.dm"
#include "game\machinery\_machines_base\stock_parts\power\battery.dm"
Expand Down
9 changes: 6 additions & 3 deletions mods/persistence/datums/mind/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ var/global/list/player_minds = list()
if(!CP.is_valid_respawn(user.mind.unique_id))
to_chat(user, SPAN_WARNING("That cloning pod has become unavailable. Please choose a new cloning pod."))
return show_valid_respawns(user)
CP.create_character(user.mind, user.ckey)
qdel(user) // Whatever mob was storing us is no longer needed.
return TRUE
if(CP.create_character(user.mind, user.ckey))
qdel(user) // Whatever mob was storing us is no longer needed.
return TRUE
else
to_chat(user, SPAN_WARNING("That cloning pod has become unavailable. Please choose a new cloning pod."))
return show_valid_respawns(user)
else
to_chat(user, SPAN_NOTICE("There does not appear to be any viable clone pods for you to spawn in."))
5 changes: 5 additions & 0 deletions mods/persistence/game/machinery/Sleeper.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/obj/machinery/sleeper/add_starter_canisters()
if(persistent_id)
return

return ..()
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
/obj/machinery/atmospherics/omni/before_save()
. = ..()
for(var/datum/omni_port/port in ports)
switch(port.direction)
if(NORTH)
tag_north = port.mode
if(EAST)
tag_east = port.mode
if(WEST)
tag_west = port.mode
if(SOUTH)
tag_south = port.mode
/obj/machinery/atmospherics/omni/initialize_ports(initial)
if(initial && persistent_id && length(ports))
return

/obj/machinery/atmospherics/omni/after_save()
. = ..()
tag_north = null
tag_east = null
tag_west = null
tag_south = null
return ..()
3 changes: 1 addition & 2 deletions mods/persistence/modules/cloning/cloning_network.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
return
var/datum/computer_file/data/cloning/latest_file
var/datum/extension/network_device/mainframe/mainframe
for(var/datum/extension/network_device/mainframe/M in mainframes_by_role[MF_ROLE_CLONING])
for(var/datum/extension/network_device/mainframe/M in get_mainframes_by_role(MF_ROLE_CLONING))
for(var/datum/computer_file/data/cloning/cloneFile in M.get_all_files())
if(cloneFile.mind_id == mind_id)
if(!latest_file || latest_file.backup_date > cloneFile.backup_date)
if(latest_file)
M.delete_file(latest_file.filename)
qdel(latest_file) // Older files can be deleted.
latest_file = cloneFile
mainframe = M
if(delete_after && latest_file)
Expand Down
16 changes: 6 additions & 10 deletions mods/persistence/modules/cloning/device_types/cloning_pod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define TASK_CLONE_TIME 60 SECONDS

/datum/extension/network_device/cloning_pod
var/occupied = FALSE
var/scanning = FALSE
var/cloning = FALSE
var/cloning_progress = 0 // Used to display messages to whoever is being clone while they're in the vat.
Expand All @@ -16,7 +15,7 @@
if(!mind_id)
return FALSE
var/obj/machinery/cloning_pod/CP = holder
if(!CP.operable() || CP.stat & (BROKEN|NOPOWER) || occupied)
if(!CP.operable() || CP.stat & (BROKEN|NOPOWER) || get_occupant())
return FALSE
var/datum/computer_network/network = get_network()
if(!network)
Expand All @@ -32,6 +31,8 @@
return CP.eject_occupant(user)

/datum/extension/network_device/cloning_pod/proc/create_character(var/datum/mind/mind, var/datum/computer_file/data/cloning/backup, var/obj/item/organ/internal/stack/stack)
if(get_occupant())
return
var/datum/computer_network/network = get_network()
if(!network)
return
Expand All @@ -53,8 +54,6 @@
var/obj/item/organ/O = new_character.get_organ(stack.parent_organ)
new_character.add_organ(stack, O)
qdel(stack.stackmob)
else
mind.philotic_damage += 10

// TODO: More feedback on philotic damage in general.
if(mind.philotic_damage > 75)
Expand Down Expand Up @@ -154,10 +153,7 @@
if(!check_clone())
return
cancel_task() // Delete any in progress timers just in case.
var/atom/movable/occupant = get_occupant()
if(!occupant)
return
var/obj/item/organ/internal/stack/S = occupant
if(!S)
var/obj/item/organ/internal/stack/S = get_occupant()
if(!istype(S) || !S.stackmob || !S.stackmob.mind)
return
return create_character(S?.stackmob?.mind, S.backup, S)
return create_character(S.stackmob?.mind, S.backup, S)
1 change: 0 additions & 1 deletion mods/persistence/modules/cloning/machines/cloning_pod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@
/obj/machinery/cloning_pod/proc/set_occupant(var/atom/movable/target, var/mob/user)
var/datum/extension/network_device/cloning_pod/D = get_extension(src, /datum/extension/network_device)
occupant = target
D.occupied = !!occupant
update_icon()
if(!target)
D.cloning = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
var/datum/extension/network_device/cloning_pod/CP = network.get_device_by_tag(href_list["machine"])
if(!istype(CP))
return TOPIC_REFRESH
var/obj/item/organ/internal/stack/occupant = CP.get_occupant()
if(!istype(occupant) || !occupant.stackmob || !occupant.stackmob.mind)
to_chat(user, SPAN_WARNING("The console flashes an error: invalid occupant!"))
return TOPIC_REFRESH
CP.begin_clone(user)
return TOPIC_REFRESH

Expand Down Expand Up @@ -84,17 +88,17 @@
cloning_pod["can_clone"] = CP.check_clone()
cloning_pod["can_backup"] = CP.check_scan()
cloning_pod["can_save"] = !!CP.finished_scan
var/atom/movable/occupant = CP.get_occupant()
if(!cloning_pod["online"])
cloning_pod["status"] = "Offline."
else if(CP.occupied)
else if(occupant)
cloning_pod["status"] = "Occupied."
if(CP.finished_scan)
cloning_pod["operation"] = "Scan complete"
else if(CP.scanning || CP.cloning)
cloning_pod["operation"] = CP.scanning ? "Scanning" : "Cloning"
cloning_pod["progress"] = (world.time - CP.task_started_on) / (TASK_SCAN_TIME)
cloning_pod["remaining"] = round((TASK_SCAN_TIME + CP.task_started_on - world.time) / 10)
var/atom/movable/occupant = CP.get_occupant()
if(istype(occupant, /obj/item/organ/internal/stack))
cloning_pod["contents"] = occupant.name
else if(istype(occupant, /mob/living/carbon))
Expand Down
3 changes: 1 addition & 2 deletions mods/persistence/modules/world_save/saved_vars/saved_misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ SAVED_VAR(/obj/machinery/atmospherics/omni, tag_north)
SAVED_VAR(/obj/machinery/atmospherics/omni, tag_east)
SAVED_VAR(/obj/machinery/atmospherics/omni, tag_south)
SAVED_VAR(/obj/machinery/atmospherics/omni, tag_west)
SAVED_VAR(/obj/machinery/atmospherics/omni, ports)

SAVED_VAR(/datum/omni_port, master)
SAVED_VAR(/datum/omni_port, direction)
Expand All @@ -1057,8 +1058,6 @@ SAVED_VAR(/datum/omni_port, air)
SAVED_VAR(/datum/omni_port, nodes)
SAVED_VAR(/datum/omni_port, filtering)

SAVED_VAR(/obj/machinery/atmospherics/portables_connector, connected_device)

SAVED_VAR(/obj/machinery/atmospherics/unary/outlet_injector, injecting)
SAVED_VAR(/obj/machinery/atmospherics/unary/outlet_injector, volume_rate)

Expand Down