Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 892cee1

Browse files
Adds grep for mapload and var in Args (#19203)
* Adds grep for mapload and var in Args * vars in args * some more * stuff * Update shuttle_creator.dm * Update __techweb_helpers.dm * fix * Update discoball.dm * Update check_grep.sh * Update check_grep.sh * Update check_grep.sh * Update check_grep.sh * I'll finish this later * datum and lateinit maploads * componentinit stuff * mapload fixes * why isnt CI catching these major issues * MERGE CONFLICT FUCKED MY PR OVER * Update check_grep.sh * Update food.dm
1 parent 8fb37fb commit 892cee1

1,118 files changed

Lines changed: 2398 additions & 2389 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/guides/HARDDELETES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ You can read more about how BYOND prioritizes these things [Here](https://www.pa
129129

130130
## Detecting Hard Deletes
131131

132-
For very simple hard deletes, simple inspection should be enough to find them. Look at what the object does during `Initialize()`, and see if it's doing anything it doesn't undo later.
132+
For very simple hard deletes, simple inspection should be enough to find them. Look at what the object does during `Initialize(mapload)`, and see if it's doing anything it doesn't undo later.
133133
If that fails, search the object's typepath, and look and see if anything is holding a reference to it without regard for the object deleting
134134

135135
BYOND currently doesn't have the capability to give us information about where a hard delete is. Fortunately we can search for most all of then ourselves.
@@ -273,7 +273,7 @@ But if you can't do anything else for reasons of conversion ease, or hot code, t
273273

274274
First, do a quick check.
275275

276-
Are you doing anything to the object in `Initialize()` that you don't undo in `Destroy()`? I don't mean like, setting its name, but are you adding it to any lists, stuff like that
276+
Are you doing anything to the object in `Initialize(mapload)` that you don't undo in `Destroy()`? I don't mean like, setting its name, but are you adding it to any lists, stuff like that
277277

278278
If this fails, you're just gonna have to read over this doc. You can skip the theory if you'd like, but it's all pretty important for having an understanding of this problem
279279

.github/guides/STANDARDS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Copying code from one place to another may be suitable for small, short-time pro
8484

8585
Instead you can use object orientation, or simply placing repeated code in a function, to obey this specification easily.
8686

87-
### Prefer `Initialize()` over `New()` for atoms
87+
### Prefer `Initialize(mapload)` over `New()` for atoms
8888

8989
Our game controller is pretty good at handling long operations and lag, but it can't control what happens when the map is loaded, which calls `New` for all atoms on the map. If you're creating a new atom, use the `Initialize` proc to do what you would normally do in `New`. This cuts down on the number of proc calls needed when the world is loaded. See here for details on `Initialize`: https://github.com/yogstation13/Yogstation/blob/df044da8608d94cbe1fe242264f749a92ca8283b/code/game/atoms.dm#L111
9090
While we normally encourage (and in some cases, even require) bringing out of date code up to date when you make unrelated changes near the out of date code, that is not the case for `New` -> `Initialize` conversions. These systems are generally more dependent on parent and children procs so unrelated random conversions of existing things can cause bugs that take months to figure out.
@@ -243,7 +243,7 @@ First, read the comments in [this BYOND thread](http://www.byond.com/forum/?post
243243

244244
There are two key points here:
245245

246-
1) Defining a list in the variable's definition calls a hidden proc - init. If you have to define a list at startup, do so in New() (or preferably Initialize()) and avoid the overhead of a second call (Init() and then New())
246+
1) Defining a list in the variable's definition calls a hidden proc - init. If you have to define a list at startup, do so in New() (or preferably Initialize(mapload)) and avoid the overhead of a second call (Init() and then New())
247247

248248
2) It also consumes more memory to the point where the list is actually required, even if the object in question may never use it!
249249

@@ -270,7 +270,7 @@ Bad:
270270

271271
Good:
272272
```dm
273-
/obj/machine/update_overlays(var/blah)
273+
/obj/machine/update_overlays(blah)
274274
var/static/on_overlay
275275
var/static/off_overlay
276276
var/static/broken_overlay
@@ -298,7 +298,7 @@ Associated lists that could instead be variables or statically defined number in
298298

299299
Bad:
300300
```dm
301-
/obj/machine/update_overlays(var/blah)
301+
/obj/machine/update_overlays(blah)
302302
var/static/our_overlays
303303
if (isnull(our_overlays))
304304
our_overlays = list("on" = iconstate2appearance(overlay_icon, "on"), "off" = iconstate2appearance(overlay_icon, "off"), "broken" = iconstate2appearance(overlay_icon, "broken"))
@@ -314,7 +314,7 @@ Good:
314314
#define OUR_OFF_OVERLAY 2
315315
#define OUR_BROKEN_OVERLAY 3
316316
317-
/obj/machine/update_overlays(var/blah)
317+
/obj/machine/update_overlays(blah)
318318
var/static/our_overlays
319319
if (isnull(our_overlays))
320320
our_overlays = list(iconstate2appearance(overlay_icon, "on"), iconstate2appearance(overlay_icon, "off"), iconstate2appearance(overlay_icon, "broken"))
@@ -331,7 +331,7 @@ Storing these in a flat (non-associated) list saves on memory, and using defines
331331

332332
Also good:
333333
```dm
334-
/obj/machine/update_overlays(var/blah)
334+
/obj/machine/update_overlays(blah)
335335
var/static/on_overlay
336336
var/static/off_overlay
337337
var/static/broken_overlay

.github/guides/STYLE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ This is good:
343343
getter_turned_into_variable = condition ? VALUE_C : VALUE_D
344344
```
345345

346-
### When passing vars through New() or Initialize()'s arguments, use src.var
346+
### When passing vars through New() or Initialize(mapload)'s arguments, use src.var
347347
Using src.var + naming the arguments the same as the var is the most readable and intuitive way to pass arguments into a new instance's vars. The main benefit is that you do not need to give arguments odd names with prefixes and suffixes that are easily forgotten in `new()` when sending named args.
348348

349349
This is very bad:

code/__DEFINES/dcs/signals/signals_atom/signals_atom_main.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// All signals send the source datum of the signal as the first argument
44

55
// /atom signals
6-
///from base of atom/proc/Initialize(): sent any time a new atom is created in this atom
6+
///from base of atom/proc/Initialize(mapload): sent any time a new atom is created in this atom
77
#define COMSIG_ATOM_INITIALIZED_ON "atom_initialized_on"
88
//from SSatoms InitAtom - Only if the atom was not deleted or failed initialization
99
#define COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZE "atom_init_success"

code/__DEFINES/dcs/signals/signals_object.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
#define COMSIG_CLOSET_DELIVERED "crate_delivered"
221221

222222
///Eigenstasium
223-
///From base of [/datum/controller/subsystem/eigenstates/proc/use_eigenlinked_atom]: (var/target)
223+
///From base of [/datum/controller/subsystem/eigenstates/proc/use_eigenlinked_atom]: (target)
224224
#define COMSIG_EIGENSTATE_ACTIVATE "eigenstate_activate"
225225

226226
// /obj signals for economy

code/__DEFINES/flags.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
3737
#define HOLOGRAM_1 (1<<10)
3838
/// TESLA_IGNORE grants immunity from being targeted by tesla-style electricity
3939
#define TESLA_IGNORE_1 (1<<11)
40-
///Whether /atom/Initialize() has already run for the object
40+
///Whether /atom/Initialize(mapload) has already run for the object
4141
#define INITIALIZED_1 (1<<12)
4242
/// was this spawned by an admin? used for stat tracking stuff.
4343
#define ADMIN_SPAWNED_1 (1<<13)

code/__DEFINES/subsystems.dm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@
6969

7070
///New should not call Initialize
7171
#define INITIALIZATION_INSSATOMS 0
72-
///New should call Initialize(TRUE)
72+
///New should call Initialize(mapload, TRUE)
7373
#define INITIALIZATION_INNEW_MAPLOAD 2
74-
///New should call Initialize(FALSE)
74+
///New should call Initialize(mapload, FALSE)
7575
#define INITIALIZATION_INNEW_REGULAR 1
7676

7777
//! ### Initialization hints

code/__HELPERS/AStar.dm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ Actual Adjacent procs :
193193
L.Add(T)
194194
return L
195195

196-
/turf/proc/reachableTurftest(caller, var/turf/T, ID, simulated_only)
196+
/turf/proc/reachableTurftest(caller, turf/T, ID, simulated_only)
197197
if(T && !T.density && !(simulated_only && SSpathfinder.space_type_cache[T.type]) && !LinkBlockedWithAccess(T,caller, ID))
198198
return TRUE
199199

@@ -228,7 +228,7 @@ Actual Adjacent procs :
228228
if(T && !T.density && !LinkBlockedWithAccess(T, caller, ID) && !(simulated_only && SSpathfinder.space_type_cache[T.type]))
229229
return TRUE
230230

231-
/turf/proc/reachableTurftestdensity(caller, var/turf/T, ID, simulated_only) //used for the sake of pathfinding while excluding turfs with dense objects
231+
/turf/proc/reachableTurftestdensity(caller, turf/T, ID, simulated_only) //used for the sake of pathfinding while excluding turfs with dense objects
232232
if(T && !T.density && !(simulated_only && SSpathfinder.space_type_cache[T.type]) && !LinkBlockedWithAccess(T,caller, ID))
233233
for(var/obj/D in T)
234234
if(D.density)

code/__HELPERS/game.dm

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@
436436
viewing += M.client
437437
flick_overlay(I, viewing, duration)
438438

439-
/proc/get_active_player_count(var/alive_check = 0, var/afk_check = 0, var/human_check = 0)
439+
/proc/get_active_player_count(alive_check = 0, afk_check = 0, human_check = 0)
440440
// Get active players who are playing in the round
441441
var/active_players = 0
442442
for(var/i = 1; i <= GLOB.player_list.len; i++)
@@ -646,8 +646,6 @@
646646
++i
647647
return L
648648

649-
/proc/poll_helper(var/mob/living/M)
650-
651649
/proc/makeBody(mob/dead/observer/G_found) // Uses stripped down and bastardized code from respawn character
652650
if(!G_found || !G_found.key)
653651
return
@@ -689,7 +687,7 @@
689687

690688
return A.loc
691689

692-
/proc/AnnounceArrival(var/mob/living/carbon/human/character, var/rank)
690+
/proc/AnnounceArrival(mob/living/carbon/human/character, rank)
693691
if(!SSticker.IsRoundInProgress() || QDELETED(character))
694692
return
695693
var/area/A = get_area(character)
@@ -724,7 +722,7 @@
724722
return (is_type_in_list(item, pire_wire))
725723

726724
// Find a obstruction free turf that's within the range of the center. Can also condition on if it is of a certain area type.
727-
/proc/find_obstruction_free_location(var/range, var/atom/center, var/area/specific_area)
725+
/proc/find_obstruction_free_location(range, atom/center, area/specific_area)
728726
var/list/turfs = RANGE_TURFS(range, center)
729727
var/list/possible_loc = list()
730728

code/__HELPERS/heap.dm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
Sink(1)
3434

3535
//Get a node up to its right position in the heap
36-
/datum/Heap/proc/Swim(var/index)
36+
/datum/Heap/proc/Swim(index)
3737
var/parent = round(index * 0.5)
3838

3939
while(parent > 0 && (call(cmp)(L[index],L[parent]) > 0))
@@ -42,7 +42,7 @@
4242
parent = round(index * 0.5)
4343

4444
//Get a node down to its right position in the heap
45-
/datum/Heap/proc/Sink(var/index)
45+
/datum/Heap/proc/Sink(index)
4646
var/g_child = GetGreaterChild(index)
4747

4848
while(g_child > 0 && (call(cmp)(L[index],L[g_child]) < 0))
@@ -52,7 +52,7 @@
5252

5353
//Returns the greater (relative to the comparison proc) of a node children
5454
//or 0 if there's no child
55-
/datum/Heap/proc/GetGreaterChild(var/index)
55+
/datum/Heap/proc/GetGreaterChild(index)
5656
if(index * 2 > L.len)
5757
return 0
5858

0 commit comments

Comments
 (0)