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

Rework entity prototype categories #5061

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ElectroJr
Copy link
Contributor

@ElectroJr ElectroJr commented Apr 22, 2024

  • Renames engine categories to use pascal case.
  • Added IPrototypeManager.EnumerateAllParents() for enumerating over all parents, including any that are abstract.
  • Added IPrototypeManager.Categories for retrieving lists of prototypes that belong to a given category.
  • Allows categories to provide a default value for a prototype's EditorSuffix. E.g., all prototypes in the debug category should get "[Debug]" appended.
  • Each category now has a HideSpawnMenu field. The old HideSpawnMenu category is now just a category with that field set to true.
  • Reworked category inheritance. Inheritance can now be disabled per category using a Inheritable field.
    • This required some jank for entities to properly inherit categories from abstract parents.
  • Entity prototypes can now be automatically added to categories based on the components that they have.
    • This should help avoid issues where people might forget to specify categories. E.g., it makes it trivial to ensure that all action-entities are in the actions category, and are hidden from the spawn menu.
    • There are two ways to associate a component with a category:
      • By adding the component to the category's Components datafield.
      • By giving the component an EntityCategoryAttribute.
    • Having two ways of doing this might lead to inconsistency, if it should be changed to use only one of these, then it should be done via the attribute, so that content can use engine categories.

@ElectroJr ElectroJr added the Status: Requires Content PR This PR breaks content and requires both to be merged together. label Apr 22, 2024
Comment on lines +23 to +27
public static implicit operator EntProtoId(EntityPrototype proto)
{
return new EntProtoId(proto.ID);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Test failure seems to be caused by this implicit operator interacting with this code in Content:

https://github.com/space-wizards/space-station-14/blob/master/Content.Shared%2FBody%2FPrototypes%2FBodyPrototypeSerializer.cs#L185

where the BodyPrototypeSlot constructor is forcing null to be cast to EntProtoId.

Copy link
Contributor

Choose a reason for hiding this comment

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

seems adding one for EntityPrototype? to EntProtoId? (if possible) and using that would fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Requires Content PR This PR breaks content and requires both to be merged together.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants