mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-10 07:41:16 +01:00
21b4095dfd
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>
134 lines
4.6 KiB
Plaintext
134 lines
4.6 KiB
Plaintext
#define PROB_SPIDER_REPLACEMENT 50
|
|
|
|
SUBSYSTEM_DEF(minor_mapping)
|
|
name = "Minor Mapping"
|
|
dependencies = list(
|
|
/datum/controller/subsystem/mapping,
|
|
/datum/controller/subsystem/atoms,
|
|
)
|
|
ss_flags = SS_NO_FIRE
|
|
///a list of vermin we pick from to spawn.
|
|
var/list/vermin_chances = list(
|
|
/mob/living/basic/mouse = 72,
|
|
/mob/living/basic/snail = 16,
|
|
/mob/living/basic/stoat = 10,
|
|
/mob/living/basic/regal_rat/controlled = 2,
|
|
)
|
|
|
|
/datum/controller/subsystem/minor_mapping/Initialize()
|
|
// 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.
|
|
#if defined(MAP_TEST) || defined(UNIT_TESTS)
|
|
return SS_INIT_NO_NEED
|
|
#else
|
|
trigger_migration(CONFIG_GET(number/mice_roundstart))
|
|
place_satchels(satchel_amount = 2)
|
|
var/weakpoint_spawns = 3
|
|
if(HAS_TRAIT(SSstation, STATION_TRAIT_SPAWN_WEAKPOINTS))
|
|
weakpoint_spawns = rand(4,8)
|
|
|
|
weakpoint_spawns += SSmapping.current_map.bonus_weakpoints //This will add 0 by default, or additional on large maps where it's included in the config.
|
|
place_weakpoints(weakpoint_spawns)
|
|
return SS_INIT_SUCCESS
|
|
#endif
|
|
|
|
/// Spawns some critters on exposed wires, usually but not always mice
|
|
/datum/controller/subsystem/minor_mapping/proc/trigger_migration(to_spawn=10)
|
|
var/list/exposed_wires = find_exposed_wires()
|
|
var/turf/open/proposed_turf
|
|
while((to_spawn > 0) && exposed_wires.len)
|
|
proposed_turf = pick_n_take(exposed_wires)
|
|
if (!valid_mouse_turf(proposed_turf))
|
|
continue
|
|
|
|
to_spawn--
|
|
|
|
var/picked_path
|
|
if(HAS_TRAIT(SSstation, STATION_TRAIT_SPIDER_INFESTATION) && prob(PROB_SPIDER_REPLACEMENT))
|
|
picked_path = /mob/living/basic/spider/maintenance
|
|
else
|
|
picked_path = pick_weight(vermin_chances)
|
|
|
|
new picked_path(proposed_turf)
|
|
|
|
/// Returns true if a mouse won't die if spawned on this turf
|
|
/datum/controller/subsystem/minor_mapping/proc/valid_mouse_turf(turf/open/proposed_turf)
|
|
if(!istype(proposed_turf))
|
|
return FALSE
|
|
var/datum/gas_mixture/turf/turf_gasmix = proposed_turf.air
|
|
var/turf_temperature = proposed_turf.temperature
|
|
return turf_gasmix.has_gas(/datum/gas/oxygen, 5) && turf_temperature < NPC_DEFAULT_MAX_TEMP && turf_temperature > NPC_DEFAULT_MIN_TEMP
|
|
|
|
/datum/controller/subsystem/minor_mapping/proc/place_satchels(satchel_amount)
|
|
var/list/turfs = find_satchel_suitable_turfs()
|
|
///List of areas where satchels should not be placed.
|
|
var/list/blacklisted_area_types = list(
|
|
/area/station/holodeck,
|
|
/area/space/nearstation,
|
|
/area/station/solars,
|
|
)
|
|
|
|
while(turfs.len && satchel_amount > 0)
|
|
var/turf/turf = pick_n_take(turfs)
|
|
if(is_type_in_list(get_area(turf), blacklisted_area_types))
|
|
continue
|
|
var/obj/item/storage/backpack/satchel/flat/flat_satchel = new(turf)
|
|
|
|
SEND_SIGNAL(flat_satchel, COMSIG_OBJ_HIDE, turf.underfloor_accessibility)
|
|
satchel_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 += Z_TURFS(z)
|
|
for(var/turf/open/floor/plating/T in all_turfs)
|
|
if(T.is_blocked_turf())
|
|
continue
|
|
//dont include multiz cables in the list because repairing them sucks
|
|
var/cable = locate(/obj/structure/cable) in T
|
|
if(cable && !istype(cable, /obj/structure/cable/multilayer/multiz))
|
|
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 Z_TURFS(z))
|
|
if(isfloorturf(detected_turf) && detected_turf.underfloor_accessibility == UNDERFLOOR_HIDDEN)
|
|
suitable += detected_turf
|
|
|
|
return shuffle(suitable)
|
|
|
|
/// This behaves nearly the same as spawning underfloot satchels, but instead spawns weakpoints.
|
|
/datum/controller/subsystem/minor_mapping/proc/place_weakpoints(weakpoint_amount)
|
|
if(weakpoint_amount == 0)
|
|
return
|
|
var/list/turfs = find_satchel_suitable_turfs()
|
|
///List of areas where weakpoints should not be placed.
|
|
var/list/blacklisted_area_types = get_blacklist_areas() + /area/station/maintenance
|
|
while(turfs.len && weakpoint_amount > 0)
|
|
var/turf/turf = pick_n_take(turfs)
|
|
if(is_type_in_list(get_area(turf), blacklisted_area_types))
|
|
continue
|
|
var/obj/effect/weakpoint/new_point = new(turf)
|
|
SEND_SIGNAL(new_point, COMSIG_OBJ_HIDE, turf.underfloor_accessibility)
|
|
weakpoint_amount--
|
|
|
|
/**
|
|
* Areas for minor_mapping procs to avoid. Mutate or adjust based on use case.
|
|
*/
|
|
/datum/controller/subsystem/minor_mapping/proc/get_blacklist_areas()
|
|
var/list/blacklist_areas = list(
|
|
/area/station/holodeck,
|
|
/area/space/nearstation,
|
|
/area/station/solars,
|
|
)
|
|
return blacklist_areas
|
|
|
|
|
|
#undef PROB_SPIDER_REPLACEMENT
|