From b4e975ef75d231e892bb6053c750c41063831d38 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Wed, 9 Oct 2019 06:51:07 +0200 Subject: [PATCH] mitigates the ghost roles/mid-round antag lock out for suicide/cryo. And related fixes. --- code/__DEFINES/misc.dm | 3 +++ code/__HELPERS/game.dm | 2 +- code/controllers/subsystem/pai.dm | 5 +++++ code/game/machinery/cryopod.dm | 3 ++- .../clockcult/clock_items/construct_chassis.dm | 5 ++++- code/modules/awaymissions/corpse.dm | 4 ++-- code/modules/mob/dead/observer/observer.dm | 14 +++++++------- code/modules/mob/living/brain/posibrain.dm | 10 +++++++--- .../friendly/drone/drones_as_items.dm | 5 ++++- .../living/simple_animal/hostile/giant_spider.dm | 5 +++++ .../simple_animal/hostile/megafauna/colossus.dm | 3 +++ 11 files changed, 43 insertions(+), 16 deletions(-) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index ba5e105041..2823761444 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -221,6 +221,9 @@ GLOBAL_LIST_EMPTY(bloody_footprints_cache) //Same as above except gets the area instead #define get_area(A) (isarea(A) ? A : get_step(A, 0)?.loc) +//Used to prevent cryo/suicidees from coming back into the round as ghost roles or mid round antags before a given duration has passed. +#define SUICIDE_REENTER_ROUND_TIMER 40 MINUTES + //Ghost orbit types: #define GHOST_ORBIT_CIRCLE "circle" #define GHOST_ORBIT_TRIANGLE "triangle" diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index cc0bd3e0b4..00decafabd 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -446,7 +446,7 @@ var/list/candidates = list() for(var/mob/dead/observer/G in GLOB.player_list) - if(G.can_reenter_round) + if(G.reenter_round_timeout < world.realtime) candidates += G return pollCandidates(Question, jobbanType, gametypeCheck, be_special_flag, poll_time, ignore_category, flashwindow, candidates) diff --git a/code/controllers/subsystem/pai.dm b/code/controllers/subsystem/pai.dm index 2e2f7edd99..09087c8626 100644 --- a/code/controllers/subsystem/pai.dm +++ b/code/controllers/subsystem/pai.dm @@ -69,6 +69,11 @@ SUBSYSTEM_DEF(pai) candidate.comments = copytext(sanitize(candidate.comments),1,MAX_MESSAGE_LEN) if("submit") + if(isobserver(usr)) + var/mob/dead/observer/O = usr + if(O.reenter_round_timeout > world.realtime) + to_chat(O, "You are unable to reenter the round yet. Your ghost role blacklist will expire in [round((O.reenter_round_timeout - world.realtime)/600)] minutes.") + return if(candidate) candidate.ready = 1 for(var/obj/item/paicard/p in pai_card_list) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index e358f10346..84cc27953a 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -411,7 +411,8 @@ // Ghost and delete the mob. if(!mob_occupant.get_ghost(1)) - mob_occupant.ghostize(0) // Players who cryo out may not re-enter the round + mob_occupant.suiciding = TRUE //to penalize them from making a ghost role / midround antag comeback right away. + mob_occupant.ghostize(0) QDEL_NULL(occupant) open_machine() diff --git a/code/modules/antagonists/clockcult/clock_items/construct_chassis.dm b/code/modules/antagonists/clockcult/clock_items/construct_chassis.dm index 12af249bee..fa15509c59 100644 --- a/code/modules/antagonists/clockcult/clock_items/construct_chassis.dm +++ b/code/modules/antagonists/clockcult/clock_items/construct_chassis.dm @@ -39,7 +39,10 @@ . = ..() //ATTACK GHOST IGNORING PARENT RETURN VALUE -/obj/item/clockwork/construct_chassis/attack_ghost(mob/user) +/obj/item/clockwork/construct_chassis/attack_ghost(mob/dead/observer/user) + if(user.reenter_round_timeout > world.realtime) + to_chat(user, "You are unable to reenter the round yet. Your ghost role blacklist will expire in [round((user.reenter_round_timeout - world.realtime)/600)] minutes.") + return if(!SSticker.mode) to_chat(user, "You cannot use that before the game has started.") return diff --git a/code/modules/awaymissions/corpse.dm b/code/modules/awaymissions/corpse.dm index 74f81ec9a0..9d5c46fdf5 100644 --- a/code/modules/awaymissions/corpse.dm +++ b/code/modules/awaymissions/corpse.dm @@ -43,8 +43,8 @@ return if(isobserver(user)) var/mob/dead/observer/O = user - if(!O.can_reenter_round) - to_chat(user, "You are unable to reenter the round.") + if(O.reenter_round_timeout > world.realtime) + to_chat(user, "You are unable to reenter the round yet. Your ghost role blacklist will expire in [round((O.reenter_round_timeout - world.realtime)/600)] minutes.") return var/ghost_role = alert(latejoinercalling ? "Latejoin as [mob_name]? (This is a ghost role, and as such, it's very likely to be off-station.)" : "Become [mob_name]? (Warning, You can no longer be cloned!)",,"Yes","No") if(ghost_role == "No" || !loc) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index fefa032e4f..16fd99e9be 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -18,7 +18,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) invisibility = INVISIBILITY_OBSERVER hud_type = /datum/hud/ghost var/can_reenter_corpse - var/can_reenter_round = TRUE + var/reenter_round_timeout = 0 // used to prevent people from coming back through ghost roles/midround antags as they suicide/cryo for a duration set by SUICIDE_REENTER_ROUND_TIMER. var/datum/hud/living/carbon/hud = null // hud var/bootime = 0 var/started_as_observer //This variable is set to 1 when you enter the game as an observer. @@ -267,7 +267,7 @@ Works together with spawning an observer, noted above. var/mob/dead/observer/ghost = new(src) // Transfer safety to observer spawning proc. SStgui.on_transfer(src, ghost) // Transfer NanoUIs. ghost.can_reenter_corpse = can_reenter_corpse - ghost.can_reenter_round = (can_reenter_corpse && !suiciding) + ghost.reenter_round_timeout = suiciding ? world.realtime + SUICIDE_REENTER_ROUND_TIMER : 0 ghost.key = key return ghost @@ -282,7 +282,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp // CITADEL EDIT if(istype(loc, /obj/machinery/cryopod)) - var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you won't be able to re-enter this round! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") + var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you won't be able to re-enter this round for the next [SUICIDE_REENTER_ROUND_TIMER/600] minutes! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") if(response != "Ghost")//darn copypaste return var/obj/machinery/cryopod/C = loc @@ -295,7 +295,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(stat == DEAD) ghostize(1) else - var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you won't be able to re-enter this round! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") + var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you won't be able to re-enter this round for the next [SUICIDE_REENTER_ROUND_TIMER/600] minutes! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") if(response != "Ghost") return //didn't want to ghost after-all ghostize(0) //0 parameter is so we can never re-enter our body, "Charlie, you can never come baaaack~" :3 @@ -306,7 +306,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set name = "Ghost" set desc = "Relinquish your life and enter the land of the dead." - var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you won't be able to re-enter this round! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") + var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you won't be able to re-enter this round for the next [SUICIDE_REENTER_ROUND_TIMER/600] minutes! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") if(response != "Ghost") return ghostize(0) @@ -617,8 +617,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp to_chat(src, "This isn't really a creature, now is it!") return 0 - if(!can_reenter_round) - to_chat(src, "You are unable to re-enter the round.") + if(reenter_round_timeout > world.realtime) + to_chat(src, "You are unable to re-enter the round yet. Your ghost role blacklist will expire in [round((reenter_round_timeout - world.realtime)/600)] minutes.") return FALSE if(can_reenter_corpse && mind && mind.current) diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index 9e0bb0428b..e52d53dca2 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -83,11 +83,15 @@ GLOBAL_VAR(posibrain_notify_cooldown) //Two ways to activate a positronic brain. A clickable link in the ghost notif, or simply clicking the object itself. /obj/item/mmi/posibrain/proc/activate(mob/user) - if(QDELETED(brainmob)) - return - if(is_occupied() || jobban_isbanned(user,"posibrain") || QDELETED(brainmob) || QDELETED(src) || QDELETED(user)) + if(QDELETED(brainmob) || is_occupied() || jobban_isbanned(user,"posibrain") || QDELETED(src) || QDELETED(user)) return + if(isobserver(user)) + var/mob/dead/observer/O = user + if(O.reenter_round_timeout > world.realtime) + to_chat(user, "You are unable to reenter the round yet. Your ghost role blacklist will expire in [round((O.reenter_round_timeout - world.realtime)/600)] minutes.") + return + var/posi_ask = alert("Become a [name]? (Warning, You can no longer be cloned, and all past lives will be forgotten!)","Are you positive?","Yes","No") if(posi_ask == "No" || QDELETED(src)) return diff --git a/code/modules/mob/living/simple_animal/friendly/drone/drones_as_items.dm b/code/modules/mob/living/simple_animal/friendly/drone/drones_as_items.dm index a655bdf231..dd0b948299 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/drones_as_items.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/drones_as_items.dm @@ -40,7 +40,7 @@ . = ..() //ATTACK GHOST IGNORING PARENT RETURN VALUE -/obj/item/drone_shell/attack_ghost(mob/user) +/obj/item/drone_shell/attack_ghost(mob/dead/observer/user) if(jobban_isbanned(user,"drone") || QDELETED(src) || QDELETED(user)) return if(CONFIG_GET(flag/use_age_restriction_for_jobs)) @@ -49,6 +49,9 @@ if(user.client.player_age < DRONE_MINIMUM_AGE) to_chat(user, "You're too new to play as a drone! Please try again in [DRONE_MINIMUM_AGE - user.client.player_age] days.") return + if(user.reenter_round_timeout > world.realtime) + to_chat(user, "You are unable to reenter the round yet. Your ghost role blacklist will expire in [round((user.reenter_round_timeout - world.realtime)/600)] minutes.") + return if(!SSticker.mode) to_chat(user, "Can't become a drone before the game has started.") return diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index cfdf302d6b..c851e50be7 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -84,6 +84,11 @@ /mob/living/simple_animal/hostile/poison/giant_spider/proc/humanize_spider(mob/user) if(key || !playable_spider || stat)//Someone is in it, it's dead, or the fun police are shutting it down return 0 + if(isobserver(user)) + var/mob/dead/observer/O = user + if(O.reenter_round_timeout > world.realtime) + to_chat(O, "You are unable to reenter the round yet. Your ghost role blacklist will expire in [round((O.reenter_round_timeout - world.realtime)/600)] minutes.") + return var/spider_ask = alert("Become a spider?", "Are you australian?", "Yes", "No") if(spider_ask == "No" || !src || QDELETED(src)) return 1 diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm index b529d826c9..a9a49e3982 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm @@ -582,6 +582,9 @@ Difficulty: Very Hard if(.) return if(ready_to_deploy) + if(user.reenter_round_timeout > world.realtime) + to_chat(user, "You are unable to reenter the round yet. Your ghost role blacklist will expire in [round((user.reenter_round_timeout - world.realtime)/600)] minutes.") + return var/be_helper = alert("Become a Lightgeist? (Warning, You can no longer be cloned!)",,"Yes","No") if(be_helper == "Yes" && !QDELETED(src) && isobserver(user)) var/mob/living/simple_animal/hostile/lightgeist/W = new /mob/living/simple_animal/hostile/lightgeist(get_turf(loc))