Skip to content

Commit

Permalink
Merge pull request #5775 from Trilbyspaceclone/map_reduction
Browse files Browse the repository at this point in the history
map reduction and locker post spawning
  • Loading branch information
Trilbyspaceclone authored Oct 23, 2024
2 parents e50b170 + beb0582 commit cd56791
Show file tree
Hide file tree
Showing 28 changed files with 3,395 additions and 7,874 deletions.
5 changes: 5 additions & 0 deletions code/game/machinery/smelter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
/*if(istype(O, /obj/structure/scrap_cube))
current_item = O
return*/
if(istype(O, /obj/structure/closet))
var/obj/structure/closet/C = O
C.populate_contents()

var/list/materials = result_materials(O)
if(!materials?.len || !are_valid_materials(materials))
eject(O, refuse_output_side)
Expand Down Expand Up @@ -200,6 +204,7 @@
if(T.density)
return
O.loc = T
O.reset_plane_and_layer()

/obj/machinery/smelter/proc/eject_material_stack(material)
var/obj/item/stack/material/stack_type = material_stack_type(material)
Expand Down
36 changes: 25 additions & 11 deletions code/game/objects/structures/crates_lockers/closets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
var/has_mobs_to_spawn = FALSE
var/chance_old_mobs = 20
var/mobs_to_spawn = /obj/random/cluster/roaches
var/populated_contents = FALSE

/obj/structure/closet/can_prevent_fall()
return TRUE

/obj/structure/closet/Initialize(mapload)
..()

populate_contents()
update_icon()
hack_require = rand(6,8)

Expand Down Expand Up @@ -95,6 +95,7 @@
storage_capacity = content_size + 5

/obj/structure/closet/Destroy()
populate_contents()
dump_contents()
. = ..()

Expand All @@ -106,16 +107,19 @@
for(var/obj/item/I in src.contents)
if(!I.anchored)
content_size += CEILING(I.w_class * 0.5, 1)
if(!content_size)
to_chat(user, "It is empty.")
else if(storage_capacity > content_size*4)
to_chat(user, "It is barely filled.")
else if(storage_capacity > content_size*2)
to_chat(user, "It is less than half full.")
else if(storage_capacity > content_size)
to_chat(user, "There is still some free space.")
if(populated_contents)
if(!content_size)
to_chat(user, "It is empty.")
else if(storage_capacity > content_size*4)
to_chat(user, "It is barely filled.")
else if(storage_capacity > content_size*2)
to_chat(user, "It is less than half full.")
else if(storage_capacity > content_size)
to_chat(user, "There is still some free space.")
else
to_chat(user, "It is full.")
else
to_chat(user, "It is full.")
to_chat(user, "It's hard to tell how full [src] is.")

/obj/structure/closet/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0 || wall_mounted)) return 1
Expand Down Expand Up @@ -204,6 +208,8 @@
if(opened || !can_open(user))
return FALSE

populate_contents()

if(rigged && (locate(/obj/item/device/radio/electropack) in src) && istype(user))
if(user.electrocute_act(20, src))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
Expand Down Expand Up @@ -336,6 +342,7 @@

// this should probably use dump_contents()
/obj/structure/closet/ex_act(severity)
populate_contents()
switch(severity)
if(1)
for(var/atom/movable/A as mob|obj in src)//pulls everything out of the locker and hits it with an explosion
Expand All @@ -355,10 +362,13 @@
health -= 50

/obj/structure/closet/proc/populate_contents()
return
populated_contents = TRUE
if(populated_contents)
return FALSE

/obj/structure/closet/proc/damage(var/damage)
health -= damage
populate_contents()
if(health <= 0)
qdel(src)

Expand Down Expand Up @@ -563,6 +573,7 @@
// tk grab then use on self
/obj/structure/closet/attack_self_tk(mob/user as mob)
src.add_fingerprint(user)
populate_contents()
if(!src.toggle())
to_chat(usr, SPAN_NOTICE("It won't budge!"))

Expand All @@ -571,6 +582,7 @@
locked = FALSE
broken = TRUE
update_icon()
populate_contents()
playsound(src.loc, "sparks", 60, 1)
to_chat(user, SPAN_NOTICE("You unlock \the [src]."))
return TRUE
Expand All @@ -586,6 +598,7 @@
playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1)
broken = TRUE
update_icon()
populate_contents()
..()

/obj/structure/closet/verb/verb_toggleopen()
Expand Down Expand Up @@ -705,6 +718,7 @@
/obj/structure/closet/proc/break_open()
welded = 0
update_icon()
populate_contents()
//Do this to prevent contents from being opened into nullspace (read: bluespace)
if(istype(loc, /obj/structure/bigDelivery))
var/obj/structure/bigDelivery/BD = loc
Expand Down
21 changes: 21 additions & 0 deletions code/game/objects/structures/crates_lockers/closets/fitness.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
icon_door = "mixed"

/obj/structure/closet/athletic_mixed/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/under/shorts/athleticgrey(src)
new /obj/item/clothing/under/shorts/athleticblack(src)
new /obj/item/clothing/under/shorts(src)
Expand All @@ -27,6 +30,9 @@
desc = "It's a storage unit for gloves for use in the boxing ring."

/obj/structure/closet/boxinggloves/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/gloves/boxing/blue(src)
new /obj/item/clothing/gloves/boxing/green(src)
new /obj/item/clothing/gloves/boxing/yellow(src)
Expand All @@ -37,6 +43,9 @@
desc = "IT'S A STORAGE UNIT FOR FIGHTER MASKS OLE!"

/obj/structure/closet/masks/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/mask/costume/job/luchador(src)
new /obj/item/clothing/mask/costume/job/luchador/rudos(src)
new /obj/item/clothing/mask/costume/job/luchador/tecnicos(src)
Expand All @@ -47,6 +56,9 @@
icon_door = "red"

/obj/structure/closet/lasertag/red/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/gun/energy/lasertag/red(src)
new /obj/item/gun/energy/lasertag/red(src)
new /obj/item/gun/energy/lasertag/red(src)
Expand Down Expand Up @@ -78,6 +90,9 @@
icon_door = "blue"

/obj/structure/closet/lasertag/blue/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/gun/energy/lasertag/blue(src)
new /obj/item/gun/energy/lasertag/blue(src)
new /obj/item/gun/energy/lasertag/blue(src)
Expand Down Expand Up @@ -109,6 +124,9 @@
icon_door = "green"

/obj/structure/closet/lasertag/green/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/gun/energy/lasertag/green(src)
new /obj/item/gun/energy/lasertag/green(src)
new /obj/item/gun/energy/lasertag/green(src)
Expand Down Expand Up @@ -140,6 +158,9 @@
icon_door = "yellow"

/obj/structure/closet/lasertag/yellow/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/gun/energy/lasertag/yellow(src)
new /obj/item/gun/energy/lasertag/yellow(src)
new /obj/item/gun/energy/lasertag/yellow(src)
Expand Down
13 changes: 12 additions & 1 deletion code/game/objects/structures/crates_lockers/closets/gimmick.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
icon_state = "syndicate"

/obj/structure/closet/gimmick/russian/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/head/ushanka(src)
new /obj/item/clothing/head/ushanka(src)
new /obj/item/clothing/head/ushanka(src)
Expand All @@ -34,12 +37,17 @@
anchored = 1

/obj/structure/closet/thunderdome/New()
..()
if(populated_contents)
return
populated_contents = TRUE

/obj/structure/closet/thunderdome/tdred
name = "red-team Thunderdome closet"

/obj/structure/closet/thunderdome/tdred/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/suit/armor/heavy/red(src)
new /obj/item/clothing/suit/armor/heavy/red(src)
new /obj/item/clothing/suit/armor/heavy/red(src)
Expand All @@ -64,6 +72,9 @@
icon_state = "syndicate"

/obj/structure/closet/thunderdome/tdgreen/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/suit/armor/heavy/green(src)
new /obj/item/clothing/suit/armor/heavy/green(src)
new /obj/item/clothing/suit/armor/heavy/green(src)
Expand Down
15 changes: 15 additions & 0 deletions code/game/objects/structures/crates_lockers/closets/job_closets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
icon_door = "black"

/obj/structure/closet/gmcloset/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/head/tophat(src)
new /obj/item/clothing/head/tophat(src)
new /obj/item/device/radio/headset/headset_service(src)
Expand All @@ -37,6 +40,9 @@
icon_door = "black"

/obj/structure/closet/chefcloset/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/under/costume/job/waiter(src)
new /obj/item/clothing/under/costume/job/waiter(src)
new /obj/item/clothing/under/rank/bartender(src)
Expand All @@ -62,6 +68,9 @@
icon_door = "mixed"

/obj/structure/closet/jcloset/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
if(prob(50))
new /obj/item/storage/backpack/sport/purple(src)
else
Expand Down Expand Up @@ -94,6 +103,9 @@
icon_state = "custodian"

/obj/structure/closet/custodial/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/storage/belt/utility/neotheology(src)
new /obj/item/device/lighting/toggleable/flashlight(src)
new /obj/item/gun/matter/launcher/nt_sprayer(src)
Expand All @@ -118,6 +130,9 @@
icon_state = "acolyte"

/obj/structure/closet/acolyte/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
if(prob(25))
new /obj/item/storage/backpack/neotheology(src)
else if(prob(25))
Expand Down
18 changes: 18 additions & 0 deletions code/game/objects/structures/crates_lockers/closets/l3closet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
icon_state = "bio"

/obj/structure/closet/l3closet/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/suit/bio_suit/general(src)
new /obj/item/clothing/head/bio_hood/general(src)

/obj/structure/closet/l3closet/general

/obj/structure/closet/l3closet/general/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/suit/bio_suit/general(src)
new /obj/item/clothing/head/bio_hood/general(src)
new /obj/item/reagent_containers/spray/sterilizine(src)
Expand All @@ -18,6 +24,9 @@
icon_door = "bio_viro"

/obj/structure/closet/l3closet/virology/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/suit/bio_suit/virology(src)
new /obj/item/clothing/head/bio_hood/virology(src)
new /obj/item/clothing/mask/breath(src)
Expand All @@ -28,18 +37,27 @@
icon_door = "bio_sec"

/obj/structure/closet/l3closet/security/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/suit/bio_suit/security(src)
new /obj/item/clothing/head/bio_hood/security(src)

/obj/structure/closet/l3closet/janitor
icon_door = "bio_jan"

/obj/structure/closet/l3closet/janitor/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/suit/bio_suit/janitor(src)
new /obj/item/clothing/head/bio_hood/janitor(src)

/obj/structure/closet/l3closet/scientist

/obj/structure/closet/l3closet/scientist/populate_contents()
if(populated_contents)
return
populated_contents = TRUE
new /obj/item/clothing/suit/bio_suit/scientist(src)
new /obj/item/clothing/head/bio_hood/scientist(src)
Loading

0 comments on commit cd56791

Please sign in to comment.