Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning up some submap archetype code #4611

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

MistakeNot4892
Copy link
Contributor

Description of changes

  • Submap archetype code uses get_decls_of_type_unassociated().
  • Maps can supply distinct submap archetype lists instead of always using the full set.
  • Submap descriptor is now name so that they'll behave nicely in input() in the future.
  • Submap name uniqueness validation is now in submap archetype validate()

Why and what will this PR improve

No crashed pods on Shaded Hills.

Authorship

Myself.

Changelog

Nothing player-facing.

@MistakeNot4892 MistakeNot4892 added the ready for review This PR is ready for review and merge. label Dec 6, 2024
code/modules/submaps/submap_archetype.dm Outdated Show resolved Hide resolved
else
if(!global.submaps_by_name)
global.submaps_by_name = list()
for(var/decl/submap_archetype/submap as anything in decls_repository.get_decls_of_type_unassociated(/decl/submap_archetype))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if this is actually necessary? we're already looping over all submap archetypes in the validation test, so theoretically it could just be

		if(global.submaps_by_name[name])
			. += "name '[name]' conflicts with submap type '[global.submaps_by_name[name]]'"
		else
			global.submaps_by_name[name] = type

and obviously submaps_by_name would have to always be a list for this code to work exactly as i wrote it
that said i think it should be a static var to avoid someone trying to access it outside of validation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good call, makes it much simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review This PR is ready for review and merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants