mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-20 11:35:19 +01:00
Whitespace Standardization [MDB IGNORE] (#15748)
* Update settings * Whitespace changes * Comment out merger hooks in gitattributes Corrupt maps would have to be resolved in repo before hooks could be updated * Revert "Whitespace changes" This reverts commitafbdd1d844. * Whitespace again minus example * Gitignore example changelog * Restore changelog merge setting * Keep older dmi hook attribute until hooks can be updated * update vscode settings too * Renormalize remaining * Revert "Gitignore example changelog" This reverts commitde22ad375d. * Attempt to normalize example.yml (and another file I guess) * Try again
This commit is contained in:
@@ -1,48 +1,48 @@
|
||||
/// Old VChat Code Stuff
|
||||
|
||||
/* Old bicon code
|
||||
/proc/expire_bicon_cache(key)
|
||||
if(GLOB.bicon_cache[key])
|
||||
GLOB.bicon_cache -= key
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
GLOBAL_LIST_EMPTY(bicon_cache) // Cache of the <img> tag results, not the icons
|
||||
*/
|
||||
|
||||
/proc/bicon(var/obj, var/use_class = 1, var/custom_classes = "")
|
||||
return icon2base64html(obj, custom_classes)
|
||||
|
||||
/* Old bicon code
|
||||
var/class = use_class ? "class='icon misc [custom_classes]'" : null
|
||||
if(!obj)
|
||||
return
|
||||
|
||||
// Try to avoid passing bicon an /icon directly. It is better to pass it an atom so it can cache.
|
||||
if(isicon(obj)) // Passed an icon directly, nothing to cache-key on, as icon refs get reused *often*
|
||||
return "<img [class] src='data:image/png;base64,[icon2base64(obj)]'>"
|
||||
|
||||
// Either an atom or somebody fucked up and is gonna get a runtime, which I'm fine with.
|
||||
var/atom/A = obj
|
||||
var/key
|
||||
var/changes_often = ishuman(A) || isobserver(A) // If this ends up with more, move it into a proc or var on atom.
|
||||
|
||||
if(changes_often)
|
||||
key = "\ref[A]"
|
||||
else
|
||||
key = "[istype(A.icon, /icon) ? "\ref[A.icon]" : A.icon]:[A.icon_state]"
|
||||
|
||||
var/base64 = GLOB.bicon_cache[key]
|
||||
// Non-human atom, no cache
|
||||
if(!base64) // Doesn't exist, make it.
|
||||
base64 = icon2base64(A.examine_icon(), key)
|
||||
GLOB.bicon_cache[key] = base64
|
||||
if(changes_often)
|
||||
addtimer(CALLBACK(GLOBAL_PROC, .proc/expire_bicon_cache, key), 50 SECONDS, TIMER_UNIQUE)
|
||||
|
||||
// May add a class to the img tag created by bicon
|
||||
if(use_class)
|
||||
class = "class='icon [A.icon_state] [custom_classes]'"
|
||||
|
||||
return "<IMG [class] src='data:image/png;base64,[base64]'>"
|
||||
*/
|
||||
/// Old VChat Code Stuff
|
||||
|
||||
/* Old bicon code
|
||||
/proc/expire_bicon_cache(key)
|
||||
if(GLOB.bicon_cache[key])
|
||||
GLOB.bicon_cache -= key
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
GLOBAL_LIST_EMPTY(bicon_cache) // Cache of the <img> tag results, not the icons
|
||||
*/
|
||||
|
||||
/proc/bicon(var/obj, var/use_class = 1, var/custom_classes = "")
|
||||
return icon2base64html(obj, custom_classes)
|
||||
|
||||
/* Old bicon code
|
||||
var/class = use_class ? "class='icon misc [custom_classes]'" : null
|
||||
if(!obj)
|
||||
return
|
||||
|
||||
// Try to avoid passing bicon an /icon directly. It is better to pass it an atom so it can cache.
|
||||
if(isicon(obj)) // Passed an icon directly, nothing to cache-key on, as icon refs get reused *often*
|
||||
return "<img [class] src='data:image/png;base64,[icon2base64(obj)]'>"
|
||||
|
||||
// Either an atom or somebody fucked up and is gonna get a runtime, which I'm fine with.
|
||||
var/atom/A = obj
|
||||
var/key
|
||||
var/changes_often = ishuman(A) || isobserver(A) // If this ends up with more, move it into a proc or var on atom.
|
||||
|
||||
if(changes_often)
|
||||
key = "\ref[A]"
|
||||
else
|
||||
key = "[istype(A.icon, /icon) ? "\ref[A.icon]" : A.icon]:[A.icon_state]"
|
||||
|
||||
var/base64 = GLOB.bicon_cache[key]
|
||||
// Non-human atom, no cache
|
||||
if(!base64) // Doesn't exist, make it.
|
||||
base64 = icon2base64(A.examine_icon(), key)
|
||||
GLOB.bicon_cache[key] = base64
|
||||
if(changes_often)
|
||||
addtimer(CALLBACK(GLOBAL_PROC, .proc/expire_bicon_cache, key), 50 SECONDS, TIMER_UNIQUE)
|
||||
|
||||
// May add a class to the img tag created by bicon
|
||||
if(use_class)
|
||||
class = "class='icon [A.icon_state] [custom_classes]'"
|
||||
|
||||
return "<IMG [class] src='data:image/png;base64,[base64]'>"
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
* Message-related procs
|
||||
*
|
||||
* Message format (/list):
|
||||
* - type - Message type, must be one of defines in `code/__DEFINES/chat.dm`
|
||||
* - text - Plain message text
|
||||
* - html - HTML message text
|
||||
* - Optional metadata, can be any key/value pair.
|
||||
*
|
||||
* Copyright (c) 2020 Aleksej Komarov
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/proc/message_to_html(message)
|
||||
// Here it is possible to add a switch statement
|
||||
// to custom-handle various message types.
|
||||
return message["html"] || message["text"]
|
||||
/**
|
||||
* Message-related procs
|
||||
*
|
||||
* Message format (/list):
|
||||
* - type - Message type, must be one of defines in `code/__DEFINES/chat.dm`
|
||||
* - text - Plain message text
|
||||
* - html - HTML message text
|
||||
* - Optional metadata, can be any key/value pair.
|
||||
*
|
||||
* Copyright (c) 2020 Aleksej Komarov
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/proc/message_to_html(message)
|
||||
// Here it is possible to add a switch statement
|
||||
// to custom-handle various message types.
|
||||
return message["html"] || message["text"]
|
||||
|
||||
@@ -1,85 +1,85 @@
|
||||
/*!
|
||||
* Copyright (c) 2020 Aleksej Komarov
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* Circumvents the message queue and sends the message
|
||||
* to the recipient (target) as soon as possible.
|
||||
*/
|
||||
/proc/to_chat_immediate(
|
||||
target,
|
||||
html,
|
||||
type = null,
|
||||
text = null,
|
||||
avoid_highlighting = FALSE,
|
||||
// FIXME: These flags are now pointless and have no effect
|
||||
handle_whitespace = TRUE,
|
||||
trailing_newline = TRUE,
|
||||
confidential = FALSE
|
||||
)
|
||||
// Useful where the integer 0 is the entire message. Use case is enabling to_chat(target, some_boolean) while preventing to_chat(target, "")
|
||||
html = "[html]"
|
||||
text = "[text]"
|
||||
|
||||
if(!target)
|
||||
return
|
||||
if(!html && !text)
|
||||
CRASH("Empty or null string in to_chat proc call.")
|
||||
if(target == world)
|
||||
target = GLOB.clients
|
||||
|
||||
// Build a message
|
||||
var/message = list()
|
||||
if(type) message["type"] = type
|
||||
if(text) message["text"] = text
|
||||
if(html) message["html"] = html
|
||||
if(avoid_highlighting) message["avoidHighlighting"] = avoid_highlighting
|
||||
|
||||
// send it immediately
|
||||
SSchat.send_immediate(target, message)
|
||||
|
||||
/**
|
||||
* Sends the message to the recipient (target).
|
||||
*
|
||||
* Recommended way to write to_chat calls:
|
||||
* ```
|
||||
* to_chat(client,
|
||||
* type = MESSAGE_TYPE_INFO,
|
||||
* html = "You have found <strong>[object]</strong>")
|
||||
* ```
|
||||
*/
|
||||
/proc/to_chat(
|
||||
target,
|
||||
html,
|
||||
type = null,
|
||||
text = null,
|
||||
avoid_highlighting = FALSE,
|
||||
// FIXME: These flags are now pointless and have no effect
|
||||
handle_whitespace = TRUE,
|
||||
trailing_newline = TRUE,
|
||||
confidential = FALSE
|
||||
)
|
||||
//if(isnull(Master) || !SSchat?.initialized || !MC_RUNNING(SSchat.init_stage))
|
||||
if(isnull(Master) || !SSchat?.subsystem_initialized)
|
||||
to_chat_immediate(target, html, type, text, avoid_highlighting)
|
||||
return
|
||||
|
||||
// Useful where the integer 0 is the entire message. Use case is enabling to_chat(target, some_boolean) while preventing to_chat(target, "")
|
||||
html = "[html]"
|
||||
text = "[text]"
|
||||
|
||||
if(!target)
|
||||
return
|
||||
if(!html && !text)
|
||||
CRASH("Empty or null string in to_chat proc call.")
|
||||
if(target == world)
|
||||
target = GLOB.clients
|
||||
|
||||
// Build a message
|
||||
var/message = list()
|
||||
if(type) message["type"] = type
|
||||
if(text) message["text"] = text
|
||||
if(html) message["html"] = html
|
||||
if(avoid_highlighting) message["avoidHighlighting"] = avoid_highlighting
|
||||
SSchat.queue(target, message)
|
||||
/*!
|
||||
* Copyright (c) 2020 Aleksej Komarov
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* Circumvents the message queue and sends the message
|
||||
* to the recipient (target) as soon as possible.
|
||||
*/
|
||||
/proc/to_chat_immediate(
|
||||
target,
|
||||
html,
|
||||
type = null,
|
||||
text = null,
|
||||
avoid_highlighting = FALSE,
|
||||
// FIXME: These flags are now pointless and have no effect
|
||||
handle_whitespace = TRUE,
|
||||
trailing_newline = TRUE,
|
||||
confidential = FALSE
|
||||
)
|
||||
// Useful where the integer 0 is the entire message. Use case is enabling to_chat(target, some_boolean) while preventing to_chat(target, "")
|
||||
html = "[html]"
|
||||
text = "[text]"
|
||||
|
||||
if(!target)
|
||||
return
|
||||
if(!html && !text)
|
||||
CRASH("Empty or null string in to_chat proc call.")
|
||||
if(target == world)
|
||||
target = GLOB.clients
|
||||
|
||||
// Build a message
|
||||
var/message = list()
|
||||
if(type) message["type"] = type
|
||||
if(text) message["text"] = text
|
||||
if(html) message["html"] = html
|
||||
if(avoid_highlighting) message["avoidHighlighting"] = avoid_highlighting
|
||||
|
||||
// send it immediately
|
||||
SSchat.send_immediate(target, message)
|
||||
|
||||
/**
|
||||
* Sends the message to the recipient (target).
|
||||
*
|
||||
* Recommended way to write to_chat calls:
|
||||
* ```
|
||||
* to_chat(client,
|
||||
* type = MESSAGE_TYPE_INFO,
|
||||
* html = "You have found <strong>[object]</strong>")
|
||||
* ```
|
||||
*/
|
||||
/proc/to_chat(
|
||||
target,
|
||||
html,
|
||||
type = null,
|
||||
text = null,
|
||||
avoid_highlighting = FALSE,
|
||||
// FIXME: These flags are now pointless and have no effect
|
||||
handle_whitespace = TRUE,
|
||||
trailing_newline = TRUE,
|
||||
confidential = FALSE
|
||||
)
|
||||
//if(isnull(Master) || !SSchat?.initialized || !MC_RUNNING(SSchat.init_stage))
|
||||
if(isnull(Master) || !SSchat?.subsystem_initialized)
|
||||
to_chat_immediate(target, html, type, text, avoid_highlighting)
|
||||
return
|
||||
|
||||
// Useful where the integer 0 is the entire message. Use case is enabling to_chat(target, some_boolean) while preventing to_chat(target, "")
|
||||
html = "[html]"
|
||||
text = "[text]"
|
||||
|
||||
if(!target)
|
||||
return
|
||||
if(!html && !text)
|
||||
CRASH("Empty or null string in to_chat proc call.")
|
||||
if(target == world)
|
||||
target = GLOB.clients
|
||||
|
||||
// Build a message
|
||||
var/message = list()
|
||||
if(type) message["type"] = type
|
||||
if(text) message["text"] = text
|
||||
if(html) message["html"] = html
|
||||
if(avoid_highlighting) message["avoidHighlighting"] = avoid_highlighting
|
||||
SSchat.queue(target, message)
|
||||
|
||||
Reference in New Issue
Block a user