Environment Protection Bags + Minor Weather Changes (#59752)

Co-authored-by: Matthew J. <12817816+ZephyrTFA@users.noreply.github.com>
This commit is contained in:
Greniza
2021-07-03 22:05:58 -07:00
committed by GitHub
parent ea59898bc1
commit b2ecb787e1
41 changed files with 351 additions and 62 deletions
@@ -44,6 +44,12 @@
var/delivery_icon = "deliverycloset" //which icon to use when packagewrapped. null to be unwrappable.
var/anchorable = TRUE
var/icon_welded = "welded"
/// Protection against weather that being inside of it provides.
var/list/weather_protection = null
/// How close being inside of the thing provides complete pressure safety. Must be between 0 and 1!
contents_pressure_protection = 0
/// How insulated the thing is, for the purposes of calculating body temperature. Must be between 0 and 1!
contents_thermal_insulation = 0
/// Whether a skittish person can dive inside this closet. Disable if opening the closet causes "bad things" to happen or that it leads to a logical inconsistency.
var/divable = TRUE
/// true whenever someone with the strong pull component is dragging this, preventing opening
@@ -27,13 +27,13 @@
QDEL_NULL(foldedbag_instance)
return ..()
/obj/structure/closet/body_bag/attackby(obj/item/I, mob/user, params)
if (istype(I, /obj/item/pen) || istype(I, /obj/item/toy/crayon))
/obj/structure/closet/body_bag/attackby(obj/item/interact_tool, mob/user, params)
if (istype(interact_tool, /obj/item/pen) || istype(interact_tool, /obj/item/toy/crayon))
if(!user.is_literate())
to_chat(user, span_notice("You scribble illegibly on [src]!"))
return
var/t = stripped_input(user, "What would you like the label to be?", name, null, 53)
if(user.get_active_held_item() != I)
if(user.get_active_held_item() != interact_tool)
return
if(!user.canUseTopic(src, BE_CLOSE))
return
@@ -44,7 +44,7 @@
else
name = initial(name)
return
else if(I.tool_behaviour == TOOL_WIRECUTTER)
else if((interact_tool.tool_behaviour == TOOL_WIRECUTTER) && tagged)
to_chat(user, span_notice("You cut the tag off [src]."))
name = "body bag"
tagged = FALSE
@@ -87,9 +87,10 @@
if(opened)
to_chat(the_folder, span_warning("You wrestle with [src], but it won't fold while unzipped."))
return
if(contents.len)
to_chat(the_folder, span_warning("There are too many things inside of [src] to fold it up!"))
return
for(var/content_thing in contents)
if(istype(content_thing, /mob) || istype(content_thing, /obj))
to_chat(the_folder, span_warning("There are too many things inside of [src] to fold it up!"))
return
// toto we made it!
return TRUE
@@ -148,3 +149,198 @@
max_weight_of_contents = A_is_item.w_class
B.w_class = max_weight_of_contents
usr.put_in_hands(B)
/// Environmental bags
/obj/structure/closet/body_bag/environmental
name = "environmental protection bag"
desc = "An insulated, reinforced bag designed to protect against exoplanetary storms and other environmental factors."
icon = 'icons/obj/bodybag.dmi'
icon_state = "envirobag"
mob_storage_capacity = 1
contents_pressure_protection = 0.8
contents_thermal_insulation = 0.5
foldedbag_path = /obj/item/bodybag/environmental/
weather_protection = list(WEATHER_ACID, WEATHER_ASH, WEATHER_RAD, WEATHER_SNOW, WEATHER_VOID) // Does not protect against lava or the The Floor Is Lava spell.
/obj/structure/closet/body_bag/environmental/nanotrasen
name = "elite environmental protection bag"
desc = "A heavily reinforced and insulated bag, capable of fully isolating its contents from external factors."
icon = 'icons/obj/bodybag.dmi'
icon_state = "ntenvirobag"
contents_pressure_protection = 1
contents_thermal_insulation = 1
foldedbag_path = /obj/item/bodybag/environmental/nanotrasen/
weather_protection = list(WEATHER_ALL)
/// Securable enviro. bags
/obj/structure/closet/body_bag/environmental/prisoner
name = "prisoner transport bag"
desc = "Intended for transport of prisoners through hazardous environments, this environmental protection bag comes with straps to keep an occupant secure."
icon = 'icons/obj/bodybag.dmi'
icon_state = "prisonerenvirobag"
foldedbag_path = /obj/item/bodybag/environmental/prisoner/
breakout_time = 4 MINUTES // because it's probably about as hard to get out of this as it is to get out of a straightjacket.
/// How long it takes to sinch the bag.
var/sinch_time = 10 SECONDS
/// Whether or not the bag is sinched. Starts unsinched.
var/sinched = FALSE
/// The sound that plays when the bag is done sinching.
var/sinch_sound = 'sound/items/equip/toolbelt_equip.ogg'
/obj/structure/closet/body_bag/environmental/prisoner/attempt_fold(mob/living/carbon/human/the_folder)
if(sinched)
to_chat(the_folder, span_warning("You wrestle with [src], but it won't fold while its straps are fastened."))
return ..()
/obj/structure/closet/body_bag/environmental/prisoner/update_icon()
. = ..()
if(sinched)
icon_state = initial(icon_state) + "_sinched"
else
icon_state = initial(icon_state)
/obj/structure/closet/body_bag/environmental/prisoner/can_open(mob/living/user, force = FALSE)
if(force)
return TRUE
if(sinched)
to_chat(user, span_danger("The buckles on [src] are sinched down, preventing it from opening."))
return FALSE
. = ..()
/obj/structure/closet/body_bag/environmental/prisoner/open(mob/living/user, force = FALSE)
if(!can_open(user, force))
return
if(opened)
return
sinched = FALSE
playsound(loc, open_sound, open_sound_volume, TRUE, -3)
opened = TRUE
if(!dense_when_open)
set_density(FALSE)
dump_contents()
update_appearance()
after_open(user, force)
return TRUE
/obj/structure/closet/body_bag/environmental/prisoner/container_resist_act(mob/living/user)
/// copy-pasted with changes because flavor text as well as some other misc stuff
if(opened)
return
if(ismovable(loc))
user.changeNext_move(CLICK_CD_BREAKOUT)
user.last_special = world.time + CLICK_CD_BREAKOUT
var/atom/movable/location = loc
location.relay_container_resist_act(user, src)
return
if(!sinched)
open()
return
user.changeNext_move(CLICK_CD_BREAKOUT)
user.last_special = world.time + CLICK_CD_BREAKOUT
user.visible_message(span_warning("Someone in [src] begins to wriggle!"), \
span_notice("You start wriggling, attempting to loosen [src]'s buckles... (this will take about [DisplayTimeText(breakout_time)].)"), \
span_hear("You hear straining cloth from [src]."))
if(do_after(user,(breakout_time), target = src))
if(!user || user.stat != CONSCIOUS || user.loc != src || opened || !sinched )
return
//we check after a while whether there is a point of resisting anymore and whether the user is capable of resisting
user.visible_message(span_danger("[user] successfully broke out of [src]!"),
span_notice("You successfully break out of [src]!"))
bust_open()
else
if(user.loc == src) //so we don't get the message if we resisted multiple times and succeeded.
to_chat(user, span_warning("You fail to break out of [src]!"))
/obj/structure/closet/body_bag/environmental/prisoner/bust_open()
sinched = FALSE
// We don't break the bag, because the buckles were backed out as opposed to fully broken.
open()
/obj/structure/closet/body_bag/environmental/prisoner/attack_hand_secondary(mob/user, modifiers)
if(!user.canUseTopic(src, BE_CLOSE) || !isturf(loc))
return
if(!opened)
togglelock(user)
return TRUE
/obj/structure/closet/body_bag/environmental/prisoner/togglelock(mob/living/user, silent)
if(user in contents)
to_chat(user, span_warning("You can't reach the buckles from here!"))
return
if(iscarbon(user))
add_fingerprint(user)
if(!sinched)
for(var/mob/living/target in contents)
to_chat(target, span_userdanger("You feel the lining of [src] tighten around you! Soon, you won't be able to escape!"))
user.visible_message(span_notice("You begin sinching down the buckles on [src]."))
if(!(do_after(user,(sinch_time),target = src)))
return
sinched = !sinched
if(sinched)
playsound(loc, sinch_sound, 15, TRUE, -2)
user.visible_message(span_notice("[user] [sinched ? null : "un"]sinches [src]."),
span_notice("You [sinched ? null : "un"]sinch [src]."),
span_hear("You hear stretching followed by metal clicking from [src]."))
log_game("[key_name(user)] [sinched ? "sinched":"unsinched"] secure environmental bag [src] at [AREACOORD(src)]")
update_appearance()
/obj/structure/closet/body_bag/environmental/prisoner/syndicate
name = "syndicate prisoner transport bag"
desc = "An alteration of Nanotrasen's environmental protection bag which has been used in several high-profile kidnappings. Designed to keep a victim unconscious, alive, and secured during transport."
icon = 'icons/obj/bodybag.dmi'
icon_state = "syndieenvirobag"
contents_pressure_protection = 1
contents_thermal_insulation = 1
foldedbag_path = /obj/item/bodybag/environmental/prisoner/syndicate
weather_protection = list(WEATHER_ALL)
breakout_time = 8 MINUTES
sinch_time = 20 SECONDS
// The contents of the gas to be distributed to an occupant once sinched down. Set in Initialize()
var/datum/gas_mixture/air_contents = null
/obj/structure/closet/body_bag/environmental/prisoner/syndicate/Initialize()
. = ..()
refresh_air()
/obj/structure/closet/body_bag/environmental/prisoner/syndicate/proc/refresh_air()
air_contents = null
air_contents = new(50) //liters
air_contents.temperature = T20C
air_contents.assert_gases(/datum/gas/oxygen, /datum/gas/nitrous_oxide)
air_contents.gases[/datum/gas/oxygen][MOLES] = (ONE_ATMOSPHERE*50)/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD
air_contents.gases[/datum/gas/nitrous_oxide][MOLES] = (ONE_ATMOSPHERE*50)/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD
/obj/structure/closet/body_bag/environmental/prisoner/syndicate/Destroy()
if(air_contents)
QDEL_NULL(air_contents)
return ..()
/obj/structure/closet/body_bag/environmental/prisoner/syndicate/return_air()
if(sinched)
refresh_air()
return air_contents
return ..()
/obj/structure/closet/body_bag/environmental/prisoner/syndicate/remove_air(amount)
if(sinched)
refresh_air()
return air_contents // The internals for this bag are bottomless. Syndicate bluespace trickery.
return ..(amount)
/obj/structure/closet/body_bag/environmental/prisoner/syndicate/return_analyzable_air()
if(sinched)
refresh_air()
return air_contents
return ..()
/obj/structure/closet/body_bag/environmental/prisoner/syndicate/togglelock(mob/living/user, silent)
. = ..()
if(sinched)
for(var/mob/living/target in contents)
to_chat(target, span_warning("You hear a faint hiss, and a white mist fills your vision..."))
@@ -12,6 +12,7 @@
close_sound = 'sound/machines/wooden_closet_close.ogg'
open_sound_volume = 25
close_sound_volume = 50
contents_pressure_protection = 0.8
var/obj/item/tank/internals/emergency_oxygen/tank
/obj/structure/closet/crate/critter/Initialize()