mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-13 00:55:20 +01:00
[MIRROR] Ghost Pool Protection Admin Button (#226)
* Ghost Pool Protection Admin Button (#52683) * Ghost Pool Protection * okay * Update tgui.bundle.js * just a bit of feedback * temporarily Co-authored-by: Emmanuel S. <emmanuelssr@gmail.com> * Update GhostPoolProtection.js * Update tgui.bundle.js * my devserver broke * okay done for real * conflict resolution bundle * Rohesies dope review Co-authored-by: Rohesie <rohesie@gmail.com> Co-authored-by: Emmanuel S. <emmanuelssr@gmail.com> Co-authored-by: Rohesie <rohesie@gmail.com> * Ghost Pool Protection Admin Button Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com> Co-authored-by: Emmanuel S. <emmanuelssr@gmail.com> Co-authored-by: Rohesie <rohesie@gmail.com>
This commit is contained in:
@@ -142,3 +142,18 @@
|
||||
// LOG BROWSE TYPES
|
||||
#define BROWSE_ROOT_ALL_LOGS 1
|
||||
#define BROWSE_ROOT_CURRENT_LOGS 2
|
||||
|
||||
// allowed ghost roles this round, starts as everything allowed
|
||||
GLOBAL_VAR_INIT(ghost_role_flags, (~0))
|
||||
|
||||
//Flags that control what ways ghosts can get back into the round
|
||||
//ie fugitives, space dragon, etc. also includes dynamic midrounds as it's the same deal
|
||||
#define GHOSTROLE_MIDROUND_EVENT (1<<0)
|
||||
//ie ashwalkers, free golems, beach bums
|
||||
#define GHOSTROLE_SPAWNER (1<<1)
|
||||
//ie mind monkeys, sentience potion
|
||||
#define GHOSTROLE_STATION_SENTIENCE (1<<2)
|
||||
//ie pais, posibrains
|
||||
#define GHOSTROLE_SILICONS (1<<3)
|
||||
//ie mafia, ctf
|
||||
#define GHOSTROLE_MINIGAME (1<<4)
|
||||
|
||||
@@ -419,6 +419,8 @@
|
||||
|
||||
/proc/pollGhostCandidates(Question, jobbanType, datum/game_mode/gametypeCheck, be_special_flag = 0, poll_time = 300, ignore_category = null, flashwindow = TRUE)
|
||||
var/list/candidates = list()
|
||||
if(!(GLOB.ghost_role_flags & GHOSTROLE_STATION_SENTIENCE))
|
||||
return candidates
|
||||
|
||||
for(var/mob/dead/observer/G in GLOB.player_list)
|
||||
candidates += G
|
||||
|
||||
@@ -139,6 +139,9 @@ SUBSYSTEM_DEF(pai)
|
||||
return FALSE
|
||||
|
||||
/datum/controller/subsystem/pai/proc/findPAI(obj/item/paicard/p, mob/user)
|
||||
if(!(GLOB.ghost_role_flags & GHOSTROLE_SILICONS))
|
||||
to_chat(user, "<span class='warning'>Due to growing incidents of SELF corrupted independent artificial intelligences, freeform personality devices have been temporarily banned in this sector.</span>")
|
||||
return
|
||||
if(!ghost_spam)
|
||||
ghost_spam = TRUE
|
||||
for(var/mob/dead/observer/G in GLOB.player_list)
|
||||
|
||||
@@ -612,6 +612,9 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
|
||||
// Classic secret : only autotraitor/minor roles
|
||||
if (GLOB.dynamic_classic_secret && !((rule.flags & TRAITOR_RULESET) || (rule.flags & MINOR_RULESET)))
|
||||
continue
|
||||
// If admins have disabled dynamic from picking from the ghost pool
|
||||
if(rule.ruletype == "Latejoin" && !(GLOB.ghost_role_flags & GHOSTROLE_MIDROUND_EVENT))
|
||||
continue
|
||||
rule.trim_candidates()
|
||||
if (rule.ready())
|
||||
drafted_rules[rule] = rule.get_weight()
|
||||
|
||||
@@ -462,6 +462,9 @@
|
||||
/obj/item/nullrod/scythe/talking/attack_self(mob/living/user)
|
||||
if(possessed)
|
||||
return
|
||||
if(!(GLOB.ghost_role_flags & GHOSTROLE_STATION_SENTIENCE))
|
||||
to_chat(user, "<span class='notice'>Anomalous otherworldly energies block you from awakening the blade!</span>")
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You attempt to wake the spirit of the blade...</span>")
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ GLOBAL_PROTECT(admin_verbs_admin)
|
||||
/datum/verbs/menu/Admin/verb/playerpanel,
|
||||
/client/proc/game_panel, /*game panel, allows to change game-mode etc*/
|
||||
/client/proc/check_ai_laws, /*shows AI and borg laws*/
|
||||
/client/proc/ghost_pool_protection, /*opens a menu for toggling ghost roles*/
|
||||
/datum/admins/proc/toggleooc, /*toggles ooc on/off for everyone*/
|
||||
/datum/admins/proc/toggleoocdead, /*toggles ooc on/off for everyone who is dead*/
|
||||
/datum/admins/proc/toggleenter, /*toggles whether people can join the current game*/
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
//very similar to centcom_podlauncher in terms of how this is coded, so i kept a lot of comments from it
|
||||
|
||||
/client/proc/ghost_pool_protection() //Creates a verb for admins to open up the ui
|
||||
set name = "Ghost Pool Protection"
|
||||
set desc = "Choose which ways people can get into the round, or just clear it out completely for admin events."
|
||||
set category = "Admin - Events"
|
||||
var/datum/ghost_pool_menu/tgui = new(usr)//create the datum
|
||||
tgui.ui_interact(usr)//datum has a tgui component, here we open the window
|
||||
|
||||
/datum/ghost_pool_menu
|
||||
var/client/holder //client of whoever is using this datum
|
||||
|
||||
//when submitted, what the pool flags will be set to
|
||||
var/new_role_flags = ALL
|
||||
|
||||
//EVERY TYPE OF WAY SOMEONE IS GETTING BACK INTO THE ROUND!
|
||||
//these are the same comments as the ones in admin.dm defines, please update those if you change them here
|
||||
/*
|
||||
var/events_or_midrounds = TRUE //ie fugitives, space dragon, etc. also includes dynamic midrounds as it's the same deal
|
||||
var/spawners = TRUE //ie ashwalkers, free golems, beach bums
|
||||
var/station_sentience = TRUE //ie posibrains, mind monkeys, sentience potion, etc.
|
||||
var/minigames = TRUE //ie mafia, ctf
|
||||
var/misc = TRUE //oddities like split personality and any animal ones like spiders, xenos
|
||||
*/
|
||||
|
||||
/datum/ghost_pool_menu/New(user)//user can either be a client or a mob due to byondcode(tm)
|
||||
if (istype(user, /client))
|
||||
var/client/user_client = user
|
||||
holder = user_client //if its a client, assign it to holder
|
||||
else
|
||||
var/mob/user_mob = user
|
||||
holder = user_mob.client //if its a mob, assign the mob's client to holder
|
||||
new_role_flags = GLOB.ghost_role_flags
|
||||
|
||||
/datum/ghost_pool_menu/ui_state(mob/user)
|
||||
return GLOB.admin_state
|
||||
|
||||
/datum/ghost_pool_menu/ui_close()
|
||||
qdel(src)
|
||||
|
||||
/datum/ghost_pool_menu/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "GhostPoolProtection")
|
||||
ui.open()
|
||||
|
||||
/datum/ghost_pool_menu/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["events_or_midrounds"] = (new_role_flags & GHOSTROLE_MIDROUND_EVENT)
|
||||
data["spawners"] = (new_role_flags & GHOSTROLE_SPAWNER)
|
||||
data["station_sentience"] = (new_role_flags & GHOSTROLE_STATION_SENTIENCE)
|
||||
data["silicons"] = (new_role_flags & GHOSTROLE_SILICONS)
|
||||
data["minigames"] = (new_role_flags & GHOSTROLE_MINIGAME)
|
||||
return data
|
||||
|
||||
/datum/ghost_pool_menu/ui_act(action, params)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
switch(action)
|
||||
if("toggle_events_or_midrounds")
|
||||
new_role_flags ^= GHOSTROLE_MIDROUND_EVENT
|
||||
if("toggle_spawners")
|
||||
new_role_flags ^= GHOSTROLE_SPAWNER
|
||||
if("toggle_station_sentience")
|
||||
new_role_flags ^= GHOSTROLE_STATION_SENTIENCE
|
||||
if("toggle_silicons")
|
||||
new_role_flags ^= GHOSTROLE_SILICONS
|
||||
if("toggle_minigames")
|
||||
new_role_flags ^= GHOSTROLE_MINIGAME
|
||||
if("all_roles")
|
||||
new_role_flags = ALL
|
||||
if("no_roles")
|
||||
new_role_flags = NONE
|
||||
if("apply_settings")
|
||||
to_chat(usr, "Settings Applied!")
|
||||
var/msg
|
||||
switch(new_role_flags)
|
||||
if(ALL)
|
||||
msg = "enabled all of"
|
||||
if(NONE)
|
||||
msg = "disabled all of"
|
||||
else
|
||||
msg = "modified"
|
||||
message_admins("[key_name_admin(holder)] has [msg] this round's allowed ghost roles.")
|
||||
GLOB.ghost_role_flags = new_role_flags
|
||||
@@ -216,6 +216,9 @@
|
||||
return
|
||||
|
||||
|
||||
if(!(GLOB.ghost_role_flags & GHOSTROLE_MINIGAME))
|
||||
to_chat(user, "<span class='warning'>CTF has been temporarily disabled by admins.</span>")
|
||||
return
|
||||
people_who_want_to_play |= user.ckey
|
||||
var/num = people_who_want_to_play.len
|
||||
var/remaining = CTF_REQUIRED_PLAYERS - num
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
/obj/effect/mob_spawn/attack_ghost(mob/user)
|
||||
if(!SSticker.HasRoundStarted() || !loc || !ghost_usable)
|
||||
return
|
||||
if(!(GLOB.ghost_role_flags & GHOSTROLE_SPAWNER) && !(flags_1 & ADMIN_SPAWNED_1))
|
||||
to_chat(user, "<span class='warning'>An admin has temporarily disabled non-admin ghost roles!</span>")
|
||||
return
|
||||
if(!uses)
|
||||
to_chat(user, "<span class='warning'>This spawner is out of charges!</span>")
|
||||
return
|
||||
|
||||
@@ -375,6 +375,8 @@
|
||||
something.apply_damage(5,BRUTE,BODY_ZONE_HEAD,FALSE,FALSE,FALSE) //notably: no damage resist (it's in your helmet), no damage spread (it's in your helmet)
|
||||
playsound(src, 'sound/machines/buzz-sigh.ogg', 30, TRUE)
|
||||
return
|
||||
if(!(GLOB.ghost_role_flags & GHOSTROLE_STATION_SENTIENCE))
|
||||
say("ERROR: Central Command has temporarily outlawed monkey sentience helmets in this sector. NEAREST LAWFUL SECTOR: 2.537 million light years away.")
|
||||
magnification = user //this polls ghosts
|
||||
visible_message("<span class='warning'>[src] powers up!</span>")
|
||||
playsound(src, 'sound/machines/ping.ogg', 30, TRUE)
|
||||
|
||||
@@ -53,6 +53,8 @@
|
||||
return FALSE
|
||||
if(EMERGENCY_ESCAPED_OR_ENDGAMED)
|
||||
return FALSE
|
||||
if(ispath(typepath, /datum/round_event/ghost_role) && GHOSTROLE_MIDROUND_EVENT)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/round_event_control/proc/preRunEvent()
|
||||
|
||||
@@ -834,7 +834,7 @@
|
||||
* Only checks if everyone is actually valid to start (still connected and an observer) if there are enough players (basic_setup)
|
||||
*/
|
||||
/datum/mafia_controller/proc/try_autostart()
|
||||
if(phase != MAFIA_PHASE_SETUP)
|
||||
if(phase != MAFIA_PHASE_SETUP || !(GLOB.ghost_role_flags & GHOSTROLE_MINIGAME))
|
||||
return
|
||||
if(GLOB.mafia_signup.len >= MAFIA_MAX_PLAYER_COUNT || custom_setup.len)//enough people to try and make something (or debug mode)
|
||||
basic_setup()
|
||||
|
||||
@@ -48,6 +48,8 @@ GLOBAL_VAR(posibrain_notify_cooldown)
|
||||
/obj/item/mmi/posibrain/attack_self(mob/user)
|
||||
if(!brainmob)
|
||||
brainmob = new(src)
|
||||
if(!(GLOB.ghost_role_flags & GHOSTROLE_SILICONS))
|
||||
to_chat(user, "<span class='warning'>Central Command has temporarily outlawed posibrain sentience in this sector...</span>")
|
||||
if(is_occupied())
|
||||
to_chat(user, "<span class='warning'>This [name] is already active!</span>")
|
||||
return
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
/mob/living/simple_animal/hostile/poison/giant_spider/Topic(href, href_list)
|
||||
if(href_list["activate"])
|
||||
var/mob/dead/observer/ghost = usr
|
||||
if(istype(ghost) && playable_spider)
|
||||
if(istype(ghost) && playable_spider && !(GLOB.ghost_role_flags & GHOSTROLE_SPAWNER))
|
||||
humanize_spider(ghost)
|
||||
|
||||
/mob/living/simple_animal/hostile/poison/giant_spider/Login()
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
|
||||
/mob/living/simple_animal/hostile/venus_human_trap/attack_ghost(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
if(. || !(GLOB.ghost_role_flags & GHOSTROLE_SPAWNER))
|
||||
return
|
||||
humanize_plant(user)
|
||||
|
||||
|
||||
@@ -1348,6 +1348,7 @@
|
||||
#include "code\modules\admin\verbs\fix_air.dm"
|
||||
#include "code\modules\admin\verbs\fps.dm"
|
||||
#include "code\modules\admin\verbs\getlogs.dm"
|
||||
#include "code\modules\admin\verbs\ghost_pool_protection.dm"
|
||||
#include "code\modules\admin\verbs\individual_logging.dm"
|
||||
#include "code\modules\admin\verbs\machine_upgrade.dm"
|
||||
#include "code\modules\admin\verbs\manipulate_organs.dm"
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
import { useBackend } from '../backend';
|
||||
import { Button, Flex, Fragment, Section, NoticeBox } from '../components';
|
||||
import { Window } from '../layouts';
|
||||
|
||||
export const GhostPoolProtection = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const {
|
||||
events_or_midrounds,
|
||||
spawners,
|
||||
station_sentience,
|
||||
silicons,
|
||||
minigames,
|
||||
} = data;
|
||||
return (
|
||||
<Window
|
||||
title="Ghost Pool Protection"
|
||||
width={400}
|
||||
height={270}>
|
||||
<Window.Content>
|
||||
<Flex grow={1} height="100%">
|
||||
<Section
|
||||
title="Options"
|
||||
buttons={
|
||||
<Fragment>
|
||||
<Button
|
||||
color="good"
|
||||
icon="plus-circle"
|
||||
content="Enable Everything"
|
||||
onClick={() => act("all_roles")} />
|
||||
<Button
|
||||
color="bad"
|
||||
icon="minus-circle"
|
||||
content="Disable Everything"
|
||||
onClick={() => act("no_roles")} />
|
||||
</Fragment>
|
||||
}>
|
||||
<NoticeBox danger>
|
||||
For people creating a sneaky event: If you
|
||||
toggle Station Created Sentience, people may
|
||||
catch on that admins have disabled roles for
|
||||
your event...
|
||||
</NoticeBox>
|
||||
<Flex.Item>
|
||||
<Button
|
||||
fluid
|
||||
textAlign="center"
|
||||
color={events_or_midrounds ? "good" : "bad"}
|
||||
icon="meteor"
|
||||
content="Events and Midround Rulesets"
|
||||
onClick={() => act("toggle_events_or_midrounds")} />
|
||||
</Flex.Item>
|
||||
<Flex.Item>
|
||||
<Button
|
||||
fluid
|
||||
textAlign="center"
|
||||
color={spawners ? "good" : "bad"}
|
||||
icon="pastafarianism"
|
||||
content="Ghost Role Spawners"
|
||||
onClick={() => act("toggle_spawners")} />
|
||||
</Flex.Item>
|
||||
<Flex.Item>
|
||||
<Button
|
||||
fluid
|
||||
textAlign="center"
|
||||
color={station_sentience ? "good" : "bad"}
|
||||
icon="user-astronaut"
|
||||
content="Station Created Sentience"
|
||||
onClick={() => act("toggle_station_sentience")} />
|
||||
</Flex.Item>
|
||||
<Flex.Item>
|
||||
<Button
|
||||
fluid
|
||||
textAlign="center"
|
||||
color={silicons ? "good" : "bad"}
|
||||
icon="robot"
|
||||
content="Silicons"
|
||||
onClick={() => act("toggle_silicons")} />
|
||||
</Flex.Item>
|
||||
<Flex.Item>
|
||||
<Button
|
||||
fluid
|
||||
textAlign="center"
|
||||
color={minigames ? "good" : "bad"}
|
||||
icon="gamepad"
|
||||
content="Minigames"
|
||||
onClick={() => act("toggle_minigames")} />
|
||||
</Flex.Item>
|
||||
<Flex.Item>
|
||||
<Button
|
||||
fluid
|
||||
textAlign="center"
|
||||
color="orange"
|
||||
icon="check"
|
||||
content="Apply Changes"
|
||||
onClick={() => act("apply_settings")} />
|
||||
</Flex.Item>
|
||||
</Section>
|
||||
</Flex>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user