Files
wwdpublic/Content.Shared/StepTrigger/Components/StepTriggerComponent.cs
VMSolidus 91107d443c [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
2024-10-19 13:07:45 +07:00

72 lines
2.3 KiB
C#

using Content.Shared.StepTrigger.Prototypes;
using Content.Shared.StepTrigger.Systems;
using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
namespace Content.Shared.StepTrigger.Components;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
[Access(typeof(StepTriggerSystem))]
public sealed partial class StepTriggerComponent : Component
{
/// <summary>
/// List of entities that are currently colliding with the entity.
/// </summary>
[ViewVariables, AutoNetworkedField]
public HashSet<EntityUid> Colliding = new();
/// <summary>
/// The list of entities that are standing on this entity,
/// which shouldn't be able to trigger it again until stepping off.
/// </summary>
[ViewVariables, AutoNetworkedField]
public HashSet<EntityUid> CurrentlySteppedOn = new();
/// <summary>
/// Whether or not this component will currently try to trigger for entities.
/// </summary>
[DataField, AutoNetworkedField]
public bool Active = true;
/// <summary>
/// Ratio of shape intersection for a trigger to occur.
/// </summary>
[DataField, AutoNetworkedField]
public float IntersectRatio = 0.3f;
/// <summary>
/// Entities will only be triggered if their speed exceeds this limit.
/// </summary>
[DataField, AutoNetworkedField]
public float RequiredTriggeredSpeed = 3.5f;
/// <summary>
/// If any entities occupy the blacklist on the same tile then steptrigger won't work.
/// </summary>
[DataField]
public EntityWhitelist? Blacklist;
/// <summary>
/// If this is true, steptrigger will still occur on entities that are in air / weightless. They do not
/// by default.
/// </summary>
[DataField, AutoNetworkedField]
public bool IgnoreWeightless;
/// <summary>
/// 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
/// </summary>
[DataField]
public StepTriggerGroup? TriggerGroups;
}
[RegisterComponent]
[Access(typeof(StepTriggerSystem))]
public sealed partial class StepTriggerActiveComponent : Component { }