forked from Simple-Station/Einstein-Engines
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] StepTriggerGroup to improve StepTriggerImmune behaviour (Si…
…mple-Station#53) * Ipc modifier added * StepTriggerGroup prototype and change in system. * fix change chemistry_effects.yml * types added in trigger/immunity * comments/clean * minor fix * another small fix * proto id / mouse landmine fix * CleanCode optimization + fixes * final * fix
- Loading branch information
1 parent
2f5e697
commit efcfc48
Showing
26 changed files
with
225 additions
and
7 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,77 @@ | ||
using Content.Shared.Damage.Prototypes; | ||
using Content.Shared.StepTrigger.Components; | ||
using Content.Shared.StepTrigger.Systems; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Serialization; | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; | ||
|
||
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 | ||
/// WD EDIT | ||
/// </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 != null) | ||
{ | ||
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 != null) | ||
{ | ||
return IsValid(component.TriggerGroups); | ||
} | ||
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); | ||
return false; | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
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,19 @@ | ||
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!; | ||
} | ||
} | ||
|
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.