Skip to content
Open
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
11 changes: 6 additions & 5 deletions code/__DEFINES/_globals.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//See also controllers/globals.dm
// See also controllers/globals.dm
// See initialization order in /code/game/world.dm

/// Creates a global initializer with a given InitValue expression, do not use
#define GLOBAL_MANAGED(X, InitValue)\
Expand All @@ -20,11 +21,11 @@
#define GLOBAL_PROTECT(X)
#endif

/// Standard BYOND global, do not use
#define GLOBAL_REAL_VAR(X) var/global/##X
/// Standard BYOND global, seriously do not use without an earthshakingly good reason
#define GLOBAL_REAL_VAR(X) var/global/##X;

/// Standard typed BYOND global, do not use
#define GLOBAL_REAL(X, Typepath) var/global##Typepath/##X
/// Standard typed BYOND global, seriously do not use without an earthshakingly good reason
#define GLOBAL_REAL(X, Typepath) var/global##Typepath/##X;

/// Defines a global var on the controller, do not use
#define GLOBAL_RAW(X) /datum/controller/global_vars/var/global##X
Expand Down
12 changes: 7 additions & 5 deletions code/__DEFINES/_tick.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define MAPTICK_LAST_INTERNAL_TICK_USAGE (world.map_cpu)

/// Tick limit while running normally
#define TICK_LIMIT_RUNNING 80
/// Tick limit used to resume things in stoplag
Expand All @@ -22,12 +24,12 @@
///like TICK_CHECK but for half the budget
#define TICK_CHECK_LOW ( TICK_USAGE > (Master.current_ticklimit * 0.5))

/// Returns true if tick usage is above 95, for high priority usage
#define TICK_CHECK_HIGH_PRIORITY ( TICK_USAGE > 95 )
/// runs stoplag if tick_usage is above 95, for high priority usage
#define CHECK_TICK_HIGH_PRIORITY ( TICK_CHECK_HIGH_PRIORITY? stoplag() : 0 )

/// Checks if a sleeping proc is running before or after the master controller
#define RUNNING_BEFORE_MASTER ( Master.last_run != null && Master.last_run != world.time )
/// Returns true if a verb ought to yield to the MC (IE: queue up to be processed by a subsystem)
#define VERB_SHOULD_YIELD ( TICK_CHECK || RUNNING_BEFORE_MASTER )

/// Returns true if tick usage is above 95, for high priority usage
#define TICK_CHECK_HIGH_PRIORITY ( TICK_USAGE > 95 )
/// runs stoplag if tick_usage is above 95, for high priority usage
#define CHECK_TICK_HIGH_PRIORITY ( TICK_CHECK_HIGH_PRIORITY? stoplag() : 0 )
7 changes: 7 additions & 0 deletions code/__DEFINES/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,10 @@ DEFINE_BITFIELD(toggles_maptext, list(
//"Disable hover text" = DISABLE_HOVER_TEXT,
"Disable runechat" = DISABLE_RUNECHAT,
))

/// The non gender specific list that we get from init_sprite_accessory_subtypes()
#define DEFAULT_SPRITE_LIST "default_sprites"
/// The male specific list that we get from init_sprite_accessory_subtypes()
#define MALE_SPRITE_LIST "male_sprites"
/// The female specific list that we get from init_sprite_accessory_subtypes()
#define FEMALE_SPRITE_LIST "female_sprites"
2 changes: 0 additions & 2 deletions code/__DEFINES/roguetown.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
/// Currently same as ALL_ICONOCLAST_PATRONS, but in text format because byond sucks and won't read things properly.
#define COLORFUL_PATRONS list("Psydon", "Astrata", "Noc", "Dendor", "Abyssor", "Necra", "Ravox", "Xylix", "Pestra", "Malum", "Eora", "Graggar", "Zizo", "Matthios", "Baotha")

GLOBAL_LIST_INIT(curse_names, list())

#define TEN_CURSES list(\
/datum/curse/astrata,\
/datum/curse/noc,\
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@
// Subsystem init_order, from highest priority to lowest priority
// Subsystems shutdown in the reverse of the order they initialize in
// The numbers just define the ordering, they are meaningless otherwise.

#define INIT_ORDER_PROFILER 101
#define INIT_ORDER_ASSETS 101
#define INIT_ORDER_TITLE 100
#define INIT_ORDER_GARBAGE 99
Expand Down Expand Up @@ -128,6 +130,7 @@
#define INIT_ORDER_TERRAIN 49
#define INIT_ORDER_DUNGEON 48
#define INIT_ORDER_NETWORKS 45
#define INIT_ORDER_TIMETRACK 44
#define INIT_ORDER_SPATIAL_GRID 43
#define INIT_ORDER_ECONOMY 40
#define INIT_ORDER_OUTPUTS 35
Expand Down
4 changes: 2 additions & 2 deletions code/__DEFINES/tracy.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// File path used for the "enable tracy next round" functionality
/// The server port is appended to the end of the filename to avoid conflicts if multiple servers share the same data folder.
#define TRACY_ENABLE_PATH "data/enable_tracy.[world.port]"
#define TRACY_ENABLE_PATH "data/enable_tracy.[world.port]"
/// The DLL path for byond-tracy.
#define TRACY_DLL_PATH (world.system_type == MS_WINDOWS ? "prof.dll" : "./libprof.so")
#define TRACY_DLL_PATH (world.system_type == MS_WINDOWS ? "prof.dll" : "./libprof.so")
15 changes: 10 additions & 5 deletions code/__HELPERS/_logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
#define SEND_SOUND(target, sound) DIRECT_OUTPUT(target, sound)
#define SEND_TEXT(target, text) DIRECT_OUTPUT(target, text)
#define WRITE_FILE(file, text) DIRECT_OUTPUT(file, text)
#define WRITE_LOG(log, text) text2file(text,log) //rustg_log_write

//This is an external call, "true" and "false" are how rust parses out booleans
#define WRITE_LOG(log, text) rustg_log_write(log, text, "true")
#define WRITE_LOG_NO_FORMAT(log, text) rustg_log_write(log, text, "false")

#define TIMETOTEXT4LOGS time2text(world.timeofday,"hh:mm:ss")
//print a warning message to world.log
#define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [UNLINT(src)] usr: [usr].")
Expand Down Expand Up @@ -78,10 +82,6 @@
if (CONFIG_GET(flag/log_virus))
WRITE_LOG(GLOB.world_virus_log, "\[[TIMETOTEXT4LOGS]\] VIRUS: [text]")

/proc/log_cloning(text, mob/initiator)
if(CONFIG_GET(flag/log_cloning))
WRITE_LOG(GLOB.world_cloning_log, "\[[TIMETOTEXT4LOGS]\] CLONING: [text]")

/proc/log_paper(text)
WRITE_LOG(GLOB.world_paper_log, "\[[TIMETOTEXT4LOGS]\] PAPER: [text]")

Expand Down Expand Up @@ -215,6 +215,11 @@
/proc/log_hunted(text)
WRITE_LOG(GLOB.hunted_log, text)

/// Logging for game performance
/proc/log_perf(list/perf_info)
. = "[perf_info.Join(",")]\n"
WRITE_LOG_NO_FORMAT(GLOB.perf_log, .)

/* ui logging */
/**
* Appends a tgui-related log entry. All arguments are optional.
Expand Down
70 changes: 1 addition & 69 deletions code/__HELPERS/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,10 @@
/////Initial Building/////
//////////////////////////

/proc/make_datum_references_lists()
init_quirk_registry()
//underwear
init_sprite_accessory_subtypes(/datum/sprite_accessory/underwear, GLOB.underwear_list, GLOB.underwear_m, GLOB.underwear_f)
//undershirt
init_sprite_accessory_subtypes(/datum/sprite_accessory/undershirt, GLOB.undershirt_list, GLOB.undershirt_m, GLOB.undershirt_f)

//Species
for(var/datum/species/species as anything in subtypesof(/datum/species))
species = new species()
GLOB.species_list[species.id] = species.type

if(species.check_roundstart_eligible())
GLOB.roundstart_species += species.id

sortTim(GLOB.species_list, GLOBAL_PROC_REF(cmp_text_dsc))
sortTim(GLOB.roundstart_species, GLOBAL_PROC_REF(cmp_text_dsc))

//Surgery steps
for(var/path in subtypesof(/datum/surgery_step))
GLOB.surgery_steps += new path()
sortTim(GLOB.surgery_steps, GLOBAL_PROC_REF(cmp_typepaths_asc))

//Surgeries
for(var/path in subtypesof(/datum/surgery))
GLOB.surgeries_list += new path()
sortTim(GLOB.surgeries_list, GLOBAL_PROC_REF(cmp_typepaths_asc))

/proc/make_datum_reference_lists()
// Keybindings
init_keybindings()

init_molten_recipes()
init_slapcraft_steps()
init_slapcraft_recipes()
init_curse_names()

GLOB.emote_list = init_emote_list()

// Faiths
for(var/datum/faith/faith as anything in subtypesof(/datum/faith))
if(IS_ABSTRACT(faith))
continue

faith = new faith()
GLOB.faith_list[faith.type] = faith

// Inquisition Hermes list
for(var/path in subtypesof(/datum/inqports)) // Why is this here
var/datum/inqports/inqports = new path()
GLOB.inqsupplies[path] = inqports

// Patron Gods
for(var/datum/patron/patron as anything in subtypesof(/datum/patron))
if(IS_ABSTRACT(patron))
continue

patron = new patron()

GLOB.patron_list[patron.type] = patron

LAZYINITLIST(GLOB.patrons_by_faith[patron.associated_faith])

GLOB.patrons_by_faith[patron.associated_faith][patron.type] = patron

//creates every subtype of prototype (excluding prototype) and adds it to list L.
//if no list/L is provided, one is created.
/proc/init_subtypes(prototype, list/L)
Expand All @@ -91,11 +31,3 @@
for(var/path as anything in subtypesof(prototype))
L[path] = new path()
return L

/proc/init_curse_names()
GLOB.curse_names = list()
for(var/datum/curse/curse_type as anything in subtypesof(/datum/curse))
if(IS_ABSTRACT(curse_type))
continue
GLOB.curse_names |= initial(curse_type.name)
GLOB.curse_names[initial(curse_type.name)] = new curse_type
4 changes: 0 additions & 4 deletions code/__HELPERS/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
return "000"

/proc/random_underwear(gender)
if(!GLOB.underwear_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/underwear, GLOB.underwear_list, GLOB.underwear_m, GLOB.underwear_f)
switch(gender)
if(MALE)
return pick(GLOB.underwear_m)
Expand All @@ -36,8 +34,6 @@
return pick(GLOB.underwear_list)

/proc/random_undershirt(gender)
if(!GLOB.undershirt_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/undershirt, GLOB.undershirt_list, GLOB.undershirt_m, GLOB.undershirt_f)
switch(gender)
if(MALE)
return pick(GLOB.undershirt_m)
Expand Down
2 changes: 0 additions & 2 deletions code/__HELPERS/roundend.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@

log_game("The round has ended.")

INVOKE_ASYNC(world, TYPE_PROC_REF(/world, flush_byond_tracy))

to_chat(world, "<BR><BR><BR><span class='reallybig'>So ends this tale of Vanderlin.</span>")
get_end_reason()

Expand Down
8 changes: 0 additions & 8 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -674,14 +674,6 @@ GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list(
/proc/stack_trace(msg)
CRASH(msg)

GLOBAL_REAL_VAR(list/stack_trace_storage)
/proc/gib_stack_trace()
stack_trace_storage = list()
stack_trace()
stack_trace_storage.Cut(1, min(3,stack_trace_storage.len))
. = stack_trace_storage
stack_trace_storage = null

//Key thing that stops lag. Cornerstone of performance in ss13, Just sitting here, in unsorted.dm.

//Increases delay as the server gets more overloaded,
Expand Down
5 changes: 5 additions & 0 deletions code/_compile_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
#define USE_CUSTOM_ERROR_HANDLER
#endif

#if defined(OPENDREAM) && !defined(SPACEMAN_DMM) && !defined(CIBUILDING)
// The code is being compiled for OpenDream, and not just for the CI linting.
#define OPENDREAM_REAL
#endif

#ifdef TESTING
#define DATUMVAR_DEBUGGING_MODE

Expand Down
2 changes: 1 addition & 1 deletion code/_globalvars/configuration.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GLOBAL_REAL(config, /datum/controller/configuration)

GLOBAL_DATUM(revdata, /datum/getrev)
GLOBAL_DATUM_INIT(revdata, /datum/getrev, new)

GLOBAL_VAR(host)
GLOBAL_VAR(station_name)
Expand Down
14 changes: 14 additions & 0 deletions code/_globalvars/lists/emote.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
GLOBAL_LIST_INIT(emote_list, init_emote_list())

/proc/init_emote_list()
var/list/emotes = list()
for(var/datum/emote/emote as anything in subtypesof(/datum/emote))
if(IS_ABSTRACT(emote))
continue

emote = new emote()

LAZYADDASSOCLIST(emotes, emote.key, emote)
LAZYADDASSOCLIST(emotes, emote.key_third_person, emote)

return emotes
10 changes: 0 additions & 10 deletions code/_globalvars/lists/flavor_misc.dm
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
//Preferences stuff
//Underwear
GLOBAL_LIST_EMPTY(underwear_list) //stores /datum/sprite_accessory/underwear indexed by name
GLOBAL_LIST_EMPTY(underwear_m) //stores only underwear name
GLOBAL_LIST_EMPTY(underwear_f) //stores only underwear name
//Undershirts
GLOBAL_LIST_EMPTY(undershirt_list) //stores /datum/sprite_accessory/undershirt indexed by name
GLOBAL_LIST_EMPTY(undershirt_m) //stores only undershirt name
GLOBAL_LIST_EMPTY(undershirt_f) //stores only undershirt name

GLOBAL_LIST_INIT(color_list_ethereal, list("F Class(Green)" = "97ee63", "F2 Class (Light Green)" = "00fa9a", "F3 Class (Dark Green)" = "37835b", "M Class (Red)" = "9c3030", "M1 Class (Purple)" = "ee82ee", "G Class (Yellow)" = "fbdf56", "O Class (Blue)" = "3399ff", "A Class (Cyan)" = "00ffff"))

GLOBAL_LIST_INIT(ghost_forms_with_directions_list, list(
Expand Down
9 changes: 9 additions & 0 deletions code/_globalvars/lists/import.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
GLOBAL_LIST_INIT(inqsupplies, init_inqsupplies())

/proc/init_inqsupplies()
var/list/supplies = list()
for(var/datum/inqports/path as anything in subtypesof(/datum/inqports))
if(IS_ABSTRACT(path))
continue
supplies[path] = new path()
return supplies
33 changes: 16 additions & 17 deletions code/_globalvars/lists/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,28 @@ GLOBAL_LIST_EMPTY(aiEyes)
GLOBAL_LIST_EMPTY(language_datum_instances)
GLOBAL_LIST_EMPTY(all_languages)

GLOBAL_LIST_EMPTY(roundstart_species)
/// Associative list of species id to type
GLOBAL_LIST_EMPTY(species_list)
GLOBAL_LIST_INIT(species_list, init_species_lists())

/proc/init_species_lists()
var/list/species_list = list()
for(var/datum/species/species as anything in subtypesof(/datum/species))
species = new species()
species_list[species.id] = species.type

if(species.check_roundstart_eligible())
GLOB.roundstart_species += species.id

sortTim(species_list, GLOBAL_PROC_REF(cmp_text_dsc))
sortTim(GLOB.roundstart_species, GLOBAL_PROC_REF(cmp_text_dsc))

return species_list

GLOBAL_LIST_EMPTY(latejoin_ai_cores)

GLOBAL_LIST_EMPTY(mob_config_movespeed_type_lookup)

GLOBAL_LIST_EMPTY(emote_list)

GLOBAL_LIST_INIT(dangerous_turfs, typecacheof(list(
/turf/open/lava,
/turf/open/openspace,
Expand All @@ -67,20 +80,6 @@ GLOBAL_LIST_INIT(dangerous_turfs, typecacheof(list(
for(var/mob/M as anything in GLOB.mob_list)
M.update_config_movespeed()

/proc/init_emote_list()
. = list()
for(var/path in subtypesof(/datum/emote))
var/datum/emote/E = new path()
if(!.[E.key])
.[E.key] = list(E)
else
.[E.key] += E

if(!.[E.key_third_person])
.[E.key_third_person] = list(E)
else
.[E.key_third_person] |= E

/// Cultures can't be interacted with so we only ever need as many datums as exist
GLOBAL_LIST_INIT(culture_singletons, init_culture_singletons())

Expand Down
Loading