Files
+37 21b4095dfd [MDB IGNORE] [IDB IGNORE] Upstream Sync - 04/17/2026 (#5453)
Upstream 04/17/2026

fixes https://github.com/Bubberstation/Bubberstation/issues/5549

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com>
Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com>
Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com>
Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com>
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com>
Co-authored-by: loganuk <fakeemail123@aol.com>
Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com>
Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com>
Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com>
Co-authored-by: Lucy <lucy@absolucy.moe>
Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com>
Co-authored-by: Isratosh <Isratosh@hotmail.com>
Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com>
Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com>
Co-authored-by: Alexander V. <volas@ya.ru>
Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com>
Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Tim <timothymtorres@gmail.com>
Co-authored-by: Iamgoofball <iamgoofball@gmail.com>
Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com>
Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com>
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com>
Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com>
Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com>
Co-authored-by: Josh <josh.adam.powell@gmail.com>
Co-authored-by: Josh Powell <josh.powell@softwire.com>
Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com>
Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com>
Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com>
Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
2026-05-16 00:56:00 +02:00

156 lines
5.5 KiB
Plaintext

/*
This is the decay subsystem that is run once at startup.
These procs are incredibly expensive and should only really be run once. That's why the only run once.
*/
#define WALL_RUST_PERCENT_CHANCE 15
#define FLOOR_DIRT_PERCENT_CHANCE 15
#define FLOOR_BLOOD_PERCENT_CHANCE 1
#define FLOOR_VOMIT_PERCENT_CHANCE 1
#define FLOOR_OIL_PERCENT_CHANCE 5
#define FLOOR_TILE_MISSING_PERCENT_CHANCE 1
#define FLOOR_COBWEB_PERCENT_CHANCE 1
#define NEST_PERCENT_CHANCE 1
SUBSYSTEM_DEF(decay)
name = "Decay System"
ss_flags = SS_NO_FIRE
dependencies = list(
/datum/controller/subsystem/mapping,
/datum/controller/subsystem/atoms,
)
/// This is used to determine what maps we should not spawn on.
var/list/station_filter = list("Catwalk Station", "Runtime Station", "MultiZ Debug", "Gateway Test")
var/list/possible_turfs = list()
var/list/possible_areas = list()
var/severity_modifier = 1
var/list/possible_nests = list(
/obj/structure/mob_spawner/spiders,
/obj/structure/mob_spawner/bush,
/obj/structure/mob_spawner/beehive,
/obj/structure/mob_spawner/rats
)
/datum/controller/subsystem/decay/Initialize()
if(CONFIG_GET(flag/ssdecay_disabled))
message_admins("SSDecay was disabled in config.")
log_world("SSDecay was disabled in config.")
return SS_INIT_NO_NEED
if(SSmapping.current_map.map_name in station_filter)
message_admins("SSDecay was disabled due to map filter.")
log_world("SSDecay was disabled due to map filter.")
return SS_INIT_NO_NEED
for(var/area/iterating_area as anything in GLOB.areas)
if(!is_station_level(iterating_area.z))
continue
possible_areas += iterating_area
// Now add the turfs
for(var/list/zlevel_turfs as anything in iterating_area.get_zlevel_turf_lists())
for(var/turf/area_turf as anything in zlevel_turfs)
if(!(area_turf.flags_1 & CAN_BE_DIRTY_1))
continue
possible_turfs += area_turf
if(!possible_turfs)
CRASH("SSDecay had no possible turfs to use!")
var/severity_modifier = CONFIG_GET(number/ssdecay_intensity)
if(!severity_modifier || severity_modifier == 5)
severity_modifier = rand(1, 4)
message_admins("SSDecay severity modifier set to [severity_modifier]")
log_world("SSDecay severity modifier set to [severity_modifier]")
do_common()
do_maintenance()
do_engineering()
do_medical()
return SS_INIT_SUCCESS
/datum/controller/subsystem/decay/proc/do_common()
for(var/turf/open/floor/iterating_floor in possible_turfs)
if(iterating_floor.turf_flags & CAN_DECAY_BREAK_1)
if(prob(FLOOR_TILE_MISSING_PERCENT_CHANCE * severity_modifier) && prob(60))
iterating_floor.break_tile_to_plating()
if(prob(FLOOR_DIRT_PERCENT_CHANCE * severity_modifier))
new /obj/effect/decal/cleanable/dirt(iterating_floor)
if(prob(FLOOR_DIRT_PERCENT_CHANCE * severity_modifier))
new /obj/effect/decal/cleanable/dirt(iterating_floor)
for(var/turf/closed/iterating_wall in possible_turfs)
if(HAS_TRAIT(iterating_wall, TRAIT_RUSTY))
continue
if(prob(WALL_RUST_PERCENT_CHANCE * severity_modifier))
iterating_wall.AddElement(/datum/element/rust)
/datum/controller/subsystem/decay/proc/do_maintenance()
for(var/area/station/maintenance/iterating_maintenance in possible_areas)
for(var/turf/open/iterating_floor in iterating_maintenance)
if(prob(FLOOR_BLOOD_PERCENT_CHANCE * severity_modifier))
var/obj/effect/decal/cleanable/blood/spawned_blood = new (iterating_floor)
spawned_blood.dry()
if(!iterating_floor.Enter(spawned_blood))
qdel(spawned_blood) //No blood under windows.
if(prob(FLOOR_COBWEB_PERCENT_CHANCE * severity_modifier))
var/obj/structure/spider/stickyweb/spawned_web = new (iterating_floor)
if(!iterating_floor.Enter(spawned_web))
qdel(spawned_web)
if(!CONFIG_GET(flag/ssdecay_disable_nests) && prob(NEST_PERCENT_CHANCE * severity_modifier) && prob(50))
var/spawner_to_spawn = pick(possible_nests)
var/obj/structure/mob_spawner/spawned_spawner = new spawner_to_spawn(iterating_floor)
if(!iterating_floor.Enter(spawned_spawner))
qdel(spawned_spawner)
/datum/controller/subsystem/decay/proc/do_engineering()
for(var/area/station/engineering/iterating_engineering in possible_areas)
for(var/turf/open/iterating_floor in iterating_engineering)
if(prob(FLOOR_BLOOD_PERCENT_CHANCE * severity_modifier))
var/obj/effect/decal/cleanable/blood/spawned_blood = new (iterating_floor)
spawned_blood.dry()
if(!iterating_floor.Enter(spawned_blood))
qdel(spawned_blood)
if(prob(FLOOR_OIL_PERCENT_CHANCE * severity_modifier))
var/obj/effect/decal/cleanable/blood/oil/spawned_oil = new (iterating_floor)
if(!iterating_floor.Enter(spawned_oil))
qdel(spawned_oil)
/datum/controller/subsystem/decay/proc/do_medical()
for(var/area/station/medical/iterating_medical in possible_areas)
for(var/turf/open/iterating_floor in iterating_medical)
if(prob(FLOOR_BLOOD_PERCENT_CHANCE * severity_modifier))
var/obj/effect/decal/cleanable/blood/spawned_blood = new (iterating_floor)
spawned_blood.dry()
if(!iterating_floor.Enter(spawned_blood))
qdel(spawned_blood)
if(prob(FLOOR_VOMIT_PERCENT_CHANCE * severity_modifier))
var/obj/effect/decal/cleanable/vomit/spawned_vomit = new (iterating_floor)
if(!iterating_floor.Enter(spawned_vomit))
qdel(spawned_vomit)
#undef WALL_RUST_PERCENT_CHANCE
#undef FLOOR_DIRT_PERCENT_CHANCE
#undef FLOOR_BLOOD_PERCENT_CHANCE
#undef FLOOR_VOMIT_PERCENT_CHANCE
#undef FLOOR_OIL_PERCENT_CHANCE
#undef FLOOR_TILE_MISSING_PERCENT_CHANCE
#undef FLOOR_COBWEB_PERCENT_CHANCE
#undef NEST_PERCENT_CHANCE