Take advantage of how thing.get_all_contents()
already includes src
as part of the contents list
#1871
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
About The Pull Request
Certain objects in SS13 make checks on both an atom and that atom's contents. For example,
/obj/effect/gun_check_blocker/CanPass()
checks the atom and all of the atom's contents, preventing the atom from moving through it if any of them are of type/obj/item/gun
.However, when doing this, the code assumes that
thing.get_all_contents()
does not includething
- and so, performs the check twice - once onthing
, and once on every object inthing.get_all_contents()
.Yet,
/atom/proc/get_all_contents()
already includessrc
as part of the list. In fact, it even initializes the list withsrc
in it:Monkestation2.0/code/__HELPERS/atoms.dm
Lines 4 to 12 in 72a3063
This PR takes advantage of this fact, removing the redundant check on
thing
, asthing
will just be checked again within thefor
loop overthing.get_all_contents()
.Why It's Good For The Game
Removes redundant code, resulting in a little less CPU time used checking an atom and all its contents.
Changelog
N/A - this does not include any changes that players would notice.