From 38570e437e09cd4217008aef4b8e4a1a420a91d0 Mon Sep 17 00:00:00 2001 From: AffectedArc07 Date: Tue, 5 May 2020 10:13:01 +0100 Subject: [PATCH] I need to learn to read my todos --- code/__DEFINES/role_preferences.dm | 8 ++++---- code/__HELPERS/names.dm | 6 +++--- code/game/gamemodes/changeling/powers/hivemind.dm | 8 ++++---- code/game/gamemodes/devil/devil.dm | 8 ++++---- .../gamemodes/miniantags/bot_swarm/swarmer_event.dm | 4 ++-- code/game/objects/items/stacks/sheets/mineral.dm | 12 ++++++------ code/modules/awaymissions/gateway.dm | 10 +++++----- code/modules/client/preference/preferences.dm | 4 ++-- code/modules/client/preference/preferences_mysql.dm | 2 +- tools/travis/check_grep.sh | 12 +++++------- 10 files changed, 36 insertions(+), 38 deletions(-) diff --git a/code/__DEFINES/role_preferences.dm b/code/__DEFINES/role_preferences.dm index 2b9e2c56b4de..8021fa4452d9 100644 --- a/code/__DEFINES/role_preferences.dm +++ b/code/__DEFINES/role_preferences.dm @@ -48,7 +48,7 @@ //Missing assignment means it's not a gamemode specific role, IT'S NOT A BUG OR ERROR. //The gamemode specific ones are just so the gamemodes can query whether a player is old enough //(in game days played) to play that role -var/global/list/special_roles = list( +GLOBAL_LIST_INIT(special_roles, list( ROLE_ABDUCTOR = /datum/game_mode/abduction, // Abductor ROLE_BLOB = /datum/game_mode/blob, // Blob ROLE_CHANGELING = /datum/game_mode/changeling, // Changeling @@ -72,10 +72,10 @@ var/global/list/special_roles = list( ROLE_VAMPIRE = /datum/game_mode/vampire, // Vampire ROLE_RAIDER = /datum/game_mode/heist, // Vox raider ROLE_ALIEN, // Xenomorph - ROLE_WIZARD = /datum/game_mode/wizard, // Wizard + ROLE_WIZARD = /datum/game_mode/wizard // Wizard // UNUSED/BROKEN ANTAGS // ROLE_HOG_GOD = /datum/game_mode/hand_of_god, // ROLE_HOG_CULTIST = /datum/game_mode/hand_of_god, // ROLE_MONKEY = /datum/game_mode/monkey, Sooner or later these are going to get ported -// ROLE_GANG = /datum/game_mode/gang, -) +// ROLE_GANG = /datum/game_mode/gang +)) diff --git a/code/__HELPERS/names.dm b/code/__HELPERS/names.dm index 6cb65eb8ca4f..90d855795f89 100644 --- a/code/__HELPERS/names.dm +++ b/code/__HELPERS/names.dm @@ -19,10 +19,10 @@ GLOBAL_VAR(command_name) /proc/command_name() return GLOB.using_map.dock_name -var/religion_name = null +GLOBAL_VAR(religion_name) /proc/religion_name() - if(religion_name) - return religion_name + if(GLOB.religion_name) + return GLOB.religion_name var/name = "" diff --git a/code/game/gamemodes/changeling/powers/hivemind.dm b/code/game/gamemodes/changeling/powers/hivemind.dm index af375cad3683..98336608da4d 100644 --- a/code/game/gamemodes/changeling/powers/hivemind.dm +++ b/code/game/gamemodes/changeling/powers/hivemind.dm @@ -23,7 +23,7 @@ return // HIVE MIND UPLOAD/DOWNLOAD DNA -var/list/datum/dna/hivemind_bank = list() +GLOBAL_LIST_EMPTY(hivemind_bank) /datum/action/changeling/hivemind_upload name = "Hive Channel DNA" @@ -36,7 +36,7 @@ var/list/datum/dna/hivemind_bank = list() var/datum/changeling/changeling = user.mind.changeling var/list/names = list() for(var/datum/dna/DNA in (changeling.absorbed_dna+changeling.protected_dna)) - if(!(DNA in hivemind_bank)) + if(!(DNA in GLOB.hivemind_bank)) names += DNA.real_name if(names.len <= 0) @@ -51,7 +51,7 @@ var/list/datum/dna/hivemind_bank = list() if(!chosen_dna) return - hivemind_bank += chosen_dna + GLOB.hivemind_bank += chosen_dna to_chat(user, "We channel the DNA of [chosen_name] to the air.") feedback_add_details("changeling_powers","HU") return 1 @@ -75,7 +75,7 @@ var/list/datum/dna/hivemind_bank = list() /datum/action/changeling/hivemind_download/sting_action(var/mob/user) var/datum/changeling/changeling = user.mind.changeling var/list/names = list() - for(var/datum/dna/DNA in hivemind_bank) + for(var/datum/dna/DNA in GLOB.hivemind_bank) if(!(DNA in changeling.absorbed_dna)) names[DNA.real_name] = DNA diff --git a/code/game/gamemodes/devil/devil.dm b/code/game/gamemodes/devil/devil.dm index ab5f5796d2e9..06933891ba60 100644 --- a/code/game/gamemodes/devil/devil.dm +++ b/code/game/gamemodes/devil/devil.dm @@ -1,4 +1,4 @@ -var/global/list/whiteness = list ( +GLOBAL_LIST_INIT(whiteness, list( /obj/item/clothing/under/color/white = 2, /obj/item/clothing/under/rank/bartender = 1, /obj/item/clothing/under/rank/chef = 1, @@ -21,7 +21,7 @@ var/global/list/whiteness = list ( /obj/item/clothing/under/noble_clothes = 1, /obj/item/clothing/under/sl_suit = 1, /obj/item/clothing/under/burial = 1 -) +)) @@ -32,9 +32,9 @@ var/global/list/whiteness = list ( var/mob/living/carbon/human/H = attacker if(H.w_uniform && istype(H.w_uniform, /obj/item/clothing/under)) var/obj/item/clothing/under/U = H.w_uniform - if(whiteness[U.type]) + if(GLOB.whiteness[U.type]) src.visible_message("[src] seems to have been harmed by the purity of [attacker]'s clothes.", "Unsullied white clothing is disrupting your form.") - return whiteness[U.type] + 1 + return GLOB.whiteness[U.type] + 1 if(BANE_TOOLBOX) if(istype(weapon,/obj/item/storage/toolbox)) src.visible_message("The [weapon] seems unusually robust this time.", "The [weapon] is your unmaking!") diff --git a/code/game/gamemodes/miniantags/bot_swarm/swarmer_event.dm b/code/game/gamemodes/miniantags/bot_swarm/swarmer_event.dm index d0be68819ae5..fbceda6bd943 100644 --- a/code/game/gamemodes/miniantags/bot_swarm/swarmer_event.dm +++ b/code/game/gamemodes/miniantags/bot_swarm/swarmer_event.dm @@ -13,9 +13,9 @@ /datum/event/spawn_swarmer/start() if(find_swarmer()) return 0 - if(!the_gateway) + if(!GLOB.the_gateway) return 0 - new /obj/effect/mob_spawn/swarmer(get_turf(the_gateway)) + new /obj/effect/mob_spawn/swarmer(get_turf(GLOB.the_gateway)) /datum/event/spawn_swarmer/proc/find_swarmer() diff --git a/code/game/objects/items/stacks/sheets/mineral.dm b/code/game/objects/items/stacks/sheets/mineral.dm index 96938bd84ff1..ec92df5f8d59 100644 --- a/code/game/objects/items/stacks/sheets/mineral.dm +++ b/code/game/objects/items/stacks/sheets/mineral.dm @@ -298,13 +298,13 @@ GLOBAL_LIST_INIT(sandbag_recipes, list ( \ materials = list(MAT_TITANIUM=MINERAL_MATERIAL_AMOUNT) point_value = 20 -var/global/list/datum/stack_recipe/titanium_recipes = list ( +GLOBAL_LIST_INIT(titanium_recipes, list( new/datum/stack_recipe("titanium tile", /obj/item/stack/tile/mineral/titanium, 1, 4, 20), new/datum/stack_recipe("surgical tray", /obj/structure/table/tray, 2, one_per_turf = 1, on_floor = 1), - ) + )) /obj/item/stack/sheet/mineral/titanium/New(loc, amount=null) - recipes = titanium_recipes + recipes = GLOB.titanium_recipes ..() /obj/item/stack/sheet/mineral/titanium/fifty @@ -328,12 +328,12 @@ var/global/list/datum/stack_recipe/titanium_recipes = list ( materials = list(MAT_TITANIUM=2000, MAT_PLASMA=2000) point_value = 45 -var/global/list/datum/stack_recipe/plastitanium_recipes = list ( +GLOBAL_LIST_INIT(plastitanium_recipes, list( new/datum/stack_recipe("plas-titanium tile", /obj/item/stack/tile/mineral/plastitanium, 1, 4, 20), - ) + )) /obj/item/stack/sheet/mineral/plastitanium/New(loc, amount=null) - recipes = plastitanium_recipes + recipes = GLOB.plastitanium_recipes ..() /obj/item/stack/sheet/mineral/enruranium diff --git a/code/modules/awaymissions/gateway.dm b/code/modules/awaymissions/gateway.dm index fc268c3ba356..d7e298e8c966 100644 --- a/code/modules/awaymissions/gateway.dm +++ b/code/modules/awaymissions/gateway.dm @@ -1,4 +1,4 @@ -var/obj/machinery/gateway/centerstation/the_gateway = null +GLOBAL_DATUM_INIT(the_gateway, /obj/machinery/gateway/centerstation, null) /obj/machinery/gateway name = "gateway" desc = "A mysterious gateway built by unknown hands, it allows for faster than light travel to far-flung locations." @@ -41,8 +41,8 @@ var/obj/machinery/gateway/centerstation/the_gateway = null /obj/machinery/gateway/centerstation/New() ..() - if(!the_gateway) - the_gateway = src + if(!GLOB.the_gateway) + GLOB.the_gateway = src /obj/machinery/gateway/centerstation/Initialize() ..() @@ -54,8 +54,8 @@ var/obj/machinery/gateway/centerstation/the_gateway = null return /obj/machinery/gateway/centerstation/Destroy() - if(the_gateway == src) - the_gateway = null + if(GLOB.the_gateway == src) + GLOB.the_gateway = null return ..() /obj/machinery/gateway/centerstation/update_icon() diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index d6d7657b7c25..d09c8b24cf2b 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -489,7 +489,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts dat += "You are banned from special roles." be_special = list() else - for(var/i in special_roles) + for(var/i in GLOB.special_roles) if(jobban_isbanned(user, i)) dat += "Be [capitalize(i)]: \[BANNED]
" else if(!player_old_enough_antag(user.client, i)) @@ -2023,7 +2023,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts if("be_special") var/r = href_list["role"] - if(r in special_roles) + if(r in GLOB.special_roles) be_special ^= r if("name") diff --git a/code/modules/client/preference/preferences_mysql.dm b/code/modules/client/preference/preferences_mysql.dm index ce2917373bf7..29544f3c8b62 100644 --- a/code/modules/client/preference/preferences_mysql.dm +++ b/code/modules/client/preference/preferences_mysql.dm @@ -84,7 +84,7 @@ // Might as well scrub out any malformed be_special list entries while we're here for(var/role in be_special) - if(!(role in special_roles)) + if(!(role in GLOB.special_roles)) log_runtime(EXCEPTION("[C.key] had a malformed role entry: '[role]'. Removing!"), src) be_special -= role diff --git a/tools/travis/check_grep.sh b/tools/travis/check_grep.sh index 22d02647bcf9..5b5c232c3740 100755 --- a/tools/travis/check_grep.sh +++ b/tools/travis/check_grep.sh @@ -14,12 +14,10 @@ if grep -P 'step_[xy]' _maps/**/*.dmm; then echo "ERROR: step_x/step_y variables detected in maps, please remove them." st=1 fi; -#### TODO: Uncomment after managing all globs #### -#if grep -P '^/*var/' code/**/*.dm; then - #echo "ERROR: Unmanaged global var use detected in code, please use the helpers." - #st=1 -#fi; -#### +if grep -P '^/*var/' code/**/*.dm; then + echo "ERROR: Unmanaged global var use detected in code, please use the helpers." + st=1 +fi; nl=' ' nl=$'\n' @@ -31,4 +29,4 @@ while read f; do fi; done < <(find . -type f -name '*.dm') -exit $st \ No newline at end of file +exit $st