-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Port] StepTriggerGroup From WhiteDream (#929)
# Description This is a port of WWhiteDreamProject/wwdpublic#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 :cl: 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 <[email protected]> Co-authored-by: Ivan <[email protected]> Co-authored-by: FoxxoTrystan <[email protected]>
- Loading branch information
1 parent
d6dd2ea
commit dee5a40
Showing
27 changed files
with
218 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using Content.Shared.StepTrigger.Components; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Serialization; | ||
|
||
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> | ||
/// Checks if types of this StepTriggerGroup is similar to types of AnotherGroup | ||
/// </summary> | ||
public bool IsValid(StepTriggerGroup? anotherGroup) | ||
{ | ||
if (Types is null) | ||
return false; | ||
|
||
foreach (var type in Types) | ||
{ | ||
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 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); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
Content.Shared/StepTrigger/Prototypes/StepTriggerTypePrototype.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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> | ||
[Prototype] | ||
public sealed partial class StepTriggerTypePrototype : IPrototype | ||
{ | ||
[ViewVariables, IdDataField] | ||
public string ID { get; private set; } = default!; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.