mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
Merge branch 'master' into movespeed_modifiers_take_two
This commit is contained in:
@@ -98,7 +98,7 @@
|
||||
return FALSE
|
||||
var/temp = text2num(trim(str_val))
|
||||
if(!isnull(temp))
|
||||
config_entry_value = CLAMP(integer ? round(temp) : temp, min_val, max_val)
|
||||
config_entry_value = clamp(integer ? round(temp) : temp, min_val, max_val)
|
||||
if(config_entry_value != temp && !(datum_flags & DF_VAR_EDITED))
|
||||
log_config("Changing [name] from [temp] to [config_entry_value]!")
|
||||
return TRUE
|
||||
|
||||
@@ -484,3 +484,13 @@
|
||||
/datum/config_entry/flag/reopen_roundstart_suicide_roles_command_report
|
||||
|
||||
/datum/config_entry/flag/auto_profile
|
||||
|
||||
// DISCORD ROLE STUFFS
|
||||
// Using strings for everything because BYOND does not like numbers this big
|
||||
/datum/config_entry/flag/enable_discord_autorole
|
||||
|
||||
/datum/config_entry/string/discord_token
|
||||
|
||||
/datum/config_entry/string/discord_guildid
|
||||
|
||||
/datum/config_entry/string/discord_roleid
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
NOTES:
|
||||
There is a DB table to track ckeys and associated discord IDs.
|
||||
This system REQUIRES TGS, and will auto-disable if TGS is not present.
|
||||
@@ -15,7 +15,7 @@ ROUNDSTART:
|
||||
2] A ping is sent to the discord with the IDs of people who wished to be notified
|
||||
3] The file is emptied
|
||||
|
||||
MIDROUND:
|
||||
MIDROUND:
|
||||
1] Someone usees the notify verb, it adds their discord ID to the list.
|
||||
2] On fire, it will write that to the disk, as long as conditions above are correct
|
||||
|
||||
@@ -43,7 +43,7 @@ SUBSYSTEM_DEF(discord)
|
||||
enabled = 1 // Allows other procs to use this (Account linking, etc)
|
||||
else
|
||||
can_fire = 0 // We dont want excess firing
|
||||
return ..() // Cancel
|
||||
return ..() // Cancel
|
||||
|
||||
try
|
||||
people_to_notify = json_decode(file2text(notify_file))
|
||||
@@ -57,18 +57,18 @@ SUBSYSTEM_DEF(discord)
|
||||
send2chat("[notifymsg]", CONFIG_GET(string/chat_announce_new_game)) // Sends the message to the discord, using same config option as the roundstart notification
|
||||
fdel(notify_file) // Deletes the file
|
||||
return ..()
|
||||
|
||||
|
||||
/datum/controller/subsystem/discord/fire()
|
||||
if(!enabled)
|
||||
return // Dont do shit if its disabled
|
||||
if(notify_members == notify_members_cache)
|
||||
return // Dont re-write the file
|
||||
return // Dont re-write the file
|
||||
// If we are all clear
|
||||
write_notify_file()
|
||||
|
||||
|
||||
/datum/controller/subsystem/discord/Shutdown()
|
||||
write_notify_file() // Guaranteed force-write on server close
|
||||
|
||||
|
||||
/datum/controller/subsystem/discord/proc/write_notify_file()
|
||||
if(!enabled) // Dont do shit if its disabled
|
||||
return
|
||||
@@ -113,3 +113,20 @@ SUBSYSTEM_DEF(discord)
|
||||
/datum/controller/subsystem/discord/proc/id_clean(input)
|
||||
var/regex/num_only = regex("\[^0-9\]", "g")
|
||||
return num_only.Replace(input, "")
|
||||
|
||||
/datum/controller/subsystem/discord/proc/grant_role(id)
|
||||
// Ignore this shit if config isnt enabled for it
|
||||
if(!CONFIG_GET(flag/enable_discord_autorole))
|
||||
return
|
||||
|
||||
var/url = "https://discordapp.com/api/guilds/[CONFIG_GET(string/discord_guildid)]/members/[id]/roles/[CONFIG_GET(string/discord_roleid)]"
|
||||
|
||||
// Make the request
|
||||
|
||||
var/datum/http_request/req = new()
|
||||
req.prepare(RUSTG_HTTP_METHOD_PUT, url, "", list("Authorization" = "Bot [CONFIG_GET(string/discord_token)]"))
|
||||
req.begin_async()
|
||||
UNTIL(req.is_complete())
|
||||
var/datum/http_response/res = req.into_response()
|
||||
|
||||
WRITE_LOG(GLOB.discord_api_log, "PUT [url] returned [res.status_code] [res.body]")
|
||||
|
||||
@@ -338,7 +338,7 @@ SUBSYSTEM_DEF(persistence)
|
||||
var/datum/chemical_reaction/randomized/R = new randomized_type
|
||||
var/loaded = FALSE
|
||||
if(R.persistent && json)
|
||||
var/list/recipe_data = json[R.id]
|
||||
var/list/recipe_data = json[R.type]
|
||||
if(recipe_data)
|
||||
if(R.LoadOldRecipe(recipe_data) && (daysSince(R.created) <= R.persistence_period))
|
||||
loaded = TRUE
|
||||
@@ -354,9 +354,8 @@ SUBSYSTEM_DEF(persistence)
|
||||
|
||||
//asert globchems done
|
||||
for(var/randomized_type in subtypesof(/datum/chemical_reaction/randomized))
|
||||
var/datum/chemical_reaction/randomized/R = randomized_type
|
||||
R = get_chemical_reaction(initial(R.id)) //ew, would be nice to add some simple tracking
|
||||
if(R && R.persistent && R.id)
|
||||
var/datum/chemical_reaction/randomized/R = get_chemical_reaction(randomized_type) //ew, would be nice to add some simple tracking
|
||||
if(R && R.persistent)
|
||||
var/recipe_data = list()
|
||||
recipe_data["timestamp"] = R.created
|
||||
recipe_data["required_reagents"] = R.required_reagents
|
||||
@@ -365,7 +364,7 @@ SUBSYSTEM_DEF(persistence)
|
||||
recipe_data["is_cold_recipe"] = R.is_cold_recipe
|
||||
recipe_data["results"] = R.results
|
||||
recipe_data["required_container"] = "[R.required_container]"
|
||||
file_data["[R.id]"] = recipe_data
|
||||
file_data["[R.type]"] = recipe_data
|
||||
|
||||
fdel(json_file)
|
||||
WRITE_FILE(json_file, json_encode(file_data))
|
||||
|
||||
@@ -235,7 +235,7 @@ SUBSYSTEM_DEF(shuttle)
|
||||
var/area/A = get_area(user)
|
||||
|
||||
log_shuttle("[key_name(user)] has called the emergency shuttle.")
|
||||
deadchat_broadcast(" has called the shuttle at <span class='name'>[A.name]</span>.", "<span class='name'>[user.real_name]</span>", user)
|
||||
deadchat_broadcast(" has called the shuttle at <span class='name'>[A.name]</span>.", "<span class='name'>[user.real_name]</span>", user, message_type=DEADCHAT_ANNOUNCEMENT)
|
||||
if(call_reason)
|
||||
SSblackbox.record_feedback("text", "shuttle_reason", 1, "[call_reason]")
|
||||
log_shuttle("Shuttle call reason: [call_reason]")
|
||||
@@ -273,7 +273,7 @@ SUBSYSTEM_DEF(shuttle)
|
||||
emergency.cancel(get_area(user))
|
||||
log_shuttle("[key_name(user)] has recalled the shuttle.")
|
||||
message_admins("[ADMIN_LOOKUPFLW(user)] has recalled the shuttle.")
|
||||
deadchat_broadcast(" has recalled the shuttle from <span class='name'>[get_area_name(user, TRUE)]</span>.", "<span class='name'>[user.real_name]</span>", user)
|
||||
deadchat_broadcast(" has recalled the shuttle from <span class='name'>[get_area_name(user, TRUE)]</span>.", "<span class='name'>[user.real_name]</span>", user, message_type=DEADCHAT_ANNOUNCEMENT)
|
||||
return 1
|
||||
|
||||
/datum/controller/subsystem/shuttle/proc/canRecall()
|
||||
|
||||
Reference in New Issue
Block a user