Skip to content

Commit

Permalink
Merge pull request #904 from dwasint/various-things
Browse files Browse the repository at this point in the history
Various things
  • Loading branch information
dwasint authored Jan 15, 2024
2 parents fd0f577 + 8ce323b commit 8c4beff
Show file tree
Hide file tree
Showing 175 changed files with 2,630 additions and 1,170 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/code/controllers/globals.dm @Cyberboss
/code/datums/helper_datums/getrev.dm @Cyberboss
/code/modules/tgs/ @Cyberboss
/code/ze_genesis_call/ @Cyberboss
/tools/tgs_test/ @Cyberboss


Expand Down
12 changes: 7 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,12 @@
#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
4 changes: 0 additions & 4 deletions code/__DEFINES/_profile.dm

This file was deleted.

8 changes: 7 additions & 1 deletion code/__DEFINES/_protect.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///Protects a datum from being VV'd
///Protects a datum from being VV'd or spawned through admin manipulation
#define GENERAL_PROTECT_DATUM(Path)\
##Path/can_vv_get(var_name){\
return FALSE;\
Expand All @@ -8,4 +8,10 @@
}\
##Path/CanProcCall(procname){\
return FALSE;\
}\
##Path/Read(savefile/savefile){\
qdel(src);\
}\
##Path/Write(savefile/savefile){\
return;\
}
1 change: 1 addition & 0 deletions code/__DEFINES/is_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,4 @@ GLOBAL_LIST_INIT(book_types, typecacheof(list(
#define is_multi_tile_object(atom) (atom.bound_width > world.icon_size || atom.bound_height > world.icon_size)

#define isartifact(thing) (istype(thing, /obj/structure/artifact) || istype(thing, /obj/item/melee/artifact) || istype(thing, /obj/item/gun/magic/artifact) || istype(thing, /obj/item/stock_parts/cell/artifact))
#define iswater(A) (istype(A, /turf/open/water))
120 changes: 107 additions & 13 deletions code/__DEFINES/logging.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/// The number of entries to store per category, don't make this too large or you'll start to see performance issues
#define CONFIG_MAX_CACHED_LOG_ENTRIES 1000

/// The number of *minimum* ticks between each log re-render, making this small will cause performance issues
/// Admins can still manually request a re-render
#define LOG_UPDATE_TIMEOUT 5 SECONDS

//Investigate logging defines
#define INVESTIGATE_ACCESSCHANGES "id_card_changes"
#define INVESTIGATE_ATMOS "atmos"
Expand Down Expand Up @@ -58,23 +65,110 @@
#define LOGSRC_MOB "Mob"

// Log header keys
#define LOG_HEADER_CATEGORY "category"
#define LOG_HEADER_INIT_TIMESTAMP "timestamp"
#define LOG_HEADER_ROUND_ID "round_id"

// Log data keys
#define LOG_ENTRY_MESSAGE "message"
#define LOG_ENTRY_TIMESTAMP "timestamp"
#define LOG_ENTRY_DATA "data"
#define LOG_HEADER_CATEGORY "cat"
#define LOG_HEADER_CATEGORY_LIST "cat-list"
#define LOG_HEADER_INIT_TIMESTAMP "ts"
#define LOG_HEADER_ROUND_ID "round-id"
#define LOG_HEADER_SECRET "secret"

// Log json keys
#define LOG_JSON_CATEGORY "category"
#define LOG_JSON_CATEGORY "cat"
#define LOG_JSON_ENTRIES "entries"
#define LOG_JSON_LOGGING_START "log_start"
#define LOG_JSON_LOGGING_START "log-start"

// Log entry keys
#define LOG_ENTRY_KEY_TIMESTAMP "ts"
#define LOG_ENTRY_KEY_CATEGORY "cat"
#define LOG_ENTRY_KEY_MESSAGE "msg"
#define LOG_ENTRY_KEY_DATA "data"
#define LOG_ENTRY_KEY_WORLD_STATE "w-state"
#define LOG_ENTRY_KEY_SEMVER_STORE "s-store"
#define LOG_ENTRY_KEY_ID "id"
#define LOG_ENTRY_KEY_SCHEMA_VERSION "s-ver"

// Category for invalid/missing categories
#define LOG_CATEGORY_NOT_FOUND "invalid-category"

// Misc categories
#define LOG_CATEGORY_ATTACK "attack"
#define LOG_CATEGORY_CONFIG "config"
#define LOG_CATEGORY_DYNAMIC "dynamic"
#define LOG_CATEGORY_ECONOMY "economy"
#define LOG_CATEGORY_FILTER "filter"
#define LOG_CATEGORY_MANIFEST "manifest"
#define LOG_CATEGORY_MECHA "mecha"
#define LOG_CATEGORY_PAPER "paper"
#define LOG_CATEGORY_RUNTIME "runtime"
#define LOG_CATEGORY_SHUTTLE "shuttle"
#define LOG_CATEGORY_SILICON "silicon"
#define LOG_CATEGORY_SILO "silo"
#define LOG_CATEGORY_SIGNAL "signal"
#define LOG_CATEGORY_SPEECH_INDICATOR "speech-indiciator"
#define LOG_CATEGORY_SUSPICIOUS_LOGIN "supicious-login"
#define LOG_CATEGORY_TARGET_ZONE_SWITCH "target-zone-switch"
#define LOG_CATEGORY_TELECOMMS "telecomms"
#define LOG_CATEGORY_TOOL "tool"
#define LOG_CATEGORY_VIRUS "virus"
#define LOG_CATEGORY_MECHCOMP "mechcomp"
#define LOG_CATEGORY_CLONING "cloning"
#define LOG_CATEGORY_MUSIC "music"
#define LOG_CATEGORY_META "currency"
#define LOG_CATEGORY_ARTIFACT "artifact"

// Admin categories
#define LOG_CATEGORY_ADMIN "admin"
#define LOG_CATEGORY_ADMIN_CIRCUIT "admin-circuit"
#define LOG_CATEGORY_ADMIN_DSAY "admin-dsay"

// Admin private categories
#define LOG_CATEGORY_ADMIN_PRIVATE "adminprivate"
#define LOG_CATEGORY_ADMIN_PRIVATE_ASAY "adminprivate-asay"

// Debug categories
#define LOG_CATEGORY_DEBUG "debug"
#define LOG_CATEGORY_DEBUG_ASSET "debug-asset"
#define LOG_CATEGORY_DEBUG_HREF "debug-href"
#define LOG_CATEGORY_DEBUG_JOB "debug-job"
#define LOG_CATEGORY_DEBUG_LUA "debug-lua"
#define LOG_CATEGORY_DEBUG_MAPPING "debug-mapping"
#define LOG_CATEGORY_DEBUG_MOBTAG "debug-mobtag"
#define LOG_CATEGORY_DEBUG_QDEL "debug-qdel"
#define LOG_CATEGORY_DEBUG_SQL "debug-sql"
#define LOG_CATEGORY_DEBUG_TGUI "debug-tgui"

// Compatibility categories, for when stuff is changed and you need existing functionality to work
#define LOG_CATEGORY_COMPAT_GAME "game-compat"

// Game categories
#define LOG_CATEGORY_GAME "game"
#define LOG_CATEGORY_GAME_ACCESS "game-access"
#define LOG_CATEGORY_GAME_EMOTE "game-emote"
#define LOG_CATEGORY_GAME_INTERNET_REQUEST "game-internet-request"
#define LOG_CATEGORY_GAME_OOC "game-ooc"
#define LOG_CATEGORY_GAME_PRAYER "game-prayer"
#define LOG_CATEGORY_GAME_RADIO_EMOTE "game-radio-emote"
#define LOG_CATEGORY_GAME_SAY "game-say"
#define LOG_CATEGORY_GAME_TOPIC "game-topic"
#define LOG_CATEGORY_GAME_TRAITOR "game-traitor"
#define LOG_CATEGORY_GAME_VOTE "game-vote"
#define LOG_CATEGORY_GAME_WHISPER "game-whisper"

// Uplink categories
#define LOG_CATEGORY_UPLINK "uplink"
#define LOG_CATEGORY_UPLINK_CHANGELING "uplink-changeling"
#define LOG_CATEGORY_UPLINK_HERETIC "uplink-heretic"
#define LOG_CATEGORY_UPLINK_MALF "uplink-malf"
#define LOG_CATEGORY_UPLINK_SPELL "uplink-spell"

// PDA categories
#define LOG_CATEGORY_PDA "pda"
#define LOG_CATEGORY_PDA_CHAT "pda-chat"
#define LOG_CATEGORY_PDA_COMMENT "pda-comment"

#define SCHEMA_VERSION "schema-version"

// Log categories
#define LOG_CATEGORY_NOT_FOUND "invalid_category"
#define LOG_CATEGORY_TARGET_ZONE_SWITCH "target_zone_switch"
// Default log schema version
#define LOG_CATEGORY_SCHEMA_VERSION_NOT_SET "0.0.1"

//wrapper macros for easier grepping
#define DIRECT_OUTPUT(A, B) A << B
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/obj_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
#define TOY_FIREARM_OVERLAY (1<<0) // If update_overlay would add some indicator that the gun is a toy, like a plastic cap on a pistol
/// Currently used to identify valid guns to steal
#define NOT_A_REAL_GUN (1<<1)
#define GUN_SMOKE_PARTICLES (1<<2)

/// Flags for sharpness in obj/item
#define SHARP_EDGED (1<<0)
Expand Down
4 changes: 2 additions & 2 deletions code/__DEFINES/~monkestation/mobs.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define SPECIES_ARACHNIDS "arachnid"
#define SPECIES_DRACONIC_SKELETON "draconic_skeleton"

GLOBAL_REAL_VAR(list/voice_type2sound) = list(
GLOBAL_REAL_VAR(list/voice_type2sound = list(
"1" = list(
"1" = sound('goon/sounds/speak_1.ogg'),
"!" = sound('goon/sounds/speak_1_exclaim.ogg'),
Expand All @@ -22,7 +22,7 @@ GLOBAL_REAL_VAR(list/voice_type2sound) = list(
"!" = sound('goon/sounds/speak_4_exclaim.ogg'),
"?" = sound('goon/sounds/speak_4_ask.ogg')
),
)
))

///Managed global that is a reference to the real global
GLOBAL_LIST_INIT(voice_type2sound_ref, voice_type2sound)
7 changes: 7 additions & 0 deletions code/__DEFINES/~monkestation/particles.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#define DEBRIS_SPARKS "spark"
#define DEBRIS_WOOD "wood"
#define DEBRIS_ROCK "rock"
#define DEBRIS_GLASS "glass"
#define DEBRIS_LEAF "leaf"
#define DEBRIS_SNOW "snow"
2 changes: 1 addition & 1 deletion code/__HELPERS/files.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
GLOBAL_VAR_INIT(fileaccess_timer, 0)

/client/proc/browse_files(root_type=BROWSE_ROOT_ALL_LOGS, max_iterations=10, list/valid_extensions=list("txt","log","htm", "html", "gz"))
/client/proc/browse_files(root_type=BROWSE_ROOT_ALL_LOGS, max_iterations=10, list/valid_extensions=list("txt","log","htm", "html", "gz", "json"))
// wow why was this ever a parameter
var/root = "data/logs/"
switch(root_type)
Expand Down
30 changes: 19 additions & 11 deletions code/__HELPERS/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/////Initial Building/////
//////////////////////////

/proc/make_datum_references_lists()
/proc/init_sprite_accessories()
///roundstart hair
init_sprite_accessory_subtypes(/datum/sprite_accessory/hair, GLOB.roundstart_hairstyles_list, GLOB.hairstyles_male_list, GLOB.hairstyles_female_list, roundstart = TRUE)
//hair - includes all locked hair
Expand Down Expand Up @@ -36,7 +36,7 @@
init_sprite_accessory_subtypes(/datum/sprite_accessory/ipc_screens, GLOB.ipc_screens_list) //Monkestation Addition
init_sprite_accessory_subtypes(/datum/sprite_accessory/ipc_antennas, GLOB.ipc_antennas_list) //Monkestation Addition
init_sprite_accessory_subtypes(/datum/sprite_accessory/ipc_chassis, GLOB.ipc_chassis_list) //Monkestation Addition
init_sprite_accessory_subtypes(/datum/sprite_accessory/pod_hair, GLOB.pod_hair_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/pod_hair, GLOB.pod_hair_list) //Monkestation Addition
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/monkey, GLOB.tails_list_monkey) //Monkestation Addition
init_sprite_accessory_subtypes(/datum/sprite_accessory/anime_head, GLOB.anime_top_list) //Monkestation Addition
init_sprite_accessory_subtypes(/datum/sprite_accessory/anime_middle, GLOB.anime_middle_list) //Monkestation Addition
Expand All @@ -46,30 +46,38 @@
init_sprite_accessory_subtypes(/datum/sprite_accessory/goblin_ears, GLOB.goblin_ears_list) //Monkestation Addition
init_sprite_accessory_subtypes(/datum/sprite_accessory/floran_leaves, GLOB.floran_leaves_list) //Monkestation Addition

//Species
/// Inits GLOB.species_list. Not using GLOBAL_LIST_INIT b/c it depends on GLOB.string_lists
/proc/init_species_list()
for(var/spath in subtypesof(/datum/species))
var/datum/species/S = new spath()
GLOB.species_list[S.id] = spath
sort_list(GLOB.species_list, GLOBAL_PROC_REF(cmp_typepaths_asc))

//Surgeries
/// Inits GLOB.surgeries
/proc/init_surgeries()
var/surgeries = list()
for(var/path in subtypesof(/datum/surgery))
GLOB.surgeries_list += new path()
sort_list(GLOB.surgeries_list, GLOBAL_PROC_REF(cmp_typepaths_asc))
surgeries += new path()
sort_list(surgeries, GLOBAL_PROC_REF(cmp_typepaths_asc))
return surgeries

// Hair Gradients - Initialise all /datum/sprite_accessory/hair_gradient into an list indexed by gradient-style name
/// Hair Gradients - Initialise all /datum/sprite_accessory/hair_gradient into an list indexed by gradient-style name
/proc/init_hair_gradients()
for(var/path in subtypesof(/datum/sprite_accessory/gradient))
var/datum/sprite_accessory/gradient/gradient = new path()
if(gradient.gradient_category & GRADIENT_APPLIES_TO_HAIR)
GLOB.hair_gradients_list[gradient.name] = gradient
if(gradient.gradient_category & GRADIENT_APPLIES_TO_FACIAL_HAIR)
GLOB.facial_hair_gradients_list[gradient.name] = gradient

// Keybindings
/// Legacy procs that really should be replaced with proper _INIT macros
/proc/make_datum_reference_lists()
// I tried to eliminate this proc but I couldn't untangle their init-order interdependencies -Dominion/Cyberboss
init_sprite_accessories()
init_species_list()
init_hair_gradients()
init_keybindings()

GLOB.emote_list = init_emote_list()

GLOB.emote_list = init_emote_list() // WHY DOES THIS NEED TO GO HERE? IT JUST INITS DATUMS
init_crafting_recipes()
init_crafting_recipes_atoms()

Expand Down
32 changes: 29 additions & 3 deletions code/__HELPERS/logging/_logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@
msg = "## NOTICE: [msg]"
log_world(msg)

#define SET_SERIALIZATION_SEMVER(semver_list, semver) semver_list[type] = semver
#define CHECK_SERIALIZATION_SEMVER(wanted, actual) (__check_serialization_semver(wanted, actual))

/// Checks if the actual semver is equal or later than the wanted semver
/// Must be passed as TEXT; you're probably looking for CHECK_SERIALIZATION_SEMVER, look right above
/proc/__check_serialization_semver(wanted, actual)
if(wanted == actual)
return TRUE

var/list/wanted_versions = semver_to_list(wanted)
var/list/actual_versions = semver_to_list(actual)

if(!wanted_versions || !actual_versions)
stack_trace("Invalid semver string(s) passed to __check_serialization_semver: '[wanted]' and '[actual]'")
return FALSE

if(wanted_versions[1] != actual_versions[1])
return FALSE // major must always

if(wanted_versions[2] > actual_versions[2])
return FALSE // actual must be later than wanted

// patch is not checked
return TRUE

//print a testing-mode debug message to world.log and world
#ifdef TESTING
#define testing(msg) log_world("## TESTING: [msg]"); to_chat(world, "## TESTING: [msg]")
Expand Down Expand Up @@ -130,7 +155,7 @@ GLOBAL_LIST_INIT(testing_global_profiler, list("_PROFILE_NAME" = "Global"))
/* Close open log handles. This should be called as late as possible, and no logging should hapen after. */
/proc/shutdown_logging()
rustg_log_close_all()
GLOB.logger.shutdown_logging()
logger.shutdown_logging()

/* Helper procs for building detailed log lines */
/proc/key_name(whom, include_link = null, include_name = TRUE)
Expand Down Expand Up @@ -234,6 +259,7 @@ GLOBAL_LIST_INIT(testing_global_profiler, list("_PROFILE_NAME" = "Global"))


/proc/log_cloning(text, mob/initiator)
if(CONFIG_GET(flag/log_cloning))
WRITE_LOG(GLOB.world_cloning_log, "CLONING: [text]")
logger.Log(LOG_CATEGORY_CLONING, text, list(initiator))

/proc/log_mechcomp(text, list/data)
logger.Log(LOG_CATEGORY_MECHCOMP, text, data)
Loading

0 comments on commit 8c4beff

Please sign in to comment.