mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-18 21:53:22 +00:00
* filled trashcarts spawn nearby grime when initialized instead of when opened for the first time (#73608) ## About The Pull Request Filled trashcarts spawn some trash in them once they are opened for the first time. But they also spawn grime, and the problem with that is that grime spawns in a range around the trashcart. So opening the trashcart for the first time would cause the grime to suddenly pop in around the cart. This PR changes it so that the grime is spawned when the filled trashcart is initialized. ## Why It's Good For The Game Having trash spawn around the trashcart the moment that you open it is probably not intended. The grime is probably meant to be there before the trashcart is opened for the first time. ## Changelog 🆑 fix: filled trashcarts spawn nearby grime when initialized instead of when opened for the first time /🆑 --------- Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com> * filled trashcarts spawn nearby grime when initialized instead of when opened for the first time --------- Co-authored-by: kawoppi <94711066+kawoppi@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com>
310 lines
9.6 KiB
Plaintext
310 lines
9.6 KiB
Plaintext
/obj/structure/closet/crate
|
|
name = "crate"
|
|
desc = "A rectangular steel crate."
|
|
icon = 'icons/obj/storage/crates.dmi' //ICON OVERRIDEN IN SKYRAT AESTHETICS - SEE MODULE
|
|
icon_state = "crate"
|
|
req_access = null
|
|
can_weld_shut = FALSE
|
|
horizontal = TRUE
|
|
allow_objects = TRUE
|
|
allow_dense = TRUE
|
|
dense_when_open = TRUE
|
|
delivery_icon = "deliverycrate"
|
|
open_sound = 'sound/machines/crate_open.ogg'
|
|
close_sound = 'sound/machines/crate_close.ogg'
|
|
open_sound_volume = 35
|
|
close_sound_volume = 50
|
|
drag_slowdown = 0
|
|
door_anim_time = 0 // no animation
|
|
pass_flags_self = PASSSTRUCTURE | LETPASSTHROW
|
|
var/crate_climb_time = 20
|
|
var/obj/item/paper/fluff/jobs/cargo/manifest/manifest
|
|
|
|
/obj/structure/closet/crate/Initialize(mapload)
|
|
. = ..()
|
|
if(icon_state == "[initial(icon_state)]open")
|
|
opened = TRUE
|
|
AddElement(/datum/element/climbable, climb_time = crate_climb_time * 0.5, climb_stun = 0)
|
|
else
|
|
AddElement(/datum/element/climbable, climb_time = crate_climb_time, climb_stun = 0)
|
|
update_appearance()
|
|
|
|
/obj/structure/closet/crate/Destroy()
|
|
QDEL_NULL(manifest)
|
|
return ..()
|
|
|
|
/obj/structure/closet/crate/CanAllowThrough(atom/movable/mover, border_dir)
|
|
. = ..()
|
|
if(!istype(mover, /obj/structure/closet))
|
|
var/obj/structure/closet/crate/locatedcrate = locate(/obj/structure/closet/crate) in get_turf(mover)
|
|
if(locatedcrate) //you can walk on it like tables, if you're not in an open crate trying to move to a closed crate
|
|
if(opened) //if we're open, allow entering regardless of located crate openness
|
|
return TRUE
|
|
if(!locatedcrate.opened) //otherwise, if the located crate is closed, allow entering
|
|
return TRUE
|
|
|
|
/obj/structure/closet/crate/update_icon_state()
|
|
icon_state = "[initial(icon_state)][opened ? "open" : ""]"
|
|
return ..()
|
|
|
|
/obj/structure/closet/crate/closet_update_overlays(list/new_overlays)
|
|
. = new_overlays
|
|
if(manifest)
|
|
. += "manifest"
|
|
if(broken)
|
|
. += "securecrateemag"
|
|
else if(locked)
|
|
. += "securecrater"
|
|
else if(secure)
|
|
. += "securecrateg"
|
|
|
|
/obj/structure/closet/crate/attack_hand(mob/user, list/modifiers)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
if(manifest)
|
|
tear_manifest(user)
|
|
|
|
/obj/structure/closet/crate/after_open(mob/living/user, force)
|
|
. = ..()
|
|
RemoveElement(/datum/element/climbable, climb_time = crate_climb_time, climb_stun = 0)
|
|
AddElement(/datum/element/climbable, climb_time = crate_climb_time * 0.5, climb_stun = 0)
|
|
|
|
/obj/structure/closet/crate/after_close(mob/living/user, force)
|
|
. = ..()
|
|
RemoveElement(/datum/element/climbable, climb_time = crate_climb_time * 0.5, climb_stun = 0)
|
|
AddElement(/datum/element/climbable, climb_time = crate_climb_time, climb_stun = 0)
|
|
|
|
|
|
/obj/structure/closet/crate/open(mob/living/user, force = FALSE)
|
|
. = ..()
|
|
if(. && !QDELETED(manifest))
|
|
to_chat(user, span_notice("The manifest is torn off [src]."))
|
|
playsound(src, 'sound/items/poster_ripped.ogg', 75, TRUE)
|
|
manifest.forceMove(get_turf(src))
|
|
manifest = null
|
|
update_appearance()
|
|
|
|
/obj/structure/closet/crate/proc/tear_manifest(mob/user)
|
|
to_chat(user, span_notice("You tear the manifest off of [src]."))
|
|
playsound(src, 'sound/items/poster_ripped.ogg', 75, TRUE)
|
|
|
|
manifest.forceMove(loc)
|
|
if(ishuman(user))
|
|
user.put_in_hands(manifest)
|
|
manifest = null
|
|
update_appearance()
|
|
|
|
/obj/structure/closet/crate/coffin
|
|
name = "coffin"
|
|
desc = "It's a burial receptacle for the dearly departed."
|
|
icon_state = "coffin"
|
|
resistance_flags = FLAMMABLE
|
|
max_integrity = 70
|
|
material_drop = /obj/item/stack/sheet/mineral/wood
|
|
material_drop_amount = 5
|
|
open_sound = 'sound/machines/wooden_closet_open.ogg'
|
|
close_sound = 'sound/machines/wooden_closet_close.ogg'
|
|
open_sound_volume = 25
|
|
close_sound_volume = 50
|
|
can_install_electronics = FALSE
|
|
|
|
/obj/structure/closet/crate/maint
|
|
|
|
/obj/structure/closet/crate/maint/Initialize(mapload)
|
|
..()
|
|
|
|
var/static/list/possible_crates = RANDOM_CRATE_LOOT
|
|
|
|
var/crate_path = pick_weight(possible_crates)
|
|
|
|
var/obj/structure/closet/crate = new crate_path(loc)
|
|
crate.RegisterSignal(crate, COMSIG_CLOSET_POPULATE_CONTENTS, TYPE_PROC_REF(/obj/structure/closet/, populate_with_random_maint_loot))
|
|
if (prob(50))
|
|
crate.opened = TRUE
|
|
crate.update_appearance()
|
|
|
|
return INITIALIZE_HINT_QDEL
|
|
|
|
/obj/structure/closet/proc/populate_with_random_maint_loot()
|
|
SIGNAL_HANDLER
|
|
|
|
for (var/i in 1 to rand(2,6))
|
|
new /obj/effect/spawner/random/maintenance(src)
|
|
|
|
/obj/structure/closet/crate/trashcart/Initialize(mapload)
|
|
. = ..()
|
|
AddElement(/datum/element/swabable, CELL_LINE_TABLE_SLUDGE, CELL_VIRUS_TABLE_GENERIC, rand(2,3), 15)
|
|
|
|
/obj/structure/closet/crate/trashcart/filled
|
|
|
|
/obj/structure/closet/crate/trashcart/filled/Initialize(mapload)
|
|
. = ..()
|
|
if(mapload)
|
|
new /obj/effect/spawner/random/trash/grime(loc) //needs to be done before the trashcart is opened because it spawns things in a range outside of the trashcart
|
|
|
|
/obj/structure/closet/crate/trashcart/filled/PopulateContents()
|
|
. = ..()
|
|
for(var/i in 1 to rand(7,15))
|
|
new /obj/effect/spawner/random/trash/garbage(src)
|
|
if(prob(12))
|
|
new /obj/item/storage/bag/trash/filled(src)
|
|
|
|
/obj/structure/closet/crate/internals
|
|
desc = "An internals crate."
|
|
name = "internals crate"
|
|
icon_state = "o2crate"
|
|
|
|
/obj/structure/closet/crate/trashcart //please make this a generic cart path later after things calm down a little
|
|
desc = "A heavy, metal trashcart with wheels."
|
|
name = "trash cart"
|
|
icon_state = "trashcart"
|
|
can_install_electronics = FALSE
|
|
|
|
/obj/structure/closet/crate/trashcart/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE)
|
|
. = ..()
|
|
if(has_gravity())
|
|
playsound(src, 'sound/effects/roll.ogg', 100, TRUE)
|
|
|
|
/obj/structure/closet/crate/trashcart/laundry
|
|
name = "laundry cart"
|
|
desc = "A large cart for hauling around large amounts of laundry."
|
|
icon_state = "laundry"
|
|
|
|
/obj/structure/closet/crate/medical
|
|
desc = "A medical crate."
|
|
name = "medical crate"
|
|
icon_state = "medicalcrate"
|
|
|
|
/obj/structure/closet/crate/freezer
|
|
desc = "A freezer."
|
|
name = "freezer"
|
|
icon_state = "freezer"
|
|
|
|
//Snowflake organ freezer code
|
|
//Order is important, since we check source, we need to do the check whenever we have all the organs in the crate
|
|
|
|
/obj/structure/closet/crate/freezer/open(mob/living/user, force = FALSE)
|
|
toggle_organ_decay(src)
|
|
..()
|
|
|
|
/obj/structure/closet/crate/freezer/close()
|
|
..()
|
|
toggle_organ_decay(src)
|
|
|
|
/obj/structure/closet/crate/freezer/Destroy()
|
|
toggle_organ_decay(src)
|
|
return ..()
|
|
|
|
/obj/structure/closet/crate/freezer/Initialize(mapload)
|
|
. = ..()
|
|
toggle_organ_decay(src)
|
|
|
|
/obj/structure/closet/crate/freezer/blood
|
|
name = "blood freezer"
|
|
desc = "A freezer containing packs of blood."
|
|
|
|
/obj/structure/closet/crate/freezer/blood/PopulateContents()
|
|
. = ..()
|
|
new /obj/item/reagent_containers/blood(src)
|
|
new /obj/item/reagent_containers/blood(src)
|
|
new /obj/item/reagent_containers/blood/a_minus(src)
|
|
new /obj/item/reagent_containers/blood/b_minus(src)
|
|
new /obj/item/reagent_containers/blood/b_plus(src)
|
|
new /obj/item/reagent_containers/blood/o_minus(src)
|
|
new /obj/item/reagent_containers/blood/o_plus(src)
|
|
new /obj/item/reagent_containers/blood/lizard(src)
|
|
new /obj/item/reagent_containers/blood/ethereal(src)
|
|
for(var/i in 1 to 3)
|
|
new /obj/item/reagent_containers/blood/random(src)
|
|
|
|
/obj/structure/closet/crate/freezer/surplus_limbs
|
|
name = "surplus prosthetic limbs"
|
|
desc = "A crate containing an assortment of cheap prosthetic limbs."
|
|
|
|
/obj/structure/closet/crate/freezer/surplus_limbs/PopulateContents()
|
|
. = ..()
|
|
new /obj/item/bodypart/arm/left/robot/surplus(src)
|
|
new /obj/item/bodypart/arm/left/robot/surplus(src)
|
|
new /obj/item/bodypart/arm/right/robot/surplus(src)
|
|
new /obj/item/bodypart/arm/right/robot/surplus(src)
|
|
new /obj/item/bodypart/leg/left/robot/surplus(src)
|
|
new /obj/item/bodypart/leg/left/robot/surplus(src)
|
|
new /obj/item/bodypart/leg/right/robot/surplus(src)
|
|
new /obj/item/bodypart/leg/right/robot/surplus(src)
|
|
|
|
/obj/structure/closet/crate/radiation
|
|
desc = "A crate with a radiation sign on it."
|
|
name = "radiation crate"
|
|
icon_state = "radiation"
|
|
|
|
/obj/structure/closet/crate/hydroponics
|
|
name = "hydroponics crate"
|
|
desc = "All you need to destroy those pesky weeds and pests."
|
|
icon_state = "hydrocrate"
|
|
|
|
/obj/structure/closet/crate/engineering
|
|
name = "engineering crate"
|
|
icon_state = "engi_crate"
|
|
|
|
/obj/structure/closet/crate/engineering/electrical
|
|
icon_state = "engi_e_crate"
|
|
|
|
/obj/structure/closet/crate/rcd
|
|
desc = "A crate for the storage of an RCD."
|
|
name = "\improper RCD crate"
|
|
icon_state = "engi_crate"
|
|
|
|
/obj/structure/closet/crate/rcd/PopulateContents()
|
|
..()
|
|
for(var/i in 1 to 4)
|
|
new /obj/item/rcd_ammo(src)
|
|
new /obj/item/construction/rcd(src)
|
|
|
|
/obj/structure/closet/crate/science
|
|
name = "science crate"
|
|
desc = "A science crate."
|
|
icon_state = "scicrate"
|
|
|
|
/obj/structure/closet/crate/solarpanel_small
|
|
name = "budget solar panel crate"
|
|
icon_state = "engi_e_crate"
|
|
|
|
/obj/structure/closet/crate/solarpanel_small/PopulateContents()
|
|
..()
|
|
for(var/i in 1 to 13)
|
|
new /obj/item/solar_assembly(src)
|
|
new /obj/item/circuitboard/computer/solar_control(src)
|
|
new /obj/item/paper/guides/jobs/engi/solars(src)
|
|
new /obj/item/electronics/tracker(src)
|
|
|
|
/obj/structure/closet/crate/goldcrate
|
|
name = "gold crate"
|
|
|
|
/obj/structure/closet/crate/goldcrate/PopulateContents()
|
|
..()
|
|
new /obj/item/storage/belt/champion(src)
|
|
|
|
/obj/structure/closet/crate/goldcrate/populate_contents_immediate()
|
|
. = ..()
|
|
|
|
// /datum/objective_item/stack/gold
|
|
for(var/i in 1 to 3)
|
|
new /obj/item/stack/sheet/mineral/gold(src, 1, FALSE)
|
|
|
|
/obj/structure/closet/crate/silvercrate
|
|
name = "silver crate"
|
|
|
|
/obj/structure/closet/crate/silvercrate/PopulateContents()
|
|
..()
|
|
for(var/i in 1 to 5)
|
|
new /obj/item/coin/silver(src)
|
|
|
|
/obj/structure/closet/crate/decorations
|
|
icon_state = "engi_crate"
|
|
|
|
/obj/structure/closet/crate/decorations/PopulateContents()
|
|
. = ..()
|
|
for(var/i in 1 to 4)
|
|
new /obj/effect/spawner/random/decoration/generic(src)
|