Merge remote-tracking branch 'upstream/stable' into ed-27-05-2025-upstream-sync

# Conflicts:
#	.github/CODEOWNERS
#	Content.Client/Guidebook/Controls/GuideReagentReaction.xaml.cs
#	Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs
#	Content.Server/Procedural/DungeonJob/DungeonJob.OreDunGen.cs
#	Resources/Prototypes/Entities/Effects/chemistry_effects.yml
#	Resources/Prototypes/Entities/Mobs/Customization/Markings/human_hair.yml
#	Resources/Prototypes/GameRules/meteorswarms.yml
#	Resources/Prototypes/Procedural/dungeon_configs.yml
This commit is contained in:
Ed
2025-05-27 12:21:14 +03:00
1165 changed files with 76878 additions and 44718 deletions

View File

@@ -0,0 +1,33 @@
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Shared.EntityEffects;
using Robust.Shared.Prototypes;
namespace Content.Server.EntityEffects.EffectConditions;
/// <summary>
/// Condition for if the entity is successfully breathing.
/// </summary>
public sealed partial class Breathing : EntityEffectCondition
{
/// <summary>
/// If true, the entity must not have trouble breathing to pass.
/// </summary>
[DataField]
public bool IsBreathing = true;
public override bool Condition(EntityEffectBaseArgs args)
{
if (!args.EntityManager.TryGetComponent(args.TargetEntity, out RespiratorComponent? respiratorComp))
return !IsBreathing; // They do not breathe.
var breathingState = args.EntityManager.System<RespiratorSystem>().IsBreathing((args.TargetEntity, respiratorComp));
return IsBreathing == breathingState;
}
public override string GuidebookExplanation(IPrototypeManager prototype)
{
return Loc.GetString("reagent-effect-condition-guidebook-breathing",
("isBreathing", IsBreathing));
}
}

View File

@@ -0,0 +1,31 @@
using Content.Shared.Body.Components;
using Content.Shared.EntityEffects;
using Robust.Shared.Prototypes;
namespace Content.Server.EntityEffects.EffectConditions;
/// <summary>
/// Condition for if the entity is or isn't wearing internals.
/// </summary>
public sealed partial class Internals : EntityEffectCondition
{
/// <summary>
/// To pass, the entity's internals must have this same state.
/// </summary>
[DataField]
public bool UsingInternals = true;
public override bool Condition(EntityEffectBaseArgs args)
{
if (!args.EntityManager.TryGetComponent(args.TargetEntity, out InternalsComponent? internalsComp))
return !UsingInternals; // They have no internals to wear.
var internalsState = internalsComp.GasTankEntity == null;
return UsingInternals == internalsState;
}
public override string GuidebookExplanation(IPrototypeManager prototype)
{
return Loc.GetString("reagent-effect-condition-guidebook-internals", ("usingInternals", UsingInternals));
}
}

View File

@@ -8,34 +8,49 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
namespace Content.Server.EntityEffects.Effects;
/// <summary>
/// Tries to force someone to emote (scream, laugh, etc). Still respects whitelists/blacklists and other limits of the specified emote unless forced.
/// Tries to force someone to emote (scream, laugh, etc). Still respects whitelists/blacklists and other limits unless specially forced.
/// </summary>
[UsedImplicitly]
public sealed partial class Emote : EntityEffect
{
[DataField("emote", customTypeSerializer: typeof(PrototypeIdSerializer<EmotePrototype>))]
public string? EmoteId;
/// <summary>
/// The emote the entity will preform.
/// </summary>
[DataField("emote", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EmotePrototype>))]
public string EmoteId;
/// <summary>
/// If the emote should be recorded in chat.
/// </summary>
[DataField]
public bool ShowInChat;
/// <summary>
/// If the forced emote will be listed in the guidebook.
/// </summary>
[DataField]
public bool ShowInGuidebook;
/// <summary>
/// If true, the entity will preform the emote even if they normally can't.
/// </summary>
[DataField]
public bool Force = false;
// JUSTIFICATION: Emoting is flavor, so same reason popup messages are not in here.
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> null;
{
if (!ShowInGuidebook)
return null; // JUSTIFICATION: Emoting is mostly flavor, so same reason popup messages are not in here.
return Loc.GetString("reagent-effect-guidebook-emote", ("chance", Probability), ("emote", EmoteId));
}
public override void Effect(EntityEffectBaseArgs args)
{
if (EmoteId == null)
return;
var chatSys = args.EntityManager.System<ChatSystem>();
if (ShowInChat)
chatSys.TryEmoteWithChat(args.TargetEntity, EmoteId, ChatTransmitRange.GhostRangeLimit, forceEmote: Force);
else
chatSys.TryEmoteWithoutChat(args.TargetEntity, EmoteId);
}
}

View File

@@ -0,0 +1,141 @@
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.EntityEffects;
using Content.Shared.FixedPoint;
using Content.Shared.Localizations;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Server.EntityEffects.Effects;
/// <summary>
/// Version of <see cref="HealthChange"/> that distributes the healing to groups
/// </summary>
[UsedImplicitly]
public sealed partial class EvenHealthChange : EntityEffect
{
/// <summary>
/// Damage to heal, collected into entire damage groups.
/// </summary>
[DataField(required: true)]
public Dictionary<ProtoId<DamageGroupPrototype>, FixedPoint2> Damage = new();
/// <summary>
/// Should this effect scale the damage by the amount of chemical in the solution?
/// Useful for touch reactions, like styptic powder or acid.
/// Only usable if the EntityEffectBaseArgs is an EntityEffectReagentArgs.
/// </summary>
[DataField]
public bool ScaleByQuantity;
/// <summary>
/// Should this effect ignore damage modifiers?
/// </summary>
[DataField]
public bool IgnoreResistances = true;
protected override string ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
{
var damages = new List<string>();
var heals = false;
var deals = false;
var damagableSystem = entSys.GetEntitySystem<DamageableSystem>();
var universalReagentDamageModifier = damagableSystem.UniversalReagentDamageModifier;
var universalReagentHealModifier = damagableSystem.UniversalReagentHealModifier;
foreach (var (group, amount) in Damage)
{
var groupProto = prototype.Index(group);
var sign = FixedPoint2.Sign(amount);
var mod = 1f;
if (sign < 0)
{
heals = true;
mod = universalReagentHealModifier;
}
else if (sign > 0)
{
deals = true;
mod = universalReagentDamageModifier;
}
damages.Add(
Loc.GetString("health-change-display",
("kind", groupProto.LocalizedName),
("amount", MathF.Abs(amount.Float() * mod)),
("deltasign", sign)
));
}
var healsordeals = heals ? (deals ? "both" : "heals") : (deals ? "deals" : "none");
return Loc.GetString("reagent-effect-guidebook-even-health-change",
("chance", Probability),
("changes", ContentLocalizationManager.FormatList(damages)),
("healsordeals", healsordeals));
}
public override void Effect(EntityEffectBaseArgs args)
{
if (!args.EntityManager.TryGetComponent<DamageableComponent>(args.TargetEntity, out var damageable))
return;
var protoMan = IoCManager.Resolve<IPrototypeManager>();
var scale = FixedPoint2.New(1);
if (args is EntityEffectReagentArgs reagentArgs)
{
scale = ScaleByQuantity ? reagentArgs.Quantity * reagentArgs.Scale : reagentArgs.Scale;
}
var damagableSystem = args.EntityManager.System<DamageableSystem>();
var universalReagentDamageModifier = damagableSystem.UniversalReagentDamageModifier;
var universalReagentHealModifier = damagableSystem.UniversalReagentHealModifier;
var dspec = new DamageSpecifier();
foreach (var (group, amount) in Damage)
{
var groupProto = protoMan.Index(group);
var groupDamage = new Dictionary<string, FixedPoint2>();
foreach (var damageId in groupProto.DamageTypes)
{
var damageAmount = damageable.Damage.DamageDict.GetValueOrDefault(damageId);
if (damageAmount != FixedPoint2.Zero)
groupDamage.Add(damageId, damageAmount);
}
var sum = groupDamage.Values.Sum();
foreach (var (damageId, damageAmount) in groupDamage)
{
var existing = dspec.DamageDict.GetOrNew(damageId);
dspec.DamageDict[damageId] = existing + damageAmount / sum * amount;
}
}
if (universalReagentDamageModifier != 1 || universalReagentHealModifier != 1)
{
foreach (var (type, val) in dspec.DamageDict)
{
if (val < 0f)
{
dspec.DamageDict[type] = val * universalReagentHealModifier;
}
if (val > 0f)
{
dspec.DamageDict[type] = val * universalReagentDamageModifier;
}
}
}
damagableSystem.TryChangeDamage(
args.TargetEntity,
dspec * scale,
IgnoreResistances,
interruptsDoAfters: false);
}
}

View File

@@ -64,48 +64,6 @@ namespace Content.Server.EntityEffects.Effects
damageSpec = entSys.GetEntitySystem<DamageableSystem>().ApplyUniversalAllModifiers(damageSpec);
foreach (var group in prototype.EnumeratePrototypes<DamageGroupPrototype>())
{
if (!damageSpec.TryGetDamageInGroup(group, out var amount))
continue;
var relevantTypes = damageSpec.DamageDict
.Where(x => x.Value != FixedPoint2.Zero && group.DamageTypes.Contains(x.Key)).ToList();
if (relevantTypes.Count != group.DamageTypes.Count)
continue;
var sum = FixedPoint2.Zero;
foreach (var type in group.DamageTypes)
{
sum += damageSpec.DamageDict.GetValueOrDefault(type);
}
// if the total sum of all the types equal the damage amount,
// assume that they're evenly distributed.
if (sum != amount)
continue;
var sign = FixedPoint2.Sign(amount);
if (sign < 0)
heals = true;
if (sign > 0)
deals = true;
damages.Add(
Loc.GetString("health-change-display",
("kind", group.LocalizedName),
("amount", MathF.Abs(amount.Float())),
("deltasign", sign)
));
foreach (var type in group.DamageTypes)
{
damageSpec.DamageDict.Remove(type);
}
}
foreach (var (kind, amount) in damageSpec.DamageDict)
{
var sign = FixedPoint2.Sign(amount);