mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-09 00:13:55 +00:00
* Station Trait: Spider Infestation (#73893) ## About The Pull Request Hate having your cables eaten by mice? Nanotrasen have heard your complaints and settled on a natural, _organic_, and eco-friendly solution. When this station trait is active, roundstart and event mouse spawns have a chance to instead be replaced with duct spiders (both will exist, it doesn't remove mice). Duct spiders are largely harmless to humans, actively hunt other maintenance creatures (such as mice), and have only one _tiny_ downside.  These mobs can also sometimes be spawned by a minor scrubber clog event. As a side note, all spider basic mobs with AI (except Araneus) will now try to automatically fill a small area around them with webs. Also I made it so that mobs will ignore their random_walking behaviour if they're engaged in a `do_after`, just in case. ## Why It's Good For The Game Adds a little bit of variety to things which can slightly annoy you in maintenance. Spiders will automatically make places they live in look like spiders live there. ## Changelog 🆑 add: A station trait which sometimes populates maintenance with small spiders. You can wear them as a hat if you wanted to have a spider on your head for some reason. add: Spider mobs will automatically start webbing up their environment. /🆑 * Station Trait: Spider Infestation --------- Co-authored-by: Jacquerel <hnevard@gmail.com>
84 lines
3.0 KiB
Plaintext
84 lines
3.0 KiB
Plaintext
#define PROB_MOUSE_SPAWN 98
|
|
#define PROB_SPIDER_REPLACEMENT 50
|
|
|
|
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
|
|
|
|
/// 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--
|
|
if(HAS_TRAIT(SSstation, STATION_TRAIT_SPIDER_INFESTATION) && prob(PROB_SPIDER_REPLACEMENT))
|
|
new /mob/living/basic/giant_spider/maintenance(proposed_turf)
|
|
return
|
|
|
|
if (prob(PROB_MOUSE_SPAWN))
|
|
new /mob/living/basic/mouse(proposed_turf)
|
|
else
|
|
new /mob/living/simple_animal/hostile/regalrat/controlled(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(amount=10)
|
|
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)
|
|
|
|
while(turfs.len && 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)
|
|
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
|
|
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 Z_TURFS(z))
|
|
if(isfloorturf(detected_turf) && detected_turf.underfloor_accessibility == UNDERFLOOR_HIDDEN)
|
|
suitable += detected_turf
|
|
|
|
return shuffle(suitable)
|
|
|
|
#undef PROB_MOUSE_SPAWN
|
|
#undef PROB_SPIDER_REPLACEMENT
|