mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-18 00:56:34 +01:00
- separates the composition of cyborgs into modules, iconsets, chassis, upgrades - modules / chassis atm can provide items, so can upgrades; in the future we will want to probably generalize the item API a bit so components can work - chassis now can (unimplemented) easily be made to give different stats - reorganizes all the cyborg sprites - adds generalized item mounts with redirection support and tears out legacy cyborg items - entirely rebalances modules & writes some new lawsets in for future use --------- Co-authored-by: silicons <silicons@silicons.dev>
99 lines
4.0 KiB
Plaintext
99 lines
4.0 KiB
Plaintext
//* This file is explicitly licensed under the MIT license. *//
|
|
//* Copyright (c) 2024 Citadel Station Developers *//
|
|
|
|
/client/AllowUpload(filename, filelength)
|
|
if(isnull(upload_current_sizelimit) || !upload_mutex)
|
|
to_chat(src, SPAN_BOLDANNOUNCE("-- Something attempted to request a file upload without using client.prompt_for_x procs. Report this to a coder. --"))
|
|
return FALSE
|
|
if(filelength > upload_current_sizelimit)
|
|
to_chat(src, SPAN_BOLDANNOUNCE("File upload was too large. Limit: [upload_current_sizelimit / 1024]KiB."))
|
|
return FALSE
|
|
return TRUE
|
|
|
|
/**
|
|
* Check if we're currently prompting for a file.
|
|
* * All file requests for a client must go through these procs, or they'll be rejected.
|
|
*/
|
|
/client/proc/is_prompting_for_file()
|
|
return upload_mutex
|
|
|
|
/client/proc/prompt_for_file_or_null(message, title, size_limit = 1024 * 1024 * 1)
|
|
if(upload_mutex)
|
|
return null
|
|
upload_mutex = TRUE
|
|
upload_current_sizelimit = size_limit
|
|
var/size_render = FLOOR(size_limit / (1024 * 1024), 0.05)
|
|
log_world("UPLOAD: Prompting '[src]' for a file with maximum size [size_limit].")
|
|
. = input(src, message, "[title] (max [size_render]MiB)]") as file|null
|
|
log_world("UPLOAD: Got file '[.]' from '[src]'.")
|
|
upload_current_sizelimit = null
|
|
upload_mutex = FALSE
|
|
|
|
/client/proc/prompt_for_file_or_wait(message, title, size_limit = 1024 * 1024 * 1)
|
|
if(upload_mutex_waiting > 10)
|
|
to_chat(src, SPAN_BOLDANNOUNCE("Failed to open file picker prompt: Too many prompts are queued!"))
|
|
return null
|
|
++upload_mutex_waiting
|
|
UNTIL(!upload_mutex)
|
|
--upload_mutex_waiting
|
|
upload_mutex = TRUE
|
|
upload_current_sizelimit = size_limit
|
|
var/size_render = FLOOR(size_limit / (1024 * 1024), 0.05)
|
|
log_world("UPLOAD: Prompting '[src]' for a file with maximum size [size_limit].")
|
|
. = input(src, message, "[title] (max [size_render]MiB)]") as file|null
|
|
log_world("UPLOAD: Got file '[.]' from '[src]'.")
|
|
upload_current_sizelimit = null
|
|
upload_mutex = FALSE
|
|
|
|
/client/proc/prompt_for_sound_or_null(message, title, size_limit = 1024 * 1024 * 1)
|
|
if(upload_mutex)
|
|
return null
|
|
upload_mutex = TRUE
|
|
upload_current_sizelimit = size_limit
|
|
var/size_render = FLOOR(size_limit / (1024 * 1024), 0.05)
|
|
log_world("UPLOAD: Prompting '[src]' for a file with maximum size [size_limit].")
|
|
. = input(src, message, "[title] (max [size_render]MiB)]") as sound|null
|
|
log_world("UPLOAD: Got file '[.]' from '[src]'.")
|
|
upload_current_sizelimit = null
|
|
upload_mutex = FALSE
|
|
|
|
/client/proc/prompt_for_sound_or_wait(message, title, size_limit = 1024 * 1024 * 1)
|
|
if(upload_mutex_waiting > 10)
|
|
to_chat(src, SPAN_BOLDANNOUNCE("Failed to open file (sound) picker prompt: Too many prompts are queued!"))
|
|
return null
|
|
++upload_mutex_waiting
|
|
UNTIL(!upload_mutex)
|
|
--upload_mutex_waiting
|
|
upload_mutex = TRUE
|
|
upload_current_sizelimit = size_limit
|
|
var/size_render = FLOOR(size_limit / (1024 * 1024), 0.05)
|
|
log_world("UPLOAD: Prompting '[src]' for a file with maximum size [size_limit].")
|
|
. = input(src, message, "[title] (max [size_render]MiB)]") as sound|null
|
|
log_world("UPLOAD: Got file '[.]' from '[src]'.")
|
|
upload_current_sizelimit = null
|
|
upload_mutex = FALSE
|
|
|
|
/client/proc/prompt_for_icon_or_null(message, title, size_limit = 1024 * 1024 * 1)
|
|
if(upload_mutex)
|
|
return null
|
|
upload_mutex = TRUE
|
|
upload_current_sizelimit = size_limit
|
|
var/size_render = FLOOR(size_limit / (1024 * 1024), 0.05)
|
|
. = input(src, message, "[title] (max [size_render]MiB)]") as icon|null
|
|
upload_current_sizelimit = null
|
|
upload_mutex = FALSE
|
|
|
|
/client/proc/prompt_for_icon_or_wait(message, title, size_limit = 1024 * 1024 * 1)
|
|
if(upload_mutex_waiting > 10)
|
|
to_chat(src, SPAN_BOLDANNOUNCE("Failed to open file (icon) picker prompt: Too many prompts are queued!"))
|
|
return null
|
|
++upload_mutex_waiting
|
|
UNTIL(!upload_mutex)
|
|
--upload_mutex_waiting
|
|
upload_mutex = TRUE
|
|
upload_current_sizelimit = size_limit
|
|
var/size_render = FLOOR(size_limit / (1024 * 1024), 0.05)
|
|
. = input(src, message, "[title] (max [size_render]MiB)]") as icon|null
|
|
upload_current_sizelimit = null
|
|
upload_mutex = FALSE
|