Skip to content

Port Internal Resources System#74

Open
BombasterDS2 wants to merge 4 commits into
Goob-Station:masterfrom
BombasterDS2:port-internal-resources-(12-06-2026)
Open

Port Internal Resources System#74
BombasterDS2 wants to merge 4 commits into
Goob-Station:masterfrom
BombasterDS2:port-internal-resources-(12-06-2026)

Conversation

@BombasterDS2

Copy link
Copy Markdown

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

  1. Use AddInternalResources uid DebugInteralResources command.

Requirements

  • I have read and am following the Pull Request and Changelog Guidelines.
  • I have tested this pull request and written instructions on how to test it
  • I have added media to this PR or it does not require an in-game showcase.

* 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
@madeline-celeste

Copy link
Copy Markdown

the IRS is coming to goob

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

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.

@BombasterDS2

Copy link
Copy Markdown
Author

Bot, don't close it

/// </summary>
[Serializable, NetSerializable]
[DataDefinition]
public sealed partial class InternalResourcesData

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Turn it into a struct to make it faster

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use Entity<InternalResourcesComponent?>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider making it client-side, not sure if that's possible but give it a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants