Skip to content

Commit

Permalink
Merge branch 'master' into floof-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DangerRevolution committed Aug 10, 2024
2 parents a3ae0c1 + 9c74822 commit 1f0ca6e
Show file tree
Hide file tree
Showing 19 changed files with 470 additions and 43 deletions.
11 changes: 10 additions & 1 deletion Content.Shared/Clothing/EntitySystems/ClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public abstract class ClothingSystem : EntitySystem
[ValidatePrototypeId<TagPrototype>]
private const string NoseTag = "HidesNose";

[ValidatePrototypeId<TagPrototype>]

private const string BeardTag = "HidesBeard";

public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -106,7 +110,7 @@ private void ToggleVisualLayer(EntityUid equipee, HumanoidVisualLayers layer, st
{
if (_tagSystem.HasTag(item, tag))
{
if (tag == NoseTag) //Special check needs to be made for NoseTag, due to masks being toggleable
if (tag == NoseTag || tag == BeardTag) // Special check for NoseTag or BeardTag, due to masks being toggleable
{
if (TryComp(item, out MaskComponent? mask) && TryComp(item, out ClothingComponent? clothing))
{
Expand Down Expand Up @@ -139,6 +143,8 @@ protected virtual void OnGotEquipped(EntityUid uid, ClothingComponent component,
ToggleVisualLayer(args.Equipee, HumanoidVisualLayers.Hair, HairTag);
if ((new string[] { "mask", "head" }).Contains(args.Slot) && _tagSystem.HasTag(args.Equipment, NoseTag))
ToggleVisualLayer(args.Equipee, HumanoidVisualLayers.Snout, NoseTag);
if ((new string[] { "mask", "head" }).Contains(args.Slot) && _tagSystem.HasTag(args.Equipment, BeardTag))
ToggleVisualLayer(args.Equipee, HumanoidVisualLayers.FacialHair, BeardTag);
}

protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent component, GotUnequippedEvent args)
Expand All @@ -148,6 +154,8 @@ protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent componen
ToggleVisualLayer(args.Equipee, HumanoidVisualLayers.Hair, HairTag);
if ((new string[] { "mask", "head" }).Contains(args.Slot) && _tagSystem.HasTag(args.Equipment, NoseTag))
ToggleVisualLayer(args.Equipee, HumanoidVisualLayers.Snout, NoseTag);
if ((new string[] { "mask", "head" }).Contains(args.Slot) && _tagSystem.HasTag(args.Equipment, BeardTag))
ToggleVisualLayer(args.Equipee, HumanoidVisualLayers.FacialHair, BeardTag);
}

private void OnGetState(EntityUid uid, ClothingComponent component, ref ComponentGetState args)
Expand All @@ -166,6 +174,7 @@ private void OnMaskToggled(Entity<ClothingComponent> ent, ref ItemMaskToggledEve
//TODO: sprites for 'pulled down' state. defaults to invisible due to no sprite with this prefix
SetEquippedPrefix(ent, args.IsToggled ? args.equippedPrefix : null, ent);
ToggleVisualLayer(args.Wearer, HumanoidVisualLayers.Snout, NoseTag);
ToggleVisualLayer(args.Wearer, HumanoidVisualLayers.FacialHair, BeardTag);
}

private void OnPickedUp(Entity<ClothingComponent> ent, ref GettingPickedUpAttemptEvent args)
Expand Down
28 changes: 28 additions & 0 deletions Content.Shared/Traits/Assorted/Components/AdrenalineComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Traits.Assorted.Components;

/// <summary>
/// This is used for any trait that modifies the Melee System implementation of Health Contest
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class AdrenalineComponent : Component
{
/// <summary>
/// When true, multiplies by the inverse of the resulting Contest.
/// </summary>
[DataField]
public bool Inverse { get; private set; } = false;

/// <summary>
/// Used as the RangeModifier input for a Health Contest.
/// </summary>
[DataField]
public float RangeModifier { get; private set; } = 1;

/// <summary>
/// Used as the BypassClamp input for a Health Contest.
/// </summary>
[DataField]
public bool BypassClamp { get; private set; } = false;
}
16 changes: 16 additions & 0 deletions Content.Shared/Traits/Assorted/Components/CritModifierComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Traits.Assorted.Components;

/// <summary>
/// This is used for any trait that modifies CritThreshold
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class CritModifierComponent : Component
{
/// <summary>
/// The amount that an entity's critical threshold will be incremented by.
/// </summary>
[DataField]
public int CritThresholdModifier { get; private set; } = 0;
}
16 changes: 16 additions & 0 deletions Content.Shared/Traits/Assorted/Components/DeadModifierComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Traits.Assorted.Components;

/// <summary>
/// This is used for any trait that modifies DeadThreshold
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class DeadModifierComponent : Component
{
/// <summary>
/// The amount that an entity's DeadThreshold will be incremented by.
/// </summary>
[DataField]
public int DeadThresholdModifier { get; private set; } = 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Traits.Assorted.Components;

/// <summary>
/// This is used for any trait that modifies the Melee System implementation of Stamina Contest
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class PainToleranceComponent : Component
{
/// <summary>
/// When true, multiplies by the inverse of the resulting Contest.
/// </summary>
[DataField]
public bool Inverse { get; private set; } = false;

/// <summary>
/// Used as the RangeModifier input for a Stamina Contest.
/// </summary>
[DataField]
public float RangeModifier { get; private set; } = 1;

/// <summary>
/// Used as the BypassClamp input for a Stamina Contest.
/// </summary>
[DataField]
public bool BypassClamp { get; private set; } = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Traits.Assorted.Components;

/// <summary>
/// This is used for any trait that modifies stamina CritThreshold
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class StaminaCritModifierComponent : Component
{
/// <summary>
/// The amount that an entity's stamina critical threshold will be incremented by.
/// </summary>
[DataField]
public int CritThresholdModifier { get; private set; } = 0;
}
63 changes: 63 additions & 0 deletions Content.Shared/Traits/Assorted/Systems/TraitStatModifierSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using Content.Shared.Contests;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Traits.Assorted.Components;
using Content.Shared.Weapons.Melee.Events;
using Content.Shared.Damage.Components;

namespace Content.Shared.Traits.Assorted.Systems;

public sealed partial class TraitStatModifierSystem : EntitySystem
{
[Dependency] private readonly ContestsSystem _contests = default!;
[Dependency] private readonly MobThresholdSystem _threshold = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CritModifierComponent, ComponentStartup>(OnCritStartup);
SubscribeLocalEvent<DeadModifierComponent, ComponentStartup>(OnDeadStartup);
SubscribeLocalEvent<StaminaCritModifierComponent, ComponentStartup>(OnStaminaCritStartup);
SubscribeLocalEvent<AdrenalineComponent, GetMeleeDamageEvent>(OnAdrenalineGetDamage);
SubscribeLocalEvent<PainToleranceComponent, GetMeleeDamageEvent>(OnPainToleranceGetDamage);
}

private void OnCritStartup(EntityUid uid, CritModifierComponent component, ComponentStartup args)
{
if (!TryComp<MobThresholdsComponent>(uid, out var threshold))
return;

var critThreshold = _threshold.GetThresholdForState(uid, Mobs.MobState.Critical, threshold);
if (critThreshold != 0)
_threshold.SetMobStateThreshold(uid, critThreshold + component.CritThresholdModifier, Mobs.MobState.Critical);
}

private void OnDeadStartup(EntityUid uid, DeadModifierComponent component, ComponentStartup args)
{
if (!TryComp<MobThresholdsComponent>(uid, out var threshold))
return;

var deadThreshold = _threshold.GetThresholdForState(uid, Mobs.MobState.Dead, threshold);
if (deadThreshold != 0)
_threshold.SetMobStateThreshold(uid, deadThreshold + component.DeadThresholdModifier, Mobs.MobState.Dead);
}

private void OnStaminaCritStartup(EntityUid uid, StaminaCritModifierComponent component, ComponentStartup args)
{
if (!TryComp<StaminaComponent>(uid, out var stamina))
return;

stamina.CritThreshold += component.CritThresholdModifier;
}

private void OnAdrenalineGetDamage(EntityUid uid, AdrenalineComponent component, ref GetMeleeDamageEvent args)
{
var modifier = _contests.HealthContest(uid, component.BypassClamp, component.RangeModifier);
args.Damage *= component.Inverse ? 1 / modifier : modifier;
}

private void OnPainToleranceGetDamage(EntityUid uid, PainToleranceComponent component, ref GetMeleeDamageEvent args)
{
var modifier = _contests.StaminaContest(uid, component.BypassClamp, component.RangeModifier);
args.Damage *= component.Inverse ? 1 / modifier : modifier;
}
}
22 changes: 22 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5196,3 +5196,25 @@ Entries:
different stamina costs to power attack with.
id: 6248
time: '2024-08-10T21:30:42.0000000+00:00'
- author: Rane
changes:
- type: Remove
message: >-
Removed the spammable hugging on click. Consider using emotes for this
instead.
id: 6249
time: '2024-08-10T21:34:22.0000000+00:00'
- author: VMSolidus and Skubman
changes:
- type: Add
message: >-
11 new Physical Traits have been added to the game! 6 positive traits,
and 5 negative traits.
id: 6250
time: '2024-08-10T21:36:09.0000000+00:00'
- author: BlueHNT
changes:
- type: Add
message: Added `HidesBeard` tag
id: 6251
time: '2024-08-10T21:36:49.0000000+00:00'
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ comp-window-knock = *knock knock*

fence-rattle-success = *rattle*
## Hugging players

hugging-success-generic = You hug {THE($target)}.
hugging-success-generic-others = { CAPITALIZE(THE($user)) } hugs {THE($target)}.
hugging-success-generic-target = { CAPITALIZE(THE($user)) } hugs you.
## Other

petting-success-tesla = You pet {THE($target)}, violating the laws of nature and physics.
Expand Down
59 changes: 59 additions & 0 deletions Resources/Locale/en-US/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,64 @@ trait-description-Foreigner =
For one reason or another you do not speak this station's primary language.
Instead, you have a translator issued to you that only you can use.
trait-name-WillToLive = Will To Live
trait-description-WillToLive =
You have an unusually strong "will to live", and will resist death more than others.
Your damage threshold for becoming Dead is increased by 10 points.
trait-name-WillToDie = Will To Die
trait-description-WillToDie =
You have an unusually weak "will to live", and will succumb to injuries sooner than others.
Your damage threshold for becoming Dead is decreased by 15 points.
trait-name-Tenacity = Tenacity
trait-description-Tenacity =
Whether it be through raw grit, willpower, or subtle bionic augmentations, you are hardier than others.
Your damage threshold for becoming Critical is increased by 5 points.
trait-name-GlassJaw = Glass Jaw
trait-description-GlassJaw =
Your body is more fragile than others, resulting in a greater susceptibility to critical injuries
Your damage threshold for becoming Critical is decreased by 10 points.
trait-name-HighAdrenaline = High Adrenaline
trait-description-HighAdrenaline =
Whether by natural causes, genetic or bionic augmentation, you have a more potent adrenal gland.
When injured, your melee attacks deal up to 10% more damage, in addition to the natural bonuses from adrenaline.
The standard adrenaline bonuses to melee damage are up to a 20% increase.
trait-name-AdrenalDysfunction = Adrenal Dysfunction
trait-description-AdrenalDysfunction =
Your adrenal gland is completely nonfunctional, or potentially missing outright.
Your melee attacks do not benefit from Adrenaline when injured.
The standard adrenaline bonuses to melee damage are up to a 20% increase.
trait-name-Masochism = Masochism
trait-description-Masochism =
Deriving enjoyment from your own pain, you are not as inhibited by it as others.
You ignore the first 10% of stamina damage penalties to your melee attacks.
trait-name-LowPainTolerance = Low Pain Tolerance
trait-description-LowPainTolerance =
Your tolerance for pain is far below average, and its effects are more inhibiting.
Your melee damage is penalized by up to an additional 15% when taking stamina damage.
trait-name-MartialArtist = Martial Artist
trait-description-MartialArtist =
You have received formal training in unarmed combat, whether with Fists, Feet, or Claws.
Your unarmed melee attacks have a small range increase, and deal 50% more damage.
This does not apply to any form of armed melee, only the weapons you were naturally born with.
trait-name-Vigor = Vigor
trait-description-Vigor =
Whether by pure determination, fitness, or bionic augmentations, your endurance is enhanced.
Your stamina is increased by 10 points.
trait-name-Lethargy = Lethargy
trait-description-Lethargy =
You become tired faster than others, making you more vulnerable to exhaustion and fatigue.
Your stamina is decreased by 15 points.
trait-name-SignLanguage = Sign Language
trait-description-SignLanguage =
You can understand and use Galactic Sign Language (GSL).
Expand Down Expand Up @@ -129,3 +187,4 @@ trait-name-WeaponsGeneralist = Weapons Generalist
trait-description-WeaponsGeneralist =
You are a jack of all trades with melee weapons, enabling you to be versatile with your weapon arsenal.
Your melee damage bonus for all Brute damage types (Blunt, Slash, Piercing) becomes 25%.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
id: MobVulpkanin
components:
- type: CombatMode
- type: InteractionPopup
successChance: 1
interactSuccessString: hugging-success-generic
interactSuccessSound: /Audio/Effects/thudswoosh.ogg
messagePerceivedByOthers: hugging-success-generic-others
- type: MindContainer
showExamineInfo: true
- type: Input
Expand Down
5 changes: 0 additions & 5 deletions Resources/Prototypes/Entities/Mobs/Player/arachne.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
id: MobArachne
components:
- type: CombatMode
- type: InteractionPopup
successChance: 1
interactSuccessString: hugging-success-generic
interactSuccessSound: /Audio/Effects/thudswoosh.ogg
messagePerceivedByOthers: hugging-success-generic-others
- type: MindContainer
showExamineInfo: true
- type: Input
Expand Down
5 changes: 0 additions & 5 deletions Resources/Prototypes/Entities/Mobs/Player/harpy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
id: MobHarpy
components:
- type: CombatMode
- type: InteractionPopup
successChance: 1
interactSuccessString: hugging-success-generic
interactSuccessSound: /Audio/Effects/thudswoosh.ogg
messagePerceivedByOthers: hugging-success-generic-others
- type: MindContainer
showExamineInfo: true
- type: Input
Expand Down
7 changes: 1 addition & 6 deletions Resources/Prototypes/Entities/Mobs/Player/skeleton.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
parent: BaseMobSkeletonPerson
id: MobSkeletonPerson
components:
- type: InteractionPopup
successChance: 1
interactSuccessString: hugging-success-generic
interactSuccessSound: /Audio/Effects/thudswoosh.ogg
messagePerceivedByOthers: hugging-success-generic-others
- type: PotentialPsionic #Nyano - Summary: makes potentially psionic.
- type: PotentialPsionic #Nyano - Summary: makes potentially psionic.

- type: entity
name: skeleton pirate
Expand Down
5 changes: 0 additions & 5 deletions Resources/Prototypes/Entities/Mobs/Species/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,6 @@
- type: Dna
- type: MindContainer
showExamineInfo: true
- type: InteractionPopup
successChance: 1
interactSuccessString: hugging-success-generic
interactSuccessSound: /Audio/Effects/thudswoosh.ogg
messagePerceivedByOthers: hugging-success-generic-others
- type: CanHostGuardian
- type: NpcFactionMember
factions:
Expand Down
Loading

0 comments on commit 1f0ca6e

Please sign in to comment.