-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding shock collar and electropack (#30529)
* Adding shock collar with the new ShockOnTrigger * Cleaning and updating the shock collar * Add StripDelay datafield to ClothingComponent * Adding SelfUnremovableClothingComponent * ShockCollar Update * Correction of the shock collar * Correction of the shock collar 2 * Renaming the DamageSpecifier DataField to Damage * Fixing the damage field in ShockCollar * Cleaning the ShockCollar * Renaming ShockCollar to ClothingNeckShockCollar * Adding ClothingNeckShockCollar as a stealTarget to a thief * Fixing a typo of the sprite path in ClothingNeckShockCollar * Cleaning the ShockOnTriggerComponent * Revision of SelfUnremovableClothing * Adding a ClothingBackpackElectropack * Sprite fix * Code review * Shock Collar sprite update * add commit hash --------- Co-authored-by: Nemanja <[email protected]>
- Loading branch information
1 parent
02eed07
commit 6567fa3
Showing
29 changed files
with
326 additions
and
21 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
Content.Server/Explosion/Components/ShockOnTriggerComponent.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,37 @@ | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; | ||
using Content.Server.Explosion.EntitySystems; | ||
|
||
namespace Content.Server.Explosion.Components; | ||
|
||
/// <summary> | ||
/// A component that electrocutes an entity having this component when a trigger is triggered. | ||
/// </summary> | ||
[RegisterComponent, AutoGenerateComponentPause] | ||
[Access(typeof(TriggerSystem))] | ||
public sealed partial class ShockOnTriggerComponent : Component | ||
{ | ||
/// <summary> | ||
/// The force of an electric shock when the trigger is triggered. | ||
/// </summary> | ||
[DataField] | ||
public int Damage = 5; | ||
|
||
/// <summary> | ||
/// Duration of electric shock when the trigger is triggered. | ||
/// </summary> | ||
[DataField] | ||
public TimeSpan Duration = TimeSpan.FromSeconds(2); | ||
|
||
/// <summary> | ||
/// The minimum delay between repeating triggers. | ||
/// </summary> | ||
[DataField] | ||
public TimeSpan Cooldown = TimeSpan.FromSeconds(4); | ||
|
||
/// <summary> | ||
/// When can the trigger run again? | ||
/// </summary> | ||
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] | ||
[AutoPausedField] | ||
public TimeSpan NextTrigger = TimeSpan.Zero; | ||
} |
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
18 changes: 18 additions & 0 deletions
18
Content.Shared/Clothing/Components/SelfUnremovableClothingComponent.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,18 @@ | ||
using Content.Shared.Clothing.EntitySystems; | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared.Clothing.Components; | ||
|
||
/// <summary> | ||
/// The component prohibits the player from taking off clothes on them that have this component. | ||
/// </summary> | ||
/// <remarks> | ||
/// See also ClothingComponent.EquipDelay if you want the clothes that the player cannot take off by himself to be put on by the player with a delay. | ||
///</remarks> | ||
[NetworkedComponent] | ||
[RegisterComponent] | ||
[Access(typeof(SelfUnremovableClothingSystem))] | ||
public sealed partial class SelfUnremovableClothingComponent : Component | ||
{ | ||
|
||
} |
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
36 changes: 36 additions & 0 deletions
36
Content.Shared/Clothing/EntitySystems/SelfUnremovableClothingSystem.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,36 @@ | ||
using Content.Shared.Clothing.Components; | ||
using Content.Shared.Examine; | ||
using Content.Shared.Inventory; | ||
using Content.Shared.Inventory.Events; | ||
|
||
namespace Content.Shared.Clothing.EntitySystems; | ||
|
||
/// <summary> | ||
/// A system for the operation of a component that prohibits the player from taking off his own clothes that have this component. | ||
/// </summary> | ||
public sealed class SelfUnremovableClothingSystem : EntitySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<SelfUnremovableClothingComponent, BeingUnequippedAttemptEvent>(OnUnequip); | ||
SubscribeLocalEvent<SelfUnremovableClothingComponent, ExaminedEvent>(OnUnequipMarkup); | ||
} | ||
|
||
private void OnUnequip(Entity<SelfUnremovableClothingComponent> selfUnremovableClothing, ref BeingUnequippedAttemptEvent args) | ||
{ | ||
if (TryComp<ClothingComponent>(selfUnremovableClothing, out var clothing) && (clothing.Slots & args.SlotFlags) == SlotFlags.NONE) | ||
return; | ||
|
||
if (args.UnEquipTarget == args.Unequipee) | ||
{ | ||
args.Cancel(); | ||
} | ||
} | ||
|
||
private void OnUnequipMarkup(Entity<SelfUnremovableClothingComponent> selfUnremovableClothing, ref ExaminedEvent args) | ||
{ | ||
args.PushMarkup(Loc.GetString("comp-self-unremovable-clothing")); | ||
} | ||
} |
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
1 change: 1 addition & 0 deletions
1
Resources/Locale/en-US/clothing/components/self-unremovable-clothing-component.ftl
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 @@ | ||
comp-self-unremovable-clothing = This cannot be removed without outside help. |
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
36 changes: 36 additions & 0 deletions
36
Resources/Prototypes/Entities/Objects/Devices/shock_collar.yml
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,36 @@ | ||
- type: entity | ||
parent: Clothing | ||
id: ClothingNeckShockCollar | ||
name: shock collar | ||
suffix: SelfUnremovable | ||
description: An electric collar that shocks on the signal. | ||
components: | ||
- type: Item | ||
size: Small | ||
- type: Sprite | ||
sprite: Clothing/Neck/Misc/shock_collar.rsi | ||
state: icon | ||
- type: Clothing | ||
sprite: Clothing/Neck/Misc/shock_collar.rsi | ||
stripDelay: 10 | ||
equipDelay: 5 # to avoid accidentally falling into the trap associated with SelfUnremovableClothing | ||
quickEquip: true | ||
slots: | ||
- neck | ||
- type: SelfUnremovableClothing | ||
- type: ShockOnTrigger | ||
damage: 5 | ||
duration: 3 | ||
cooldown: 4 | ||
- type: TriggerOnSignal | ||
- type: DeviceLinkSink | ||
ports: | ||
- Trigger | ||
- type: GuideHelp | ||
guides: | ||
- Security | ||
- type: StealTarget | ||
stealGroup: ClothingNeckShockCollar | ||
- type: Tag | ||
tags: | ||
- WhitelistChameleon |
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.