mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-01 20:42:08 +00:00
🆑 tweak: Ducts can now be hidden under tiles code: tile hiding is now an element and way cooler and sexier /🆑 Ducts can now be hidden under tiles Plumbing machinery connects can now be hidden aswell Plumbing can now also be properly mapped in without breaking anything Plumbing component now uses the normal overlay systeem instead of being a weird exception You can now add the /datum/element/undertile element to instantly make something hidable under tiles when appropriate.
60 lines
1.6 KiB
Plaintext
60 lines
1.6 KiB
Plaintext
SUBSYSTEM_DEF(minor_mapping)
|
|
name = "Minor Mapping"
|
|
init_order = INIT_ORDER_MINOR_MAPPING
|
|
flags = SS_NO_FIRE
|
|
|
|
/datum/controller/subsystem/minor_mapping/Initialize(timeofday)
|
|
trigger_migration(CONFIG_GET(number/mice_roundstart))
|
|
place_satchels()
|
|
return ..()
|
|
|
|
/datum/controller/subsystem/minor_mapping/proc/trigger_migration(num_mice=10)
|
|
var/list/exposed_wires = find_exposed_wires()
|
|
|
|
var/mob/living/simple_animal/mouse/M
|
|
var/turf/proposed_turf
|
|
|
|
while((num_mice > 0) && exposed_wires.len)
|
|
proposed_turf = pick_n_take(exposed_wires)
|
|
if(!M)
|
|
M = new(proposed_turf)
|
|
else
|
|
M.forceMove(proposed_turf)
|
|
if(M.environment_air_is_safe())
|
|
num_mice -= 1
|
|
M = null
|
|
|
|
/datum/controller/subsystem/minor_mapping/proc/place_satchels(amount=10)
|
|
var/list/turfs = find_satchel_suitable_turfs()
|
|
|
|
while(turfs.len && amount > 0)
|
|
var/turf/T = pick_n_take(turfs)
|
|
var/obj/item/storage/backpack/satchel/flat/F = new(T)
|
|
|
|
SEND_SIGNAL(F, COMSIG_OBJ_HIDE, T.intact)
|
|
amount--
|
|
|
|
/proc/find_exposed_wires()
|
|
var/list/exposed_wires = list()
|
|
|
|
var/list/all_turfs
|
|
for(var/z in SSmapping.levels_by_trait(ZTRAIT_STATION))
|
|
all_turfs += block(locate(1,1,z), locate(world.maxx,world.maxy,z))
|
|
for(var/turf/open/floor/plating/T in all_turfs)
|
|
if(is_blocked_turf(T))
|
|
continue
|
|
if(locate(/obj/structure/cable) in T)
|
|
exposed_wires += T
|
|
|
|
return shuffle(exposed_wires)
|
|
|
|
/proc/find_satchel_suitable_turfs()
|
|
var/list/suitable = list()
|
|
|
|
for(var/z in SSmapping.levels_by_trait(ZTRAIT_STATION))
|
|
for(var/t in block(locate(1,1,z), locate(world.maxx,world.maxy,z)))
|
|
if(isfloorturf(t) && !isplatingturf(t))
|
|
suitable += t
|
|
|
|
return shuffle(suitable)
|