From e3d1f7a5e0e8e1538289af5c5c3ab3baa516ac00 Mon Sep 17 00:00:00 2001 From: Archie Date: Sat, 12 Jun 2021 04:43:48 -0300 Subject: [PATCH 1/6] event test --- hyperstation/code/mobs/mimic.dm | 71 +++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/hyperstation/code/mobs/mimic.dm b/hyperstation/code/mobs/mimic.dm index 9683b6f0..1a2ad90a 100644 --- a/hyperstation/code/mobs/mimic.dm +++ b/hyperstation/code/mobs/mimic.dm @@ -157,3 +157,74 @@ else unstealth = FALSE Mimictransform() + +/datum/round_event_control/mimic_infestation + name = "Mimic Infestation" + typepath = /datum/round_event/mimic_infestation + weight = 5 + max_occurrences = 1 + min_players = 15 + +/datum/round_event/mimic_infestation + announceWhen = 200 + var/static/list/station_areas_blacklist = typecacheof(/area/space, + /area/mine, + /area/ruin, + /area/engine/supermatter, + /area/engine/atmospherics_engine, + /area/engine/engineering/reactor_core, + /area/engine/engineering/reactor_control, + /area/ai_monitored/turret_protected/ai, + /area/layenia/cloudlayer, + /area/asteroid/nearstation, + /area/science/server, + /area/science/explab + /area/security/labor, + /area/security/processing) + var/spawncount = 1 + fakeable = FALSE + +/datum/round_event/mimic_infestation/setup() + announceWhen = rand(announceWhen, announceWhen + 50) + spawncount = rand(5, 8) + +/datum/round_event/mimic_infestation/announce(fake) + priority_announce("Unidentified lifesigns detected aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", 'sound/ai/aliens.ogg') + +/datum/round_event/mimic_infestation/start() + var/list/area/stationAreas = list() + var/list/area/eligible_areas = list() + for(var/area/A in world) // Get the areas in the Z level + if(A.z == SSmapping.station_start) + stationAreas += A + for(var/area/place in stationAreas) // first we check if it's a valid area + if(place.outdoors) + continue + if(place.areasize < 16) + continue + if(is_type_in_typecache(place, station_areas_blacklist)) + continue + eligible_areas += place + for(var/area/place in eligible_areas) // now we check if there are people in that area + var/numOfPeople + for(var/mob/living/carbon/H in place) + numOfPeople++ + message_admins("Found [H] in [place]!") + if(numOfPeople > 0) + message_admins("Area [place] is ineligible as there are [numOfPeople] there.") + eligible_areas -= place + + var/area/pickedArea = pick(eligible_areas) + message_admins("The area that has been picked is [pickedArea]") + 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 and yeet it from the list + if(isclosedturf(thisTurf)) + t -= thisTurf + + while(spawncount >= 1 && t.len) + var/turf/pickedTurf = pick(t) + var/spawn_type = /mob/living/simple_animal/hostile/hs13mimic + spawn_atom_to_turf(spawn_type, pickedTurf, 1, FALSE) + t -= pickedTurf //So we don't spawn them on top of eachother + spawncount-- + notify_ghosts("A mimic has spawned in [pickedTurf]!", enter_link="(Click to orbit)", source=pickedTurf, action=NOTIFY_ORBIT) From 7b52b7fb9204e35b1048cfaf58998539aeffe3ca Mon Sep 17 00:00:00 2001 From: Archie Date: Sat, 12 Jun 2021 05:37:38 -0300 Subject: [PATCH 2/6] LUDICROUS logic --- hyperstation/code/mobs/mimic.dm | 59 +++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/hyperstation/code/mobs/mimic.dm b/hyperstation/code/mobs/mimic.dm index 2f553cde..3128cbd3 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 = 3 + move_to_delay = 2 speed = 0 see_in_dark = 6 pass_flags = PASSTABLE @@ -30,7 +30,7 @@ vision_range = 2 aggro_vision_range = 9 wander = TRUE - minbodytemp = 250 //VERY weak to cold + minbodytemp = 250 //weak to cold maxbodytemp = 1500 pressure_resistance = 600 var/unstealth = FALSE @@ -40,7 +40,7 @@ . = ..() // When initialized, make sure they take the form of something. unstealth = FALSE - Mimictransform() + trytftorandomobject() /mob/living/simple_animal/hostile/hs13mimic/attack_hand(mob/living/carbon/human/M) . = ..() @@ -196,6 +196,10 @@ else Mimictransform() + +//Event control + + /datum/round_event_control/mimic_infestation name = "Mimic Infestation" typepath = /datum/round_event/mimic_infestation @@ -208,23 +212,23 @@ var/static/list/station_areas_blacklist = typecacheof(/area/space, /area/mine, /area/ruin, + /area/hallway, /area/engine/supermatter, /area/engine/atmospherics_engine, /area/engine/engineering/reactor_core, /area/engine/engineering/reactor_control, /area/ai_monitored/turret_protected/ai, /area/layenia/cloudlayer, - /area/asteroid/nearstation, - /area/science/server, - /area/science/explab - /area/security/labor, + /area/asteroid/nearstation, + /area/science/server, + /area/science/explab, /area/security/processing) var/spawncount = 1 fakeable = FALSE /datum/round_event/mimic_infestation/setup() announceWhen = rand(announceWhen, announceWhen + 50) - spawncount = rand(5, 8) + spawncount = rand(4, 7) /datum/round_event/mimic_infestation/announce(fake) priority_announce("Unidentified lifesigns detected aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", 'sound/ai/aliens.ogg') @@ -247,22 +251,35 @@ var/numOfPeople for(var/mob/living/carbon/H in place) numOfPeople++ - message_admins("Found [H] in [place]!") + break if(numOfPeople > 0) - message_admins("Area [place] is ineligible as there are [numOfPeople] there.") eligible_areas -= place - var/area/pickedArea = pick(eligible_areas) - message_admins("The area that has been picked is [pickedArea]") - 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 and yeet it from the list - if(isclosedturf(thisTurf)) - t -= thisTurf - - while(spawncount >= 1 && t.len) - var/turf/pickedTurf = pick(t) + var/validFound = FALSE + var/list/turf/validTurfs = list() + var/area/pickedArea + while(!validFound || !eligible_areas.len) + 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) + t -= thisTurf + else + for(var/obj/O in thisTurf) + if(O.density && !(istype(O, /obj/structure/table))) + t -= thisTurf + break + if(t.len >= spawncount) //Is the number of available turfs equal or bigger than spawncount? + validFound = TRUE + validTurfs = t + + if(!eligible_areas.len) + message_admins("No eligible areas for spawning mimics.") + return FALSE + + notify_ghosts("A mimic has spawned in [pickedArea]!", enter_link="(Click to orbit)", source=pickedArea, action=NOTIFY_ORBIT) + while(spawncount >= 1 && validTurfs.len) + var/turf/pickedTurf = pick_n_take(validTurfs) var/spawn_type = /mob/living/simple_animal/hostile/hs13mimic spawn_atom_to_turf(spawn_type, pickedTurf, 1, FALSE) - t -= pickedTurf //So we don't spawn them on top of eachother spawncount-- - notify_ghosts("A mimic has spawned in [pickedTurf]!", enter_link="(Click to orbit)", source=pickedTurf, action=NOTIFY_ORBIT) From 452256926c23f44ece836a395ef371cdc587bb49 Mon Sep 17 00:00:00 2001 From: Archie Date: Sat, 12 Jun 2021 05:40:06 -0300 Subject: [PATCH 3/6] That too. --- hyperstation/code/mobs/mimic.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyperstation/code/mobs/mimic.dm b/hyperstation/code/mobs/mimic.dm index 3128cbd3..f5a89900 100644 --- a/hyperstation/code/mobs/mimic.dm +++ b/hyperstation/code/mobs/mimic.dm @@ -277,7 +277,7 @@ message_admins("No eligible areas for spawning mimics.") return FALSE - notify_ghosts("A mimic has spawned in [pickedArea]!", enter_link="(Click to orbit)", source=pickedArea, action=NOTIFY_ORBIT) + notify_ghosts("A group of mimics has spawned in [pickedArea]!", source=pickedArea, action=NOTIFY_ATTACK, flashwindow = FALSE) while(spawncount >= 1 && validTurfs.len) var/turf/pickedTurf = pick_n_take(validTurfs) var/spawn_type = /mob/living/simple_animal/hostile/hs13mimic From da0016adaf2c5d5b4cb880a05c10491f9ed968d2 Mon Sep 17 00:00:00 2001 From: Archie Date: Sat, 12 Jun 2021 06:59:48 -0300 Subject: [PATCH 4/6] 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) From 1dddefd11b3d50cb4104d46c1ff0cf08ca75c533 Mon Sep 17 00:00:00 2001 From: Archie Date: Sat, 12 Jun 2021 07:01:57 -0300 Subject: [PATCH 5/6] aaaa --- hyperstation/code/mobs/mimic.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyperstation/code/mobs/mimic.dm b/hyperstation/code/mobs/mimic.dm index 2edf6f26..082d7d5e 100644 --- a/hyperstation/code/mobs/mimic.dm +++ b/hyperstation/code/mobs/mimic.dm @@ -189,7 +189,7 @@ /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 && !(isdead(target))) - C.target = target + C.target = passtarget C.trigger() /mob/living/simple_animal/hostile/hs13mimic/proc/trytftorandomobject() From c29e3137d8974f767f08edd2dc36eaca0c46777d Mon Sep 17 00:00:00 2001 From: Archie Date: Sat, 12 Jun 2021 07:03:35 -0300 Subject: [PATCH 6/6] Chaos chaos chaos --- code/game/gamemodes/dynamic/dynamic_rulesets_events.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_events.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_events.dm index 3d761aa0..665ed2b8 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_events.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_events.dm @@ -164,7 +164,7 @@ high_population_requirement = 15 earliest_start = 30 MINUTES occurances_max = 2 - chaos_min = 1.5 + chaos_min = 2 ////////////////////////////////////////////// // //