mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
[Port] StepTriggerGroup From WhiteDream (#929)
# Description This is a port of https://github.com/WWhiteDreamProject/wwdpublic/pull/53 from White Dream. This PR improves the StepTriggerImmune component by making it operate on a more granular Blacklist system, such that StepTriggerImmune entities can further clarify via prototypes which kinds of floor traps they are immune to, such as landmines/mousetraps, and not have blanket immunity to everything. Because it turns out things like Lava and Soap also were caught by the immunity, when really we just wanted Harpies & Felinids to not trigger landmines. <details><summary><h1>Media</h1></summary> <p> > # Описание > Необходимо настроить модификатор урона, чтобы IPC не получали урон от осколков стекла. > > Иммунитет StepTriggerImmuneComponent доработан. Теперь имеются несколько типов (types): Lava - тип тайла, наступив на который появляется урон. Это собственно лава и LiquidPlasma Landmine - мины. Chasm - дырка в карте, куда можно провалиться Mousetrap - Мышеловка SlipTile - Все, что должно подскальзывать игроков, имеющее размер тайла SlipEntity - Все, что должно подскальзывать игроков, имеющее развер энтити. Разделено для баланса. Самые ловки могут игнорировать мелкие предметы (энтити), т.е. уворачиваться от них. Но большие по площади вещи (тайлы по типу разлитой воды, бананиума) просчитываются отдельно. > > # Изменения > * [x] Улучшить StepTriggerSystem (Immune) > * [x] Добавлены типы триггера. - Lava Landmine Shard Chasm Mousetrap SlipTile SlipEntity > * [x] Исправить осколки у IPC > * [x] Исправить отсутствие урона от лавы и падение в дыры у фелинидов и гарпий. > > 🆑 Hell_Cat > > * Feature: StepTriggerSystem is improved | Улучшена StepTriggerSystem > * fix: IPC: Immunity for shards and SpiderWeb | Иммунитет осколкам. > * fix: Felinid | Фелиниды : Immunity for Shard Landmine Mousetrap SlipEntities | Иммунитет для осколков, жидкости, мин, мышеловок, мыла и бананов. > * fix: Harpy | Гарпия : Immunity for Shards Landmine Mousetrap | Иммунитет для осколков, жидкости, мин и мышеловок. > * fix: Mice | Мыши : Don't blow up on landmines | Мыши не подрываются на минах. </p> </details> # Changelog 🆑 Hell_Cat Feature: StepTriggerSystem has been improved with new StepTriggerGroups. Additionally, the StepTriggerImmune component now allows declaring for specific StepTriggerGroups for a given entity to be immune to. Some examples may be, Felinids, Mice, and Harpies being unable to set off Landmines. --------- Signed-off-by: VMSolidus <evilexecutive@gmail.com> Co-authored-by: Ivan <126400932+HellCatten@users.noreply.github.com> Co-authored-by: FoxxoTrystan <45297731+FoxxoTrystan@users.noreply.github.com> # Conflicts: # Content.Shared/StepTrigger/Components/StepTriggerComponent.cs # Content.Shared/StepTrigger/Components/StepTriggerImmuneComponent.cs # Content.Shared/StepTrigger/Prototypes/StepTriggerGroup.cs # Content.Shared/StepTrigger/Prototypes/StepTriggerTypePrototype.cs # Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs # Resources/Prototypes/Entities/Effects/chemistry_effects.yml # Resources/Prototypes/Entities/Mobs/NPCs/animals.yml # Resources/Prototypes/Entities/Mobs/Player/ipc.yml # Resources/Prototypes/Entities/Mobs/Species/harpy.yml # Resources/Prototypes/Entities/Objects/Devices/mousetrap.yml # Resources/Prototypes/Entities/Objects/Devices/pda.yml # Resources/Prototypes/Entities/Objects/Fun/dice.yml # Resources/Prototypes/Entities/Objects/Materials/shards.yml # Resources/Prototypes/Entities/Objects/Misc/land_mine.yml # Resources/Prototypes/Entities/Objects/Specific/Janitorial/soap.yml # Resources/Prototypes/Entities/Tiles/bananium.yml # Resources/Prototypes/Entities/Tiles/chasm.yml # Resources/Prototypes/Entities/Tiles/lava.yml # Resources/Prototypes/Entities/Tiles/liquid_plasma.yml # Resources/Prototypes/Nyanotrasen/Entities/Mobs/Species/felinid.yml # Resources/Prototypes/Traits/skills.yml
This commit is contained in:
@@ -54,22 +54,18 @@ public sealed partial class StepTriggerComponent : Component
|
||||
public bool IgnoreWeightless;
|
||||
|
||||
/// <summary>
|
||||
/// Does this have separate "StepOn" and "StepOff" triggers.
|
||||
/// Does this have separate "StepOn" and "StepOff" triggers.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool StepOn = false;
|
||||
|
||||
/// <summary>
|
||||
/// If TriggerGroups is specified, it will check StepTriggerImmunityComponent to have the same TriggerType to activate immunity
|
||||
/// If TriggerGroups is specified, it will check StepTriggerImmunityComponent to have the same TriggerType to activate immunity
|
||||
/// </summary>
|
||||
// WD EDIT
|
||||
[DataField]
|
||||
public StepTriggerGroup? TriggerGroups;
|
||||
}
|
||||
|
||||
[RegisterComponent]
|
||||
[Access(typeof(StepTriggerSystem))]
|
||||
public sealed partial class StepTriggerActiveComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
public sealed partial class StepTriggerActiveComponent : Component { }
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Content.Shared.StepTrigger.Components;
|
||||
public sealed partial class StepTriggerImmuneComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// WhiteList of immunity step triggers.
|
||||
/// WhiteList of immunity step triggers.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public StepTriggerGroup? Whitelist;
|
||||
|
||||
@@ -1,77 +1,72 @@
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.StepTrigger.Components;
|
||||
using Content.Shared.StepTrigger.Systems;
|
||||
using Content.Shared.StepTrigger.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||
|
||||
namespace Content.Shared.StepTrigger.Prototypes
|
||||
namespace Content.Shared.StepTrigger.Prototypes;
|
||||
|
||||
/// <summary>
|
||||
/// A group of <see cref="StepTriggerTypePrototype">
|
||||
/// Used to determine StepTriggerTypes like Tags.
|
||||
/// Used for better work with Immunity.
|
||||
/// StepTriggerTypes in StepTriggerTypes.yml
|
||||
/// </summary>
|
||||
/// <code>
|
||||
/// stepTriggerGroups:
|
||||
/// types:
|
||||
/// - Lava
|
||||
/// - Landmine
|
||||
/// - Shard
|
||||
/// - Chasm
|
||||
/// - Mousetrap
|
||||
/// - SlipTile
|
||||
/// - SlipEntity
|
||||
/// </code>
|
||||
[DataDefinition]
|
||||
[Serializable, NetSerializable]
|
||||
public sealed partial class StepTriggerGroup
|
||||
{
|
||||
[DataField]
|
||||
public List<ProtoId<StepTriggerTypePrototype>>? Types = null;
|
||||
|
||||
/// <summary>
|
||||
/// A group of <see cref="StepTriggerTypePrototype">
|
||||
/// Used to determine StepTriggerTypes like Tags.
|
||||
/// Used for better work with Immunity.
|
||||
/// StepTriggerTypes in StepTriggerTypes.yml
|
||||
/// WD EDIT
|
||||
/// Checks if types of this StepTriggerGroup is similar to types of AnotherGroup
|
||||
/// </summary>
|
||||
/// <code>
|
||||
/// stepTriggerGroups:
|
||||
/// types:
|
||||
/// - Lava
|
||||
/// - Landmine
|
||||
/// - Shard
|
||||
/// - Chasm
|
||||
/// - Mousetrap
|
||||
/// - SlipTile
|
||||
/// - SlipEntity
|
||||
/// </code>
|
||||
[DataDefinition]
|
||||
[Serializable, NetSerializable]
|
||||
public sealed partial class StepTriggerGroup
|
||||
public bool IsValid(StepTriggerGroup? anotherGroup)
|
||||
{
|
||||
[DataField]
|
||||
public List<ProtoId<StepTriggerTypePrototype>>? Types = null;
|
||||
|
||||
/// <summary>
|
||||
/// Checks if types of this StepTriggerGroup is similar to types of AnotherGroup
|
||||
/// </summary>
|
||||
public bool IsValid(StepTriggerGroup? AnotherGroup)
|
||||
{
|
||||
if (Types != null)
|
||||
{
|
||||
foreach (var type in Types)
|
||||
{
|
||||
if (AnotherGroup != null
|
||||
&& AnotherGroup.Types != null
|
||||
&& AnotherGroup.Types.Contains(type))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (Types is null)
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks validation (if types of this StepTriggerGroup are similar to types of
|
||||
/// another StepTriggerComponent.
|
||||
/// </summary>
|
||||
public bool IsValid(StepTriggerComponent component)
|
||||
foreach (var type in Types)
|
||||
{
|
||||
if (component.TriggerGroups != null)
|
||||
{
|
||||
return IsValid(component.TriggerGroups);
|
||||
}
|
||||
return false;
|
||||
if (anotherGroup != null
|
||||
&& anotherGroup.Types != null
|
||||
&& anotherGroup.Types.Contains(type))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks validation (if types of this StepTriggerGroup are similar to types of
|
||||
/// another StepTriggerImmuneComponent.
|
||||
/// </summary>
|
||||
public bool IsValid(StepTriggerImmuneComponent component)
|
||||
{
|
||||
if (component.Whitelist != null)
|
||||
return IsValid(component.Whitelist);
|
||||
/// <summary>
|
||||
/// Checks validation (if types of this StepTriggerGroup are similar to types of
|
||||
/// another StepTriggerComponent.
|
||||
/// </summary>
|
||||
public bool IsValid(StepTriggerComponent component)
|
||||
{
|
||||
if (component.TriggerGroups is null)
|
||||
return false;
|
||||
}
|
||||
|
||||
return IsValid(component.TriggerGroups);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks validation (if types of this StepTriggerGroup are similar to types of
|
||||
/// another StepTriggerImmuneComponent.
|
||||
/// </summary>
|
||||
public bool IsValid(StepTriggerImmuneComponent component)
|
||||
{
|
||||
if (component.Whitelist is null)
|
||||
return false;
|
||||
|
||||
return IsValid(component.Whitelist);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared.StepTrigger.Prototypes
|
||||
{
|
||||
/// <summary>
|
||||
/// Prototype representing a StepTriggerType in YAML.
|
||||
/// Meant to only have an ID property, as that is the only thing that
|
||||
/// gets saved in StepTriggerGroup.
|
||||
/// </summary>
|
||||
// WD EDIT
|
||||
[Prototype("stepTriggerType")]
|
||||
public sealed partial class StepTriggerTypePrototype : IPrototype
|
||||
{
|
||||
[ViewVariables]
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
}
|
||||
}
|
||||
namespace Content.Shared.StepTrigger.Prototypes;
|
||||
|
||||
/// <summary>
|
||||
/// Prototype representing a StepTriggerType in YAML.
|
||||
/// Meant to only have an ID property, as that is the only thing that
|
||||
/// gets saved in StepTriggerGroup.
|
||||
/// </summary>
|
||||
[Prototype]
|
||||
public sealed partial class StepTriggerTypePrototype : IPrototype
|
||||
{
|
||||
[ViewVariables, IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Events;
|
||||
using Enumerable = System.Linq.Enumerable;
|
||||
|
||||
namespace Content.Shared.StepTrigger.Systems;
|
||||
|
||||
@@ -119,7 +118,6 @@ public sealed class StepTriggerSystem : EntitySystem
|
||||
|
||||
private bool CanTrigger(EntityUid uid, EntityUid otherUid, StepTriggerComponent component)
|
||||
{
|
||||
// WD EDIT START
|
||||
if (!component.Active
|
||||
|| component.CurrentlySteppedOn.Contains(otherUid))
|
||||
return false;
|
||||
@@ -129,7 +127,6 @@ public sealed class StepTriggerSystem : EntitySystem
|
||||
&& component.TriggerGroups != null
|
||||
&& component.TriggerGroups.IsValid(stepTriggerImmuneComponent))
|
||||
return false;
|
||||
// WD EDIT END
|
||||
|
||||
// Can't trigger if we don't ignore weightless entities
|
||||
// and the entity is flying or currently weightless
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
animationState: foam-dissolve
|
||||
- type: Slippery
|
||||
- type: StepTrigger
|
||||
triggerGroups: # WD EDIT
|
||||
triggerGroups:
|
||||
types:
|
||||
- SlipTile
|
||||
# disabled until foam reagent duplication is fixed
|
||||
|
||||
@@ -1689,10 +1689,10 @@
|
||||
- type: FireVisuals
|
||||
sprite: Mobs/Effects/onfire.rsi
|
||||
normalState: Mouse_burning
|
||||
- type: StepTriggerImmune # WD EDIT START
|
||||
- type: StepTriggerImmune
|
||||
whitelist:
|
||||
types:
|
||||
- Landmine # END
|
||||
- Landmine
|
||||
|
||||
- type: entity
|
||||
parent: MobMouse
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
- type: OfferItem
|
||||
- type: LayingDown
|
||||
- type: Carriable
|
||||
- type: StepTriggerImmune #WD EDIT
|
||||
- type: StepTriggerImmune
|
||||
whitelist:
|
||||
types:
|
||||
- Shard
|
||||
|
||||
@@ -114,6 +114,10 @@
|
||||
walkModifier: 0.75
|
||||
- type: SpeedModifierImmunity
|
||||
- type: NoSlip
|
||||
- type: StepTriggerImmune
|
||||
whitelist:
|
||||
types:
|
||||
- Shard
|
||||
|
||||
- type: entity
|
||||
parent: BaseSpeciesDummy
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
- GalacticCommon
|
||||
- SolCommon
|
||||
- type: StepTriggerImmune
|
||||
whitelist: # WD EDIT
|
||||
whitelist:
|
||||
types:
|
||||
- Shard
|
||||
- Landmine
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
- type: StepTrigger
|
||||
intersectRatio: 0.2
|
||||
requiredTriggeredSpeed: 0
|
||||
triggerGroups: # WD EDIT
|
||||
triggerGroups:
|
||||
types:
|
||||
- Mousetrap
|
||||
- type: Mousetrap
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
paralyzeTime: 4
|
||||
launchForwardsMultiplier: 1.5
|
||||
- type: StepTrigger
|
||||
triggerGroups: # WD EDIT
|
||||
triggerGroups:
|
||||
types:
|
||||
- SlipEntity
|
||||
- type: CollisionWake
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
mask:
|
||||
- ItemMask
|
||||
- type: StepTrigger
|
||||
triggerGroups: # WD EDIT
|
||||
triggerGroups:
|
||||
types:
|
||||
- Shard
|
||||
intersectRatio: 0.2
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
- !type:DoActsBehavior
|
||||
acts: [ "Destruction" ]
|
||||
- type: StepTrigger
|
||||
triggerGroups: # WD EDIT
|
||||
triggerGroups:
|
||||
types:
|
||||
- Shard
|
||||
intersectRatio: 0.2
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
params:
|
||||
maxDistance: 10
|
||||
- type: StepTrigger
|
||||
triggerGroups: # WD EDIT
|
||||
triggerGroups:
|
||||
types:
|
||||
- Landmine
|
||||
requiredTriggeredSpeed: 0
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
paralyzeTime: 2
|
||||
launchForwardsMultiplier: 1.5
|
||||
- type: StepTrigger
|
||||
triggerGroups: # WD EDIT
|
||||
triggerGroups:
|
||||
types:
|
||||
- SlipEntity
|
||||
intersectRatio: 0.2
|
||||
@@ -160,7 +160,7 @@
|
||||
paralyzeTime: 5
|
||||
launchForwardsMultiplier: 2.5
|
||||
- type: StepTrigger
|
||||
triggerGroups: # WD EDIT
|
||||
triggerGroups:
|
||||
types:
|
||||
- SlipEntity
|
||||
intersectRatio: 0.04
|
||||
@@ -204,7 +204,7 @@
|
||||
- type: Slippery
|
||||
paralyzeTime: 2
|
||||
- type: StepTrigger
|
||||
triggerGroups: # WD EDIT
|
||||
triggerGroups:
|
||||
types:
|
||||
- SlipEntity
|
||||
- type: Item
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
paralyzeTime: 2
|
||||
launchForwardsMultiplier: 1.5
|
||||
- type: StepTrigger
|
||||
triggerGroups: # WD EDIT
|
||||
triggerGroups:
|
||||
types:
|
||||
- SlipTile
|
||||
intersectRatio: 0.2
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
blacklist:
|
||||
tags:
|
||||
- Catwalk
|
||||
triggerGroups: # WD EDIT
|
||||
triggerGroups:
|
||||
types:
|
||||
- Chasm
|
||||
- type: Transform
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
blacklist:
|
||||
tags:
|
||||
- Catwalk
|
||||
triggerGroups: # WD EDIT
|
||||
triggerGroups:
|
||||
types:
|
||||
- Lava
|
||||
- type: Lava
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
blacklist:
|
||||
tags:
|
||||
- Catwalk
|
||||
triggerGroups: # WD EDIT
|
||||
triggerGroups:
|
||||
types:
|
||||
- Lava
|
||||
- type: Lava
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
stripTimeReduction: 0
|
||||
stripTimeMultiplier: 0.667
|
||||
- type: StepTriggerImmune
|
||||
whitelist: # WD EDIT
|
||||
whitelist:
|
||||
types:
|
||||
- Shard
|
||||
- Landmine
|
||||
|
||||
@@ -270,7 +270,7 @@
|
||||
points: -3
|
||||
components:
|
||||
- type: StepTriggerImmune
|
||||
whitelist: # WD EDIT
|
||||
whitelist:
|
||||
types:
|
||||
- Shard
|
||||
- Landmine
|
||||
|
||||
Reference in New Issue
Block a user