send
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
///Allows an admin to force an event
|
||||
/client/proc/forceEvent()
|
||||
set name = "Trigger Event"
|
||||
set category = "Admin.Events"
|
||||
|
||||
if(!holder || !check_rights(R_FUN))
|
||||
return
|
||||
|
||||
holder.forceEvent()
|
||||
|
||||
///Opens up the Force Event Panel
|
||||
/datum/admins/proc/forceEvent()
|
||||
if(!check_rights(R_FUN))
|
||||
return
|
||||
|
||||
var/datum/force_event/ui = new(usr)
|
||||
ui.ui_interact(usr)
|
||||
|
||||
/// Force Event Panel
|
||||
/datum/force_event
|
||||
|
||||
/datum/force_event/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "ForceEvent")
|
||||
ui.open()
|
||||
|
||||
/datum/force_event/ui_state(mob/user)
|
||||
return GLOB.fun_state
|
||||
|
||||
/datum/force_event/ui_static_data(mob/user)
|
||||
var/static/list/category_to_icons
|
||||
if(!category_to_icons)
|
||||
category_to_icons = list(
|
||||
EVENT_CATEGORY_AI = "robot",
|
||||
EVENT_CATEGORY_ANOMALIES = "cloud-bolt",
|
||||
EVENT_CATEGORY_BUREAUCRATIC = "print",
|
||||
EVENT_CATEGORY_ENGINEERING = "wrench",
|
||||
EVENT_CATEGORY_ENTITIES = "ghost",
|
||||
EVENT_CATEGORY_FRIENDLY = "face-smile",
|
||||
EVENT_CATEGORY_HEALTH = "brain",
|
||||
EVENT_CATEGORY_HOLIDAY = "calendar",
|
||||
EVENT_CATEGORY_INVASION = "user-group",
|
||||
EVENT_CATEGORY_JANITORIAL = "bath",
|
||||
EVENT_CATEGORY_SPACE = "meteor",
|
||||
EVENT_CATEGORY_WIZARD = "hat-wizard",
|
||||
)
|
||||
var/list/data = list()
|
||||
|
||||
var/list/categories_seen = list()
|
||||
var/list/categories = list()
|
||||
|
||||
var/list/events = list()
|
||||
|
||||
for(var/datum/round_event_control/event_control as anything in SSevents.control)
|
||||
//add category
|
||||
if(!categories_seen[event_control.category])
|
||||
categories_seen[event_control.category] = TRUE
|
||||
UNTYPED_LIST_ADD(categories, list(
|
||||
"name" = event_control.category,
|
||||
"icon" = category_to_icons[event_control.category],
|
||||
))
|
||||
//add event, with one value matching up the category
|
||||
UNTYPED_LIST_ADD(events, list(
|
||||
"name" = event_control.name,
|
||||
"description" = event_control.description,
|
||||
"type" = event_control.type,
|
||||
"category" = event_control.category,
|
||||
))
|
||||
data["categories"] = categories
|
||||
data["events"] = events
|
||||
return data
|
||||
|
||||
/datum/force_event/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
if(..())
|
||||
return
|
||||
if(!check_rights(R_FUN))
|
||||
return
|
||||
switch(action)
|
||||
if("forceevent")
|
||||
var/announce_event = params["announce"]
|
||||
var/string_path = params["type"]
|
||||
if(!string_path)
|
||||
return
|
||||
var/event_to_run_type = text2path(string_path)
|
||||
if(!event_to_run_type)
|
||||
return
|
||||
var/datum/round_event_control/event = locate(event_to_run_type) in SSevents.control
|
||||
if(!event)
|
||||
return
|
||||
if(event.admin_setup(usr) == ADMIN_CANCEL_EVENT)
|
||||
return
|
||||
var/always_announce_chance = 100
|
||||
var/no_announce_chance = 0
|
||||
event.runEvent(announce_chance_override = announce_event ? always_announce_chance : no_announce_chance, admin_forced = TRUE)
|
||||
message_admins("[key_name_admin(usr)] has triggered an event. ([event.name])")
|
||||
log_admin("[key_name(usr)] has triggered an event. ([event.name])")
|
||||
@@ -158,27 +158,6 @@
|
||||
message_admins("[key_name_admin(usr)] tried to create a revenant. Unfortunately, there were no candidates available.")
|
||||
log_admin("[key_name(usr)] failed to create a revenant.")
|
||||
|
||||
else if(href_list["forceevent"])
|
||||
if(!check_rights(R_FUN))
|
||||
return
|
||||
var/datum/round_event_control/E = locate(href_list["forceevent"]) in SSevents.control
|
||||
if(E)
|
||||
E.admin_setup(usr)
|
||||
var/datum/round_event/event = E.runEvent()
|
||||
if(event.announceWhen>0)
|
||||
event.processing = FALSE
|
||||
var/prompt = alert(usr, "Would you like to alert the crew?", "Alert", "Yes", "No", "Cancel")
|
||||
switch(prompt)
|
||||
if("Cancel")
|
||||
event.kill()
|
||||
return
|
||||
if("No")
|
||||
event.announceWhen = -1
|
||||
event.processing = TRUE
|
||||
message_admins("[key_name_admin(usr)] has triggered an event. ([E.name])")
|
||||
log_admin("[key_name(usr)] has triggered an event. ([E.name])")
|
||||
return
|
||||
|
||||
else if(href_list["dbsearchckey"] || href_list["dbsearchadmin"] || href_list["dbsearchip"] || href_list["dbsearchcid"])
|
||||
var/adminckey = href_list["dbsearchadmin"]
|
||||
var/playerckey = href_list["dbsearchckey"]
|
||||
|
||||
@@ -517,10 +517,10 @@ Traitors and the like can also be revived with the previous role mostly intact.
|
||||
message_admins("Admin [key_name_admin(usr)] has added a new AI law - [input]")
|
||||
|
||||
var/show_log = alert(src, "Show ion message?", "Message", "Yes", "No")
|
||||
var/announce_ion_laws = (show_log == "Yes" ? 1 : -1)
|
||||
var/announce_ion_laws = (show_log == "Yes" ? 100 : 0)
|
||||
|
||||
var/datum/round_event/ion_storm/add_law_only/ion = new()
|
||||
ion.announceEvent = announce_ion_laws
|
||||
ion.announce_chance = announce_ion_laws
|
||||
ion.ionMessage = input
|
||||
|
||||
SSblackbox.record_feedback("tally", "admin_verb", 1, "Add Custom AI Law") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
@@ -583,13 +583,15 @@
|
||||
// log_admin("[key_name(holder)] has Un-Fully Immersed everyone.")
|
||||
if(E)
|
||||
E.processing = FALSE
|
||||
if(E.announceWhen>0)
|
||||
if(E.announce_when>0)
|
||||
switch(alert(holder, "Would you like to alert the crew?", "Alert", "Yes", "No", "Cancel"))
|
||||
if("Yes")
|
||||
E.announce_chance = 100
|
||||
if("Cancel")
|
||||
E.kill()
|
||||
return
|
||||
if("No")
|
||||
E.announceWhen = -1
|
||||
E.announce_chance = 0
|
||||
E.processing = TRUE
|
||||
if(holder)
|
||||
log_admin("[key_name(holder)] used secret [action]")
|
||||
|
||||
Reference in New Issue
Block a user