oops! All Refactors!

This commit is contained in:
Letter N
2021-02-12 11:07:58 +08:00
parent 834e4730b3
commit 8a0c932d55
24 changed files with 2304 additions and 1982 deletions
+38 -10
View File
@@ -605,21 +605,49 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
msg2 = replacetext(replacetext(msg2, "\proper", ""), "\improper", "")
world.TgsTargetedChatBroadcast("[msg] | [msg2]", TRUE)
/proc/send2otherserver(source,msg,type = "Ahelp")
var/comms_key = CONFIG_GET(string/comms_key)
if(!comms_key)
/**
* Sends a message to a set of cross-communications-enabled servers using world topic calls
*
* Arguments:
* * source - Who sent this message
* * msg - The message body
* * type - The type of message, becomes the topic command under the hood
* * target_servers - A collection of servers to send the message to, defined in config
* * additional_data - An (optional) associated list of extra parameters and data to send with this world topic call
*/
/proc/send2otherserver(source, msg, type = "Ahelp", target_servers, list/additional_data = list())
if(!CONFIG_GET(string/comms_key))
debug_world_log("Server cross-comms message not sent for lack of configured key")
return
var/list/message = list()
message["message_sender"] = source
message["message"] = msg
message["source"] = "([CONFIG_GET(string/cross_comms_name)])"
message["key"] = comms_key
message += type
var/our_id = CONFIG_GET(string/cross_comms_name)
additional_data["message_sender"] = source
additional_data["message"] = msg
additional_data["source"] = "([our_id])"
additional_data += type
var/list/servers = CONFIG_GET(keyed_list/cross_server)
for(var/I in servers)
world.Export("[servers[I]]?[list2params(message)]")
if(I == our_id) //No sending to ourselves
continue
if(target_servers && !(I in target_servers))
continue
world.send_cross_comms(I, additional_data)
/// Sends a message to a given cross comms server by name (by name for security).
/world/proc/send_cross_comms(server_name, list/message, auth = TRUE)
set waitfor = FALSE
if (auth)
var/comms_key = CONFIG_GET(string/comms_key)
if(!comms_key)
debug_world_log("Server cross-comms message not sent for lack of configured key")
return
message["key"] = comms_key
var/list/servers = CONFIG_GET(keyed_list/cross_server)
var/server_url = servers[server_name]
if (!server_url)
CRASH("Invalid cross comms config: [server_name]")
world.Export("[server_url]?[list2params(message)]")
/proc/ircadminwho()
var/list/message = list("Admins: ")
+22 -21
View File
@@ -3,7 +3,7 @@
set name = "Pray"
if(GLOB.say_disabled) //This is here to try to identify lag problems
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>", confidential = TRUE)
return
msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)
@@ -12,7 +12,7 @@
log_prayer("[src.key]/([src.name]): [msg]")
if(usr.client)
if(usr.client.prefs.muted & MUTE_PRAY)
to_chat(usr, "<span class='danger'>You cannot pray (muted).</span>")
to_chat(usr, "<span class='danger'>You cannot pray (muted).</span>", confidential = TRUE)
return
if(src.client.handle_spam_prevention(msg,MUTE_PRAY))
return
@@ -44,34 +44,35 @@
for(var/client/C in GLOB.admins)
if(C.prefs.chat_toggles & CHAT_PRAYER)
to_chat(C, msg)
to_chat(C, msg, confidential = TRUE)
if(C.prefs.toggles & SOUND_PRAYERS)
if(usr.job == "Chaplain")
SEND_SOUND(C, sound('sound/effects/pray.ogg'))
else
SEND_SOUND(C, sound('sound/effects/ding.ogg'))
to_chat(usr, "<span class='info'>You pray to the gods: \"[msg_tmp]\"</span>")
to_chat(usr, "<span class='info'>You pray to the gods: \"[msg_tmp]\"</span>", confidential = TRUE)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Prayer") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
//log_admin("HELP: [key_name(src)]: [msg]")
/proc/CentCom_announce(text , mob/Sender)
/// Used by communications consoles to message CentCom
/proc/message_centcom(text, mob/sender)
var/msg = copytext_char(sanitize(text), 1, MAX_MESSAGE_LEN)
msg = "<span class='adminnotice'><b><font color=orange>CENTCOM:</font>[ADMIN_FULLMONTY(Sender)] [ADMIN_CENTCOM_REPLY(Sender)]:</b> [msg]</span>"
to_chat(GLOB.admins, msg)
for(var/obj/machinery/computer/communications/C in GLOB.machines)
C.overrideCooldown()
msg = "<span class='adminnotice'><b><font color=orange>CENTCOM:</font>[ADMIN_FULLMONTY(sender)] [ADMIN_CENTCOM_REPLY(sender)]:</b> [msg]</span>"
to_chat(GLOB.admins, msg, confidential = TRUE)
for(var/obj/machinery/computer/communications/console in GLOB.machines)
console.override_cooldown()
/proc/Syndicate_announce(text , mob/Sender)
/// Used by communications consoles to message the Syndicate
/proc/message_syndicate(text, mob/sender)
var/msg = copytext_char(sanitize(text), 1, MAX_MESSAGE_LEN)
msg = "<span class='adminnotice'><b><font color=crimson>SYNDICATE:</font>[ADMIN_FULLMONTY(Sender)] [ADMIN_SYNDICATE_REPLY(Sender)]:</b> [msg]</span>"
to_chat(GLOB.admins, msg)
for(var/obj/machinery/computer/communications/C in GLOB.machines)
C.overrideCooldown()
msg = "<span class='adminnotice'><b><font color=crimson>SYNDICATE:</font>[ADMIN_FULLMONTY(sender)] [ADMIN_SYNDICATE_REPLY(sender)]:</b> [msg]</span>"
to_chat(GLOB.admins, msg, confidential = TRUE)
for(var/obj/machinery/computer/communications/console in GLOB.machines)
console.override_cooldown()
/proc/Nuke_request(text , mob/Sender)
/// Used by communications consoles to request the nuclear launch codes
/proc/nuke_request(text, mob/sender)
var/msg = copytext_char(sanitize(text), 1, MAX_MESSAGE_LEN)
msg = "<span class='adminnotice'><b><font color=orange>NUKE CODE REQUEST:</font>[ADMIN_FULLMONTY(Sender)] [ADMIN_CENTCOM_REPLY(Sender)] [ADMIN_SET_SD_CODE]:</b> [msg]</span>"
to_chat(GLOB.admins, msg)
for(var/obj/machinery/computer/communications/C in GLOB.machines)
C.overrideCooldown()
msg = "<span class='adminnotice'><b><font color=orange>NUKE CODE REQUEST:</font>[ADMIN_FULLMONTY(sender)] [ADMIN_CENTCOM_REPLY(sender)] [ADMIN_SET_SD_CODE]:</b> [msg]</span>"
to_chat(GLOB.admins, msg, confidential = TRUE)
for(var/obj/machinery/computer/communications/console in GLOB.machines)
console.override_cooldown()
+24 -13
View File
@@ -3,8 +3,14 @@
desc = "Used to order supplies, approve requests, and control the shuttle."
icon_screen = "supply"
circuit = /obj/item/circuitboard/computer/cargo
light_color = "#E2853D"//orange
///Can the supply console send the shuttle back and forth? Used in the UI backend.
var/can_send = TRUE
///Can this console only send requests?
var/requestonly = FALSE
///Can you approve requests placed for cargo? Works differently between the app and the computer.
var/can_approve_requests = TRUE
var/contraband = FALSE
var/self_paid = FALSE
var/safety_warning = "For safety reasons, the automated supply shuttle \
@@ -16,25 +22,21 @@
/// var that tracks message cooldown
var/message_cooldown
var/list/loaded_coupons
light_color = "#E2853D"//orange
/// var that makes express console use rockets
var/is_express = FALSE
/obj/machinery/computer/cargo/request
name = "supply request console"
desc = "Used to request supplies from cargo."
icon_screen = "request"
circuit = /obj/item/circuitboard/computer/cargo/request
can_send = FALSE
can_approve_requests = FALSE
requestonly = TRUE
/obj/machinery/computer/cargo/Initialize()
. = ..()
radio = new /obj/item/radio/headset/headset_cargo(src)
var/obj/item/circuitboard/computer/cargo/board = circuit
contraband = board.contraband
if (board.obj_flags & EMAGGED)
obj_flags |= EMAGGED
else
obj_flags &= ~EMAGGED
/obj/machinery/computer/cargo/Destroy()
QDEL_NULL(radio)
@@ -64,6 +66,10 @@
board.obj_flags |= EMAGGED
update_static_data(user)
/obj/machinery/computer/cargo/on_construction()
. = ..()
circuit.configure_machine(src)
/obj/machinery/computer/cargo/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
@@ -81,6 +87,8 @@
data["docked"] = SSshuttle.supply.mode == SHUTTLE_IDLE
data["loan"] = !!SSshuttle.shuttle_loan
data["loan_dispatched"] = SSshuttle.shuttle_loan && SSshuttle.shuttle_loan.dispatched
data["can_send"] = can_send
data["can_approve_requests"] = can_approve_requests
var/message = "Remember to stamp and send back the supply manifests."
if(SSshuttle.centcom_message)
message = SSshuttle.centcom_message
@@ -128,14 +136,15 @@
"id" = pack,
"desc" = P.desc || P.name, // If there is a description, use it. Otherwise use the pack's name.
"goody" = P.goody,
"private_goody" = P.goody == PACK_GOODY_PRIVATE,
"access" = P.access,
"private_goody" = P.goody == PACK_GOODY_PRIVATE,
"can_private_buy" = P.can_private_buy
))
return data
/obj/machinery/computer/cargo/ui_act(action, params, datum/tgui/ui)
if(..())
. = ..()
if(.)
return
switch(action)
if("send")
@@ -172,6 +181,8 @@
log_game("[key_name(usr)] accepted a shuttle loan event.")
. = TRUE
if("add")
if(is_express)
return
var/id = text2path(params["id"])
var/datum/supply_pack/pack = SSshuttle.supply_packs[id]
if(!istype(pack))
@@ -195,9 +206,9 @@
rank = "Silicon"
var/datum/bank_account/account
if(self_paid && ishuman(usr))
var/mob/living/carbon/human/H = usr
var/obj/item/card/id/id_card = H.get_idcard(TRUE)
if(self_paid && isliving(usr))
var/mob/living/L = usr
var/obj/item/card/id/id_card = L.get_idcard(TRUE)
if(!istype(id_card))
say("No ID card detected.")
return
+1 -1
View File
@@ -968,7 +968,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
var/mob/living/M = mob
M.update_damage_hud()
if (prefs.auto_fit_viewport)
fit_viewport()
addtimer(CALLBACK(src,.verb/fit_viewport,10)) //Delayed to avoid wingets from Login calls.
SEND_SIGNAL(mob, COMSIG_MOB_CLIENT_CHANGE_VIEW, src, old_view, actualview)
/client/proc/generate_clickcatcher()
+17 -2
View File
@@ -62,9 +62,15 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/UI_style = null
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.
var/chat_on_map = TRUE
///Limit preference on the size of the message. Requires chat_on_map to have effect.
var/max_chat_length = CHAT_MESSAGE_MAX_LENGTH
///Whether non-mob messages will be displayed, such as machine vendor announcements. Requires chat_on_map to have effect. Boolean.
var/see_chat_non_mob = TRUE
///Whether emotes will be displayed on runechat. Requires chat_on_map to have effect. Boolean.
var/see_rc_emotes = TRUE
/// Custom Keybindings
var/list/key_bindings = list()
@@ -160,13 +166,13 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/auto_fit_viewport = FALSE
///Should we be in the widescreen mode set by the config?
var/widescreenpref = TRUE
///What size should pixels be displayed as? 0 is strech to fit
var/pixel_size = 0
///What scaling method should we use?
var/scaling_method = "normal"
var/uplink_spawn_loc = UPLINK_PDA
///The playtime_reward_cloak variable can be set to TRUE from the prefs menu only once the user has gained over 5K playtime hours. If true, it allows the user to get a cool looking roundstart cloak.
var/playtime_reward_cloak = FALSE
var/hud_toggle_flash = TRUE
var/hud_toggle_color = "#ffffff"
@@ -209,8 +215,17 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/autostand = TRUE
var/auto_ooc = FALSE
///This var stores the amount of points the owner will get for making it out alive.
var/hardcore_survival_score = 0
///Someone thought we were nice! We get a little heart in OOC until we join the server past the below time (we can keep it until the end of the round otherwise)
var/hearted
///If we have a hearted commendations, we honor it every time the player loads preferences until this time has been passed
var/hearted_until
/// If we have persistent scars enabled
var/persistent_scars = TRUE
///If we want to broadcast deadchat connect/disconnect messages
var/broadcast_login_logout = TRUE
/// We have 5 slots for persistent scars, if enabled we pick a random one to load (empty by default) and scars at the end of the shift if we survived as our original person
var/list/scars_list = list("1" = "", "2" = "", "3" = "", "4" = "", "5" = "")
/// Which of the 5 persistent scar slots we randomly roll to load for this round, if enabled. Actually rolled in [/datum/preferences/proc/load_character(slot)]
@@ -13,6 +13,7 @@
active_power_usage = 100
circuit = /obj/item/circuitboard/machine/smartfridge
var/base_build_path = /obj/machinery/smartfridge ///What path boards used to construct it should build into when dropped. Needed so we don't accidentally have them build variants with items preloaded in them.
var/max_n_of_items = 1500
var/allow_ai_retrieve = FALSE
var/list/initial_contents
@@ -43,7 +44,7 @@
SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays)
if(!stat)
SSvis_overlays.add_vis_overlay(src, icon, "smartfridge-light-mask", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha)
if(visible_contents)
if (visible_contents)
switch(contents.len)
if(0)
icon_state = "[initial(icon_state)]"
@@ -111,10 +112,10 @@
if(loaded)
if(contents.len >= max_n_of_items)
user.visible_message("<span class='notice'>[user] loads \the [src] with \the [O].</span>", \
"<span class='notice'>You fill \the [src] with \the [O].</span>")
"<span class='notice'>You fill \the [src] with \the [O].</span>")
else
user.visible_message("<span class='notice'>[user] loads \the [src] with \the [O].</span>", \
"<span class='notice'>You load \the [src] with \the [O].</span>")
"<span class='notice'>You load \the [src] with \the [O].</span>")
if(O.contents.len > 0)
to_chat(user, "<span class='warning'>Some items are refused.</span>")
if (visible_contents)
@@ -172,6 +173,10 @@
var/listofitems = list()
for (var/I in src)
// We do not vend our own components.
if(I in component_parts)
continue
var/atom/movable/O = I
if (!QDELETED(O))
var/md5name = md5(O.name) // This needs to happen because of a bug in a TGUI component, https://github.com/ractivejs/ractive/issues/744
@@ -212,6 +217,8 @@
if(desired == 1 && Adjacent(usr) && !issilicon(usr))
for(var/obj/item/O in src)
if(O.name == params["name"])
if(O in component_parts)
CRASH("Attempted removal of [O] component_part from vending machine via vending interface.")
dispense(O, usr)
break
if (visible_contents)
@@ -222,6 +229,8 @@
if(desired <= 0)
break
if(O.name == params["name"])
if(O in component_parts)
CRASH("Attempted removal of [O] component_part from vending machine via vending interface.")
dispense(O, usr)
desired--
if (visible_contents)
@@ -242,13 +251,21 @@
idle_power_usage = 5
active_power_usage = 200
visible_contents = FALSE
base_build_path = /obj/machinery/smartfridge/drying_rack //should really be seeing this without admin fuckery.
var/drying = FALSE
/obj/machinery/smartfridge/drying_rack/Initialize()
. = ..()
if(component_parts && component_parts.len)
component_parts.Cut()
// Cache the old_parts first, we'll delete it after we've changed component_parts to a new list.
// This stops handle_atom_del being called on every part when not necessary.
var/list/old_parts = component_parts.Copy()
component_parts = null
circuit = null
QDEL_LIST(old_parts)
RefreshParts()
/obj/machinery/smartfridge/drying_rack/on_deconstruction()
new /obj/item/stack/sheet/mineral/wood(drop_location(), 10)
@@ -280,25 +297,18 @@
return TRUE
return FALSE
// /obj/machinery/smartfridge/drying_rack/powered() do we have this? no.
// if(!anchored)
// return FALSE
// return ..()
/obj/machinery/smartfridge/drying_rack/powered()
if(!anchored)
return FALSE
return ..()
/obj/machinery/smartfridge/drying_rack/power_change()
if(powered() && anchored)
stat &= ~NOPOWER
else
stat |= NOPOWER
. = ..()
if(!powered())
toggle_drying(TRUE)
update_icon()
// . = ..()
// if(!powered())
// toggle_drying(TRUE)
/obj/machinery/smartfridge/drying_rack/load() //For updating the filled overlay
..()
/obj/machinery/smartfridge/drying_rack/load(/obj/item/dried_object) //For updating the filled overlay
. = ..()
update_icon()
/obj/machinery/smartfridge/drying_rack/update_overlays()
@@ -363,6 +373,7 @@
/obj/machinery/smartfridge/drinks
name = "drink showcase"
desc = "A refrigerated storage unit for tasty tasty alcohol."
base_build_path = /obj/machinery/smartfridge/drinks
/obj/machinery/smartfridge/drinks/accept_check(obj/item/O)
if(!istype(O, /obj/item/reagent_containers) || (O.item_flags & ABSTRACT) || !O.reagents || !O.reagents.reagent_list.len)
@@ -375,6 +386,7 @@
// ----------------------------
/obj/machinery/smartfridge/food
desc = "A refrigerated storage unit for food."
base_build_path = /obj/machinery/smartfridge/food
/obj/machinery/smartfridge/food/accept_check(obj/item/O)
if(istype(O, /obj/item/reagent_containers/food/snacks/))
@@ -387,6 +399,7 @@
/obj/machinery/smartfridge/extract
name = "smart slime extract storage"
desc = "A refrigerated storage unit for slime extracts."
base_build_path = /obj/machinery/smartfridge/extract
/obj/machinery/smartfridge/extract/accept_check(obj/item/O)
if(istype(O, /obj/item/slime_extract))
@@ -405,6 +418,7 @@
name = "smart organ storage"
desc = "A refrigerated storage unit for organ storage."
max_n_of_items = 20 //vastly lower to prevent processing too long
base_build_path = /obj/machinery/smartfridge/organ
var/repair_rate = 0
/obj/machinery/smartfridge/organ/accept_check(obj/item/O)
@@ -429,14 +443,14 @@
/obj/machinery/smartfridge/organ/RefreshParts()
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
max_n_of_items = 20 * B.rating
repair_rate = max(0, STANDARD_ORGAN_HEALING * (B.rating - 1))
repair_rate = max(0, STANDARD_ORGAN_HEALING * (B.rating - 1) * 0.5)
/obj/machinery/smartfridge/organ/process()
/obj/machinery/smartfridge/organ/process(delta_time)
for(var/organ in contents)
var/obj/item/organ/O = organ
if(!istype(O))
return
O.applyOrganDamage(-repair_rate)
O.applyOrganDamage(-repair_rate * delta_time)
/obj/machinery/smartfridge/organ/Exited(atom/movable/AM, atom/newLoc)
. = ..()
@@ -444,7 +458,9 @@
var/obj/item/organ/O = AM
O.organ_flags &= ~ORGAN_FROZEN
/obj/machinery/smartfridge/organ/preloaded //cit specific??????
//cit specific??????
/obj/machinery/smartfridge/organ/preloaded
base_build_path = /obj/machinery/smartfridge/organ/preloaded
initial_contents = list(
/obj/item/reagent_containers/medspray/synthtissue = 1,
/obj/item/reagent_containers/medspray/sterilizine = 1)
@@ -461,6 +477,7 @@
/obj/machinery/smartfridge/chemistry
name = "smart chemical storage"
desc = "A refrigerated storage unit for medicine storage."
base_build_path = /obj/machinery/smartfridge/chemistry
/obj/machinery/smartfridge/chemistry/accept_check(obj/item/O)
var/static/list/chemfridge_typecache = typecacheof(list(
@@ -502,6 +519,7 @@
/obj/machinery/smartfridge/chemistry/virology
name = "smart virus storage"
desc = "A refrigerated storage unit for volatile sample storage."
base_build_path = /obj/machinery/smartfridge/chemistry/virology
/obj/machinery/smartfridge/chemistry/virology/preloaded
initial_contents = list(
@@ -523,6 +541,7 @@
icon_state = "disktoaster"
pass_flags = PASSTABLE
visible_contents = FALSE
base_build_path = /obj/machinery/smartfridge/disks
/obj/machinery/smartfridge/disks/accept_check(obj/item/O)
if(istype(O, /obj/item/disk/))
+3
View File
@@ -196,6 +196,9 @@
deleted_atoms++
log_world("Annihilated [deleted_atoms] objects.")
/datum/map_template/proc/post_load()
return
//for your ever biggening badminnery kevinz000
//❤ - Cyberboss
/proc/load_new_z_level(file, name, orientation, list/ztraits)
+1 -1
View File
@@ -1,4 +1,4 @@
/// An error report generated by [parsed_map/check_for_errors].
/// An error report generated by [/datum/parsed_map/proc/check_for_errors].
/datum/map_report
var/original_path
var/list/bad_paths = list()
@@ -3,7 +3,6 @@
desc = "Makes researched and prototype items with materials and energy."
layer = BELOW_OBJ_LAYER
var/consoleless_interface = TRUE //Whether it can be used without a console.
var/offstation_security_levels = TRUE
var/print_cost_coeff = 1 //Materials needed * coeff = actual.
var/list/categories = list()
var/datum/component/remote_materials/materials
@@ -19,7 +18,11 @@
var/screen = RESEARCH_FABRICATOR_SCREEN_MAIN
var/selected_category
var/offstation_security_levels
/obj/machinery/rnd/production/Initialize(mapload)
if(mapload && offstation_security_levels)
log_mapping("Depricated var named \"offstation_security_levels\" at ([x], [y], [z])!")
. = ..()
create_reagents(0, OPENCONTAINER)
matching_designs = list()
@@ -22,12 +22,3 @@
/obj/machinery/rnd/production/circuit_imprinter/disconnect_console()
linked_console.linked_imprinter = null
..()
/obj/machinery/rnd/production/circuit_imprinter/calculate_efficiency()
. = ..()
var/obj/item/circuitboard/machine/circuit_imprinter/C = circuit
offstation_security_levels = C.offstation_security_levels
/obj/machinery/rnd/production/circuit_imprinter/offstation
offstation_security_levels = FALSE
circuit = /obj/item/circuitboard/machine/circuit_imprinter/offstation
@@ -23,12 +23,3 @@
/obj/machinery/rnd/production/protolathe/disconnect_console()
linked_console.linked_lathe = null
..()
/obj/machinery/rnd/production/protolathe/calculate_efficiency()
. = ..()
var/obj/item/circuitboard/machine/protolathe/C = circuit
offstation_security_levels = C.offstation_security_levels
/obj/machinery/rnd/production/protolathe/offstation
offstation_security_levels = FALSE
circuit = /obj/item/circuitboard/machine/protolathe/offstation