Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds the Mancrowave #1083

Merged
merged 5 commits into from
Sep 4, 2024
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
1 change: 1 addition & 0 deletions _maps/map_files/Theseus/Theseus.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -11249,6 +11249,7 @@
dir = 4
},
/obj/structure/noticeboard/directional/east,
/obj/machinery/sleeper/mancrowave,
/turf/open/floor/iron,
/area/station/medical/surgery/prep)
"edN" = (
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/lighting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/// frequency, in 1/10ths of a second, of the lighting process
#define LIGHTING_INTERVAL 5

#define MINIMUM_USEFUL_LIGHT_RANGE 1.4
#define MINIMUM_USEFUL_LIGHT_RANGE 1

/// height off the ground of light sources on the pseudo-z-axis, you should probably leave this alone
#define LIGHTING_HEIGHT 1
Expand Down
9 changes: 6 additions & 3 deletions code/controllers/subsystem/ambience.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ SUBSYSTEM_DEF(ambience)
cached_clients.len--

//Check to see if the client exists and isn't held by a new player
var/mob/client_mob = client_iterator?.mob.hear_location()
var/mob/client_mob = client_iterator?.mob
if(isnull(client_iterator) || isnewplayer(client_mob))
ambience_listening_clients -= client_iterator
client_old_areas -= client_iterator
continue

if(!client_mob.can_hear())
continue
var/atom/movable/hearer = client_mob.hear_location()
if(ismob(hearer))
var/mob/hearer_mob = hearer
if(!hearer_mob.can_hear())
continue

//Check to see if the client-mob is in a valid area
var/area/current_area = get_area(client_mob)
Expand Down
9 changes: 6 additions & 3 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1251,11 +1251,11 @@
switch(var_name)
if(NAMEOF(src, light_inner_range))
if(light_system == COMPLEX_LIGHT)
set_light(l_inner_range = var_value)
set_light(l_outer_range = light_outer_range, l_inner_range = var_value, )
. = TRUE
if(NAMEOF(src, light_outer_range))
if(light_system == COMPLEX_LIGHT)
set_light(l_outer_range = var_value)
set_light(l_outer_range = var_value, l_inner_range = light_inner_range)
else
set_light_range(var_value)
. = TRUE
Expand All @@ -1272,7 +1272,10 @@
set_light_color(var_value)
. = TRUE
if(NAMEOF(src, light_on))
set_light_on(var_value)
if(light_system == COMPLEX_LIGHT)
set_light(l_on = var_value)
else
set_light_color(var_value)
. = TRUE
if(NAMEOF(src, light_flags))
set_light_flags(var_value)
Expand Down
59 changes: 44 additions & 15 deletions code/game/machinery/Sleeper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,33 @@
state_open = TRUE
circuit = /obj/item/circuitboard/machine/sleeper

processing_flags = START_PROCESSING_MANUALLY

light_color = LIGHT_COLOR_CYAN
light_inner_range = 0.1
light_outer_range = 1.4
light_power = 1

var/efficiency = 1
var/min_health = -25
var/list/available_chems
var/controls_inside = FALSE
var/list/possible_chems = list(
list(/datum/reagent/medicine/epinephrine, /datum/reagent/medicine/morphine, /datum/reagent/medicine/bicaridine, /datum/reagent/medicine/kelotane),
list(/datum/reagent/medicine/imidazoline,/datum/reagent/medicine/inacusiate),
list(/datum/reagent/medicine/dylovene, /datum/reagent/medicine/ryetalyn, /datum/reagent/medicine/alkysine, /datum/reagent/medicine/dexalin),
list(/datum/reagent/medicine/tricordrazine)
)
var/list/chem_buttons //Used when emagged to scramble which chem is used, eg: ryetalyn -> morphine

var/scrambled_chems = FALSE //Are chem buttons scrambled? used as a warning
/// Can the controls be accessed by the occupant?
var/controls_inside = FALSE
/// Has a maintenance hatch
var/has_panel = TRUE
var/has_anim = TRUE
var/rotatable = TRUE
var/enter_message = "<span class='notice'><b>You feel cool air surround you. You go numb as your senses turn inward.</b></span>"

payment_department = ACCOUNT_MED
fair_market_price = 5

Expand All @@ -51,10 +65,11 @@

efficiency = initial(efficiency)* E
min_health = initial(min_health) * E
available_chems = list()
for(var/i in 1 to I)
available_chems |= possible_chems[i]
reset_chem_buttons()
if(length(possible_chems))
available_chems = list()
for(var/i in 1 to I)
available_chems |= possible_chems[i]
reset_chem_buttons()

/obj/machinery/sleeper/update_icon_state()
icon_state = "[base_icon_state][state_open ? "-open" : null]"
Expand All @@ -65,6 +80,10 @@
span_notice("You climb out of [src]!"))
open_machine()

/obj/machinery/sleeper/on_set_is_operational(old_value)
. = ..()
refresh_light()

/obj/machinery/sleeper/Exited(atom/movable/gone, direction)
. = ..()
if (!state_open && gone == occupant)
Expand All @@ -76,21 +95,29 @@

/obj/machinery/sleeper/open_machine()
if(!state_open && !panel_open)
z_flick("[initial(icon_state)]-anim", src)
if(has_anim)
z_flick("[initial(icon_state)]-anim", src)
..()

/obj/machinery/sleeper/close_machine(mob/user)
if((isnull(user) || istype(user)) && state_open && !panel_open)
z_flick("[initial(icon_state)]-anim", src)
if(has_anim)
z_flick("[initial(icon_state)]-anim", src)

..(user)

var/mob/living/mob_occupant = occupant
if(mob_occupant && mob_occupant.stat != DEAD)
if(!mob_occupant)
return

if(enter_message && mob_occupant.stat != DEAD)
to_chat(mob_occupant, "[enter_message]")

/obj/machinery/sleeper/emp_act(severity)
. = ..()
if (. & EMP_PROTECT_SELF)
return

if(is_operational && occupant)
open_machine()

Expand All @@ -101,11 +128,12 @@

close_machine(target)


/obj/machinery/sleeper/screwdriver_act(mob/living/user, obj/item/I)
. = TRUE
if(..())
return
if(!has_panel)
return FALSE
if(occupant)
to_chat(user, span_warning("[src] is currently occupied!"))
return
Expand All @@ -118,7 +146,7 @@

/obj/machinery/sleeper/wrench_act(mob/living/user, obj/item/I)
. = ..()
if(default_change_direction_wrench(user, I))
if(rotatable && default_change_direction_wrench(user, I))
return TRUE

/obj/machinery/sleeper/crowbar_act(mob/living/user, obj/item/I)
Expand All @@ -129,7 +157,7 @@
return TRUE

/obj/machinery/sleeper/default_pry_open(obj/item/I) //wew
. = !(state_open || panel_open || (flags_1 & NODECONSTRUCT_1)) && I.tool_behaviour == TOOL_CROWBAR
. = has_panel && !(state_open || panel_open || (flags_1 & NODECONSTRUCT_1)) && I.tool_behaviour == TOOL_CROWBAR
if(.)
I.play_tool_sound(src, 50)
visible_message(span_notice("[usr] pries open [src]."), span_notice("You pry open [src]."))
Expand Down Expand Up @@ -159,10 +187,6 @@
. = ..()
. += span_notice("Alt-click [src] to [state_open ? "close" : "open"] it.")

/obj/machinery/sleeper/process()
..()
use_power(active_power_usage)

/obj/machinery/sleeper/ui_data()
var/list/data = list()
data["occupied"] = occupant ? 1 : 0
Expand Down Expand Up @@ -263,6 +287,11 @@
for(var/chem in av_chem)
chem_buttons[chem] = pick_n_take(av_chem) //no dupes, allow for random buttons to still be correct

/obj/machinery/sleeper/proc/refresh_light()
if(is_operational)
set_light(l_on = TRUE)
else
set_light(l_on = FALSE)

/obj/machinery/sleeper/syndie
icon_state = "sleeper_s"
Expand Down
Loading
Loading