Merge branch 'master' of https://github.com/Citadel-Station-13/Citadel-Station-13 into proc-define-shit

This commit is contained in:
SandPoot
2024-03-08 19:10:22 -03:00
810 changed files with 140372 additions and 5523 deletions
+6 -6
View File
@@ -134,16 +134,16 @@
var/obj/item/active_mousedown_item = null
///Used in MouseDrag to preserve the original mouse click parameters
var/mouseParams = ""
///Used in MouseDrag to preserve the last mouse-entered location.
var/mouseLocation = null
///Used in MouseDrag to preserve the last mouse-entered object.
var/mouseObject = null
var/mouseControlObject = null
///Used in MouseDrag to preserve the last mouse-entered location. Weakref
var/datum/weakref/mouse_location_ref = null
///Used in MouseDrag to preserve the last mouse-entered object. Weakref
var/datum/weakref/mouse_object_ref
var/mouse_control_object
/// Messages currently seen by this client
var/list/seen_messages
/// viewsize datum for holding our view size
var/datum/viewData/view_size
var/datum/view_data/view_size
/// our current tab
var/stat_tab
+19 -14
View File
@@ -167,8 +167,8 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
/client/proc/is_content_unlocked()
if(!prefs.unlock_content)
to_chat(src, "Become a BYOND member to access member-perks and features, as well as support the engine that makes this game possible. Only 10 bucks for 3 months! <a href=\"https://secure.byond.com/membership\">Click Here to find out more</a>.")
return 0
return 1
return FALSE
return TRUE
/*
* Call back proc that should be checked in all paths where a client can send messages
*
@@ -199,11 +199,11 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
total_message_count = 0
total_count_reset = 0
cmd_admin_mute(src, mute_type, 1)
return 1
return TRUE
//Otherwise just supress the message
else if(cache >= SPAM_TRIGGER_AUTOMUTE)
return 1
return TRUE
if(CONFIG_GET(flag/automute_on) && !holder && last_message == message)
@@ -211,21 +211,21 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
if(src.last_message_count >= SPAM_TRIGGER_AUTOMUTE)
to_chat(src, "<span class='danger'>You have exceeded the spam filter limit for identical messages. An auto-mute was applied.</span>")
cmd_admin_mute(src, mute_type, 1)
return 1
return TRUE
if(src.last_message_count >= SPAM_TRIGGER_WARNING)
to_chat(src, "<span class='danger'>You are nearing the spam filter limit for identical messages.</span>")
return 0
return FALSE
else
last_message = message
src.last_message_count = 0
return 0
return FALSE
//This stops files larger than UPLOAD_LIMIT being sent from client to server via input(), client.Import() etc.
/client/AllowUpload(filename, filelength)
if(filelength > UPLOAD_LIMIT)
to_chat(src, "<font color='red'>Error: AllowUpload(): File Upload too large. Upload Limit: [UPLOAD_LIMIT/1024]KiB.</font>")
return 0
return 1
return FALSE
return TRUE
///////////
@@ -393,7 +393,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
to_chat(src, "Because you are an admin, you are being allowed to walk past this limitation, But it is still STRONGLY suggested you upgrade")
else
qdel(src)
return 0
return FALSE
else if (byond_version < cwv) //We have words for this client.
if(CONFIG_GET(flag/client_warn_popup))
var/msg = "<b>Your version of byond may be getting out of date:</b><br>"
@@ -413,11 +413,11 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
if (!CONFIG_GET(flag/allow_webclient))
to_chat(src, "Web client is disabled")
qdel(src)
return 0
return FALSE
if (CONFIG_GET(flag/webclient_only_byond_members) && !IsByondMember())
to_chat(src, "Sorry, but the web client is restricted to byond members only.")
qdel(src)
return 0
return FALSE
if( (world.address == address || !address) && !GLOB.host )
GLOB.host = key
@@ -881,9 +881,9 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
click_intercept_time = 0 //Reset and return. Next click should work, but not this one.
return
click_intercept_time = 0 //Just reset. Let's not keep re-checking forever.
var/list/L = params2list(params)
var/list/modifiers = params2list(params)
if(L["drag"])
if(modifiers[DRAG])
return
var/mcl = CONFIG_GET(number/minute_click_limit)
@@ -929,6 +929,11 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
// so that the visual focus indicator matches reality.
winset(src, null, "input.background-color=[COLOR_INPUT_DISABLED]")
else
winset(src, null, "input.focus=true input.background-color=[COLOR_INPUT_ENABLED]")
SEND_SIGNAL(src, COMSIG_CLIENT_CLICK, object, location, control, params, usr)
..()
/client/proc/add_verbs_from_config()
+19 -17
View File
@@ -41,10 +41,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/last_custom_holoform = 0
//Cooldowns for saving/loading. These are four are all separate due to loading code calling these one after another
var/saveprefcooldown
var/loadprefcooldown
var/savecharcooldown
var/loadcharcooldown
COOLDOWN_DECLARE(saveprefcooldown)
COOLDOWN_DECLARE(loadprefcooldown)
COOLDOWN_DECLARE(savecharcooldown)
COOLDOWN_DECLARE(loadcharcooldown)
//game-preferences
var/lastchangelog = "" //Saved changlog filesize to detect if there was a change
@@ -65,7 +65,6 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/screentip_pref = SCREENTIP_PREFERENCE_ENABLED
var/screentip_color = "#ffd391"
var/screentip_images = TRUE
var/buttons_locked = FALSE
var/hotkeys = FALSE
///Runechat preference. If true, certain messages will be displayed on the map, not ust on the chat area. Boolean.
@@ -268,6 +267,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/loadout_errors = 0
var/pref_queue
var/char_queue
/datum/preferences/New(client/C)
parent = C
@@ -1070,8 +1072,6 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<b>Runechat message char limit:</b> <a href='?_src_=prefs;preference=max_chat_length;task=input'>[max_chat_length]</a><br>"
dat += "<b>See Runechat for non-mobs:</b> <a href='?_src_=prefs;preference=see_chat_non_mob'>[see_chat_non_mob ? "Enabled" : "Disabled"]</a><br>"
dat += "<br>"
dat += "<b>Action Buttons:</b> <a href='?_src_=prefs;preference=action_buttons'>[(buttons_locked) ? "Locked In Place" : "Unlocked"]</a><br>"
dat += "<br>"
dat += "<b>PDA Color:</b> <span style='border:1px solid #161616; background-color: [pda_color];'><font color='[color_hex2num(pda_color) < 200 ? "FFFFFF" : "000000"]'>[pda_color]</font></span> <a href='?_src_=prefs;preference=pda_color;task=input'>Change</a><BR>"
dat += "<b>PDA Style:</b> <a href='?_src_=prefs;task=input;preference=pda_style'>[pda_style]</a><br>"
dat += "<b>PDA Reskin:</b> <a href='?_src_=prefs;task=input;preference=pda_skin'>[pda_skin]</a><br>"
@@ -1429,7 +1429,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
//The job before the current job. I only use this to get the previous jobs color when I'm filling in blank rows.
var/datum/job/lastJob
for(var/datum/job/job in sortList(SSjob.occupations, GLOBAL_PROC_REF(cmp_job_display_asc)))
for(var/datum/job/job in sort_list(SSjob.occupations, GLOBAL_PROC_REF(cmp_job_display_asc)))
index += 1
if((index >= limit) || (job.title in splitJobs))
@@ -1578,7 +1578,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
SetJobPreferenceLevel(job, jpval)
SetChoices(user)
return 1
return TRUE
/datum/preferences/proc/ResetJobs()
@@ -1724,7 +1724,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
UpdateJobPreference(user, href_list["text"], text2num(href_list["level"]))
else
SetChoices(user)
return 1
return TRUE
else if(href_list["preference"] == "trait")
switch(href_list["task"])
@@ -2631,8 +2631,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/pickedui = input(user, "Choose your UI style.", "Character Preference", UI_style) as null|anything in GLOB.available_ui_styles
if(pickedui)
UI_style = pickedui
if (parent && parent.mob && parent.mob.hud_used)
parent.mob.hud_used.update_ui_style(ui_style2icon(UI_style))
if (pickedui && parent && parent.mob && parent.mob.hud_used)
QDEL_NULL(parent.mob.hud_used)
parent.mob.create_mob_hud()
parent.mob.hud_used.show_hud(1, parent.mob)
if("pda_style")
var/pickedPDAStyle = input(user, "Choose your PDA style.", "Character Preference", pda_style) as null|anything in GLOB.pda_styles
if(pickedPDAStyle)
@@ -2981,7 +2983,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if(!length(key_bindings[old_key]))
key_bindings -= old_key
key_bindings[full_key] += list(kb_name)
key_bindings[full_key] = sortList(key_bindings[full_key])
key_bindings[full_key] = sort_list(key_bindings[full_key])
if(href_list["special"]) // special keys need a full reset
user.client.ensure_keys_set(src)
user << browse(null, "window=capturekeypress")
@@ -3001,15 +3003,13 @@ GLOBAL_LIST_EMPTY(preferences_datums)
chat_on_map = !chat_on_map
if("see_chat_non_mob")
see_chat_non_mob = !see_chat_non_mob
if("action_buttons")
buttons_locked = !buttons_locked
if("tgui_fancy")
tgui_fancy = !tgui_fancy
if("outline_enabled")
outline_enabled = !outline_enabled
if("outline_color")
var/pickedOutlineColor = input(user, "Choose your outline color.", "General Preference", outline_color) as color|null
if(pickedOutlineColor != pickedOutlineColor)
if(pickedOutlineColor != outline_color)
outline_color = pickedOutlineColor // nullable
if("screentip_pref")
var/choice = input(user, "Choose your screentip preference", "Screentipping?", screentip_pref) as null|anything in GLOB.screentip_pref_options
@@ -3217,6 +3217,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
load_character()
if("changeslot")
if(char_queue)
deltimer(char_queue) // Do not dare.
if(!load_character(text2num(href_list["num"])))
random_character()
real_name = random_unique_name(gender)
@@ -3333,7 +3335,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
user_gear[LOADOUT_CUSTOM_DESCRIPTION] = new_description
ShowChoices(user)
return 1
return TRUE
/datum/preferences/proc/copy_to(mob/living/carbon/human/character, icon_updates = 1, roundstart_checks = TRUE, initial_spawn = FALSE)
if(be_random_name)
+40 -20
View File
@@ -401,7 +401,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if(istype(parent))
to_chat(parent, "<span class='warning'>You're attempting to load your preferences a little too fast. Wait half a second, then try again.</span>")
return FALSE
loadprefcooldown = world.time + PREF_SAVELOAD_COOLDOWN
COOLDOWN_START(src, loadprefcooldown, PREF_LOAD_COOLDOWN)
if(!fexists(path))
return FALSE
@@ -435,7 +435,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["see_chat_non_mob"] >> see_chat_non_mob
S["tgui_fancy"] >> tgui_fancy
S["tgui_lock"] >> tgui_lock
S["buttons_locked"] >> buttons_locked
S["windowflash"] >> windowflashing
S["be_special"] >> be_special
@@ -513,7 +512,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
see_chat_non_mob = sanitize_integer(see_chat_non_mob, 0, 1, initial(see_chat_non_mob))
tgui_fancy = sanitize_integer(tgui_fancy, 0, 1, initial(tgui_fancy))
tgui_lock = sanitize_integer(tgui_lock, 0, 1, initial(tgui_lock))
buttons_locked = sanitize_integer(buttons_locked, 0, 1, initial(buttons_locked))
windowflashing = sanitize_integer(windowflashing, 0, 1, initial(windowflashing))
default_slot = sanitize_integer(default_slot, 1, max_save_slots, initial(default_slot))
toggles = sanitize_integer(toggles, 0, 16777215, initial(toggles))
@@ -595,18 +593,20 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if(!GLOB.keybindings_by_name[bindname])
modless_key_bindings -= key
/datum/preferences/proc/save_preferences(bypass_cooldown = FALSE)
/datum/preferences/proc/save_preferences(bypass_cooldown = FALSE, silent = FALSE)
if(!path)
return 0
return FALSE
if(!bypass_cooldown)
if(world.time < saveprefcooldown)
if(istype(parent))
to_chat(parent, "<span class='warning'>You're attempting to save your preferences a little too fast. Wait half a second, then try again.</span>")
return 0
saveprefcooldown = world.time + PREF_SAVELOAD_COOLDOWN
queue_save_pref(PREF_SAVE_COOLDOWN, silent)
return FALSE
COOLDOWN_START(src, saveprefcooldown, PREF_SAVE_COOLDOWN)
if(pref_queue)
deltimer(pref_queue)
var/savefile/S = new /savefile(path)
if(!S)
return 0
return FALSE
S.cd = "/"
WRITE_FILE(S["version"] , SAVEFILE_VERSION_MAX) //updates (or failing that the sanity checks) will ensure data is not invalid at load. Assume up-to-date
@@ -626,7 +626,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["see_chat_non_mob"], see_chat_non_mob)
WRITE_FILE(S["tgui_fancy"], tgui_fancy)
WRITE_FILE(S["tgui_lock"], tgui_lock)
WRITE_FILE(S["buttons_locked"], buttons_locked)
WRITE_FILE(S["windowflash"], windowflashing)
WRITE_FILE(S["be_special"], be_special)
WRITE_FILE(S["default_slot"], default_slot)
@@ -676,7 +675,17 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
else
WRITE_FILE(S["unlockable_loadout"], safe_json_encode(list()))
return 1
if(parent && !silent)
to_chat(parent, span_notice("Saved preferences!"))
return TRUE
/datum/preferences/proc/queue_save_pref(save_in, silent)
if(parent && !silent)
to_chat(parent, span_notice("Saving preferences in [save_in * 0.1] second\s."))
if(pref_queue)
deltimer(pref_queue)
pref_queue = addtimer(CALLBACK(src, PROC_REF(save_preferences), TRUE, silent), save_in, TIMER_STOPPABLE)
/datum/preferences/proc/load_character(slot, bypass_cooldown = FALSE)
if(!path)
@@ -686,7 +695,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if(istype(parent))
to_chat(parent, "<span class='warning'>You're attempting to load your character a little too fast. Wait half a second, then try again.</span>")
return "SLOW THE FUCK DOWN" //the reason this isn't null is to make sure that people don't have their character slots overridden by random chars if they accidentally double-click a slot
loadcharcooldown = world.time + PREF_SAVELOAD_COOLDOWN
COOLDOWN_START(src, loadcharcooldown, PREF_LOAD_COOLDOWN)
if(!fexists(path))
return FALSE
var/savefile/S = new /savefile(path)
@@ -1084,20 +1093,22 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
cit_character_pref_load(S)
return 1
return TRUE
/datum/preferences/proc/save_character(bypass_cooldown = FALSE)
/datum/preferences/proc/save_character(bypass_cooldown = FALSE, silent = FALSE)
if(!path)
return 0
return FALSE
if(!bypass_cooldown)
if(world.time < savecharcooldown)
if(istype(parent))
to_chat(parent, "<span class='warning'>You're attempting to save your character a little too fast. Wait half a second, then try again.</span>")
return 0
savecharcooldown = world.time + PREF_SAVELOAD_COOLDOWN
queue_save_char(PREF_SAVE_COOLDOWN, silent)
return FALSE
COOLDOWN_START(src, savecharcooldown, PREF_SAVE_COOLDOWN)
if(char_queue)
deltimer(char_queue)
var/savefile/S = new /savefile(path)
if(!S)
return 0
return FALSE
S.cd = "/character[default_slot]"
WRITE_FILE(S["version"] , SAVEFILE_VERSION_MAX) //load_character will sanitize any bad data, so assume up-to-date.)
@@ -1281,8 +1292,17 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
cit_character_pref_save(S)
return 1
if(parent && !silent)
to_chat(parent, span_notice("Saved character slot!"))
return TRUE
/datum/preferences/proc/queue_save_char(save_in, silent)
if(parent && !silent)
to_chat(parent, span_notice("Saving character in [save_in * 0.1] second\s."))
if(char_queue)
deltimer(char_queue)
char_queue = addtimer(CALLBACK(src, PROC_REF(save_character), TRUE, silent), save_in, TIMER_STOPPABLE)
#undef SAVEFILE_VERSION_MAX
#undef SAVEFILE_VERSION_MIN
+1 -1
View File
@@ -237,7 +237,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
choices["[C.mob]([C])"] = C
else
choices[C] = C
choices = sortList(choices)
choices = sort_list(choices)
var/selection = input("Please, select a player!", "Ignore", null, null) as null|anything in choices
if(!selection || !(selection in choices))
return
+1 -1
View File
@@ -50,7 +50,7 @@
else
Lines += "[C.key] ([round(C.avgping, 1)]ms)"
for(var/line in sortList(Lines))
for(var/line in sort_list(Lines))
msg += "[line]\n"
msg += "<b>Total Players: [length(Lines)]</b>"