From 5d5c17492f31bb1d5902f589b6aa092facf2a7e9 Mon Sep 17 00:00:00 2001 From: Citinited Date: Sat, 1 Dec 2018 16:18:04 +0000 Subject: [PATCH] Fixes some issues in floor cluwne code --- code/modules/admin/verbs/spawnfloorcluwne.dm | 33 +++++++++++-------- .../simple_animal/hostile/floorcluwne.dm | 8 +++-- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/code/modules/admin/verbs/spawnfloorcluwne.dm b/code/modules/admin/verbs/spawnfloorcluwne.dm index 02ff9eda6e2..2134408e646 100644 --- a/code/modules/admin/verbs/spawnfloorcluwne.dm +++ b/code/modules/admin/verbs/spawnfloorcluwne.dm @@ -2,25 +2,30 @@ set category = "Event" set name = "Unleash Floor Cluwne" set desc = "Pick a specific target or just let it select randomly and spawn the floor cluwne mob on the station. Be warned: spawning more than one may cause issues!" - var/target + var/mob/living/carbon/human/target if(!check_rights(R_EVENT)) return - var/confirm = alert("Are you sure you want to release a floor cluwne and kill alot of people?", "Confirm Massacre", "Yes", "No") + var/confirm = alert("Are you sure you want to release a floor cluwne and kill a lot of people?", "Confirm Massacre", "Yes", "No") if(confirm == "Yes") var/turf/T = get_turf(usr) - target = input("Any specific target in mind? Please note only live, non cluwned, human targets are valid.", "Target", target) as null|anything in GLOB.player_list - if(isnull(target)) + var/list/potential_targets = list() + for(var/mob/M in GLOB.player_list) + if(!istype(M, /mob/living/carbon/human)) + continue + if(M.mind.assigned_role == "Cluwne") + continue + var/mob/living/carbon/human/H = M + potential_targets += H + for(var/mob/M in potential_targets) + if(!potential_targets.len) //You're probably the only player on this damn station, spawn it yourself + to_chat(src, "No valid targets!") return - if(target && ishuman(target)) - var/mob/living/carbon/human/H = target - var/mob/living/simple_animal/hostile/floor_cluwne/FC = new /mob/living/simple_animal/hostile/floor_cluwne(T) - FC.Acquire_Victim(H) - else - new /mob/living/simple_animal/hostile/floor_cluwne(T) - log_admin("[key_name(usr)] spawned floor cluwne.") - message_admins("[key_name(usr)] spawned floor cluwne.") - else - return + target = input("Any specific target in mind? Please note only live, non cluwned, human targets are valid.", "Target", target) as null|anything in potential_targets + var/mob/living/simple_animal/hostile/floor_cluwne/FC = new /mob/living/simple_animal/hostile/floor_cluwne(T) + if(target) + FC.Acquire_Victim(target) + log_admin("[key_name(usr)] spawned floor cluwne[target ? ", initially targetting [target]": null].") + message_admins("[key_name(usr)] spawned floor cluwne[target ? ", initially targetting [target]": null].") diff --git a/code/modules/mob/living/simple_animal/hostile/floorcluwne.dm b/code/modules/mob/living/simple_animal/hostile/floorcluwne.dm index 04c6220f12d..ff2f7ebce09 100644 --- a/code/modules/mob/living/simple_animal/hostile/floorcluwne.dm +++ b/code/modules/mob/living/simple_animal/hostile/floorcluwne.dm @@ -79,7 +79,7 @@ var/area/tp = teleportlocs[area] forceMove(pick(get_area_turfs(tp.type))) - if(!current_victim && !admincluwne) + if((!current_victim && !admincluwne) || QDELETED(current_victim)) Acquire_Victim() if(stage && !manifested) @@ -147,6 +147,8 @@ var/list/players_copy = GLOB.player_list.Copy() while(players_copy.len) var/mob/living/carbon/human/H = pick_n_take(players_copy) + if(!ishuman(H)) + continue if(specific) H = specific @@ -158,7 +160,7 @@ current_victim = H return target = current_victim - if(H && ishuman(H) && H.stat != DEAD && H != current_victim && !isLivingSSD(H) && H.client && !H.get_int_organ(/obj/item/organ/internal/honktumor/cursed) && !is_type_in_typecache(get_area(H.loc), invalid_area_typecache)) + if(H && H.stat != DEAD && H != current_victim && !isLivingSSD(H) && H.client && !H.get_int_organ(/obj/item/organ/internal/honktumor/cursed) && !is_type_in_typecache(get_area(H.loc), invalid_area_typecache)) current_victim = H interest = 0 return target = current_victim @@ -195,6 +197,8 @@ /mob/living/simple_animal/hostile/floor_cluwne/proc/On_Stage() var/mob/living/carbon/human/H = current_victim + if(!H) + Acquire_Victim() switch(stage) if(STAGE_HAUNT)