-
Notifications
You must be signed in to change notification settings - Fork 48
Detritivore Trait #117
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Detritivore Trait #117
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9aeb4b4
add detritivore metabolizer
portfiend 55bc1c1
allow detritivores to digest mold and gastrotoxin
portfiend 70d4fe9
allow detritivores to digest vent crud + trash
portfiend 6c395a4
whitespace
portfiend bc66384
add metabolizer traits
portfiend e34449d
add perks trait category
portfiend a64c766
add detritivore trait
portfiend cbff793
increase satiation of vent crud and trash
portfiend 30c7719
tweaks
portfiend 76fd5ef
this does not need to be handled
portfiend d1ffdd7
"fix" detritivore metabolism
portfiend d551197
give mice and rats detritivore
portfiend e81cc5e
elaboration
portfiend d580a25
rename proto
portfiend 70f2f47
Merge branch 'master' into feat/detritivore-trait
portfiend d468765
i ficked it
portfiend c1c3f49
comment
portfiend 7cdf775
predict metabolism types
portfiend 50d5de8
Merge branch 'master' into feat/detritivore-trait
portfiend File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| using System.Linq; | ||
| using Content.Shared.Body; | ||
| using Content.Shared.Whitelist; | ||
| using Robust.Shared.Prototypes; | ||
|
|
||
| namespace Content.Shared.Metabolism; | ||
|
|
||
| public sealed partial class MetabolizerSystem | ||
| { | ||
| [Dependency] private BodySystem _body = default!; | ||
| [Dependency] private EntityWhitelistSystem _whitelist = default!; | ||
|
|
||
| private void InitializeDen() | ||
| { | ||
| SubscribeLocalEvent<BodyComponent, AddTraitMetabolizerEvent>(_body.RelayEvent); | ||
| SubscribeLocalEvent<BodyComponent, RemoveTraitMetabolizerEvent>(_body.RelayEvent); | ||
|
|
||
| SubscribeLocalEvent<MetabolizerComponent, BodyRelayedEvent<AddTraitMetabolizerEvent>>(OnAddTraitMetabolizerEvent); | ||
| SubscribeLocalEvent<MetabolizerComponent, BodyRelayedEvent<RemoveTraitMetabolizerEvent>>(OnRemoveTraitMetabolizerEvent); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Adds metabolizers to metabolizer organs that pass a whitelist. | ||
| /// </summary> | ||
| /// <param name="ent">The metabolizer organ.</param> | ||
| private void OnAddTraitMetabolizerEvent(Entity<MetabolizerComponent> ent, | ||
| ref BodyRelayedEvent<AddTraitMetabolizerEvent> args) | ||
| { | ||
| if (args.Args.Metabolizers.Count == 0 | ||
| || _whitelist.IsWhitelistFail(args.Args.OrganWhitelist, ent)) | ||
| return; | ||
|
|
||
| var metabolizers = args.Args.Metabolizers; | ||
|
|
||
| if (ent.Comp.MetabolizerTypes != null) | ||
| metabolizers = metabolizers.Union(ent.Comp.MetabolizerTypes).ToHashSet(); | ||
|
|
||
| ent.Comp.MetabolizerTypes = metabolizers; | ||
| Dirty(ent); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Removes metabolizers from metabolizer organs that pass a whitelist. | ||
| /// </summary> | ||
| /// <param name="ent">The metabolizer organ.</param> | ||
| private void OnRemoveTraitMetabolizerEvent(Entity<MetabolizerComponent> ent, | ||
| ref BodyRelayedEvent<RemoveTraitMetabolizerEvent> args) | ||
| { | ||
| if (args.Args.Metabolizers.Count == 0 | ||
| || ent.Comp.MetabolizerTypes == null | ||
| || _whitelist.IsWhitelistFail(args.Args.OrganWhitelist, ent)) | ||
| return; | ||
|
|
||
| // TODO: add smarter handling for this | ||
| var metabolizers = ent.Comp.MetabolizerTypes | ||
| .Except(args.Args.Metabolizers) | ||
| .ToHashSet(); | ||
|
|
||
| ent.Comp.MetabolizerTypes = metabolizers; | ||
|
portfiend marked this conversation as resolved.
|
||
| Dirty(ent); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// An event that adds metabolizers to subscribed entities that pass the whitelist. | ||
| /// </summary> | ||
| /// <param name="Metabolizers">The metabolizers to add.</param> | ||
| /// <param name="OrganWhitelist">The whitelist for organs to add metabolizers to.</param> | ||
| [ByRefEvent] | ||
| public record struct AddTraitMetabolizerEvent(HashSet<ProtoId<MetabolizerTypePrototype>> Metabolizers, | ||
| EntityWhitelist? OrganWhitelist = null); | ||
|
|
||
| /// <summary> | ||
| /// An event that removes metabolizers from subscribed entities that pass the whitelist. | ||
| /// </summary> | ||
| /// <param name="Metabolizers">The metabolizers to add.</param> | ||
| /// <param name="OrganWhitelist">The whitelist for organs to add metabolizers to.</param> | ||
| [ByRefEvent] | ||
| public record struct RemoveTraitMetabolizerEvent(HashSet<ProtoId<MetabolizerTypePrototype>> Metabolizers, | ||
| EntityWhitelist? OrganWhitelist = null); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| metabolizer-type-detritivore = Detritivore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| trait-category-perks = Perks | ||
| trait-category-species-morphs = Morphotypes | ||
| trait-category-species-specific = Species-specific |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| trait-detritivore-name = Detritivore | ||
| trait-detritivore-desc = | ||
| You can digest gastrotoxin (rotting food), mold, and trash without being | ||
| poisoned, and sate your hunger by doing so! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| - type: entity | ||
| id: OrganDetritivoreMetabolizer | ||
| abstract: true | ||
| components: | ||
| - type: Metabolizer | ||
| metabolizerTypes: [ Animal, Detritivore ] | ||
|
|
||
| - type: entity | ||
| parent: OrganBaseOrganic | ||
| id: OrganDetritivore | ||
| abstract: true | ||
| suffix: Detritivore | ||
|
|
||
| - type: entity | ||
| parent: OrganDetritivore | ||
| id: OrganDetritivoreInternal | ||
| abstract: true | ||
| components: | ||
| - type: Sprite | ||
| sprite: Mobs/Species/Human/organs.rsi # TODO: Custom detritivore organ sprites | ||
|
|
||
| - type: entity | ||
| parent: [ OrganBaseLungs, OrganDetritivoreInternal, OrganDetritivoreMetabolizer ] | ||
| id: OrganDetritivoreLungs | ||
|
|
||
| - type: entity | ||
| parent: [ OrganBaseHeart, OrganDetritivoreInternal, OrganDetritivoreMetabolizer ] | ||
| id: OrganDetritivoreHeart | ||
|
|
||
| - type: entity | ||
| parent: [ OrganBaseStomach, OrganDetritivoreInternal, OrganDetritivoreMetabolizer ] | ||
| id: OrganDetritivoreStomach | ||
|
|
||
| - type: entity | ||
| parent: [ OrganBaseLiver, OrganDetritivoreInternal, OrganDetritivoreMetabolizer ] | ||
| id: OrganDetritivoreLiver | ||
|
|
||
| - type: entity | ||
| parent: [ OrganBaseKidneys, OrganDetritivoreInternal, OrganDetritivoreMetabolizer ] | ||
| id: OrganDetritivoreKidneys | ||
|
|
||
| - type: entity | ||
| abstract: true | ||
| id: BaseMobDetritivore | ||
| components: | ||
| - type: EntityTableContainerFill | ||
| containers: | ||
| body_organs: !type:AllSelector | ||
| children: | ||
| - id: OrganDetritivoreLungs | ||
| - id: OrganDetritivoreHeart | ||
| - id: OrganDetritivoreStomach | ||
| - id: OrganDetritivoreLiver | ||
| - id: OrganDetritivoreKidneys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Hardy digestion for trash eaters and decomposers. | ||
| # Can consume gastrotoxin, trash, and mold safely, and derive nutrition from doing so. | ||
| - type: metabolizerType | ||
| id: Detritivore | ||
| name: metabolizer-type-detritivore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.