Rodents can be Faxecuted (executed via Fax machine) (#21461)
* Rodents can be Faxecuted (executed via Fax machine) * use brute instead of new group. * fax visuals now use tags for mouse and hamster instead of comps * fix for ubuntu, damn ubuntu bane of my life * cant copy hamlet, can now faxecute mothroaches. * fix * fix * fixes * removed ifs now using switch, removed hastag now using string. * fixes and no more switch * cleanup * more cleanup * fix * cleanup * moved damage out of faxmachine and into own system and component. * changes * fixes and done i think. * tidy * Fixes --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
48
Content.Client/Fax/System/FaxVisualsSystem.cs
Normal file
48
Content.Client/Fax/System/FaxVisualsSystem.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Robust.Client.GameObjects;
|
||||
using Content.Shared.Fax.Components;
|
||||
using Content.Shared.Fax;
|
||||
using Robust.Client.Animations;
|
||||
|
||||
namespace Content.Client.Fax.System;
|
||||
|
||||
/// <summary>
|
||||
/// Visualizer for the fax machine which displays the correct sprite based on the inserted entity.
|
||||
/// </summary>
|
||||
public sealed class FaxVisualsSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AnimationPlayerSystem _player = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<FaxMachineComponent, AppearanceChangeEvent>(OnAppearanceChanged);
|
||||
}
|
||||
|
||||
private void OnAppearanceChanged(EntityUid uid, FaxMachineComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
if (args.Sprite == null)
|
||||
return;
|
||||
|
||||
if (_appearance.TryGetData(uid, FaxMachineVisuals.VisualState, out FaxMachineVisualState visuals) && visuals == FaxMachineVisualState.Inserting)
|
||||
{
|
||||
_player.Play(uid, new Animation()
|
||||
{
|
||||
Length = TimeSpan.FromSeconds(2.4),
|
||||
AnimationTracks =
|
||||
{
|
||||
new AnimationTrackSpriteFlick()
|
||||
{
|
||||
LayerKey = FaxMachineVisuals.VisualState,
|
||||
KeyFrames =
|
||||
{
|
||||
new AnimationTrackSpriteFlick.KeyFrame(component.InsertingState, 0f),
|
||||
new AnimationTrackSpriteFlick.KeyFrame("icon", 2.4f),
|
||||
}
|
||||
}
|
||||
}
|
||||
}, "faxecute");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.DeviceNetwork.Components;
|
||||
using Content.Server.EUI;
|
||||
using Content.Shared.Eui;
|
||||
using Content.Shared.Fax.Components;
|
||||
using Content.Shared.Fax;
|
||||
using Content.Shared.Follower;
|
||||
using Content.Shared.Ghost;
|
||||
|
||||
@@ -16,7 +16,10 @@ using Content.Shared.DeviceNetwork;
|
||||
using Content.Shared.Emag.Components;
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.Fax;
|
||||
using Content.Shared.Fax.Systems;
|
||||
using Content.Shared.Fax.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Paper;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
@@ -42,6 +45,7 @@ public sealed class FaxSystem : EntitySystem
|
||||
[Dependency] private readonly UserInterfaceSystem _userInterface = default!;
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
[Dependency] private readonly FaxecuteSystem _faxecute = default!;
|
||||
|
||||
private const string PaperSlotId = "Paper";
|
||||
|
||||
@@ -313,11 +317,17 @@ public sealed class FaxSystem : EntitySystem
|
||||
|
||||
private void OnCopyButtonPressed(EntityUid uid, FaxMachineComponent component, FaxCopyMessage args)
|
||||
{
|
||||
if (HasComp<MobStateComponent>(component.PaperSlot.Item))
|
||||
_faxecute.Faxecute(uid, component); /// when button pressed it will hurt the mob.
|
||||
else
|
||||
Copy(uid, component, args);
|
||||
}
|
||||
|
||||
private void OnSendButtonPressed(EntityUid uid, FaxMachineComponent component, FaxSendMessage args)
|
||||
{
|
||||
if (HasComp<MobStateComponent>(component.PaperSlot.Item))
|
||||
_faxecute.Faxecute(uid, component); /// when button pressed it will hurt the mob.
|
||||
else
|
||||
Send(uid, component, args.Actor);
|
||||
}
|
||||
|
||||
@@ -336,14 +346,20 @@ public sealed class FaxSystem : EntitySystem
|
||||
if (!Resolve(uid, ref component))
|
||||
return;
|
||||
|
||||
if (TryComp<FaxableObjectComponent>(component.PaperSlot.Item, out var faxable))
|
||||
component.InsertingState = faxable.InsertingState;
|
||||
|
||||
|
||||
if (component.InsertingTimeRemaining > 0)
|
||||
{
|
||||
_appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
else if (component.PrintingTimeRemaining > 0)
|
||||
_appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Printing);
|
||||
else
|
||||
_appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Normal);
|
||||
}
|
||||
|
||||
private void UpdateUserInterface(EntityUid uid, FaxMachineComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.Fax;
|
||||
using Content.Shared.Fax.Components;
|
||||
using Content.Server.Paper;
|
||||
using Content.Server.Station.Components;
|
||||
using Content.Server.Station.Systems;
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Paper;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.Fax;
|
||||
namespace Content.Shared.Fax.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class FaxMachineComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
@@ -16,6 +17,13 @@ public sealed partial class FaxMachineComponent : Component
|
||||
[DataField("name")]
|
||||
public string FaxName { get; set; } = "Unknown";
|
||||
|
||||
/// <summary>
|
||||
/// Sprite to use when inserting an object.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField, AutoNetworkedField]
|
||||
public string InsertingState = "inserting";
|
||||
|
||||
/// <summary>
|
||||
/// Device address of fax in network to which data will be send
|
||||
/// </summary>
|
||||
@@ -26,7 +34,7 @@ public sealed partial class FaxMachineComponent : Component
|
||||
/// <summary>
|
||||
/// Contains the item to be sent, assumes it's paper...
|
||||
/// </summary>
|
||||
[DataField("paperSlot", required: true)]
|
||||
[DataField(required: true)]
|
||||
public ItemSlot PaperSlot = new();
|
||||
|
||||
/// <summary>
|
||||
@@ -34,39 +42,39 @@ public sealed partial class FaxMachineComponent : Component
|
||||
/// This will make it visible to others on the network
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("responsePings")]
|
||||
[DataField]
|
||||
public bool ResponsePings { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Should admins be notified on message receive
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("notifyAdmins")]
|
||||
[DataField]
|
||||
public bool NotifyAdmins { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Should that fax receive nuke codes send by admins. Probably should be captain fax only
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("receiveNukeCodes")]
|
||||
[DataField]
|
||||
public bool ReceiveNukeCodes { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Sound to play when fax has been emagged
|
||||
/// </summary>
|
||||
[DataField("emagSound")]
|
||||
[DataField]
|
||||
public SoundSpecifier EmagSound = new SoundCollectionSpecifier("sparks");
|
||||
|
||||
/// <summary>
|
||||
/// Sound to play when fax printing new message
|
||||
/// </summary>
|
||||
[DataField("printSound")]
|
||||
[DataField]
|
||||
public SoundSpecifier PrintSound = new SoundPathSpecifier("/Audio/Machines/printer.ogg");
|
||||
|
||||
/// <summary>
|
||||
/// Sound to play when fax successfully send message
|
||||
/// </summary>
|
||||
[DataField("sendSound")]
|
||||
[DataField]
|
||||
public SoundSpecifier SendSound = new SoundPathSpecifier("/Audio/Machines/high_tech_confirm.ogg");
|
||||
|
||||
/// <summary>
|
||||
@@ -79,27 +87,27 @@ public sealed partial class FaxMachineComponent : Component
|
||||
/// Print queue of the incoming message
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("printingQueue")]
|
||||
[DataField]
|
||||
public Queue<FaxPrintout> PrintingQueue { get; private set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Message sending timeout
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("sendTimeoutRemaining")]
|
||||
[DataField]
|
||||
public float SendTimeoutRemaining;
|
||||
|
||||
/// <summary>
|
||||
/// Message sending timeout
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("sendTimeout")]
|
||||
[DataField]
|
||||
public float SendTimeout = 5f;
|
||||
|
||||
/// <summary>
|
||||
/// Remaining time of inserting animation
|
||||
/// </summary>
|
||||
[DataField("insertingTimeRemaining")]
|
||||
[DataField]
|
||||
public float InsertingTimeRemaining;
|
||||
|
||||
/// <summary>
|
||||
@@ -111,7 +119,7 @@ public sealed partial class FaxMachineComponent : Component
|
||||
/// <summary>
|
||||
/// Remaining time of printing animation
|
||||
/// </summary>
|
||||
[DataField("printingTimeRemaining")]
|
||||
[DataField]
|
||||
public float PrintingTimeRemaining;
|
||||
|
||||
/// <summary>
|
||||
@@ -124,13 +132,13 @@ public sealed partial class FaxMachineComponent : Component
|
||||
[DataDefinition]
|
||||
public sealed partial class FaxPrintout
|
||||
{
|
||||
[DataField("name", required: true)]
|
||||
[DataField(required: true)]
|
||||
public string Name { get; private set; } = default!;
|
||||
|
||||
[DataField("content", required: true)]
|
||||
[DataField(required: true)]
|
||||
public string Content { get; private set; } = default!;
|
||||
|
||||
[DataField("prototypeId", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>), required: true)]
|
||||
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>), required: true)]
|
||||
public string PrototypeId { get; private set; } = default!;
|
||||
|
||||
[DataField("stampState")]
|
||||
16
Content.Shared/Fax/Components/FaxableObjectComponent.cs
Normal file
16
Content.Shared/Fax/Components/FaxableObjectComponent.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Fax.Components;
|
||||
/// <summary>
|
||||
/// Entity with this component can be faxed.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class FaxableObjectComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Sprite to use when inserting an object.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField, AutoNetworkedField]
|
||||
public string InsertingState = "inserting";
|
||||
}
|
||||
19
Content.Shared/Fax/Components/FaxecuteComponent.cs
Normal file
19
Content.Shared/Fax/Components/FaxecuteComponent.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Content.Shared.Damage;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Fax.Components;
|
||||
|
||||
/// <summary>
|
||||
/// A fax component which stores a damage specifier for attempting to fax a mob.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class FaxecuteComponent : Component
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Type of damage dealt when entity is faxecuted.
|
||||
/// </summary>
|
||||
[DataField(required: true), AutoNetworkedField]
|
||||
public DamageSpecifier Damage = new();
|
||||
}
|
||||
|
||||
9
Content.Shared/Fax/DamageOnFaxecuteEvent.cs
Normal file
9
Content.Shared/Fax/DamageOnFaxecuteEvent.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
namespace Content.Shared.Fax.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Event for killing any mob within the fax machine.
|
||||
/// </summary
|
||||
[ByRefEvent]
|
||||
public record struct DamageOnFaxecuteEvent(FaxMachineComponent? Action);
|
||||
|
||||
34
Content.Shared/Fax/Systems/FaxecuteSystem.cs
Normal file
34
Content.Shared/Fax/Systems/FaxecuteSystem.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Fax.Components;
|
||||
|
||||
namespace Content.Shared.Fax.Systems;
|
||||
/// <summary>
|
||||
/// System for handling execution of a mob within fax when copy or send attempt is made.
|
||||
/// </summary>
|
||||
public sealed class FaxecuteSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
}
|
||||
|
||||
public void Faxecute(EntityUid uid, FaxMachineComponent component, DamageOnFaxecuteEvent? args = null)
|
||||
{
|
||||
var sendEntity = component.PaperSlot.Item;
|
||||
if (sendEntity == null)
|
||||
return;
|
||||
|
||||
if (!TryComp<FaxecuteComponent>(uid, out var faxecute))
|
||||
return;
|
||||
|
||||
var damageSpec = faxecute.Damage;
|
||||
_damageable.TryChangeDamage(sendEntity, damageSpec);
|
||||
_popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-error", ("target", uid)), uid, PopupType.LargeCaution);
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ fax-machine-popup-received = Received correspondence from { $from }.
|
||||
fax-machine-popup-name-long = Fax name is too long
|
||||
fax-machine-popup-name-exist = Fax with same name already exist in network
|
||||
fax-machine-popup-name-set = Fax name has been updated
|
||||
fax-machine-popup-error = ERROR - jam in paper feed
|
||||
fax-machine-popup-copy-error = ERROR - unable to copy!
|
||||
|
||||
fax-machine-dialog-rename = Rename
|
||||
fax-machine-dialog-field-name = Name
|
||||
|
||||
@@ -432,6 +432,8 @@
|
||||
- type: Speech
|
||||
speechVerb: Moth
|
||||
speechSounds: Squeak
|
||||
- type: FaxableObject
|
||||
insertingState: inserting_mothroach
|
||||
- type: MothAccent
|
||||
- type: Sprite
|
||||
sprite: Mobs/Animals/mothroach.rsi
|
||||
@@ -1535,6 +1537,8 @@
|
||||
rootTask:
|
||||
task: MouseCompound
|
||||
- type: Physics
|
||||
- type: FaxableObject
|
||||
insertingState: inserting_mouse
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
fix1:
|
||||
@@ -3049,6 +3053,8 @@
|
||||
- type: Item
|
||||
size: Tiny
|
||||
- type: Physics
|
||||
- type: FaxableObject
|
||||
insertingState: inserting_hamster
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
fix1:
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
- Trash
|
||||
- Paper
|
||||
- type: Appearance
|
||||
- type: FaxableObject
|
||||
- type: PaperVisuals
|
||||
- type: Flammable
|
||||
fireSpread: true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- type: entity
|
||||
- type: entity
|
||||
parent: BaseMachinePowered
|
||||
id: FaxMachineBase
|
||||
name: long range fax machine
|
||||
@@ -9,7 +9,7 @@
|
||||
drawdepth: SmallObjects
|
||||
layers:
|
||||
- state: icon
|
||||
map: ["base"]
|
||||
map: [ "enum.FaxMachineVisuals.VisualState" ]
|
||||
- type: Icon
|
||||
sprite: Structures/Machines/fax_machine.rsi
|
||||
state: icon
|
||||
@@ -36,23 +36,27 @@
|
||||
type: FaxBoundUi
|
||||
- type: ApcPowerReceiver
|
||||
powerLoad: 250
|
||||
- type: Faxecute
|
||||
damage:
|
||||
types:
|
||||
Blunt: 100
|
||||
- type: FaxMachine
|
||||
paperSlot:
|
||||
insertSound: /Audio/Machines/scanning.ogg
|
||||
ejectSound: /Audio/Machines/tray_eject.ogg
|
||||
whitelist:
|
||||
components:
|
||||
- Paper
|
||||
- FaxableObject #used to be PaperComponent - brainfood1183
|
||||
- type: GenericVisualizer
|
||||
visuals:
|
||||
enum.PowerDeviceVisuals.Powered:
|
||||
base:
|
||||
enum.FaxMachineVisuals.VisualState:
|
||||
True: { state: idle }
|
||||
False: { state: icon }
|
||||
enum.FaxMachineVisuals.VisualState:
|
||||
base:
|
||||
Inserting: { state: inserting }
|
||||
enum.FaxMachineVisuals.VisualState:
|
||||
Printing: { state: printing }
|
||||
Normal: {state: idle}
|
||||
- type: ItemSlots
|
||||
- type: ContainerContainer
|
||||
containers:
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
@@ -40,6 +40,63 @@
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "inserting_hamster",
|
||||
"delays": [
|
||||
[
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "inserting_mothroach",
|
||||
"delays": [
|
||||
[
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "inserting_mouse",
|
||||
"delays": [
|
||||
[
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "printing",
|
||||
"delays": [
|
||||
|
||||
Reference in New Issue
Block a user