Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vanderlin updates to BYOND 516 + Vanderlin fixes #1272

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

env:
BYOND_MAJOR: 515
BYOND_MINOR: 1636
BYOND_MINOR: 1647
SPACEMAN_DMM_VERSION: suite-1.9

jobs:
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/colors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,6 @@
#define CLOTHING_STORM "#1a2677"
#define CLOTHING_OCEAN "#56928a"
#define CLOTHING_ISLAND "#bd3541"
// End Kaizoku Assets.

#define hex2num(X) text2num(X, 16)
2 changes: 1 addition & 1 deletion code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
// Subsystems shutdown in the reverse of the order they initialize in
// The numbers just define the ordering, they are meaningless otherwise.

#define INIT_ORDER_ASSETS 101
#define INIT_ORDER_TITLE 100
#define INIT_ORDER_GARBAGE 99
#define INIT_ORDER_DBCORE 95
Expand Down Expand Up @@ -128,7 +129,6 @@
#define INIT_ORDER_TIMER 1
#define INIT_ORDER_DEFAULT 0
#define INIT_ORDER_AIR -1
#define INIT_ORDER_ASSETS -4
#define INIT_ORDER_ICON_SMOOTHING -5
#define INIT_ORDER_OVERLAY -6
#define INIT_ORDER_XKEYSCORE -10
Expand Down
5 changes: 0 additions & 5 deletions code/__HELPERS/files.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
//Sends resource files to client cache
/client/proc/getFiles(...)
for(var/file in args)
src << browse_rsc(file)

/client/proc/browse_files(root="data/logs/", max_iterations=10, list/valid_extensions=list("txt","log","htm", "html"))
var/path = root

Expand Down
15 changes: 10 additions & 5 deletions code/__HELPERS/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,11 @@ GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0
alpha += 25
obj_flags &= ~FROZEN

/// Generate a filename for this asset
/// The same asset will always lead to the same asset name
/// (Generated names do not include file extention.)
/proc/generate_asset_name(file)
return "asset.[md5(fcopy_rsc(file))]"

//Converts an icon to base64. Operates by putting the icon in the iconCache savefile,
// exporting it as text, and then parsing the base64 from that.
Expand Down Expand Up @@ -1104,11 +1109,11 @@ GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0
if (!isicon(I))
if (isfile(thing)) //special snowflake
var/name = sanitize_filename("[generate_asset_name(thing)].png")
register_asset(name, thing)
SSassets.transport.register_asset(name, thing)
for (var/mob/thing2 in targets)
if(!istype(thing2) || !thing2.client)
continue
send_asset_async(thing2?.client, key)
SSassets.transport.send_assets(thing2?.client, key)
return "<img class='icon icon-misc' src=\"[url_encode(name)]\">"
var/atom/A = thing
if (isnull(dir))
Expand All @@ -1130,13 +1135,13 @@ GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0
I = icon(I, icon_state, dir, frame, moving)

key = "[generate_asset_name(I)].png"
register_asset(key, I)
SSassets.transport.register_asset(key, I)
for (var/mob/thing2 in targets)
if(!istype(thing2) || !thing2.client)
continue
send_asset_async(thing2?.client, key)
SSassets.transport.send_assets(thing2?.client, key)

return "<img class='icon icon-[icon_state]' src=\"[url_encode(key)]\">"
return "<img class='icon icon-[icon_state]' src='[SSassets.transport.get_asset_url(key)]'>"

/proc/icon2base64html(thing)
if (!thing)
Expand Down
6 changes: 3 additions & 3 deletions code/__HELPERS/roundend.dm
Original file line number Diff line number Diff line change
Expand Up @@ -543,12 +543,12 @@
var/datum/action/report/R = new
C.player_details.player_actions += R
R.Grant(C.mob)
to_chat(C,"<a href='?src=[REF(R)];report=1'>Show roundend report again</a>")
to_chat(C,"<a href='byond://?src=[REF(R)];report=1'>Show roundend report again</a>")

/datum/controller/subsystem/ticker/proc/give_show_playerlist_button(client/C)
set waitfor = 0
to_chat(C,"<a href='?src=[C];playerlistrogue=1'>* SHOW PLAYER LIST *</a>")
to_chat(C,"<a href='?src=[C];commendsomeone=1'>* Commend a Character *</a>")
to_chat(C,"<a href='byond://?src=[C];playerlistrogue=1'>* SHOW PLAYER LIST *</a>")
to_chat(C,"<a href='byond://?src=[C];commendsomeone=1'>* Commend a Character *</a>")

/datum/action/report
name = "Show roundend report"
Expand Down
48 changes: 6 additions & 42 deletions code/__HELPERS/type2type.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,6 @@
* text2dir_extended & dir2text_short
*/

//Returns an integer given a hex input, supports negative values "-ff"
//skips preceding invalid characters
//breaks when hittin invalid characters thereafter
// If safe=TRUE, returns null on incorrect input strings instead of CRASHing
/proc/hex2num(hex, safe=FALSE)
. = 0
var/place = 1
for(var/i in length(hex) to 1 step -1)
var/num = text2ascii(hex, i)
switch(num)
if(48 to 57)
num -= 48 //0-9
if(97 to 102)
num -= 87 //a-f
if(65 to 70)
num -= 55 //A-F
if(45)
return . * -1 // -
else
if(safe)
return null
else
CRASH("Malformed hex number")

. += num * place
place *= 16

//Returns the hex value of a decimal number
//len == length of returned string
//if len < 0 then the returned string will be as long as it needs to be to contain the data
Expand Down Expand Up @@ -497,7 +470,7 @@
//word of warning: using a matrix like this as a color value will simplify it back to a string after being set
/proc/color_hex2color_matrix(string)
var/length = length(string)
if(length != 7 && length != 9)
if((length != 7 && length != 9) || length != length_char(string))
return color_matrix_identity()
var/r = hex2num(copytext(string, 2, 4))/255
var/g = hex2num(copytext(string, 4, 6))/255
Expand Down Expand Up @@ -551,6 +524,11 @@
else //regex everything else (works for /proc too)
return lowertext(replacetext("[the_type]", "[type2parent(the_type)]/", ""))

/// Return html to load a url.
/// for use inside of browse() calls to html assets that might be loaded on a cdn.
/proc/url2htmlloader(url)
return {"<html><head><meta http-equiv="refresh" content="0;URL='[url]'"/></head><body onLoad="parent.location='[url]'"></body></html>"}

/proc/strtohex(str)
if(!istext(str)||!str)
return
Expand All @@ -560,17 +538,3 @@
c= text2ascii(str,i)
r+= num2hex(c)
return r

// Decodes hex to raw byte string.
// If safe=TRUE, returns null on incorrect input strings instead of CRASHing
/proc/hextostr(str, safe=FALSE)
if(!istext(str)||!str)
return
var/r
var/c
for(var/i = 1 to length(str)/2)
c = hex2num(copytext(str,i*2-1,i*2+1), safe)
if(isnull(c))
return null
r += ascii2text(c)
return r
8 changes: 1 addition & 7 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@
var/textr = copytext(HTMLstring, 2, 4)
var/textg = copytext(HTMLstring, 4, 6)
var/textb = copytext(HTMLstring, 6, 8)
var/r = hex2num(textr)
var/g = hex2num(textg)
var/b = hex2num(textb)
textr = num2hex(255 - r, 2)
textg = num2hex(255 - g, 2)
textb = num2hex(255 - b, 2)
return text("#[][][]", textr, textg, textb)
return rgb(255 - hex2num(textr), 255 - hex2num(textg), 255 - hex2num(textb))

/proc/Get_Angle(atom/movable/start,atom/movable/end)//For beams.
if(!start || !end)
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/alert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
for(var/X in H.bodyparts)
var/obj/item/bodypart/BP = X
for(var/obj/item/I in BP.embedded_objects)
msg += "<a href='?src=[REF(H)];embedded_object=[REF(I)];embedded_limb=[REF(BP)]' class='warning'>[I] - [BP.name]</a>\n"
msg += "<a href='byond://?src=[REF(H)];embedded_object=[REF(I)];embedded_limb=[REF(BP)]' class='warning'>[I] - [BP.name]</a>\n"
msg += "***"
to_chat(H, "[msg.Join()]")

Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/mouseover.dm
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,5 @@
/client/proc/genmouseobj()
mouseovertext = new /atom/movable/screen/movable/mouseover/maptext
mouseoverbox = new /atom/movable/screen/movable/mouseover
var/datum/asset/stuff = get_asset_datum(/datum/asset/simple/roguefonts)
var/datum/asset/stuff = get_asset_datum(/datum/asset/simple/namespaced/roguefonts)
stuff.send(src)
4 changes: 0 additions & 4 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1907,10 +1907,6 @@
/atom/movable/screen/char_preview
name = "Me."
icon_state = ""
// var/list/prevcolors = list("background-color=#000000","background-color=#242f28","background-color=#302323","background-color=#999a63","background-color=#7e7e7e")

//atom/movable/screen/char_preview/Click()
// winset(usr.client, "preferencess_window.character_preview_map", pick(prevcolors))

#define READ_RIGHT 1
#define READ_LEFT 2
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@
if(dextrous && !ismob(A))
..()
else
AttackingTarget()
AttackingTarget(A)



Expand Down
3 changes: 3 additions & 0 deletions code/controllers/configuration/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
LoadPolicy()
LoadChatFilter()

if(Master)
Master.OnConfigLoad()

/datum/controller/configuration/proc/full_wipe()
if(IsAdminAdvancedProcCall())
return
Expand Down
5 changes: 5 additions & 0 deletions code/controllers/master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -626,3 +626,8 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
processing = CONFIG_GET(number/mc_tick_rate/base_mc_tick_rate)
else if (client_count > CONFIG_GET(number/mc_tick_rate/high_pop_mc_mode_amount))
processing = CONFIG_GET(number/mc_tick_rate/high_pop_mc_tick_rate)

/datum/controller/master/proc/OnConfigLoad()
for (var/thing in subsystems)
var/datum/controller/subsystem/SS = thing
SS.OnConfigLoad()
3 changes: 3 additions & 0 deletions code/controllers/subsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,6 @@
if ("queued_priority") //editing this breaks things.
return 0
. = ..()

/// Called after the config has been loaded or reloaded.
/datum/controller/subsystem/proc/OnConfigLoad()
22 changes: 17 additions & 5 deletions code/controllers/subsystem/assets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,27 @@ SUBSYSTEM_DEF(assets)
flags = SS_NO_FIRE
var/list/cache = list()
var/list/preload = list()
var/datum/asset_transport/transport = new()

/datum/controller/subsystem/assets/OnConfigLoad()
var/newtransporttype = /datum/asset_transport
switch (CONFIG_GET(string/asset_transport))
if ("webroot")
newtransporttype = /datum/asset_transport/webroot

if (newtransporttype == transport.type)
return

var/datum/asset_transport/newtransport = new newtransporttype ()
if (newtransport.validate_config())
transport = newtransport
transport.Load()

/datum/controller/subsystem/assets/Initialize(timeofday)
for(var/type in typesof(/datum/asset))
var/datum/asset/A = type
if (type != initial(A._abstract))
get_asset_datum(type)

preload = cache.Copy() //don't preload assets generated during the round

for(var/client/C in GLOB.clients)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(getFilesSlow), C, preload, FALSE), 10)
..()
transport.Initialize(cache)
return ..()
2 changes: 1 addition & 1 deletion code/controllers/subsystem/events.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ SUBSYSTEM_DEF(events)
var/magic = ""
var/holiday = ""
for(var/datum/round_event_control/E in SSevents.control)
dat = "<BR><A href='?src=[REF(src)];[HrefToken()];forceevent=[REF(E)]'>[E]</A>"
dat = "<BR><A href='byond://?src=[REF(src)];[HrefToken()];forceevent=[REF(E)]'>[E]</A>"
if(E.holidayID)
holiday += dat
else if(E.wizardevent)
Expand Down
Loading
Loading