Port Internal Resources System#74
Conversation
* wowza * made armor use it * converted to internal resource * fixing bugs and shit cause im in fucking minecraft * cleanup + biomass converted * clarity * oops * the 2 people who use this would have been angry * fix maybe? * ok NOW it should work # Conflicts: # Content.Goobstation.Client/Changeling/ChangelingBiomassSystem.cs # Content.Goobstation.Client/Changeling/ChangelingSystem.cs # Content.Goobstation.Server/Changeling/ChangelingBiomassSystem.cs # Content.Goobstation.Server/Changeling/ChangelingSystem.Abilities.cs # Content.Goobstation.Server/Changeling/ChangelingSystem.cs # Content.Goobstation.Shared/Changeling/Actions/Changeling.Actions.cs # Content.Goobstation.Shared/Changeling/Components/ChangelingActionComponent.cs # Content.Goobstation.Shared/Changeling/Components/ChangelingBiomassComponent.cs # Content.Goobstation.Shared/Changeling/Components/ChangelingIdentityComponent.cs # Content.Goobstation.Shared/Changeling/Components/VoidAdaptionComponent.cs # Content.Goobstation.Shared/Changeling/Systems/ChangelingGunSystem.cs # Content.Goobstation.Shared/Changeling/Systems/SharedChangelingActionSystem.cs # Content.Goobstation.Shared/Changeling/Systems/SharedChangelingBiomassSystem.cs # Content.Goobstation.Shared/Changeling/Systems/SharedVoidAdaptionSystem.cs # Content.Goobstation.Shared/Inventory/GoobInventorySystem.Relays.cs # Content.IntegrationTests/Tests/_Goobstation/Changeling/ChangelingArmorTests.cs # Modules/GoobStation/Content.Goobstation.Shared/InternalResources/Data/InternalResourcesPrototype.cs # Modules/GoobStation/Content.Goobstation.Shared/InternalResources/Data/InternalResourcesThresholdsPrototype.cs # Modules/GoobStation/Resources/Prototypes/_Goobtstation/InternalResources/thresholds.yml # Resources/Prototypes/_Goobstation/Actions/changeling.yml # Resources/Prototypes/_Goobstation/Changeling/Alerts/changeling.yml # Resources/Prototypes/_Goobstation/Changeling/Entities/Clothing/Head/helmets.yml # Resources/Prototypes/_Goobstation/Changeling/Entities/Clothing/OuterClothing/armor.yml # Resources/Prototypes/_Goobstation/Changeling/starting_evolutions.yml # Resources/Prototypes/_Goobstation/InternalResources/changeling.yml
|
the IRS is coming to goob |
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our development discord. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
Bot, don't close it |
| /// </summary> | ||
| [Serializable, NetSerializable] | ||
| [DataDefinition] | ||
| public sealed partial class InternalResourcesData |
There was a problem hiding this comment.
Turn it into a struct to make it faster
There was a problem hiding this comment.
Also change the types of everywhere it's stored to RefList, that way you will access the struct by-reference and then you'll just have to add ref before every InternalResourcesData method parameter to fix the code
|
|
||
| namespace Content.Goobstation.Shared.InternalResources.EntitySystems; | ||
|
|
||
| public sealed partial class SharedInternalResourcesActionSystem : EntitySystem |
There was a problem hiding this comment.
| public sealed partial class SharedInternalResourcesActionSystem : EntitySystem | |
| public sealed partial class InternalResourcesActionSystem : EntitySystem |
| if (!_internalResources.TryGetResourceType(args.Performer, action.Comp.ResourceProto, out var data)) | ||
| return; | ||
|
|
||
| var toggled = Comp<ActionComponent>(action).Toggled; |
There was a problem hiding this comment.
Use [Dependency] private EntityQuery<ActionComponent> ...
| /// <summary> | ||
| /// Tries to add internal resources type to entity by protoId. | ||
| /// </summary> | ||
| public bool TryAddInternalResources(EntityUid uid, string protoId, [NotNullWhen(true)] out InternalResourcesData? data) |
There was a problem hiding this comment.
Make this method accept ProtoId<InternalResourcesPrototype>
Also use Entity<InternalResourcesComponent?>
| /// <summary> | ||
| /// Tries to remove an internal resource type from an entity with an internal resources component by protoId. | ||
| /// </summary> | ||
| public void TryRemoveInternalResource(EntityUid uid, string protoId, InternalResourcesComponent? component = null) |
There was a problem hiding this comment.
Use Entity<InternalResourcesComponent?>
There was a problem hiding this comment.
and a ProtoId<> as a parameter instead of a string
| /// <summary> | ||
| /// Sets the capacity of a resource using a float amount with a given internal resources data. | ||
| /// </summary> | ||
| public bool TrySetResourcesCapacity(EntityUid uid, InternalResourcesData data, float capacity, InternalResourcesComponent? component = null) |
There was a problem hiding this comment.
Entity<InternalResourcesComponent?>
| /// <summary> | ||
| /// Sets the capacity of a resource using a float amount with a given protoId | ||
| /// </summary> | ||
| public bool TrySetResourcesCapacity(EntityUid uid, string protoId, float capacity, InternalResourcesComponent? component = null) |
There was a problem hiding this comment.
Entity<InternalResourcesComponent?> and ProtoId<> and also line breaks
| /// Updates the capacity of a resource by a float amount with a given internal resources data. | ||
| /// Does not SET the capacity - just adds the given value. | ||
| /// </summary> | ||
| public bool TryUpdateResourcesCapacity(EntityUid uid, InternalResourcesData data, float amount, InternalResourcesComponent? component = null) |
There was a problem hiding this comment.
Entity<InternalResourcesComponent?> and also line breaks
| /// Updates the capacity of a resource by a float amount with a given protoId | ||
| /// Does not SET the capacity - just adds the given value. | ||
| /// </summary> | ||
| public bool TryUpdateResourcesCapacity(EntityUid uid, string protoId, float amount, InternalResourcesComponent? component = null) |
There was a problem hiding this comment.
Entity<InternalResourcesComponent?> and ProtoId<> and also line breaks
| /// Generic component for alerts that have needs to update when some value in some component changes. | ||
| /// </summary> | ||
| [RegisterComponent, NetworkedComponent] | ||
| public sealed partial class ValueRelatedAlertComponent : Component |
There was a problem hiding this comment.
Consider making it client-side, not sure if that's possible but give it a try
About the PR
Ported Internal Resources System (Goob-Station/Goob-Station#4585) and it's modification made by thebiggestbruh (Goob-Station/Goob-Station#5574) with cleanups.
Technical details
Removed Thresholds made by thebiggestbruh since these threshold do not contain processing logic and still require additional proccessing in systems that can be made with get of internal resource amount (todo: add thresholds with EntityEffects).
Optimization might be required later since system using a lot of List methods that can be changed to FrozenDictionary.
Test plan
Requirements