From da0016adaf2c5d5b4cb880a05c10491f9ed968d2 Mon Sep 17 00:00:00 2001 From: Archie Date: Sat, 12 Jun 2021 06:59:48 -0300 Subject: [PATCH] Even more hideous logic --- .../dynamic/dynamic_rulesets_events.dm | 19 +++ hyperstation/code/mobs/mimic.dm | 112 +++++++++++------- 2 files changed, 87 insertions(+), 44 deletions(-) diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_events.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_events.dm index df980539..3d761aa0 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_events.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_events.dm @@ -147,6 +147,25 @@ occurances_max = 2 chaos_min = 1.5 +////////////////////////////////////////////// +// // +// MIMICS // +// // +////////////////////////////////////////////// + +/datum/dynamic_ruleset/event/mimics + name = "Mimic Infestation" + typepath = /datum/round_event/mimic_infestation + enemy_roles = list("AI","Security Officer","Head of Security","Captain") + required_enemies = list(3,2,2,2,2,1,1,1,0,0) + weight = 2 + cost = 5 + requirements = list(101,20,15,10,10,10,10,10,10,10) + high_population_requirement = 15 + earliest_start = 30 MINUTES + occurances_max = 2 + chaos_min = 1.5 + ////////////////////////////////////////////// // // // CLOGGED VENTS // diff --git a/hyperstation/code/mobs/mimic.dm b/hyperstation/code/mobs/mimic.dm index f5a89900..2edf6f26 100644 --- a/hyperstation/code/mobs/mimic.dm +++ b/hyperstation/code/mobs/mimic.dm @@ -10,7 +10,7 @@ maxHealth = 38 health = 38 turns_per_move = 5 - move_to_delay = 2 + move_to_delay = 1 speed = 0 see_in_dark = 6 pass_flags = PASSTABLE @@ -35,6 +35,10 @@ pressure_resistance = 600 var/unstealth = FALSE var/knockdown_people = 1 + var/static/mimic_blacklisted_transform_items = typecacheof(list( + /obj/item/projectile, + /obj/item/radio/intercom)) + var/turns_since_notarget /mob/living/simple_animal/hostile/hs13mimic/Initialize() . = ..() @@ -46,6 +50,52 @@ . = ..() trigger() +/mob/living/simple_animal/hostile/hs13mimic/Life() + . = ..() + turns_since_notarget++ + if(turns_since_notarget >= 5) + turns_since_notarget = 0 + if(unstealth && (!target || isdead(target))) + target = null + trytftorandomobject() + +/mob/living/simple_animal/hostile/hs13mimic/AttackingTarget() + . = ..() + if(knockdown_people && . && prob(15) && iscarbon(target)) + var/mob/living/carbon/C = target + C.Knockdown(40) + C.visible_message("\The [src] knocks down \the [C]!", \ + "\The [src] knocks you down!") + +/mob/living/simple_animal/hostile/hs13mimic/adjustHealth(amount, updating_health = TRUE, forced = FALSE) + trigger() + . = ..() + +/mob/living/simple_animal/hostile/hs13mimic/FindTarget() + . = ..() + if(.) + trigger() + else if(!target && unstealth) + trytftorandomobject() + +/mob/living/simple_animal/hostile/hs13mimic/death(gibbed) + restore() + . = ..() + +/mob/living/simple_animal/hostile/hs13mimic/med_hud_set_health() + if(!unstealth) + var/image/holder = hud_list[HEALTH_HUD] + holder.icon_state = null + return //we hide medical hud while morphed + ..() + +/mob/living/simple_animal/hostile/hs13mimic/med_hud_set_status() + if(!unstealth) + var/image/holder = hud_list[STATUS_HUD] + holder.icon_state = null + return //we hide medical hud while morphed + ..() + /mob/living/simple_animal/hostile/hs13mimic/proc/Mimictransform() //The list of default things to transform needs to be bigger, consider this in the future. var/transformitem = rand(1,100) medhudupdate() @@ -114,43 +164,6 @@ else restore() -/mob/living/simple_animal/hostile/hs13mimic/AttackingTarget() - . = ..() - if(knockdown_people && . && prob(15) && iscarbon(target)) - var/mob/living/carbon/C = target - C.Knockdown(40) - C.visible_message("\The [src] knocks down \the [C]!", \ - "\The [src] knocks you down!") - -/mob/living/simple_animal/hostile/hs13mimic/adjustHealth(amount, updating_health = TRUE, forced = FALSE) - trigger() - . = ..() - -/mob/living/simple_animal/hostile/hs13mimic/FindTarget() - . = ..() - if(.) - trigger() - else if(!target && unstealth) - trytftorandomobject() - -/mob/living/simple_animal/hostile/hs13mimic/death(gibbed) - restore() - . = ..() - -/mob/living/simple_animal/hostile/hs13mimic/med_hud_set_health() - if(!unstealth) - var/image/holder = hud_list[HEALTH_HUD] - holder.icon_state = null - return //we hide medical hud while morphed - ..() - -/mob/living/simple_animal/hostile/hs13mimic/med_hud_set_status() - if(!unstealth) - var/image/holder = hud_list[STATUS_HUD] - holder.icon_state = null - return //we hide medical hud while morphed - ..() - /mob/living/simple_animal/hostile/hs13mimic/proc/medhudupdate() med_hud_set_health() med_hud_set_status() @@ -175,8 +188,8 @@ /mob/living/simple_animal/hostile/hs13mimic/proc/triggerOthers(passtarget) // for(var/mob/living/simple_animal/hostile/hs13mimic/C in oview(5, src.loc)) - if(passtarget && C.target == null) - C.target = passtarget + if(passtarget && C.target == null && !(isdead(target))) + C.target = target C.trigger() /mob/living/simple_animal/hostile/hs13mimic/proc/trytftorandomobject() @@ -184,7 +197,8 @@ medhudupdate() var/list/obj/item/listItems = list() for(var/obj/item/I in oview(9,src.loc)) - listItems += I + if(!(is_type_in_typecache(I, mimic_blacklisted_transform_items))) + listItems += I if(LAZYLEN(listItems)) var/obj/item/changedReference = pick(listItems) wander = FALSE @@ -209,10 +223,15 @@ /datum/round_event/mimic_infestation announceWhen = 200 - var/static/list/station_areas_blacklist = typecacheof(/area/space, + var/static/list/mimic_station_areas_blacklist = typecacheof(/area/space, + /area/shuttle, /area/mine, + /area/holodeck, /area/ruin, /area/hallway, + /area/hallway/primary, + /area/hallway/secondary, + /area/hallway/secondary/entry, /area/engine/supermatter, /area/engine/atmospherics_engine, /area/engine/engineering/reactor_core, @@ -244,7 +263,7 @@ continue if(place.areasize < 16) continue - if(is_type_in_typecache(place, station_areas_blacklist)) + if(is_type_in_typecache(place, mimic_station_areas_blacklist)) continue eligible_areas += place for(var/area/place in eligible_areas) // now we check if there are people in that area @@ -262,7 +281,12 @@ pickedArea = pick_n_take(eligible_areas) var/list/turf/t = get_area_turfs(pickedArea, SSmapping.station_start) for(var/turf/thisTurf in t) // now we check if it's a closed turf, cold turf or occupied turf and yeet it - if(isclosedturf(thisTurf) || thisTurf.temperature <= T0C) + if(isopenturf(thisTurf)) + var/turf/open/tempGet = thisTurf + if(tempGet.air.temperature <= T0C) + t -= thisTurf + continue + if(isclosedturf(thisTurf)) t -= thisTurf else for(var/obj/O in thisTurf)