Skip to content

Commit

Permalink
Constructable Suit Storage Units (#3027)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

Suit storage units now have circuit boards and require four microlasers,
and can be constructed and deconstructed like most machines. Better
microlasers reduce how long decontamination takes.

Adds examine messages for stock part efficiency and locks.

Adds suit storage units boards to Industrial engineering.

Changes the span classes to macros


## Why It's Good For The Game

<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->

This should improve quality of life in how you want to layout your ship
with being able to freely move the suit storage units around , or
install more as needed instead of just permanently destroying them.

## Changelog

:cl:
add: Suit Storage Unit construction
add: Added suit storage unit circuit boards to industrial engineering
tech
tweak: Suit storage unit examines
tweak: span class to span macros in suit_storage.dm
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
Gristlebee authored May 31, 2024
1 parent 61b713e commit d823b8b
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 33 deletions.
97 changes: 65 additions & 32 deletions code/game/machinery/suit_storage_unit.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define BASE_UV_CYCLES 7

// SUIT STORAGE UNIT /////////////////
/obj/machinery/suit_storage_unit
name = "suit storage unit"
Expand All @@ -9,6 +11,7 @@
use_power = IDLE_POWER_USE
idle_power_usage = IDLE_DRAW_MINIMAL
max_integrity = 250
circuit = /obj/item/circuitboard/machine/suit_storage_unit

var/obj/item/clothing/suit/space/suit = null
var/obj/item/clothing/head/helmet/space/helmet = null
Expand Down Expand Up @@ -42,7 +45,9 @@
*/
var/uv_super = FALSE
/// How many cycles remain for the decontamination sequence.
var/uv_cycles = 6
var/uv_cycles = 7
/// Time reduction from stock parts
var/lasers_bonus = 0
/// Cooldown for occupant breakout messages via relaymove()
var/message_cooldown
/// How long it takes to break out of the SSU.
Expand Down Expand Up @@ -193,6 +198,19 @@
storage = new storage_type(src)
update_appearance()

/obj/machinery/suit_storage_unit/examine(mob/user)
. = ..()
. += span_notice("Number of UV cycles reduced by <b>[lasers_bonus]<b>.")
if(locked)
. += span_notice("The locking bolts on \the [src] are engaged, preventing it from being pried open.")

/obj/machinery/suit_storage_unit/RefreshParts()
lasers_bonus = 0
for(var/obj/item/stock_parts/micro_laser/lasers in component_parts)
lasers_bonus += ((lasers.rating) * 0.25)

uv_cycles = BASE_UV_CYCLES - lasers_bonus

/obj/machinery/suit_storage_unit/Destroy()
QDEL_NULL(suit)
QDEL_NULL(helmet)
Expand Down Expand Up @@ -252,7 +270,15 @@
if(!(flags_1 & NODECONSTRUCT_1))
open_machine()
dump_contents()
new /obj/item/stack/sheet/metal (loc, 2)
on_deconstruction()
if(circuit)
circuit.forceMove(loc)
circuit = null
if(length(component_parts))
spawn_frame(disassembled)
for(var/obj/item/I in component_parts)
I.forceMove(loc)
component_parts.Cut()
qdel(src)

/obj/machinery/suit_storage_unit/interact(mob/living/user)
Expand Down Expand Up @@ -320,7 +346,7 @@
else
if (occupant)
var/mob/living/mob_occupant = occupant
to_chat(mob_occupant, "<span class='userdanger'>[src]'s confines grow warm, then hot, then scorching. You're being burned [!mob_occupant.stat ? "alive" : "away"]!</span>")
to_chat(mob_occupant, span_userdanger("[src]'s confines grow warm, then hot, then scorching. You're being burned [!mob_occupant.stat ? "alive" : "away"]!"))
cook()
if ("lock", "unlock")
if (!state_open)
Expand Down Expand Up @@ -366,27 +392,27 @@
return
var/mob/living/target = A
if(!state_open)
to_chat(user, "<span class='warning'>The unit's doors are shut!</span>")
to_chat(user, span_warning("The unit's doors are shut!"))
return
if(!is_operational)
to_chat(user, "<span class='warning'>The unit is not operational!</span>")
to_chat(user, span_warning("The unit is not operational!"))
return
if(occupant || helmet || suit || storage)
to_chat(user, "<span class='warning'>It's too cluttered inside to fit in!</span>")
to_chat(user, span_warning("It's too cluttered inside to fit in!"))
return

if(target == user)
user.visible_message("<span class='warning'>[user] starts squeezing into [src]!</span>", "<span class='notice'>You start working your way into [src]...</span>")
user.visible_message(span_warning("[user] starts squeezing into [src]!"), span_notice("You start working your way into [src]..."))
else
target.visible_message("<span class='warning'>[user] starts shoving [target] into [src]!</span>", "<span class='userdanger'>[user] starts shoving you into [src]!</span>")
target.visible_message(span_warning("[user] starts shoving [target] into [src]!"), span_userdanger("[user] starts shoving you into [src]!"))

if(do_mob(user, target, 30))
if(occupant || helmet || suit || storage)
return
if(target == user)
user.visible_message("<span class='warning'>[user] slips into [src] and closes the door behind [user.p_them()]!</span>", "<span class=notice'>You slip into [src]'s cramped space and shut its door.</span>")
user.visible_message(span_warning("[user] slips into [src] and closes the door behind [user.p_them()]!"), span_notice("You slip into [src]'s cramped space and shut its door."))
else
target.visible_message("<span class='warning'>[user] pushes [target] into [src] and shuts its door!</span>", "<span class='userdanger'>[user] shoves you into [src] and shuts the door!</span>")
target.visible_message(span_warning("[user] pushes [target] into [src] and shuts its door!"), span_userdanger("[user] shoves you into [src] and shuts the door!"))
close_machine(target)
add_fingerprint(user)

Expand All @@ -400,7 +426,7 @@
*/
/obj/machinery/suit_storage_unit/proc/cook()
var/mob/living/mob_occupant = occupant
if(uv_cycles)
if(uv_cycles > 0)
uv_cycles--
uv = TRUE
locked = TRUE
Expand All @@ -414,11 +440,11 @@
mob_occupant.emote("scream")
addtimer(CALLBACK(src, PROC_REF(cook)), 50)
else
uv_cycles = initial(uv_cycles)
uv_cycles = (BASE_UV_CYCLES - lasers_bonus)
uv = FALSE
locked = FALSE
if(uv_super)
visible_message("<span class='warning'>[src]'s door creaks open with a loud whining noise. A cloud of foul black smoke escapes from its chamber.</span>")
visible_message(span_warning("[src]'s door creaks open with a loud whining noise. A cloud of foul black smoke escapes from its chamber."))
playsound(src, 'sound/machines/creaking.ogg', 50, TRUE)
helmet = null
qdel(helmet)
Expand All @@ -432,9 +458,9 @@
wires.cut_all()
else
if(!occupant)
visible_message("<span class='notice'>[src]'s door slides open. The glowing yellow lights dim to a gentle green.</span>")
visible_message(span_notice("[src]'s door slides open. The glowing yellow lights dim to a gentle green."))
else
visible_message("<span class='warning'>[src]'s door slides open, barraging you with the nauseating smell of charred flesh.</span>")
visible_message(span_warning("[src]'s door slides open, barraging you with the nauseating smell of charred flesh."))
mob_occupant.radiation = 0
playsound(src, 'sound/machines/airlocks/standard/close.ogg', 25, TRUE)
var/list/things_to_clear = list() //Done this way since using GetAllContents on the SSU itself would include circuitry and such.
Expand Down Expand Up @@ -472,7 +498,7 @@
if(locked)
if(message_cooldown <= world.time)
message_cooldown = world.time + 50
to_chat(user, "<span class='warning'>[src]'s door won't budge!</span>")
to_chat(user, span_warning("[src]'s door won't budge!"))
return
open_machine()
dump_contents()
Expand All @@ -484,64 +510,64 @@
return
user.changeNext_move(CLICK_CD_BREAKOUT)
user.last_special = world.time + CLICK_CD_BREAKOUT
user.visible_message("<span class='notice'>You see [user] kicking against the doors of [src]!</span>", \
"<span class='notice'>You start kicking against the doors... (this will take about [DisplayTimeText(breakout_time)].)</span>", \
"<span class='hear'>You hear a thump from [src].</span>")
user.visible_message(span_notice("You see [user] kicking against the doors of [src]!"), \
span_notice("You start kicking against the doors... (this will take about [DisplayTimeText(breakout_time)].)"), \
span_hear("You hear a thump from [src]."))
if(do_after(user,(breakout_time), target = src))
if(!user || user.stat != CONSCIOUS || user.loc != src)
return
user.visible_message("<span class='warning'>[user] successfully broke out of [src]!</span>", \
"<span class='notice'>You successfully break out of [src]!</span>")
user.visible_message(span_warning("[user] successfully broke out of [src]!"), \
span_notice("You successfully break out of [src]!"))
open_machine()
dump_contents()

add_fingerprint(user)
if(locked)
visible_message("<span class='notice'>You see [user] kicking against the doors of [src]!</span>", \
"<span class='notice'>You start kicking against the doors...</span>")
visible_message(span_notice("You see [user] kicking against the doors of [src]!"), \
span_notice("You start kicking against the doors..."))
addtimer(CALLBACK(src, PROC_REF(resist_open), user), 300)
else
open_machine()
dump_contents()

/obj/machinery/suit_storage_unit/proc/resist_open(mob/user)
if(!state_open && occupant && (user in src) && user.stat == 0) // Check they're still here.
visible_message("<span class='notice'>You see [user] burst out of [src]!</span>", \
"<span class='notice'>You escape the cramped confines of [src]!</span>")
visible_message(span_notice("You see [user] burst out of [src]!"), \
span_notice("You escape the cramped confines of [src]!"))
open_machine()

/obj/machinery/suit_storage_unit/attackby(obj/item/I, mob/user, params)
if(state_open && is_operational)
if(istype(I, /obj/item/clothing/suit))
if(suit)
to_chat(user, "<span class='warning'>The unit already contains a suit!.</span>")
to_chat(user, span_warning("The unit already contains a suit!."))
return
if(!user.transferItemToLoc(I, src))
return
suit = I
else if(istype(I, /obj/item/clothing/head))
if(helmet)
to_chat(user, "<span class='warning'>The unit already contains a helmet!</span>")
to_chat(user, span_warning("The unit already contains a helmet!"))
return
if(!user.transferItemToLoc(I, src))
return
helmet = I
else if(istype(I, /obj/item/clothing/mask))
if(mask)
to_chat(user, "<span class='warning'>The unit already contains a mask!</span>")
to_chat(user, span_warning("The unit already contains a mask!"))
return
if(!user.transferItemToLoc(I, src))
return
mask = I
else
if(storage)
to_chat(user, "<span class='warning'>The auxiliary storage compartment is full!</span>")
to_chat(user, span_warning("The auxiliary storage compartment is full!"))
return
if(!user.transferItemToLoc(I, src))
return
storage = I

visible_message("<span class='notice'>[user] inserts [I] into [src]</span>", "<span class='notice'>You load [I] into [src].</span>")
visible_message(span_notice("[user] inserts [I] into [src]"), span_notice("You load [I] into [src]."))
update_appearance()
return

Expand All @@ -564,7 +590,7 @@
*/
/obj/machinery/suit_storage_unit/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/I)
if(!(flags_1 & NODECONSTRUCT_1) && I.tool_behaviour == TOOL_SCREWDRIVER && uv)
to_chat(user, "<span class='warning'>It might not be wise to fiddle with [src] while it's running...</span>")
to_chat(user, span_warning("It might not be wise to fiddle with [src] while it's running..."))
return TRUE
return ..()

Expand All @@ -573,8 +599,12 @@
. = !(state_open || panel_open || is_operational || locked || (flags_1 & NODECONSTRUCT_1)) && I.tool_behaviour == TOOL_CROWBAR
if(.)
I.play_tool_sound(src, 50)
visible_message("<span class='notice'>[usr] pries open \the [src].</span>", "<span class='notice'>You pry open \the [src].</span>")
visible_message(span_notice("[usr] pries open \the [src]."), span_notice("You pry open \the [src]."))
open_machine()
// todo, make it not deconstruct while locked
if(!locked)
if(default_deconstruction_crowbar(I))
return TRUE

// Mapping helper unit takes whatever lies on top of it
/obj/machinery/suit_storage_unit/inherit/Initialize(mapload)
Expand All @@ -599,3 +629,6 @@
AM.forceMove(src)
storage = AM
update_appearance()


#undef BASE_UV_CYCLES
Original file line number Diff line number Diff line change
Expand Up @@ -1543,3 +1543,9 @@
/obj/item/stock_parts/capacitor = 1,
/obj/item/stock_parts/micro_laser = 2,
)

/obj/item/circuitboard/machine/suit_storage_unit
name = "Suit Storage Unit"
icon_state = "engineering"
build_path = /obj/machinery/suit_storage_unit
req_components = list(/obj/item/stock_parts/micro_laser = 4)
7 changes: 7 additions & 0 deletions code/modules/research/designs/machine_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
build_path = /obj/item/circuitboard/machine/smes
category = list ("Engineering Machinery")

/datum/design/board/ssu
name = "Machine Design (Suit Storage Unit Board)"
desc = "The circuit board for a suit storage unit."
id = "ssu"
build_path = /obj/item/circuitboard/machine/suit_storage_unit
category = list ("Engineering Machinery")

/datum/design/board/circulator
name = "Machine Design (Circulator Board)"
desc = "The circuit board for a circulator."
Expand Down
2 changes: 1 addition & 1 deletion code/modules/research/techweb/all_nodes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
prereq_ids = list("base")
design_ids = list("solarcontrol", "solarassembly", "recharger", "powermonitor", "rped", "pacman", "adv_capacitor", "adv_scanning", "emitter", "high_cell", "adv_matter_bin", "scanner_gate",
"atmosalerts", "atmos_control", "recycler", "autolathe", "high_micro_laser", "nano_mani", "mesons", "welding_goggles", "thermomachine", "rad_collector", "tesla_coil", "grounding_rod",
"apc_control", "cell_charger", "power control", "airlock_board", "firelock_board", "aac_electronics", "airalarm_electronics", "firealarm_electronics", "cell_charger", "stack_console", "stack_machine",
"apc_control", "cell_charger", "ssu", "power control", "airlock_board", "firelock_board", "aac_electronics", "airalarm_electronics", "firealarm_electronics", "cell_charger", "stack_console", "stack_machine",
"oxygen_tank", "plasma_tank", "emergency_oxygen", "emergency_oxygen_engi", "plasmaman_tank_belt", "pneumatic_seal", "shieldwallgen", "shieldwallgen_atmos") //WS edit, solar assemblies from lathe
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 5000)
export_price = 5000
Expand Down

0 comments on commit d823b8b

Please sign in to comment.