-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Fansana:master' into Ghost-Role-Bar
- Loading branch information
Showing
13 changed files
with
192 additions
and
51 deletions.
There are no files selected for viewing
This file contains 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 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
29 changes: 29 additions & 0 deletions
29
Content.Server/FloofStation/Traits/Components/VampirismComponent.cs
This file contains 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,29 @@ | ||
using Content.Server.Body.Components; | ||
using Content.Shared.Body.Prototypes; | ||
using Content.Shared.Whitelist; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Server.Floofstation.Traits.Components; | ||
|
||
/// <summary> | ||
/// Enables the mob to suck blood from other mobs to replenish its own saturation. | ||
/// Must be fully initialized before being added to a mob. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class VampirismComponent : Component | ||
{ | ||
[DataField] | ||
public HashSet<ProtoId<MetabolizerTypePrototype>> MetabolizerPrototypes = new() { "Vampiric", "Animal" }; | ||
|
||
/// <summary> | ||
/// A whitelist for what special-digestible-required foods the vampire's stomach is capable of eating. | ||
/// </summary> | ||
[DataField] | ||
public EntityWhitelist? SpecialDigestible = null; | ||
|
||
[DataField] | ||
public TimeSpan SuccDelay = TimeSpan.FromSeconds(1); | ||
|
||
[DataField] | ||
public float UnitsToSucc = 10; | ||
} |
This file contains 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,51 @@ | ||
using Content.Server.Body.Components; | ||
using Content.Server.Floofstation.Traits.Components; | ||
using Content.Server.Vampiric; | ||
using Content.Shared.Body.Components; | ||
using Content.Shared.Body.Systems; | ||
|
||
namespace Content.Server.Floofstation.Traits; | ||
|
||
public sealed class VampirismSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SharedBodySystem _body = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<VampirismComponent, MapInitEvent>(OnInitVampire); | ||
} | ||
|
||
private void OnInitVampire(Entity<VampirismComponent> ent, ref MapInitEvent args) | ||
{ | ||
EnsureBloodSucker(ent); | ||
|
||
if (!TryComp<BodyComponent>(ent, out var body) | ||
|| !_body.TryGetBodyOrganComponents<MetabolizerComponent>(ent, out var comps, body)) | ||
return; | ||
|
||
foreach (var (metabolizer, organ) in comps) | ||
{ | ||
if (!TryComp<StomachComponent>(organ.Owner, out var stomach)) | ||
continue; | ||
|
||
metabolizer.MetabolizerTypes = ent.Comp.MetabolizerPrototypes; | ||
|
||
if (ent.Comp.SpecialDigestible is {} whitelist) | ||
stomach.SpecialDigestible = whitelist; | ||
} | ||
} | ||
|
||
private void EnsureBloodSucker(Entity<VampirismComponent> uid) | ||
{ | ||
if (HasComp<BloodSuckerComponent>(uid)) | ||
return; | ||
|
||
AddComp(uid, new BloodSuckerComponent | ||
{ | ||
Delay = uid.Comp.SuccDelay, | ||
InjectWhenSucc = false, // The code for it is deprecated, might wanna make it inject something when (if?) it gets reworked | ||
UnitsToSucc = uid.Comp.UnitsToSucc, | ||
WebRequired = false | ||
}); | ||
} | ||
} |
This file contains 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 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 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 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 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 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.