Skip to content

Commit

Permalink
Merge pull request Simple-Station#164 from Mnemotechnician/feat/bette…
Browse files Browse the repository at this point in the history
…r-vampires

Vampireal
  • Loading branch information
Fansana authored Sep 2, 2024
2 parents ed56ce0 + d5dbe73 commit 18030e7
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 13 deletions.
3 changes: 2 additions & 1 deletion Content.Server/Body/Components/MetabolizerComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Body.Systems;
using Content.Server.Floofstation.Traits;
using Content.Server.Traits.Assorted;
using Content.Shared.Body.Prototypes;
using Content.Shared.FixedPoint;
Expand Down Expand Up @@ -45,7 +46,7 @@ public sealed partial class MetabolizerComponent : Component
/// List of metabolizer types that this organ is. ex. Human, Slime, Felinid, w/e.
/// </summary>
[DataField]
[Access(typeof(MetabolizerSystem), typeof(LiquorLifelineSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
[Access(typeof(MetabolizerSystem), typeof(LiquorLifelineSystem), typeof(VampirismSystem), Other = AccessPermissions.ReadExecute)] // Floofstation
public HashSet<ProtoId<MetabolizerTypePrototype>>? MetabolizerTypes = null;

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Body/Components/StomachComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Body.Systems;
using Content.Server.Floofstation.Traits;
using Content.Server.Nutrition.EntitySystems;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
Expand Down Expand Up @@ -45,6 +46,7 @@ public sealed partial class StomachComponent : Component
/// A whitelist for what special-digestible-required foods this stomach is capable of eating.
/// </summary>
[DataField]
[Access(Other = AccessPermissions.ReadWriteExecute)] // Floofstation
public EntityWhitelist? SpecialDigestible = null;

/// <summary>
Expand Down
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;
}
51 changes: 51 additions & 0 deletions Content.Server/FloofStation/Traits/VampirismSystem.cs
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
});
}
}
8 changes: 7 additions & 1 deletion Resources/Locale/en-US/Floof/traits/traits.ftl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
trait-name-Vampirism = Vampirism
trait-description-Vampirism = Whether through implantation, genetic modification, or evolution, you have a pair of hollow, sharp fangs used to drink iron-based blood from the beings that contain it.
trait-description-Vampirism =
Your body has evolved to be able to suck blood from beings that contain it and metabolize it into useful compounds.
You cannot eat normal food, but drinking blood satiates your hunger and thirst, and also improves your health.
trait-name-HollowFangs = Hollow fangs
trait-description-HollowFangs =
Whether through implantation, genetic modification, or evolution, you have a pair of hollow, sharp fangs used to drink iron-based blood from the beings that contain it.
trait-name-CumProducer = Cock
trait-description-CumProducer = You have a schlong between your legs.
Expand Down
49 changes: 38 additions & 11 deletions Resources/Prototypes/Floof/Traits/physical.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,54 @@
- type: trait
id: Vampirism # You may port this to EE, you have my permission!
category: Physical
points: -1
points: 3
requirements:
- !type:CharacterJobRequirement
inverted: true
jobs:
- Borg
- MedicalBorg
- !type:CharacterSpeciesRequirement # This will be removed once you can edit organs with traits
- !type:CharacterSpeciesRequirement
inverted: true
species:
- Moth
- Oni
- Diona
- SlimePerson
- Human
- IPC
- !type:CharacterTraitRequirement
inverted: true
traits:
- HollowFangs
components:
- type: Vampirism
succDelay: 3
specialDigestible: # Vampires cannot eat food chat is that real
tags:
- IceCream
- Pill
- Crayon
- Paper

- type: trait
id: HollowFangs
category: Physical
points: -2
requirements:
- !type:CharacterJobRequirement
inverted: true
jobs:
- Borg
- MedicalBorg
- !type:CharacterSpeciesRequirement
inverted: true
species:
- IPC
- !type:CharacterTraitRequirement
inverted: true
traits:
- Vampirism
components:
- type: BloodSucker
unitsToSucc: 10
injectWhenSucc: false
webRequired: false
- type: Vampirism
succDelay: 5
metabolizerPrototypes:
- Animal

- type: trait
id: Weakness
Expand Down
5 changes: 5 additions & 0 deletions Resources/Prototypes/Reagents/biological.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
- !type:AdjustReagent
reagent: UncookedAnimalProteins
amount: 0.5
# Floofstation - prevent vampires from getting sick by drinking blood
conditions:
- !type:OrganType
type: Vampiric
shouldHave: false
Medicine:
effects:
- !type:HealthChange
Expand Down

0 comments on commit 18030e7

Please sign in to comment.