mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-23 23:54:45 +00:00
## About The Pull Request It was bugging me how catwalks would just be stuck rendering on the game plane in order to be above the pipes and all the other underfloor objects, because it meant that they stood out due to being affected by ambient occlusion. So I decided to change that, and the best change I could come up with, was to refactor the logic of `/datum/element/undertile` in order to actually allow us to do exactly what we wanted by having three different states of underfloor visibility, which in turn allowed me to slap everything that wasn't accessible on the floor plane rather than whatever plane they were on, effectively making it so catwalk tiles wouldn't need to be on the game plane anymore. :) Also fixes https://github.com/tgstation/tgstation/issues/63590 while I'm at it :) ## Why It's Good For The Game Seeing ambient occlusion on catwalks make them stand out in a jarring way, now that won't be the case anymore! Now, instead, you get something like this, which _absolutely_ looks like it fits in!  ## Changelog 🆑 GoldenAlpharex refactor: Refactored the way the undertile component works, to allow it to have a bit more granularity as to when it's meant to be covered, but still visible, like for catwalks! fix: Catwalks no longer are affected by ambient occlusion, and now properly feel like actual floor tiles. /🆑
75 lines
2.3 KiB
Plaintext
75 lines
2.3 KiB
Plaintext
#define PROB_MOUSE_SPAWN 98
|
|
|
|
SUBSYSTEM_DEF(minor_mapping)
|
|
name = "Minor Mapping"
|
|
init_order = INIT_ORDER_MINOR_MAPPING
|
|
flags = SS_NO_FIRE
|
|
|
|
/datum/controller/subsystem/minor_mapping/Initialize()
|
|
#ifdef UNIT_TESTS // This whole subsystem just introduces a lot of odd confounding variables into unit test situations, so let's just not bother with doing an initialize here.
|
|
return SS_INIT_NO_NEED
|
|
#endif // the mice are easily the bigger problem, but let's just avoid anything that could cause some bullshit.
|
|
trigger_migration(CONFIG_GET(number/mice_roundstart))
|
|
place_satchels()
|
|
return SS_INIT_SUCCESS
|
|
|
|
/datum/controller/subsystem/minor_mapping/proc/trigger_migration(num_mice=10)
|
|
var/list/exposed_wires = find_exposed_wires()
|
|
|
|
var/mob/living/basic/mouse/mouse
|
|
var/turf/open/proposed_turf
|
|
|
|
|
|
while((num_mice > 0) && exposed_wires.len)
|
|
proposed_turf = pick_n_take(exposed_wires)
|
|
|
|
if(!istype(proposed_turf))
|
|
continue
|
|
|
|
if(prob(PROB_MOUSE_SPAWN))
|
|
if(!mouse)
|
|
mouse = new(proposed_turf)
|
|
else
|
|
mouse.forceMove(proposed_turf)
|
|
else
|
|
mouse = new /mob/living/simple_animal/hostile/regalrat/controlled(proposed_turf)
|
|
if(proposed_turf.air.has_gas(/datum/gas/oxygen, 5))
|
|
num_mice -= 1
|
|
mouse = 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.underfloor_accessibility)
|
|
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(T.is_blocked_turf())
|
|
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/turf/detected_turf as anything in block(locate(1,1,z), locate(world.maxx,world.maxy,z)))
|
|
if(isfloorturf(detected_turf) && detected_turf.underfloor_accessibility == UNDERFLOOR_HIDDEN)
|
|
suitable += detected_turf
|
|
|
|
return shuffle(suitable)
|
|
|
|
#undef PROB_MOUSE_SPAWN
|