From fe32f46b737da1ea65be44750cb6e546264097ad Mon Sep 17 00:00:00 2001 From: Gandalf Date: Sat, 22 May 2021 02:35:54 +0100 Subject: [PATCH] Ghost role bans (#5856) * a * Update venus_human_trap.dm * a * a --- code/__DEFINES/~skyrat_defines/banning.dm | 3 +++ code/__HELPERS/game.dm | 5 ++++ code/modules/admin/sql_ban_system.dm | 3 ++- code/modules/awaymissions/corpse.dm | 4 +++ .../simple_animal/hostile/venus_human_trap.dm | 5 +++- .../mob/living/simple_animal/simple_animal.dm | 25 +++++++++++++++++++ .../modules/events/code/event_spawner.dm | 3 +++ tgstation.dme | 1 + 8 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 modular_skyrat/master_files/code/modules/mob/living/simple_animal/simple_animal.dm diff --git a/code/__DEFINES/~skyrat_defines/banning.dm b/code/__DEFINES/~skyrat_defines/banning.dm index aa54f46037b..22f2686ed73 100644 --- a/code/__DEFINES/~skyrat_defines/banning.dm +++ b/code/__DEFINES/~skyrat_defines/banning.dm @@ -1,3 +1,6 @@ #define BAN_PACIFICATION "Pacification ban" #define BAN_DONOTREVIVE "Do not revive ban" #define BAN_RESPAWN "Respawn ban" +#define BAN_MOB_CONTROL "Ghost mob control ban" +#define BAN_GHOST_ROLE_SPAWNER "Ghost role spawner ban" +#define BAN_GHOST_TAKEOVER "Ghost candidate ban" diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 43cdcb209dc..e605fe57854 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -433,6 +433,11 @@ var/mob/M = m if(!M.key || !M.client || (ignore_category && GLOB.poll_ignore[ignore_category] && (M.ckey in GLOB.poll_ignore[ignore_category]))) continue + //SKYRAT EDIT ADDITION BEGIN + if(is_banned_from(M.ckey, BAN_GHOST_TAKEOVER)) + to_chat(M, "There was a ghost prompt for: [Question], unfortunately you are banned from ghost takeovers.") + continue + //SKYRAT EDIT END if(be_special_flag) if(!(M.client.prefs) || !(be_special_flag in M.client.prefs.be_special)) continue diff --git a/code/modules/admin/sql_ban_system.dm b/code/modules/admin/sql_ban_system.dm index f4bcef45979..99ecdb65638 100644 --- a/code/modules/admin/sql_ban_system.dm +++ b/code/modules/admin/sql_ban_system.dm @@ -350,7 +350,8 @@ "Skyrat Ban Options" = list( BAN_PACIFICATION, BAN_DONOTREVIVE, - BAN_RESPAWN + BAN_RESPAWN, + BAN_MOB_CONTROL ),//SKYRAT EDIT ADDITION - EXTRA_BANS ) for(var/department in long_job_lists) diff --git a/code/modules/awaymissions/corpse.dm b/code/modules/awaymissions/corpse.dm index 747942a545e..732e9ad5bb5 100644 --- a/code/modules/awaymissions/corpse.dm +++ b/code/modules/awaymissions/corpse.dm @@ -51,6 +51,10 @@ if(SSticker.mode.type in excluded_gamemodes) to_chat(user, "Error, unable to spawn.") return + + if(is_banned_from(user.ckey, BAN_GHOST_ROLE_SPAWNER)) + to_chat(user, "Error, you are banned from playing ghost roles!") + return //SKYRAT EDIT ADDITION END if(!(GLOB.ghost_role_flags & GHOSTROLE_SPAWNER) && !(flags_1 & ADMIN_SPAWNED_1)) diff --git a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm index 7a8627ef77f..e8057bbb61c 100644 --- a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm +++ b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm @@ -30,6 +30,7 @@ var/list/vines = list() + /obj/structure/alien/resin/flower_bud/Initialize() . = ..() countdown = new(src) @@ -138,6 +139,8 @@ /// Whether or not this plant is ghost possessable var/playable_plant = TRUE + ghost_controllable = TRUE //SKYRAT EDIT ADDITION + /mob/living/simple_animal/hostile/venus_human_trap/Life(delta_time = SSMOBS_DT, times_fired) . = ..() @@ -185,7 +188,7 @@ . = ..() if(. || !(GLOB.ghost_role_flags & GHOSTROLE_SPAWNER)) return - humanize_plant(user) + //humanize_plant(user) SKYRAT EDIT REMOVAL /** * Sets a ghost to control the plant if the plant is eligible diff --git a/modular_skyrat/master_files/code/modules/mob/living/simple_animal/simple_animal.dm b/modular_skyrat/master_files/code/modules/mob/living/simple_animal/simple_animal.dm new file mode 100644 index 00000000000..4c896121770 --- /dev/null +++ b/modular_skyrat/master_files/code/modules/mob/living/simple_animal/simple_animal.dm @@ -0,0 +1,25 @@ +/mob/living/simple_animal + /// If set to TRUE, ghosts will be able to click on the simple mob and take control of it. + var/ghost_controllable = FALSE + +/mob/living/simple_animal/attack_ghost(mob/dead/observer/user) + . = ..() + if(.) + return + if(ghost_controllable) + take_control(user) + +/mob/living/simple_animal/proc/take_control(mob/user) + if(key || stat) + return + if(is_banned_from(user.ckey, BAN_MOB_CONTROL)) + to_chat(user, "Error, you are banned from taking control of player controlled mobs!") + return + var/query = tgui_alert("Become a [src]?", "Take mob control", list("Yes", "No")) + if(query == "No" || !src || QDELETED(src)) + return + if(key) + to_chat(user, "Someone else already took this mob!") + return + key = user.key + log_game("[key_name(src)] took control of [name].") diff --git a/modular_skyrat/modules/events/code/event_spawner.dm b/modular_skyrat/modules/events/code/event_spawner.dm index 00713b8abaa..a434a1e84c5 100644 --- a/modular_skyrat/modules/events/code/event_spawner.dm +++ b/modular_skyrat/modules/events/code/event_spawner.dm @@ -27,6 +27,9 @@ if(ckey_whitelist && !(lowertext(user.ckey) in ckey_whitelist)) alert(user, "Sorry, This spawner is not for you!", "", "Ok") return + if(is_banned_from(user.ckey, BAN_GHOST_ROLE_SPAWNER)) + to_chat(user, "Error, you are banned from playing ghost roles!") + return var/species_string if(species_whitelist) species_string = "" diff --git a/tgstation.dme b/tgstation.dme index 21a88ae4c29..0347f94a17f 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3624,6 +3624,7 @@ #include "modular_skyrat\master_files\code\modules\mob\living\emote_popup.dm" #include "modular_skyrat\master_files\code\modules\mob\living\carbon\carbon_say.dm" #include "modular_skyrat\master_files\code\modules\mob\living\dead\new_player\new_player.dm" +#include "modular_skyrat\master_files\code\modules\mob\living\simple_animal\simple_animal.dm" #include "modular_skyrat\master_files\code\modules\mob\living\simple_animal\friendly\bumbles.dm" #include "modular_skyrat\master_files\code\modules\power\lighting.dm" #include "modular_skyrat\master_files\code\modules\projectiles\guns\gun.dm"