Skip to content

Commit

Permalink
Merge pull request Simple-Station#73 from SS14-Classic/Hotfixes-10/5/…
Browse files Browse the repository at this point in the history
…2024

Hotfixes 10/5/2024
  • Loading branch information
VMSolidus authored Oct 5, 2024
2 parents d62a406 + d0d4e83 commit b425262
Show file tree
Hide file tree
Showing 32 changed files with 390 additions and 95 deletions.
21 changes: 8 additions & 13 deletions Content.Server/Body/Components/BloodstreamComponent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Server.Body.Systems;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Traits;
using Content.Server.Traits.Assorted;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
Expand Down Expand Up @@ -83,6 +84,13 @@ public sealed partial class BloodstreamComponent : Component
[DataField]
public FixedPoint2 BloodRefreshAmount = 1.0f;

/// <summary>
/// How much hunger/thirst is used to regenerate one unit of blood. Set to zero to disable.
/// The actual thirst/hunger rate will scale with <see cref="BloodRefreshAmount"/>.
/// </summary>
/// <remarks>Those will have no effect if the entity has no hunger/thirst components.</remarks>
public float BloodRegenerationHunger = 1f, BloodRegenerationThirst = 1f;

/// <summary>
/// How much blood needs to be in the temporary solution in order to create a puddle?
/// </summary>
Expand Down Expand Up @@ -172,18 +180,5 @@ public sealed partial class BloodstreamComponent : Component
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public TimeSpan StatusTime;

/// <summary>
/// If this is true, the entity will not passively regenerate blood,
/// and instead will slowly lose blood.
/// </summary>
[DataField]
public bool HasBloodDeficiency = false;

/// <summary>
/// How much percentage of max blood volume should be removed with blood deficiency in each update interval?
/// </summary>
[DataField]
public float BloodDeficiencyLossPercentage;
}
}
15 changes: 15 additions & 0 deletions Content.Server/Body/Events/NaturalBloodRegenerationAttemptEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Content.Shared.FixedPoint;

namespace Content.Server.Body.Events;

/// <summary>
/// Raised on a mob when its bloodstream tries to perform natural blood regeneration.
/// </summary>
[ByRefEvent]
public sealed class NaturalBloodRegenerationAttemptEvent : CancellableEntityEventArgs
{
/// <summary>
/// How much blood the mob will regenerate on this tick. Can be negative.
/// </summary>
public FixedPoint2 Amount;
}
50 changes: 39 additions & 11 deletions Content.Server/Body/Systems/BloodstreamSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Body.Components;
using Content.Server.Body.Events;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Chemistry.ReactionEffects;
using Content.Server.Fluids.EntitySystems;
Expand All @@ -14,6 +15,8 @@
using Content.Shared.Drunk;
using Content.Shared.FixedPoint;
using Content.Shared.Mobs.Systems;
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Popups;
using Content.Shared.Rejuvenate;
using Content.Shared.Speech.EntitySystems;
Expand All @@ -39,6 +42,8 @@ public sealed class BloodstreamSystem : EntitySystem
[Dependency] private readonly SharedStutteringSystem _stutteringSystem = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
[Dependency] private readonly ForensicsSystem _forensicsSystem = default!;
[Dependency] private readonly HungerSystem _hunger = default!;
[Dependency] private readonly ThirstSystem _thirst = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -118,17 +123,9 @@ public override void Update(float frameTime)
if (!_solutionContainerSystem.ResolveSolution(uid, bloodstream.BloodSolutionName, ref bloodstream.BloodSolution, out var bloodSolution))
continue;

// Removes blood for Blood Deficiency constantly.
if (bloodstream.HasBloodDeficiency)
{
if (!_mobStateSystem.IsDead(uid))
RemoveBlood(uid, bloodstream.BloodMaxVolume * bloodstream.BloodDeficiencyLossPercentage, bloodstream);
}
// Adds blood to their blood level if it is below the maximum.
else if (bloodSolution.Volume < bloodSolution.MaxVolume && !_mobStateSystem.IsDead(uid))
{
TryModifyBloodLevel(uid, bloodstream.BloodRefreshAmount, bloodstream);
}
// Try to apply natural blood regeneration/bloodloss
if (!_mobStateSystem.IsDead(uid))
TryDoNaturalRegeneration((uid, bloodstream), bloodSolution);

// Removes blood from the bloodstream based on bleed amount (bleed rate)
// as well as stop their bleeding to a certain extent.
Expand Down Expand Up @@ -498,4 +495,35 @@ private void RemoveBlood(EntityUid uid, FixedPoint2 amount, BloodstreamComponent

bloodSolution.RemoveReagent(component.BloodReagent, amount);
}

/// <summary>
/// Tries to apply natural blood regeneration/loss to the entity. Returns true if succesful.
/// </summary>
private bool TryDoNaturalRegeneration(Entity<BloodstreamComponent> ent, Solution bloodSolution)
{
var ev = new NaturalBloodRegenerationAttemptEvent { Amount = ent.Comp.BloodRefreshAmount };
RaiseLocalEvent(ent, ref ev);

if (ev.Cancelled || (ev.Amount > 0 && bloodSolution.Volume >= bloodSolution.MaxVolume))
return false;

var usedHunger = ev.Amount * ent.Comp.BloodRegenerationHunger;
var usedThirst = ev.Amount * ent.Comp.BloodRegenerationThirst;

// First, check if the entity has enough hunger/thirst
var hungerComp = CompOrNull<HungerComponent>(ent);
var thirstComp = CompOrNull<ThirstComponent>(ent);
if (usedHunger > 0 && hungerComp is not null && (hungerComp.CurrentHunger < usedHunger || hungerComp.CurrentThreshold <= HungerThreshold.Starving)
|| usedThirst > 0 && thirstComp is not null && (thirstComp.CurrentThirst < usedThirst || thirstComp.CurrentThirstThreshold <= ThirstThreshold.Parched))
return false;

// Then actually expend hunger and thirst (if necessary) and regenerate blood.
if (usedHunger > 0 && hungerComp is not null)
_hunger.ModifyHunger(ent, (float) -usedHunger, hungerComp);

if (usedThirst > 0 && thirstComp is not null)
_thirst.ModifyThirst(ent, thirstComp, (float) -usedThirst);

return TryModifyBloodLevel(ent, ev.Amount, ent.Comp);
}
}
2 changes: 1 addition & 1 deletion Content.Server/Cloning/CloningSystem.Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private void MakeAHugeMess(EntityUid uid, PhysicsComponent? physics = null, Bloo
? physics.Mass
: 71));

bloodSolution.AddReagent("blood", 0.8f
bloodSolution.AddReagent("Blood", 0.8f
* ((blood is not null)
? blood.BloodMaxVolume
: 300));
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/GameTicking/GameTicker.Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void SpawnPlayer(ICommonSession player, HumanoidCharacterProfile charact
}

//Ghost system return to round, check for whether the character isn't the same.
if (lateJoin && !_adminManager.IsAdmin(player) && !CheckGhostReturnToRound(player, character, out var checkAvoid))
if (!_cfg.GetCVar(CCVars.GhostAllowSameCharacter) && lateJoin && !_adminManager.IsAdmin(player) && !CheckGhostReturnToRound(player, character, out var checkAvoid))
{
var message = checkAvoid
? Loc.GetString("ghost-respawn-same-character-slightly-changed-name")
Expand Down
6 changes: 4 additions & 2 deletions Content.Server/Mood/MoodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ private void OnInit(EntityUid uid, MoodComponent component, ComponentStartup arg
if (_debugMode)
return;

if (TryComp<MobThresholdsComponent>(uid, out var mobThresholdsComponent)
if (_config.GetCVar(CCVars.MoodModifiesThresholds)
&& TryComp<MobThresholdsComponent>(uid, out var mobThresholdsComponent)
&& _mobThreshold.TryGetThresholdForState(uid, MobState.Critical, out var critThreshold, mobThresholdsComponent))
component.CritThresholdBeforeModify = critThreshold.Value;

Expand Down Expand Up @@ -345,7 +346,8 @@ private void RefreshShaders(EntityUid uid, int modifier)

private void SetCritThreshold(EntityUid uid, MoodComponent component, int modifier)
{
if (!TryComp<MobThresholdsComponent>(uid, out var mobThresholds)
if (!_config.GetCVar(CCVars.MoodModifiesThresholds)
|| !TryComp<MobThresholdsComponent>(uid, out var mobThresholds)
|| !_mobThreshold.TryGetThresholdForState(uid, MobState.Critical, out var key))
return;

Expand Down
6 changes: 6 additions & 0 deletions Content.Server/Traits/BloodDeficiencyComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ public sealed partial class BloodDeficiencyComponent : Component
// </summary>
[DataField(required: true)]
public float BloodLossPercentage;

/// <summary>
/// Whether the effects of this trait should be active.
/// </summary>
[DataField]
public bool Active = true;
}
17 changes: 9 additions & 8 deletions Content.Server/Traits/BloodDeficiencySystem.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
using Content.Server.Body.Systems;
using Content.Server.Body.Components;
using Content.Shared.Damage;
using Content.Server.Body.Events;
using Content.Server.Traits.Assorted;
using Content.Shared.FixedPoint;

namespace Content.Server.Traits.Assorted;
namespace Content.Server.Traits;

public sealed class BloodDeficiencySystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<BloodDeficiencyComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<BloodDeficiencyComponent, NaturalBloodRegenerationAttemptEvent>(OnBloodRegen);
}

private void OnStartup(EntityUid uid, BloodDeficiencyComponent component, ComponentStartup args)
private void OnBloodRegen(Entity<BloodDeficiencyComponent> ent, ref NaturalBloodRegenerationAttemptEvent args)
{
if (!TryComp<BloodstreamComponent>(uid, out var bloodstream))
if (!ent.Comp.Active || !TryComp<BloodstreamComponent>(ent.Owner, out var bloodstream))
return;

bloodstream.HasBloodDeficiency = true;
bloodstream.BloodDeficiencyLossPercentage = component.BloodLossPercentage;
args.Amount = FixedPoint2.Min(args.Amount, 0) // If the blood regen amount already was negative, we keep it.
- bloodstream.BloodMaxVolume * ent.Comp.BloodLossPercentage;
}
}
18 changes: 12 additions & 6 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2461,6 +2461,9 @@ public static readonly CVarDef<float>
public static readonly CVarDef<bool> MoodDecreasesSpeed =
CVarDef.Create("mood.decreases_speed", true, CVar.SERVER);

public static readonly CVarDef<bool> MoodModifiesThresholds =
CVarDef.Create("mood.modify_thresholds", false, CVar.SERVER);

#endregion

#region Lying Down System
Expand Down Expand Up @@ -2506,14 +2509,17 @@ public static readonly CVarDef<float>

#endregion

#region GhostRespawn
#region GhostRespawn

public static readonly CVarDef<double> GhostRespawnTime =
CVarDef.Create("ghost.respawn_time", 15d, CVar.SERVERONLY);

public static readonly CVarDef<double> GhostRespawnTime =
CVarDef.Create("ghost.respawn_time", 15d, CVar.SERVERONLY);
public static readonly CVarDef<int> GhostRespawnMaxPlayers =
CVarDef.Create("ghost.respawn_max_players", 40, CVar.SERVERONLY);

public static readonly CVarDef<int> GhostRespawnMaxPlayers =
CVarDef.Create("ghost.respawn_max_players", 40, CVar.SERVERONLY);
public static readonly CVarDef<bool> GhostAllowSameCharacter =
CVarDef.Create("ghost.allow_same_character", true, CVar.SERVERONLY);

#endregion
#endregion
}
}
9 changes: 9 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6963,3 +6963,12 @@ Entries:
id: 6420
time: '2024-10-04T00:52:11.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1004
- author: VMSolidus
changes:
- type: Fix
message: >-
Fixed a bug with CloningSystem. It now correctly spills blood upon
cloning fail.
id: 6421
time: '2024-10-05T14:28:32.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1009
26 changes: 13 additions & 13 deletions Resources/Locale/en-US/ghost/ghost-respawn.ftl
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
ghost-respawn-time-left = Before the opportunity to return to the round { $time }
{ $time ->
[one] minute
*[other] minutes
}
ghost-respawn-max-players = The function is not available, there should be fewer players on the server { $players }.
ghost-respawn-window-title = Rules for returning to the round
ghost-respawn-window-rules-footer = By using this feature, you [color=#ff7700]agree[/color] [color=#ff0000]not to transfer[/color] the knowledge of your past character to a new one. For violation of the clause specified here, [color=#ff0000]a ban in the amount of 3 days or more follows[/color].
ghost-respawn-same-character = You cannot enter the round for the same character. Change it in the character settings.
ghost-respawn-time-left = Please wait {$time} {$time ->
[one] minute
*[other] minutes
} before trying to respawn.
ghost-respawn-log-character-almost-same = Player { $player } { $try ->
[true] join
ghost-respawn-max-players = Cannot respawn right now. There should be fewer than {$players} players.
ghost-respawn-window-title = Respawn rules
ghost-respawn-window-rules-footer = By respawning, you [color=#ff7700]agree[/color] [color=#ff0000]not to use any knowledge gained as your previous charactrer[/color]. Violation of this rule may constitute a server ban. Please, read the server rules for more details.
ghost-respawn-same-character = You cannot respawn as the same character. Please select a different one in character preferences.
ghost-respawn-log-character-almost-same = Player {$player} { $try ->
[true] joined
*[false] tried to join
} in the round after the respawn with a similar name. Past name: { $oldName }, current: { $newName }.
ghost-respawn-log-return-to-lobby = { $userName } returned to the lobby.
} the round after respawning with a similar name. Previous name: { $oldName }, current: { $newName }.
ghost-respawn-log-return-to-lobby = { $userName } returned to the lobby.
10 changes: 8 additions & 2 deletions Resources/Locale/en-US/language/languages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ language-RootSpeak-description = The strange whistling-style language spoken by
language-Nekomimetic-name = Nekomimetic
language-Nekomimetic-description = To the casual observer, this language is an incomprehensible mess of broken Japanese. To the Felinids and Oni, it's somehow comprehensible.
language-Draconic-name = Draconic
language-Draconic-description = The common language of lizard-people, composed of sibilant hisses and rattles.
language-Draconic-name = Sinta'Unathi
language-Draconic-description =
The common language of Moghes - composed of sibilant hisses and rattles. Spoken natively by Unathi.
language-Draconic-name = Sinta'Azaziba
language-Draconic-description =
A language of Moghes consisting of a combination of spoken word and gesticulation.
While waning since Moghes entered the galactic stage - it enjoys popular use by Unathi that never fell to the Hegemony's cultural dominance.
language-SolCommon-name = Sol common
language-SolCommon-description =
Expand Down
8 changes: 7 additions & 1 deletion Resources/Locale/en-US/mood/mood.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,10 @@ mood-effect-LotoEnthrallment =
mood-effect-NicotineBenefit =
I feel as if I have been standing my entire life and I just sat down.
mood-effect-NicotineWithdrawal =
I could really go for a smoke right now.
I could really go for a smoke right now.
# Drugs
mood-effect-EthanolBenefit =
I feel so relaxed from drinking.
mood-effect-SpaceDrugsBenefit =
Woaaaah, such pretty colors maaaaan. It's like I can hear color and taste sound maaan.
2 changes: 1 addition & 1 deletion Resources/Locale/en-US/species/species.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

species-name-human = Human
species-name-dwarf = Dwarf
species-name-reptilian = Reptilian
species-name-reptilian = Unathi
species-name-slime = Slime Person
species-name-diona = Diona
species-name-arachnid = Arachnid
Expand Down
7 changes: 6 additions & 1 deletion Resources/Locale/en-US/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,9 @@ trait-description-LowDampening =
trait-name-HighDampening = kδ Proficient
trait-description-HighDampening =
You are skilled in the art of subtly manipulating the noösphere. Your powers are less likely to show unintended effects.
You are skilled in the art of subtly manipulating the noösphere. Your powers are less likely to show unintended effects.
trait-name-Azaziba = Sinta'Azaziba
trait-description-Azaziba =
A language of Moghes consisting of a combination of spoken word and gesticulation.
While waning since Moghes entered the galactic stage - it enjoys popular use by Unathi that never fell to the Hegemony's cultural dominance.
15 changes: 1 addition & 14 deletions Resources/Prototypes/Actions/psionics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,10 @@
event: !type:AnomalyPowerActionEvent
settings:
powerName: "Shadeskip"
overchargeFeedback: "shadeskip-overcharge-feedback"
overchargeCooldown: 120
overchargeRecoil:
groups:
Burn: -100 #This will be divided by the caster's Dampening.
minGlimmer: 6
maxGlimmer: 8
supercriticalGlimmerMultiplier: 3
glimmerSoundThreshold: 50
supercriticalThreshold: 500
doSupercritical: false
entitySpawnEntries:
- settings:
spawnOnPulse: true
Expand All @@ -254,13 +248,6 @@
maxRange: 1.5
spawns:
- ShadowKudzuWeak
- settings:
spawnOnSuperCritical: true
minAmount: 30
maxAmount: 50
maxRange: 50
spawns:
- ShadowKudzu
- settings:
spawnOnPulse: true
spawnOnSuperCritical: true
Expand Down
2 changes: 2 additions & 0 deletions Resources/Prototypes/CharacterItemGroups/languageGroups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
id: Elyran
- type: trait
id: ValyrianStandard
- type: trait
id: Azaziba

- type: characterItemGroup
id: TraitsAccents
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Mobs/Species/arachne.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
- DoorBumpOpener
- type: Bloodstream
bloodReagent: DemonsBlood
bloodRegenerationThirst: 4 # 1 unit of demon's blood satiates 4 thirst
- type: BloodSucker
webRequired: true
- type: Arachne
Expand Down
Loading

0 comments on commit b425262

Please sign in to comment.