[MIRROR] Adds(feature): Triggerable Landmarks for Event-help (#6675)

Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com>
Co-authored-by: CHOMPStation2 <chompsation2@gmail.com>
Co-authored-by: Raeschen <rycoop29@gmail.com>
This commit is contained in:
CHOMPStation2
2023-07-29 23:24:23 -07:00
committed by GitHub
parent e8d64fa92f
commit c25cb2e25d
5 changed files with 262 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ var/global/list/cleanbot_reserved_turfs = list() //List of all turfs currently t
var/global/list/cable_list = list() //Index for all cables, so that powernets don't have to look through the entire world all the time
var/global/list/landmarks_list = list() //list of all landmarks created
var/global/list/event_triggers = list() //Associative list of creator_ckey:list(landmark references) for event triggers
var/global/list/surgery_steps = list() //list of all surgery steps |BS12
var/global/list/side_effects = list() //list of all medical sideeffects types by thier names |BS12
var/global/list/mechas_list = list() //list of all mechs. Used by hostile mobs target tracking.

View File

@@ -0,0 +1,129 @@
/*
Landmark to be spawned by GMs and admins when running events.
Do NOT directly spawn "" or buildmode spawn this.
Use the "Manage Event Triggers" verb under "Eventkit" category.
Admin verb is called by code\modules\admin\verbs\event_triggers.dm
*/
/obj/effect/landmark/event_trigger
name = "ONLY FOR EVENTS. DO NOT USE WHEN MAPPING"
desc = "Please notify staff if you see this!"
var/creator_ckey = ""
var/isTeamwork = FALSE //Whether to notify creator or whole team.
var/isRepeating = FALSE
var/coordinates = ""
var/cooldown = 0 //Given in seconds in set_vars() but stored in ticks
var/last_trigger = 0
var/isLoud = FALSE
var/isNarrate = FALSE
/obj/effect/landmark/event_trigger/New()
..()
coordinates = "(X:[loc.x];Y:[loc.y];Z:[loc.z])"
/obj/effect/landmark/event_trigger/proc/set_vars(mob/M)
var/new_name = sanitize(tgui_input_text(M, "Input Name for the trigger", "Naming", "Event Trigger"))
if(!new_name)
return
name = new_name
creator_ckey = M.ckey
if(!event_triggers[creator_ckey])
event_triggers[creator_ckey] = list()
event_triggers[creator_ckey] |= list(src)
isTeamwork = (tgui_alert(M, "Notify rest of team?", "Teamwork", list("No", "Yes")) == "Yes" ? TRUE : FALSE)
if(!isTeamwork)
isLoud = (tgui_alert(M, "Should it make a bwoink when triggered for YOU?", "bwoink", list("No", "Yes")) == "Yes" ? TRUE : FALSE)
isRepeating = (tgui_alert(M, "Make it fire repeatedly?", "Repetition", list("No", "Yes")) == "Yes" ? TRUE : FALSE)
if(isRepeating)
cooldown = tgui_input_number(M, "Set cooldown in seconds. Minimum 5 seconds!", "Cooldown", 60, min_value = 5)
cooldown = cooldown SECONDS
else
delete_me = TRUE
log_admin("[M.ckey] has created a [isNarrate ? "Narrtion" : "Notification"] landmark trigger at [coordinates]")
/obj/effect/landmark/event_trigger/Destroy()
if(event_triggers[creator_ckey])
event_triggers[creator_ckey] -= src
..()
/obj/effect/landmark/event_trigger/Crossed(var/atom/movable/AM)
if(!isliving(AM))
return FALSE
var/mob/living/L = AM
if(!L.ckey) return FALSE
if(world.time < (last_trigger + cooldown))
return FALSE
if(!isRepeating && last_trigger) //Used to avoid spam if qdel(src) fires too slowly
return FALSE
last_trigger = world.time
if(!creator_ckey) //For some reason, the user didn't have a ckey. Let's clean up
qdel(src)
return FALSE
var/mob/creator_reference = GLOB.directory[creator_ckey]
if(!creator_reference || isTeamwork) //If logged/crashed, we default to teamwork mode
message_admins("Player [L.name] ([L.ckey]) has triggered event narrate landmark [name] of type \
[isNarrate ? "Narration" : "Notification"]. \n \
The landmark was created by [creator_ckey], and it [isRepeating ? \
"will be possible to trigger after [cooldown / (1 SECOND)] seconds" : "has self-deleted"]\n \
COORDINATES: [coordinates]")
else
if(isLoud)
creator_reference << 'sound/effects/adminhelp.ogg'
to_chat(creator_reference, SPAN_WARNING("Player [L.name] ([L.ckey]) has triggered event \
narrate landmark [name] of type [isNarrate ? "Narration" : "Notification"]. \n \
It [isRepeating ? "will be possible to trigger after [cooldown / (1 SECOND)] seconds" : "has self-deleted"] \n \
COORDINATES: [coordinates]"))
if(!isNarrate)
if(!isRepeating)
qdel(src)
return FALSE
else
return L
/obj/effect/landmark/event_trigger/auto_narrate
var/message
var/isPersonal_orVis_orAud = 0 //0 for personal, 1 for vis, 2 for aud
var/message_range //Leave at 0 for world.view
var/isWarning = FALSE //For personal messages
isNarrate = TRUE
/obj/effect/landmark/event_trigger/auto_narrate/New()
message_range = world.view
..()
/obj/effect/landmark/event_trigger/auto_narrate/set_vars(mob/M)
..()
message = encode_html_emphasis(sanitize(tgui_input_text(M, "What should the automatic narration say?", "Message"), encode = FALSE))
isPersonal_orVis_orAud = (tgui_alert(M, "Should it send directly to the player, or send to the turf?", "Target", list("Player", "Turf")) == "Player" ? 0 : 1)
if(isPersonal_orVis_orAud == 0)
isWarning = (tgui_alert(M, "Should it be a normal message or a big scary red text?", "Scary Red", list("Big Red", "Normal")) == "Big Red" ? TRUE : FALSE)
else
isPersonal_orVis_orAud = (tgui_alert(M, "Should it be visible or audible?", "Mode", list("Visible", "Audible")) == "Audible" ? 2 : 1)
var/range = tgui_input_number(M, "Give narration range! Input value over 10 to use world.view", "Range",default = 11, min_value = 0)
if(range <= 10)
message_range = range
/obj/effect/landmark/event_trigger/auto_narrate/Crossed(var/atom/movable/AM)
. = ..() //Checks if AM is mob/living and notifies admin(s)
if(!.)
return
var/mob/living/L = .
var/turf/T = get_turf(src)
switch(isPersonal_orVis_orAud)
if(0)
if(isWarning)
to_chat(L, SPAN_DANGER(message))
else
to_chat(L, message)
if(1)
T.visible_message(message, range = message_range, runemessage = message)
if(2)
T.audible_message(message, hearing_distance = message_range, runemessage= message)
if(!isRepeating)
qdel(src)

View File

@@ -172,7 +172,8 @@ var/list/admin_verbs_fun = list(
/client/proc/remove_mob_for_narration, //VOREStation Add
/client/proc/narrate_mob, //VOREStation Add
/client/proc/narrate_mob_args, //VOREStation Add
/client/proc/getPlayerStatus //VORESTation Add
/client/proc/getPlayerStatus, //VORESTation Add
/client/proc/manage_event_triggers
)

View File

@@ -0,0 +1,128 @@
/*
Eventkit verb to be used to spawn the obj/effect/landmarks defined under code\game\objects\effects\landmarks_events.dm
*/
/client/proc/manage_event_triggers()
set name = "Manage Event Triggers"
set desc = "Open dialogue to create or delete narration/notification triggers"
set category = "Fun" //ChompEDIT - Eventkit --> Fun
if(!check_rights(R_FUN)) return
var/mode = tgui_input_list(src, "What do you wish to do?", "Manage Event Triggers", \
list(
"Create Notification Trigger",
"Create Narration Trigger",
"Manage Personal Triggers",
"Manage Other's Triggers",
"Cancel"
), "Cancel" )
if(!mode || mode == "Cancel") return
feedback_add_details("admin_verb","EventTriggerManage")
switch(mode)
if("Create Notification Trigger")
var/obj/effect/landmark/event_trigger/ET = new /obj/effect/landmark/event_trigger(usr.loc)
ET.set_vars(src)
if("Create Narration Trigger")
var/obj/effect/landmark/event_trigger/auto_narrate/AN = new /obj/effect/landmark/event_trigger/auto_narrate(usr.loc)
AN.set_vars(src)
if("Manage Personal Triggers")
var/personal_list = event_triggers[src.ckey]
if(!LAZYLEN(personal_list))
to_chat(src, SPAN_NOTICE("You don't have any landmarks to manage!"))
return
personal_list |= list("Cancel", "Delete All")
var/choice = tgui_input_list(src, "Select a landmark to choose between teleporting to it or deleting it, select delete all to clear them.", \
"Manage Personal Triggers", personal_list)
if(!choice || choice == "Cancel")
return
if(choice == "Delete All")
var/confirm = tgui_alert(src, "ARE YOU SURE? THERE IS NO GOING BACK", "CONFIRM", list("Go Back", "Delete all my event triggers"), autofocus = FALSE)
if(confirm == "Go Back")
return
for(var/obj/effect/landmark/event_trigger/ET in personal_list)
ET.delete_me = TRUE
qdel(ET)
else if(istype(choice, /obj/effect/landmark/event_trigger))
var/obj/effect/landmark/event_trigger/ET = choice
var/decision = tgui_alert(src, "Teleport to Landmark or Delete it?", "Manage [ET.name]", list("Teleport", "Delete"), autofocus = FALSE)
if(decision == "Teleport")
var/mob/M = usr
if(isobserver(M))
var/confirm_teleport = tgui_alert(src, "You're not a ghost! Admin-ghost?", "You're not a ghost", \
list("Cancel", "Teleport me with my character"))
if(confirm_teleport == "Cancel")
return
M.forceMove(get_turf(ET))
if(decision == "Delete")
var/confirm = tgui_alert(src, "ARE YOU SURE? THERE IS NO GOING BACK FROM DELETING [ET.name]", "CONFIRM", list("Go Back", "Delete it!"), autofocus = FALSE)
if(confirm == "Go Back")
return
ET.delete_me = TRUE
qdel(ET)
if("Manage Other's Triggers")
var/other_ckey = sanitize(tgui_input_text(src, "input trigger owner's ckey", "CKEY", ""))
var/others_list = event_triggers[other_ckey]
if(!LAZYLEN(others_list))
to_chat(src, SPAN_NOTICE("[other_ckey] doesn't have any landmarks to manage!"))
return
others_list |= list("Cancel", "Delete All")
var/choice = tgui_input_list(src, "Select a landmark to choose between teleporting to it or deleting it, select delete all to clear them.", \
"Manage Personal Triggers", others_list)
if(!choice || choice == "Cancel")
return
if(choice == "Delete All")
if(other_ckey && GLOB.directory[other_ckey])
var/client/C = GLOB.directory[other_ckey]
var/mob/M = C.statobj
if(M.client && M.client.inactivity < 30 MINUTES)
if(tgui_alert(src, "[M] has only been inactive for [M.client.inactivity / (1 MINUTE)] minutes.\n \
If you want to delete their event triggers, ask them in asay or discord to do it themselves or wait 30 minutes. \n \
Only proceed if you are absolutely certain.", "Force Delete", list("Confirm", "Cancel")) == "Confirm")
for(var/obj/effect/landmark/event_trigger/ET in others_list)
ET.delete_me = TRUE
qdel(ET)
log_and_message_admins("[src.ckey] deleted all of [other_ckey]'s event triggers while [other_ckey] was active")
return
var/confirm = tgui_alert(src, "ARE YOU SURE? THERE IS NO GOING BACK", "CONFIRM", list("Go Back", "Delete all my event triggers"), autofocus = FALSE)
if(confirm == "Go Back")
return
for(var/obj/effect/landmark/event_trigger/ET in others_list)
ET.delete_me = TRUE
qdel(ET)
log_and_message_admins("[src.ckey] deleted all of [other_ckey]'s event triggers. [other_ckey] was either inactive or disconnected at this time.")
else if(istype(choice, /obj/effect/landmark/event_trigger))
var/obj/effect/landmark/event_trigger/ET = choice
var/decision = tgui_alert(src, "Teleport to Landmark or Delete it?", "Manage [ET]", list("Teleport", "Delete"), autofocus = FALSE)
if(decision == "Teleport")
var/mob/M = usr
if(isobserver(M))
var/confirm_teleport = tgui_alert(src, "You're not a ghost! Admin-ghost?", "You're not a ghost", \
list("Cancel", "Teleport me with my character"))
if(confirm_teleport == "Cancel")
return
M.forceMove(get_turf(ET))
if(decision == "Delete")
if(other_ckey && GLOB.directory[other_ckey])
var/client/C = GLOB.directory[other_ckey]
var/mob/M = C.statobj
if(M.client && M.client.inactivity < 30 MINUTES)
if(tgui_alert(src, "[M] has only been inactive for [M.client.inactivity / (1 MINUTE)] minutes.\n \
If you want to delete their event triggers, ask them in asay or discord to do it themselves or wait 30 minutes. \n \
Only proceed if you are absolutely certain.", "Force Delete", list("Confirm", "Cancel")) == "Confirm")
ET.delete_me = TRUE
qdel(ET)
log_and_message_admins("[src.ckey] tried to delete event trigger [ET.name] while [other_ckey] is active.")
return
var/confirm = tgui_alert(src, "ARE YOU SURE? THERE IS NO GOING BACK FROM DELETING [ET.name]", "CONFIRM", list("Go Back", "Delete it!"), autofocus = FALSE)
if(confirm == "Go Back")
return
ET.delete_me = TRUE
qdel(ET)
log_and_message_admins("[src.ckey] tried to deleted event trigger [ET.name], [other_ckey] is either disconnected or inactive.")

View File

@@ -1167,6 +1167,7 @@
#include "code\game\objects\effects\item_pickup_ghost.dm"
#include "code\game\objects\effects\job_start_landmarks.dm"
#include "code\game\objects\effects\landmarks.dm"
#include "code\game\objects\effects\landmarks_events.dm"
#include "code\game\objects\effects\landmarks_poi_vr.dm"
#include "code\game\objects\effects\landmarks_vr.dm"
#include "code\game\objects\effects\manifest.dm"
@@ -1867,6 +1868,7 @@
#include "code\modules\admin\verbs\diagnostics.dm"
#include "code\modules\admin\verbs\dice.dm"
#include "code\modules\admin\verbs\entity_narrate.dm"
#include "code\modules\admin\verbs\event_triggers.dm"
#include "code\modules\admin\verbs\fps.dm"
#include "code\modules\admin\verbs\get_player_status.dm"
#include "code\modules\admin\verbs\getlogs.dm"