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

TEST: Возможность работать на 516 #3328

Draft
wants to merge 4 commits into
base: dev-sierra
Choose a base branch
from
Draft
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
6 changes: 3 additions & 3 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
#include "code\__defines\movement.dm"
#include "code\__defines\overmap.dm"
#include "code\__defines\proc_presets.dm"
#include "code\__defines\procs.dm"
#include "code\__defines\psi.dm"
#include "code\__defines\qdel.dm"
#include "code\__defines\research.dm"
Expand Down Expand Up @@ -263,8 +264,6 @@
#include "code\core\datum\IsAbstract.dm"
#include "code\core\image\Transform.dm"
#include "code\core\math\math.dm"
#include "code\core\math\vector2.dm"
#include "code\core\math\vector3.dm"
#include "code\core\matrix\Transform.dm"
#include "code\datums\ai_law_sets.dm"
#include "code\datums\ai_laws.dm"
Expand Down Expand Up @@ -1391,7 +1390,6 @@
#include "code\modules\admin\NewBan.dm"
#include "code\modules\admin\persistence.dm"
#include "code\modules\admin\player_notes.dm"
#include "code\modules\admin\player_panel.dm"
#include "code\modules\admin\spam_prevention.dm"
#include "code\modules\admin\ticket.dm"
#include "code\modules\admin\topic.dm"
Expand Down Expand Up @@ -1460,6 +1458,7 @@
#include "code\modules\admin\verbs\adminsay.dm"
#include "code\modules\admin\verbs\antag-ooc.dm"
#include "code\modules\admin\verbs\atmosdebug.dm"
#include "code\modules\admin\verbs\check_antagonist.dm"
#include "code\modules\admin\verbs\cinematic.dm"
#include "code\modules\admin\verbs\custom_event.dm"
#include "code\modules\admin\verbs\deadsay.dm"
Expand All @@ -1472,6 +1471,7 @@
#include "code\modules\admin\verbs\mapping.dm"
#include "code\modules\admin\verbs\massmodvar.dm"
#include "code\modules\admin\verbs\modifyvariables.dm"
#include "code\modules\admin\verbs\player_list.dm"
#include "code\modules\admin\verbs\playsound.dm"
#include "code\modules\admin\verbs\possess.dm"
#include "code\modules\admin\verbs\pray.dm"
Expand Down
4 changes: 2 additions & 2 deletions code/__defines/_renderer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/atom/movable/renderer
abstract_type = /atom/movable/renderer
appearance_flags = DEFAULT_RENDERER_APPEARANCE_FLAGS
screen_loc = "CENTER"
screen_loc = RENDERER_SCREEN_LOC
plane = LOWEST_PLANE
blend_mode = BLEND_OVERLAY

Expand Down Expand Up @@ -72,7 +72,7 @@ INITIALIZE_IMMEDIATE(/atom/movable/renderer)
else if (render_target_name)
render_target = "*[ckey(name)]"
relay = new
relay.screen_loc = "CENTER"
relay.screen_loc = RENDERER_SCREEN_LOC
relay.appearance_flags = PASS_MOUSE | NO_CLIENT_COLOR | KEEP_TOGETHER
relay.name = "[render_target] relay"
relay.mouse_opacity = mouse_opacity
Expand Down
2 changes: 1 addition & 1 deletion code/__defines/byond_tracy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
lib = "tracy.so"
else
CRASH("Tracy initialization failed: unsupported platform or DLL not found.")
var/init = CALL_EXT(lib, "init")()
var/init = call_ext(lib, "init")()
if(init != "0")
CRASH("[lib] init error: [init]")
14 changes: 14 additions & 0 deletions code/__defines/procs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/// Call by name proc references, checks if the proc exists on either this type () (AND ONLY THIS TYPE) or as a global proc.
#define PROC_REF(X) (nameof(.proc/##X))

/// Call by name verb references, checks if the verb exists on either this type or as a global verb.
#define VERB_REF(X) (nameof(.verb/##X))

/// Call by name proc reference, checks if the proc exists on either the given type or as a global proc
#define TYPE_PROC_REF(TYPE, X) (nameof(##TYPE.proc/##X))

/// Call by name verb reference, checks if the verb exists on either the given type or as a global verb
#define TYPE_VERB_REF(TYPE, X) (nameof(##TYPE.verb/##X))

/// Call by name proc reference, checks if the proc is an existing global proc
#define GLOBAL_PROC_REF(X) (/proc/##X)
2 changes: 1 addition & 1 deletion code/_helpers/logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ var/global/log_end= world.system_type == UNIX ? ascii2text(13) : ""

if(key)
if(include_link && C)
. += "<a href='?priv_msg=\ref[C];ticket=\ref[ticket]'>"
. += "<a href='byond://byond://?priv_msg=\ref[C];ticket=\ref[ticket]'>"

. += key

Expand Down
110 changes: 10 additions & 100 deletions code/_helpers/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ Turf and target are seperate in case you want to teleport some distance from a t
return 1
return 0

/proc/sign(x)
return x!=0?x/abs(x):0

/proc/getline(atom/M,atom/N)//Ultra-Fast Bresenham Line-Drawing Algorithm
RETURN_TYPE(/list)
var/px=M.x //starting x
Expand Down Expand Up @@ -365,98 +362,11 @@ Turf and target are seperate in case you want to teleport some distance from a t
return GetConnectedZlevels(z)
return list() //We return an empty list, because we are apparently in nullspace

/proc/get_sorted_mobs()
RETURN_TYPE(/list)
var/list/old_list = getmobs()
var/list/AI_list = list()
var/list/Dead_list = list()
var/list/keyclient_list = list()
var/list/key_list = list()
var/list/logged_list = list()
for(var/named in old_list)
var/mob/M = old_list[named]
if(issilicon(M))
AI_list |= M
else if(isghost(M) || M.stat == DEAD)
Dead_list |= M
else if(M.key && M.client)
keyclient_list |= M
else if(M.key)
key_list |= M
else
logged_list |= M
old_list.Remove(named)
var/list/new_list = list()
new_list += AI_list
new_list += keyclient_list
new_list += key_list
new_list += logged_list
new_list += Dead_list
return new_list

//Returns a list of all mobs with their name
/proc/getmobs()
RETURN_TYPE(/list)
var/list/mobs = sortmobs()
var/list/names = list()
var/list/creatures = list()
var/list/namecounts = list()
for(var/mob/M in mobs)
var/name = M.name
if (name in names)
namecounts[name]++
name = "[name] ([namecounts[name]])"
else
names.Add(name)
namecounts[name] = 1
if (M.real_name && M.real_name != M.name)
name += " \[[M.real_name]\]"
if (M.stat == DEAD)
if(isobserver(M))
name += " \[observer\]"
else
name += " \[dead\]"
creatures[name] = M

return creatures

/proc/get_follow_targets()
RETURN_TYPE(/list)
return follow_repository.get_follow_targets()

//Orders mobs by type then by name
/proc/sortmobs()
RETURN_TYPE(/list)
var/list/moblist = list()
var/list/sortmob = sortAtom(SSmobs.mob_list)
for(var/mob/observer/eye/M in sortmob)
moblist.Add(M)
for(var/mob/living/silicon/ai/M in sortmob)
moblist.Add(M)
for(var/mob/living/silicon/pai/M in sortmob)
moblist.Add(M)
for(var/mob/living/silicon/robot/M in sortmob)
moblist.Add(M)
for(var/mob/living/carbon/human/M in sortmob)
moblist.Add(M)
for(var/mob/living/carbon/brain/M in sortmob)
moblist.Add(M)
for(var/mob/living/carbon/alien/M in sortmob)
moblist.Add(M)
for(var/mob/observer/ghost/M in sortmob)
moblist.Add(M)
for(var/mob/new_player/M in sortmob)
moblist.Add(M)
for(var/mob/living/carbon/slime/M in sortmob)
moblist.Add(M)
for(var/mob/living/simple_animal/M in sortmob)
moblist.Add(M)
// for(var/mob/living/silicon/hivebot/M in world)
// mob_list.Add(M)
// for(var/mob/living/silicon/hive_mainframe/M in world)
// mob_list.Add(M)
return moblist

//Forces a variable to be posative
/proc/modulus(M)
if(M >= 0)
Expand Down Expand Up @@ -537,13 +447,10 @@ Turf and target are seperate in case you want to teleport some distance from a t
*
* Returns a list of atoms.
*/
/atom/proc/GetAllContents(searchDepth = 5, includeSelf = FALSE)
/atom/proc/GetAllContents(searchDepth = 5)
RETURN_TYPE(/list)
var/list/toReturn = list()

if(includeSelf)
toReturn += src

for(var/atom/part in contents)
toReturn += part
if(length(part.contents) && searchDepth)
Expand Down Expand Up @@ -741,17 +648,20 @@ GLOBAL_LIST_INIT(duplicate_object_disallowed_vars, list(
trg_min_y = turf.y
var/list/refined_src = list()
for (var/turf/turf in turfs_src)
refined_src[turf] = new /datum/vector2 (turf.x - src_min_x, turf.y - src_min_y)
refined_src[turf] = list(turf.x - src_min_x, turf.y - src_min_y)
var/list/refined_trg = list()
for (var/turf/turf in turfs_trg)
refined_trg[turf] = new /datum/vector2 (turf.x - trg_min_x, turf.y - trg_min_y)
refined_trg[turf] = list(turf.x - src_min_x, turf.y - src_min_y)
var/list/turfs_to_update = list()
var/list/copied_movables = list()
moving:
for (var/turf/source_turf in refined_src)
var/datum/vector2/source_position = refined_src[source_turf]
var/list/source_position = refined_src[source_turf]
for (var/turf/target_turf in refined_trg)
if (source_position ~= refined_trg[target_turf])
var/list/target_position = refined_trg[target_turf]
var/same_position = source_position[1] == target_position[1] \
&& source_position[2] == target_position[2]
if (same_position)
var/old_dir1 = source_turf.dir
var/old_icon_state1 = source_turf.icon_state
var/old_icon1 = source_turf.icon
Expand Down Expand Up @@ -999,9 +909,9 @@ var/global/list/WALLITEMS = list(
return replacetext(replacetext(text,"\proper ",""),"\improper ","")

/proc/topic_link(datum/D, arglist, content)
if(istype(arglist,/list))
if(islist(arglist))
arglist = list2params(arglist)
return "<a href='?src=\ref[D];[arglist]'>[content]</a>"
return "<a href='byond://byond://?src=\ref[D];[arglist]'>[content]</a>"

/proc/get_random_colour(simple = FALSE, lower = 0, upper = 255)
var/colour
Expand Down
8 changes: 8 additions & 0 deletions code/_macros.dm
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,11 @@

/// Explicitly set the length of L to NEWLEN, adding nulls or dropping entries. Is the same value as NEWLEN.
#define LIST_RESIZE(L, NEWLEN) ((L).len = (NEWLEN))



/// A ref=src anchor.
#define aref(text, params) "<a href=\"byond://?src=\ref[src];[params]\">[text]</a>"

/// A ref=src anchor with additional anchor properties.
#define arefext(text, params, props) "<a href=\"byond://?src=\ref[src];[params]\" [props]>[text]</a>"
71 changes: 15 additions & 56 deletions code/_version.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,24 @@ DM version compatibility macros & procs
Retain even if empty - the future exists
*/

#if DM_VERSION < 515
#if DM_VERSION < 516

/proc/ceil(number)
return -round(-number)
/proc/sign(num)
if (!num || !isnum(num))
return 0
if (num > 0)
return 1
return -1

/proc/floor(number)
return round(number)
/proc/lerp(low, high, factor)
if (isnum(low) && isnum(high))
return low + (high - low) * factor
crash_with("non-num lerp() is unsupported below byond 516.1648")

/proc/fract(number)
return number - trunc(number)

/proc/ftime()
throw EXCEPTION("ftime not available below 515")

/proc/get_steps_to()
throw EXCEPTION("get_steps_to not available below 515")

/proc/isinf(number)
return number == POSITIVE_INFINITY || number == NEGATIVE_INFINITY

/proc/isnan(number)
return isnum(number) && number != number

/proc/ispointer()
throw EXCEPTION("ispointer not available below 515")

/proc/nameof(thing)
throw EXCEPTION("nameof not available below 515")

/proc/noise_hash()
throw EXCEPTION("noise_hash not available below 515")

/proc/refcount(datum)
throw EXCEPTION("refcount not available below 515")

/proc/trimtext(text)
var/static/regex/pattern
if (!pattern)
pattern = regex(@"^\s*(.*?)\s*$", "g")
return replacetext_char(text, pattern, "$1")

/proc/trunc(number)
if (number < 0)
return -round(-number)
return round(number)

/client/proc/RenderIcon(atom)
throw EXCEPTION("client::RenderIcon() not available below 515")

#define PROC_REF(X) (.proc/##X)
#define TYPE_PROC_REF(TYPE, X) (##TYPE.proc/##X)
#define GLOBAL_PROC_REF(X) (.proc/##X)
#define CALL_EXT call
#endif

#if DM_VERSION > 515
#define RENDERER_SCREEN_LOC "1,1"
#else

#define PROC_REF(X) (nameof(.proc/##X))
#define TYPE_PROC_REF(TYPE, X) (nameof(##TYPE.proc/##X))
#define GLOBAL_PROC_REF(X) (/proc/##X)
#define CALL_EXT call_ext

#define RENDERER_SCREEN_LOC "CENTER"
#endif
5 changes: 2 additions & 3 deletions code/controllers/hooks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
error("Invalid hook '/hook/[hook]' called.")
return 0

var/caller = new hook_path
var/hook_inst = new hook_path
var/status = 1
for(var/P in typesof("[hook_path]/proc"))
var/proc_name = replacetext("[P]", "[hook_path]/proc/", "")
if(!call(caller, proc_name)(arglist(args)))
if(!call(hook_inst, P)(arglist(args)))
error("Hook '[P]' failed or runtimed.")
status = 0

Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystems/initialization/codex.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ SUBSYSTEM_DEF(codex)
var/datum/codex_entry/linked_entry = get_entry_by_string(key)
var/replacement = linkRegex.group[4]
if(linked_entry)
replacement = "<a href='?src=\ref[SScodex];show_examined_info=\ref[linked_entry];show_to=\ref[viewer]'>[replacement]</a>"
replacement = "<a href='byond://?src=\ref[SScodex];show_examined_info=\ref[linked_entry];show_to=\ref[viewer]'>[replacement]</a>"
string = replacetextEx(string, linkRegex.match, replacement)
return string

Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystems/typing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SUBSYSTEM_DEF(typing)
istyping_input = 0|1,
istyping_hotkey = 0|1
), ...)
See PROC_REF(GetEntry for details.
See TYPE_PROC_REF(GetEntry for details.
*/
var/static/list/status = list()

Expand Down
Loading
Loading