Add Modular grenades (chemnades). (#7138)
@@ -21,8 +21,9 @@ namespace Content.Client.Entry
|
||||
"WarpPoint",
|
||||
"EmitSoundOnUse",
|
||||
"EmitSoundOnLand",
|
||||
"NameIdentifier",
|
||||
"EmitSoundOnTrigger",
|
||||
"EmitSoundOnActivate",
|
||||
"NameIdentifier",
|
||||
"HeatResistance",
|
||||
"EntityStorage",
|
||||
"MeleeWeapon",
|
||||
@@ -101,7 +102,6 @@ namespace Content.Client.Entry
|
||||
"SolarControlConsole",
|
||||
"Thruster",
|
||||
"FlashOnTrigger",
|
||||
"SoundOnTrigger",
|
||||
"TriggerOnCollide",
|
||||
"DeleteOnTrigger",
|
||||
"EmptyOnMachineDeconstruct",
|
||||
|
||||
@@ -90,7 +90,7 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
("desc", Loc.GetString(proto.PhysicalDescription))));
|
||||
}
|
||||
|
||||
private void UpdateAppearance(EntityUid uid, Solution solution,
|
||||
public void UpdateAppearance(EntityUid uid, Solution solution,
|
||||
AppearanceComponent? appearanceComponent = null)
|
||||
{
|
||||
if (!EntityManager.EntityExists(uid)
|
||||
@@ -116,7 +116,7 @@ public sealed partial class SolutionContainerSystem : EntitySystem
|
||||
return splitSol;
|
||||
}
|
||||
|
||||
private void UpdateChemicals(EntityUid uid, Solution solutionHolder, bool needsReactionsProcessing = false)
|
||||
public void UpdateChemicals(EntityUid uid, Solution solutionHolder, bool needsReactionsProcessing = false)
|
||||
{
|
||||
// Process reactions
|
||||
if (needsReactionsProcessing && solutionHolder.CanReact)
|
||||
|
||||
32
Content.Server/Construction/Completions/AdminLog.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Database;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Construction.Completions;
|
||||
|
||||
/// <summary>
|
||||
/// Generate an admin log upon reaching this node. Useful for dangerous construction (e.g., modular grenades)
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
public sealed class AdminLog : IGraphAction
|
||||
{
|
||||
[DataField("logType", required: true)]
|
||||
public LogType LogType = LogType.Construction;
|
||||
|
||||
[DataField("impact")]
|
||||
public LogImpact Impact = LogImpact.Medium;
|
||||
|
||||
[DataField("message", required: true)]
|
||||
public string Message = string.Empty;
|
||||
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
var logSys = entityManager.EntitySysManager.GetEntitySystem<AdminLogSystem>();
|
||||
|
||||
if (userUid.HasValue)
|
||||
logSys.Add(LogType, Impact, $"{Message} - Entity: {entityManager.ToPrettyString(uid):entity}, User: {entityManager.ToPrettyString(userUid.Value):user}");
|
||||
else
|
||||
logSys.Add(LogType, Impact, $"{Message} - Entity: {entityManager.ToPrettyString(uid):entity}");
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,9 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Sound;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Construction.Completions
|
||||
{
|
||||
@@ -16,9 +13,17 @@ namespace Content.Server.Construction.Completions
|
||||
{
|
||||
[DataField("sound", required: true)] public SoundSpecifier Sound { get; private set; } = default!;
|
||||
|
||||
[DataField("AudioParams")]
|
||||
public AudioParams AudioParams = AudioParams.Default;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("variation")]
|
||||
public float Variation = 0.125f;
|
||||
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(uid), Sound.GetSound(), uid, AudioHelpers.WithVariation(0.125f));
|
||||
var scale = (float) IoCManager.Resolve<IRobustRandom>().NextGaussian(1, Variation);
|
||||
SoundSystem.Play(Filter.Pvs(uid, entityManager: entityManager), Sound.GetSound(), uid, AudioParams.WithPitchScale(scale));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Server.Explosion.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Component for tracking active trigger timers. A timers can activated by some other component, e.g. <see cref="OnUseTimerTriggerComponent"/>.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class ActiveTimerTriggerComponent : Component
|
||||
{
|
||||
[DataField("timeRemaining")]
|
||||
public float TimeRemaining;
|
||||
|
||||
[DataField("user")]
|
||||
public EntityUid? User;
|
||||
|
||||
[DataField("beepInterval")]
|
||||
public float BeepInterval;
|
||||
|
||||
[DataField("timeUntilBeep")]
|
||||
public float TimeUntilBeep;
|
||||
|
||||
[DataField("beepSound")]
|
||||
public SoundSpecifier? BeepSound;
|
||||
|
||||
[DataField("beepParams")]
|
||||
public AudioParams BeepParams = AudioParams.Default;
|
||||
}
|
||||
@@ -1,11 +1,36 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Server.Explosion.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class OnUseTimerTriggerComponent : Component
|
||||
{
|
||||
[DataField("delay")] public float Delay = 0f;
|
||||
[DataField("delay")]
|
||||
public float Delay = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// If not null, a user can use verbs to configure the delay to one of these options.
|
||||
/// </summary>
|
||||
[DataField("delayOptions")]
|
||||
public List<float>? DelayOptions = null;
|
||||
|
||||
/// <summary>
|
||||
/// If not null, this timer will periodically play this sound wile active.
|
||||
/// </summary>
|
||||
[DataField("beepSound")]
|
||||
public SoundSpecifier? BeepSound;
|
||||
|
||||
/// <summary>
|
||||
/// Time before beeping starts. Defaults to a single beep interval. If set to zero, will emit a beep immediately after use.
|
||||
/// </summary>
|
||||
[DataField("initialBeepDelay")]
|
||||
public float? InitialBeepDelay;
|
||||
|
||||
[DataField("beepInterval")]
|
||||
public float BeepInterval = 1;
|
||||
|
||||
[DataField("beepParams")]
|
||||
public AudioParams BeepParams = AudioParams.Default.WithVolume(-2f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
using Content.Server.Explosion.EntitySystems;
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Explosion.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Whenever a <see cref="TriggerEvent"/> is run play a sound in PVS range.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class SoundOnTriggerComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("sound")]
|
||||
public SoundSpecifier? Sound { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,119 @@
|
||||
using System;
|
||||
using Content.Server.Explosion.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Trigger;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Explosion.EntitySystems;
|
||||
|
||||
public sealed partial class TriggerSystem
|
||||
{
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
|
||||
private void InitializeOnUse()
|
||||
{
|
||||
SubscribeLocalEvent<OnUseTimerTriggerComponent, UseInHandEvent>(OnTimerUse);
|
||||
SubscribeLocalEvent<OnUseTimerTriggerComponent, ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<OnUseTimerTriggerComponent, GetVerbsEvent<AlternativeVerb>>(OnGetAltVerbs);
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, OnUseTimerTriggerComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (args.IsInDetailsRange)
|
||||
args.PushText(Loc.GetString("examine-trigger-timer", ("time", component.Delay)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an alt-click interaction that cycles through delays.
|
||||
/// </summary>
|
||||
private void OnGetAltVerbs(EntityUid uid, OnUseTimerTriggerComponent component, GetVerbsEvent<AlternativeVerb> args)
|
||||
{
|
||||
if (!args.CanInteract || !args.CanAccess)
|
||||
return;
|
||||
|
||||
if (component.DelayOptions == null || component.DelayOptions.Count == 1)
|
||||
return;
|
||||
|
||||
args.Verbs.Add(new AlternativeVerb()
|
||||
{
|
||||
Category = TimerOptions,
|
||||
Text = Loc.GetString("verb-trigger-timer-cycle"),
|
||||
Act = () => CycleDelay(component, args.User),
|
||||
Priority = 1
|
||||
});
|
||||
|
||||
foreach (var option in component.DelayOptions)
|
||||
{
|
||||
if (MathHelper.CloseTo(option, component.Delay))
|
||||
{
|
||||
args.Verbs.Add(new AlternativeVerb()
|
||||
{
|
||||
Category = TimerOptions,
|
||||
Text = Loc.GetString("verb-trigger-timer-set-current", ("time", option)),
|
||||
Disabled = true,
|
||||
Priority = (int) (-100 * option)
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
args.Verbs.Add(new AlternativeVerb()
|
||||
{
|
||||
Category = TimerOptions,
|
||||
Text = Loc.GetString("verb-trigger-timer-set", ("time", option)),
|
||||
Priority = (int) (-100 * option),
|
||||
|
||||
Act = () =>
|
||||
{
|
||||
component.Delay = option;
|
||||
_popupSystem.PopupEntity(Loc.GetString("popup-trigger-timer-set", ("time", option)), args.User, Filter.Entities(args.User));
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void CycleDelay(OnUseTimerTriggerComponent component, EntityUid user)
|
||||
{
|
||||
if (component.DelayOptions == null || component.DelayOptions.Count == 1)
|
||||
return;
|
||||
|
||||
// This is somewhat inefficient, but its good enough. This is run rarely, and the lists should be short.
|
||||
|
||||
component.DelayOptions.Sort();
|
||||
|
||||
if (component.DelayOptions[^1] <= component.Delay)
|
||||
{
|
||||
component.Delay = component.DelayOptions[0];
|
||||
_popupSystem.PopupEntity(Loc.GetString("popup-trigger-timer-set", ("time", component.Delay)), user, Filter.Entities(user));
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var option in component.DelayOptions)
|
||||
{
|
||||
if (option > component.Delay)
|
||||
{
|
||||
component.Delay = option;
|
||||
_popupSystem.PopupEntity(Loc.GetString("popup-trigger-timer-set", ("time", option)), user, Filter.Entities(user));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTimerUse(EntityUid uid, OnUseTimerTriggerComponent component, UseInHandEvent args)
|
||||
{
|
||||
if (args.Handled) return;
|
||||
|
||||
Trigger(uid, args.User, component);
|
||||
HandleTimerTrigger(
|
||||
uid,
|
||||
args.User,
|
||||
component.Delay,
|
||||
component.BeepInterval,
|
||||
component.InitialBeepDelay,
|
||||
component.BeepSound,
|
||||
component.BeepParams);
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
// TODO: Need to split this out so it's a generic "OnUseTimerTrigger" component.
|
||||
private void Trigger(EntityUid uid, EntityUid user, OnUseTimerTriggerComponent component)
|
||||
{
|
||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
appearance.SetData(TriggerVisuals.VisualState, TriggerVisualState.Primed);
|
||||
|
||||
HandleTimerTrigger(TimeSpan.FromSeconds(component.Delay), uid, user);
|
||||
}
|
||||
public static VerbCategory TimerOptions = new("verb-categories-timer", "/Textures/Interface/VerbIcons/clock.svg.192dpi.png");
|
||||
}
|
||||
|
||||
@@ -1,27 +1,17 @@
|
||||
using System;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Doors;
|
||||
using Content.Server.Doors.Components;
|
||||
using Content.Server.Doors.Systems;
|
||||
using Content.Server.Explosion.Components;
|
||||
using Content.Server.Flash;
|
||||
using Content.Server.Flash.Components;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Doors;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Timing;
|
||||
using System.Threading;
|
||||
using Content.Server.Construction.Components;
|
||||
using Content.Shared.Sound;
|
||||
using Content.Shared.Trigger;
|
||||
using Timer = Robust.Shared.Timing.Timer;
|
||||
using Content.Shared.Physics;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Database;
|
||||
|
||||
namespace Content.Server.Explosion.EntitySystems
|
||||
{
|
||||
@@ -48,6 +38,7 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
[Dependency] private readonly FlashSystem _flashSystem = default!;
|
||||
[Dependency] private readonly DoorSystem _sharedDoorSystem = default!;
|
||||
[Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -59,7 +50,6 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
SubscribeLocalEvent<TriggerOnCollideComponent, StartCollideEvent>(OnTriggerCollide);
|
||||
|
||||
SubscribeLocalEvent<DeleteOnTriggerComponent, TriggerEvent>(HandleDeleteTrigger);
|
||||
SubscribeLocalEvent<SoundOnTriggerComponent, TriggerEvent>(HandleSoundTrigger);
|
||||
SubscribeLocalEvent<ExplodeOnTriggerComponent, TriggerEvent>(HandleExplodeTrigger);
|
||||
SubscribeLocalEvent<FlashOnTriggerComponent, TriggerEvent>(HandleFlashTrigger);
|
||||
SubscribeLocalEvent<ToggleDoorOnTriggerComponent, TriggerEvent>(HandleDoorTrigger);
|
||||
@@ -100,12 +90,6 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void HandleSoundTrigger(EntityUid uid, SoundOnTriggerComponent component, TriggerEvent args)
|
||||
{
|
||||
if (component.Sound == null) return;
|
||||
SoundSystem.Play(Filter.Pvs(component.Owner), component.Sound.GetSound(), uid);
|
||||
}
|
||||
|
||||
private void HandleDeleteTrigger(EntityUid uid, DeleteOnTriggerComponent component, TriggerEvent args)
|
||||
{
|
||||
EntityManager.QueueDeleteEntity(uid);
|
||||
@@ -128,19 +112,39 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
EntityManager.EventBus.RaiseLocalEvent(trigger, triggerEvent);
|
||||
}
|
||||
|
||||
public void HandleTimerTrigger(TimeSpan delay, EntityUid triggered, EntityUid? user = null)
|
||||
public void HandleTimerTrigger(EntityUid uid, EntityUid? user, float delay , float beepInterval, float? initialBeepDelay, SoundSpecifier? beepSound, AudioParams beepParams)
|
||||
{
|
||||
if (delay.TotalSeconds <= 0)
|
||||
if (delay <= 0)
|
||||
{
|
||||
Trigger(triggered, user);
|
||||
RemComp<ActiveTimerTriggerComponent>(uid);
|
||||
Trigger(uid, user);
|
||||
return;
|
||||
}
|
||||
|
||||
Timer.Spawn(delay, () =>
|
||||
if (HasComp<ActiveTimerTriggerComponent>(uid))
|
||||
return;
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
if (Deleted(triggered)) return;
|
||||
Trigger(triggered, user);
|
||||
});
|
||||
_logSystem.Add(LogType.Trigger,
|
||||
$"{ToPrettyString(user.Value):user} started a {delay} second timer trigger on entity {ToPrettyString(uid):timer}");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logSystem.Add(LogType.Trigger,
|
||||
$"{delay} second timer trigger started on entity {ToPrettyString(uid):timer}");
|
||||
}
|
||||
|
||||
var active = AddComp<ActiveTimerTriggerComponent>(uid);
|
||||
active.TimeRemaining = delay;
|
||||
active.User = user;
|
||||
active.BeepParams = beepParams;
|
||||
active.BeepSound = beepSound;
|
||||
active.BeepInterval = beepInterval;
|
||||
active.TimeUntilBeep = initialBeepDelay == null ? active.BeepInterval : initialBeepDelay.Value;
|
||||
|
||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
appearance.SetData(TriggerVisuals.VisualState, TriggerVisualState.Primed);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
@@ -148,6 +152,40 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
base.Update(frameTime);
|
||||
|
||||
UpdateProximity(frameTime);
|
||||
UpdateTimer(frameTime);
|
||||
}
|
||||
|
||||
private void UpdateTimer(float frameTime)
|
||||
{
|
||||
HashSet<EntityUid> toRemove = new();
|
||||
foreach (var timer in EntityQuery<ActiveTimerTriggerComponent>())
|
||||
{
|
||||
timer.TimeRemaining -= frameTime;
|
||||
timer.TimeUntilBeep -= frameTime;
|
||||
|
||||
if (timer.TimeRemaining <= 0)
|
||||
{
|
||||
Trigger(timer.Owner, timer.User);
|
||||
toRemove.Add(timer.Owner);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (timer.BeepSound == null || timer.TimeUntilBeep > 0)
|
||||
continue;
|
||||
|
||||
timer.TimeUntilBeep += timer.BeepInterval;
|
||||
var filter = Filter.Pvs(timer.Owner, entityManager: EntityManager);
|
||||
SoundSystem.Play(filter, timer.BeepSound.GetSound(), timer.Owner, timer.BeepParams);
|
||||
}
|
||||
|
||||
foreach (var uid in toRemove)
|
||||
{
|
||||
RemComp<ActiveTimerTriggerComponent>(uid);
|
||||
|
||||
// In case this is a re-usable grenade, un-prime it.
|
||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
appearance.SetData(TriggerVisuals.VisualState, TriggerVisualState.Unprimed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
141
Content.Server/Payload/EntitySystems/PayloadSystem.cs
Normal file
@@ -0,0 +1,141 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Server.Explosion.EntitySystems;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Payload.Components;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Serialization.Manager;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Payload.EntitySystems;
|
||||
|
||||
public sealed class PayloadSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionSystem = default!;
|
||||
[Dependency] private readonly SharedChemicalReactionSystem _chemistrySystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
[Dependency] private readonly IComponentFactory _componentFactory = default!;
|
||||
[Dependency] private readonly ISerializationManager _serializationManager = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<PayloadCaseComponent, TriggerEvent>(OnCaseTriggered);
|
||||
SubscribeLocalEvent<PayloadTriggerComponent, TriggerEvent>(OnTriggerTriggered);
|
||||
SubscribeLocalEvent<PayloadCaseComponent, EntInsertedIntoContainerMessage>(OnEntityInserted);
|
||||
SubscribeLocalEvent<PayloadCaseComponent, EntRemovedFromContainerMessage>(OnEntityRemoved);
|
||||
SubscribeLocalEvent<ChemicalPayloadComponent, TriggerEvent>(HandleChemicalPayloadTrigger);
|
||||
}
|
||||
|
||||
private void OnCaseTriggered(EntityUid uid, PayloadCaseComponent component, TriggerEvent args)
|
||||
{
|
||||
if (!TryComp(uid, out ContainerManagerComponent? contMan))
|
||||
return;
|
||||
|
||||
// Pass trigger event onto all contained payloads. Payload capacity configurable by construction graphs.
|
||||
foreach (var container in contMan.Containers.Values)
|
||||
{
|
||||
foreach (var entity in container.ContainedEntities)
|
||||
{
|
||||
if (_tagSystem.HasTag(entity, "Payload"))
|
||||
RaiseLocalEvent(entity, args, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerTriggered(EntityUid uid, PayloadTriggerComponent component, TriggerEvent args)
|
||||
{
|
||||
if (!component.Active)
|
||||
return;
|
||||
|
||||
if (Transform(uid).ParentUid is not { Valid: true } parent)
|
||||
return;
|
||||
|
||||
// Ensure we don't enter a trigger-loop
|
||||
DebugTools.Assert(!_tagSystem.HasTag(uid, "Payload"));
|
||||
|
||||
RaiseLocalEvent(parent, args, false);
|
||||
}
|
||||
|
||||
private void OnEntityInserted(EntityUid uid, PayloadCaseComponent _, EntInsertedIntoContainerMessage args)
|
||||
{
|
||||
if (!TryComp(args.Entity, out PayloadTriggerComponent? trigger))
|
||||
return;
|
||||
|
||||
trigger.Active = true;
|
||||
|
||||
if (trigger.Components == null)
|
||||
return;
|
||||
|
||||
// ANY payload trigger that gets inserted can grant components. It is up to the construction graphs to determine trigger capacity.
|
||||
foreach (var (name, data) in trigger.Components)
|
||||
{
|
||||
if (!_componentFactory.TryGetRegistration(name, out var registration))
|
||||
continue;
|
||||
|
||||
if (HasComp(uid, registration.Type))
|
||||
continue;
|
||||
|
||||
if (_componentFactory.GetComponent(registration.Type) is not Component component)
|
||||
continue;
|
||||
|
||||
component.Owner = uid;
|
||||
|
||||
if (_serializationManager.Copy(data, component, null) is Component copied)
|
||||
EntityManager.AddComponent(uid, copied);
|
||||
|
||||
trigger.GrantedComponents.Add(registration.Type);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEntityRemoved(EntityUid uid, PayloadCaseComponent component, EntRemovedFromContainerMessage args)
|
||||
{
|
||||
if (!TryComp(args.Entity, out PayloadTriggerComponent? trigger))
|
||||
return;
|
||||
|
||||
trigger.Active = false;
|
||||
|
||||
foreach (var type in trigger.GrantedComponents)
|
||||
{
|
||||
EntityManager.RemoveComponent(uid, type);
|
||||
}
|
||||
|
||||
trigger.GrantedComponents.Clear();
|
||||
}
|
||||
|
||||
private void HandleChemicalPayloadTrigger(EntityUid uid, ChemicalPayloadComponent component, TriggerEvent args)
|
||||
{
|
||||
if (component.BeakerSlotA.Item is not EntityUid beakerA
|
||||
|| component.BeakerSlotB.Item is not EntityUid beakerB
|
||||
|| !TryComp(beakerA, out FitsInDispenserComponent? compA)
|
||||
|| !TryComp(beakerB, out FitsInDispenserComponent? compB)
|
||||
|| !_solutionSystem.TryGetSolution(beakerA, compA.Solution, out var solutionA)
|
||||
|| !_solutionSystem.TryGetSolution(beakerB, compB.Solution, out var solutionB)
|
||||
|| solutionA.TotalVolume == 0
|
||||
|| solutionB.TotalVolume == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var solStringA = SolutionContainerSystem.ToPrettyString(solutionA);
|
||||
var solStringB = SolutionContainerSystem.ToPrettyString(solutionB);
|
||||
|
||||
_logSystem.Add(LogType.ChemicalReaction,
|
||||
$"Chemical bomb payload {ToPrettyString(uid):payload} at {Transform(uid).MapPosition:location} is combining two solutions: {solStringA:solutionA} and {solStringB:solutionB}");
|
||||
|
||||
solutionA.MaxVolume += solutionB.MaxVolume;
|
||||
_solutionSystem.TryAddSolution(beakerA, solutionA, solutionB);
|
||||
solutionB.RemoveAllSolution();
|
||||
|
||||
// The grenade might be a dud. Redistribute solution:
|
||||
var tmpSol = _solutionSystem.SplitSolution(beakerA, solutionA, solutionA.CurrentVolume * solutionB.MaxVolume / solutionA.MaxVolume);
|
||||
_solutionSystem.TryAddSolution(beakerB, solutionB, tmpSol);
|
||||
solutionA.MaxVolume -= solutionB.MaxVolume;
|
||||
_solutionSystem.UpdateChemicals(beakerA, solutionA, false);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Server.Sound.Components
|
||||
{
|
||||
@@ -15,6 +13,9 @@ namespace Content.Server.Sound.Components
|
||||
[DataField("sound", required: true)]
|
||||
public SoundSpecifier Sound { get; set; } = default!;
|
||||
|
||||
[DataField("audioParams")]
|
||||
public AudioParams AudioParams = AudioParams.Default.WithVolume(-2f);
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("variation")]
|
||||
public float PitchVariation { get; set; } = 0.0f;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using Content.Server.Explosion.EntitySystems;
|
||||
|
||||
namespace Content.Server.Sound.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Whenever a <see cref="TriggerEvent"/> is run play a sound in PVS range.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class EmitSoundOnTriggerComponent : BaseEmitSoundComponent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
using Content.Server.Explosion.EntitySystems;
|
||||
using Content.Server.Interaction.Components;
|
||||
using Content.Server.Sound.Components;
|
||||
using Content.Server.Throwing;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Throwing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Sound
|
||||
{
|
||||
@@ -18,6 +18,8 @@ namespace Content.Server.Sound
|
||||
[UsedImplicitly]
|
||||
public sealed class EmitSoundSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -26,6 +28,12 @@ namespace Content.Server.Sound
|
||||
SubscribeLocalEvent<EmitSoundOnUseComponent, UseInHandEvent>(HandleEmitSoundOnUseInHand);
|
||||
SubscribeLocalEvent<EmitSoundOnThrowComponent, ThrownEvent>(HandleEmitSoundOnThrown);
|
||||
SubscribeLocalEvent<EmitSoundOnActivateComponent, ActivateInWorldEvent>(HandleEmitSoundOnActivateInWorld);
|
||||
SubscribeLocalEvent<EmitSoundOnTriggerComponent, TriggerEvent>(HandleEmitSoundOnTrigger);
|
||||
}
|
||||
|
||||
private void HandleEmitSoundOnTrigger(EntityUid uid, EmitSoundOnTriggerComponent component, TriggerEvent args)
|
||||
{
|
||||
TryEmitSound(component);
|
||||
}
|
||||
|
||||
private void HandleEmitSoundOnLand(EntityUid eUI, BaseEmitSoundComponent component, LandEvent arg)
|
||||
@@ -35,9 +43,7 @@ namespace Content.Server.Sound
|
||||
|
||||
private void HandleEmitSoundOnUseInHand(EntityUid eUI, BaseEmitSoundComponent component, UseInHandEvent arg)
|
||||
{
|
||||
if (arg.Handled) return;
|
||||
|
||||
arg.Handled = true;
|
||||
// Intentionally not handling interaction. This component is an easy way to add sounds in addition to other behavior.
|
||||
TryEmitSound(component);
|
||||
}
|
||||
|
||||
@@ -48,15 +54,14 @@ namespace Content.Server.Sound
|
||||
|
||||
private void HandleEmitSoundOnActivateInWorld(EntityUid eUI, BaseEmitSoundComponent component, ActivateInWorldEvent arg)
|
||||
{
|
||||
if (arg.Handled) return;
|
||||
|
||||
arg.Handled = true;
|
||||
// Intentionally not handling interaction. This component is an easy way to add sounds in addition to other behavior.
|
||||
TryEmitSound(component);
|
||||
}
|
||||
|
||||
private static void TryEmitSound(BaseEmitSoundComponent component)
|
||||
private void TryEmitSound(BaseEmitSoundComponent component)
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(component.Owner), component.Sound.GetSound(), component.Owner, AudioHelpers.WithVariation(component.PitchVariation).WithVolume(-2f));
|
||||
var audioParams = component.AudioParams.WithPitchScale((float) _random.NextGaussian(1, component.PitchVariation));
|
||||
SoundSystem.Play(Filter.Pvs(component.Owner, entityManager: EntityManager), component.Sound.GetSound(), component.Owner, audioParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ public enum LogType
|
||||
Chat = 61,
|
||||
Action = 62,
|
||||
RCD = 63,
|
||||
Construction = 64,
|
||||
Trigger = 65,
|
||||
// haha so funny
|
||||
Emag = 69,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Payload.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Chemical payload that mixes the solutions of two drain-able solution containers when triggered.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class ChemicalPayloadComponent : Component
|
||||
{
|
||||
[DataField("beakerSlotA", required: true)]
|
||||
public ItemSlot BeakerSlotA = new();
|
||||
|
||||
[DataField("beakerSlotB", required: true)]
|
||||
public ItemSlot BeakerSlotB = new();
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum ChemicalPayloadVisuals : byte
|
||||
{
|
||||
Slots
|
||||
}
|
||||
|
||||
[Flags]
|
||||
[Serializable, NetSerializable]
|
||||
public enum ChemicalPayloadFilledSlots : byte
|
||||
{
|
||||
None = 0,
|
||||
Left = 1 << 0,
|
||||
Right = 1 << 1,
|
||||
Both = Left | Right,
|
||||
}
|
||||
12
Content.Shared/Payload/Components/PayloadCaseComponent.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace Content.Shared.Payload.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Component that enables payloads and payload triggers to function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If an entity with a <see cref="PayloadTriggerComponent"/> is installed into a an entity with a <see
|
||||
/// cref="PayloadCaseComponent"/>, the trigger will grant components to the case-entity. If the case entity is
|
||||
/// triggered, it will forward the trigger onto any contained payload entity.
|
||||
/// </remarks>
|
||||
[RegisterComponent]
|
||||
public sealed class PayloadCaseComponent : Component { }
|
||||
45
Content.Shared/Payload/Components/PayloadTriggerComponent.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared.Payload.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Component for providing the means of triggering an explosive payload. Used in grenade construction.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This component performs two functions. Firstly, it will add or remove other components to some entity when this
|
||||
/// item is installed inside of it. This is intended for use with constructible grenades. For example, this allows
|
||||
/// you to add things like <see cref="OnUseTimerTriggerComponent"/>, or <see cref="TriggerOnProximityComponent"/>.
|
||||
/// This is required because otherwise you would have to forward arbitrary interaction directed at the casing
|
||||
/// through to the trigger, which would be quite complicated. Also proximity triggers don't really work inside of
|
||||
/// containers.
|
||||
///
|
||||
/// Secondly, if the entity that this component is attached to is ever triggered directly (e.g., via a device
|
||||
/// network message), the trigger will be forwarded to the device that this entity is installed in (if any).
|
||||
/// </remarks>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class PayloadTriggerComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// If true, triggering this entity will also cause the parent of this entity to be triggered.
|
||||
/// </summary>
|
||||
public bool Active = false;
|
||||
|
||||
/// <summary>
|
||||
/// List of components to add or remove from an entity when this trigger is (un)installed.
|
||||
/// </summary>
|
||||
[DataField("components", serverOnly:true, readOnly: true)]
|
||||
public readonly EntityPrototype.ComponentRegistry? Components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Keeps track of what components this trigger has granted to the payload case.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is required in case someone creates a construction graph that accepts more than one trigger, and those
|
||||
/// trigger grant the same type of component (or the case just innately has that component). This list is used
|
||||
/// when removing the component, to ensure that removal of this trigger only removes the components that it was
|
||||
/// responsible for adding.
|
||||
/// </remarks>
|
||||
[DataField("grantedComponents", serverOnly: true)]
|
||||
public readonly HashSet<Type> GrantedComponents = new();
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Payload.Components;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Shared.Payload.EntitySystems;
|
||||
|
||||
public sealed class ChemicalPayloadSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ChemicalPayloadComponent, ComponentInit>(OnComponentInit);
|
||||
SubscribeLocalEvent<ChemicalPayloadComponent, ComponentRemove>(OnComponentRemove);
|
||||
SubscribeLocalEvent<ChemicalPayloadComponent, EntInsertedIntoContainerMessage>(OnContainerModified);
|
||||
SubscribeLocalEvent<ChemicalPayloadComponent, EntRemovedFromContainerMessage>(OnContainerModified);
|
||||
}
|
||||
|
||||
private void OnContainerModified(EntityUid uid, ChemicalPayloadComponent component, ContainerModifiedMessage args)
|
||||
{
|
||||
UpdateAppearance(uid, component);
|
||||
}
|
||||
|
||||
private void UpdateAppearance(EntityUid uid, ChemicalPayloadComponent? component = null, AppearanceComponent? appearance = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, ref appearance, false))
|
||||
return;
|
||||
|
||||
var filled = ChemicalPayloadFilledSlots.None;
|
||||
|
||||
if (component.BeakerSlotA.HasItem)
|
||||
filled |= ChemicalPayloadFilledSlots.Left;
|
||||
|
||||
if (component.BeakerSlotB.HasItem)
|
||||
filled |= ChemicalPayloadFilledSlots.Right;
|
||||
|
||||
appearance.SetData(ChemicalPayloadVisuals.Slots, filled);
|
||||
}
|
||||
|
||||
private void OnComponentInit(EntityUid uid, ChemicalPayloadComponent payload, ComponentInit args)
|
||||
{
|
||||
_itemSlotsSystem.AddItemSlot(uid, "BeakerSlotA", payload.BeakerSlotA);
|
||||
_itemSlotsSystem.AddItemSlot(uid, "BeakerSlotB", payload.BeakerSlotB);
|
||||
}
|
||||
|
||||
private void OnComponentRemove(EntityUid uid, ChemicalPayloadComponent payload, ComponentRemove args)
|
||||
{
|
||||
_itemSlotsSystem.RemoveItemSlot(uid, payload.BeakerSlotA);
|
||||
_itemSlotsSystem.RemoveItemSlot(uid, payload.BeakerSlotB);
|
||||
}
|
||||
}
|
||||
@@ -190,6 +190,17 @@ namespace Content.Shared.Verbs
|
||||
return string.Compare(Text, otherVerb.Text, StringComparison.CurrentCulture);
|
||||
}
|
||||
|
||||
if (IconEntity != otherVerb.IconEntity)
|
||||
{
|
||||
if (IconEntity == null)
|
||||
return -1;
|
||||
|
||||
if (otherVerb.IconEntity == null)
|
||||
return 1;
|
||||
|
||||
return IconEntity.Value.CompareTo(otherVerb.IconEntity.Value);
|
||||
}
|
||||
|
||||
// Finally, compare icon texture paths. Note that this matters for verbs that don't have any text (e.g., the rotate-verbs)
|
||||
return string.Compare(IconTexture, otherVerb.IconTexture, StringComparison.CurrentCulture);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ verb-categories-rotate = Rotate
|
||||
verb-categories-transfer = Set Transfer Amount
|
||||
verb-categories-split = Split
|
||||
verb-categories-set-sensor = Sensor
|
||||
verb-categories-timer = Set Delay
|
||||
|
||||
verb-common-toggle-light = Toggle light
|
||||
verb-common-close = Close
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
verb-trigger-timer-set = {$time} Seconds
|
||||
verb-trigger-timer-set-current = {$time} Seconds (current)
|
||||
verb-trigger-timer-cycle = Cycle Time Delay
|
||||
|
||||
examine-trigger-timer = The timer is set to {$time} seconds.
|
||||
|
||||
popup-trigger-timer-set = Timer set to {$time} seconds.
|
||||
@@ -98,6 +98,8 @@
|
||||
- Syringe
|
||||
- ReagentGrinderMachineCircuitboard
|
||||
- PillCanister
|
||||
- TimerTrigger
|
||||
- ChemicalPayload
|
||||
|
||||
- type: technology
|
||||
name: "medical machinery"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# Misc electronic trigger devices.
|
||||
# TODO:
|
||||
# - proximity
|
||||
# - voice
|
||||
# - machine linking
|
||||
# - device network
|
||||
# - biometric/health (maybe just via device nets?)
|
||||
# - booby-trap / on-storage-open
|
||||
|
||||
- type: entity
|
||||
parent: BaseItem
|
||||
id: TimerTrigger
|
||||
name: timer trigger
|
||||
description: A configurable timer.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Objects/Devices/timer.rsi
|
||||
state: timer
|
||||
- type: Item
|
||||
size: 5
|
||||
- type: PayloadTrigger
|
||||
components:
|
||||
- type: OnUseTimerTrigger
|
||||
delay: 5
|
||||
delayOptions: [3, 5, 10, 15, 30]
|
||||
initialBeepDelay: 0
|
||||
beepSound: /Audio/Machines/Nuke/general_beep.ogg
|
||||
76
Resources/Prototypes/Entities/Objects/Devices/payload.yml
Normal file
@@ -0,0 +1,76 @@
|
||||
- type: entity
|
||||
parent: BaseItem
|
||||
abstract: true
|
||||
id: BasePayload
|
||||
components:
|
||||
- type: Appearance
|
||||
- type: Sprite
|
||||
netsync: false
|
||||
- type: Tag
|
||||
tags:
|
||||
- Payload
|
||||
- type: Damageable
|
||||
damageContainer: Inorganic
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
!type:DamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: [ "Destruction" ]
|
||||
|
||||
- type: entity
|
||||
name: explosive payload
|
||||
parent: BasePayload
|
||||
id: ExplosivePayload
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Objects/Devices/payload.rsi
|
||||
state: payload-explosive-armed
|
||||
- type: Explosive
|
||||
devastationRange: 0
|
||||
heavyImpactRange: 2
|
||||
lightImpactRange: 4
|
||||
flashRange: 7
|
||||
- type: ExplodeOnTrigger
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
!type:DamageTypeTrigger
|
||||
damageType: Heat
|
||||
damage: 25
|
||||
behaviors:
|
||||
- !type:ExplodeBehavior
|
||||
- trigger:
|
||||
!type:DamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: [ "Destruction" ]
|
||||
|
||||
- type: entity
|
||||
name: chemical payload
|
||||
parent: BasePayload
|
||||
id: ChemicalPayload
|
||||
description: A chemical payload. Has space to store two beakers. In combination with a trigger and a case, this can be used to initiate chemical reactions.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Objects/Devices/payload.rsi
|
||||
state: payload-empty
|
||||
- type: ChemicalPayload
|
||||
beakerSlotA: &slotDef
|
||||
whitelist:
|
||||
components:
|
||||
- FitsInDispenser
|
||||
swap: false
|
||||
beakerSlotB: *slotDef
|
||||
- type: Appearance
|
||||
visuals:
|
||||
- type: GenericEnumVisualizer
|
||||
key: enum.ChemicalPayloadVisuals.Slots
|
||||
states:
|
||||
enum.ChemicalPayloadFilledSlots.None: payload-empty
|
||||
enum.ChemicalPayloadFilledSlots.Left: payload-chemical-left
|
||||
enum.ChemicalPayloadFilledSlots.Right: payload-chemical-right
|
||||
enum.ChemicalPayloadFilledSlots.Both: payload-chemical-armed
|
||||
@@ -19,3 +19,9 @@
|
||||
variation: 0.125
|
||||
- type: UseDelay
|
||||
delay: 0.5
|
||||
- type: EmitSoundOnTrigger
|
||||
sound:
|
||||
collection: BikeHorn
|
||||
- type: Tag
|
||||
tags:
|
||||
- Payload # yes, you can make re-usable prank grenades
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
- type: entity
|
||||
name: beaker
|
||||
parent: BaseItem
|
||||
description: Used to contain a moderate amount of chemicals and solutions.
|
||||
id: Beaker
|
||||
id: BaseBeaker
|
||||
components:
|
||||
- type: Tag
|
||||
tags:
|
||||
@@ -39,8 +37,6 @@
|
||||
interfaces:
|
||||
- key: enum.TransferAmountUiKey.Key
|
||||
type: TransferAmountBoundUserInterface
|
||||
- type: Spillable
|
||||
solution: beaker
|
||||
- type: Drink
|
||||
isOpen: true
|
||||
- type: Appearance
|
||||
@@ -60,7 +56,8 @@
|
||||
- !type:PlaySoundBehavior
|
||||
sound:
|
||||
collection: GlassBreak
|
||||
- !type:SpillBehavior { }
|
||||
- !type:SpillBehavior
|
||||
solution: beaker
|
||||
- !type:SpawnEntitiesBehavior
|
||||
spawn:
|
||||
ShardGlass:
|
||||
@@ -82,12 +79,23 @@
|
||||
types:
|
||||
Blunt: 5
|
||||
|
||||
- type: entity
|
||||
name: beaker
|
||||
parent: BaseBeaker
|
||||
description: Used to contain a moderate amount of chemicals and solutions.
|
||||
id: Beaker
|
||||
components:
|
||||
- type: Spillable
|
||||
solution: beaker
|
||||
|
||||
- type: entity
|
||||
name: large beaker
|
||||
parent: Beaker
|
||||
parent: BaseBeaker
|
||||
description: Used to contain a large amount of chemicals or solutions.
|
||||
id: LargeBeaker
|
||||
components:
|
||||
- type: Spillable
|
||||
solution: beaker
|
||||
- type: Sprite
|
||||
sprite: Objects/Specific/Chemistry/beaker_large.rsi
|
||||
layers:
|
||||
@@ -109,7 +117,7 @@
|
||||
|
||||
- type: entity
|
||||
name: cryostasis beaker
|
||||
parent: Beaker
|
||||
parent: BaseBeaker
|
||||
description: Used to contain chemicals or solutions without reactions.
|
||||
id: CryostasisBeaker
|
||||
components:
|
||||
@@ -122,13 +130,28 @@
|
||||
beaker:
|
||||
maxVol: 40
|
||||
canReact: false
|
||||
|
||||
- type: Damageable
|
||||
damageContainer: Inorganic
|
||||
damageModifierSet: FlimsyMetallic
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
!type:DamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:SpillBehavior
|
||||
solution: beaker
|
||||
- !type:DoActsBehavior
|
||||
acts: [ "Destruction" ]
|
||||
|
||||
- type: entity
|
||||
name: bluespace beaker
|
||||
parent: Beaker
|
||||
parent: BaseBeaker
|
||||
description: Powered by experimental bluespace technology.
|
||||
id: BluespaceBeaker
|
||||
components:
|
||||
- type: Spillable
|
||||
solution: beaker
|
||||
- type: Sprite
|
||||
sprite: Objects/Specific/Chemistry/beaker_bluespace.rsi
|
||||
layers:
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
path: /Audio/Weapons/Guns/Hits/snap.ogg
|
||||
- type: FlashOnTrigger
|
||||
range: 1
|
||||
- type: SoundOnTrigger
|
||||
- type: EmitSoundOnTrigger
|
||||
sound:
|
||||
path: "/Audio/Effects/flash_bang.ogg"
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
delay: 3.5
|
||||
- type: FlashOnTrigger
|
||||
range: 7
|
||||
- type: SoundOnTrigger
|
||||
- type: EmitSoundOnTrigger
|
||||
sound:
|
||||
path: "/Audio/Effects/flash_bang.ogg"
|
||||
- type: DeleteOnTrigger
|
||||
@@ -148,3 +148,36 @@
|
||||
- type: TimerTriggerVisualizer
|
||||
countdown_sound:
|
||||
path: /Audio/Effects/countdown.ogg
|
||||
|
||||
- type: entity
|
||||
name: modular grenade
|
||||
description: A grenade casing. Requires a trigger and a payload.
|
||||
parent: BaseItem
|
||||
id: ModularGrenade
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Objects/Weapons/Grenades/modular.rsi
|
||||
state: empty
|
||||
- type: Item
|
||||
size: 8
|
||||
- type: PayloadCase
|
||||
- type: Construction
|
||||
graph: ModularGrenadeGraph
|
||||
node: emptyCase
|
||||
- type: Damageable
|
||||
damageContainer: Inorganic
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
!type:DamageTrigger
|
||||
damage: 50
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: [ "Destruction" ]
|
||||
- type: Appearance
|
||||
visuals:
|
||||
- type: GenericEnumVisualizer
|
||||
key: enum.Trigger.TriggerVisuals.VisualState
|
||||
states:
|
||||
enum.Trigger.TriggerVisualState.Primed: primed
|
||||
enum.Trigger.TriggerVisualState.Unprimed: complete
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
id: PortableFlasher
|
||||
description: An ultrabright flashbulb with a proximity trigger, useful for making an area security-only.
|
||||
components:
|
||||
- type: SoundOnTrigger
|
||||
- type: EmitSoundOnTrigger
|
||||
sound:
|
||||
path: /Audio/Weapons/flash.ogg
|
||||
- type: FlashOnTrigger
|
||||
|
||||
@@ -185,6 +185,8 @@
|
||||
- KitchenKnife
|
||||
- ButchCleaver
|
||||
- FlashlightLantern
|
||||
- TimerTrigger
|
||||
- ChemicalPayload
|
||||
- type: ActivatableUI
|
||||
key: enum.LatheUiKey.Key #Yes only having 1 of them here doesn't break anything
|
||||
- type: ActivatableUIRequiresPower
|
||||
@@ -294,6 +296,7 @@
|
||||
- CableStack
|
||||
- CableMVStack
|
||||
- CableHVStack
|
||||
- TimerTrigger
|
||||
|
||||
- type: entity
|
||||
parent: Autolathe
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
- type: constructionGraph
|
||||
id: ModularGrenadeGraph
|
||||
start: start
|
||||
graph:
|
||||
|
||||
- node: start
|
||||
edges:
|
||||
- to: emptyCase
|
||||
steps:
|
||||
- material: Steel
|
||||
amount: 5
|
||||
doAfter: 1
|
||||
|
||||
- node: emptyCase
|
||||
entity: ModularGrenade
|
||||
actions:
|
||||
- !type:SpriteStateChange
|
||||
state: empty
|
||||
edges:
|
||||
- to: wiredCase
|
||||
steps:
|
||||
- material: Cable
|
||||
doAfter: 0.5
|
||||
|
||||
- node: wiredCase
|
||||
entity: ModularGrenade
|
||||
actions:
|
||||
- !type:SpriteStateChange
|
||||
state: wired
|
||||
- !type:PlaySound
|
||||
sound: /Audio/Machines/button.ogg
|
||||
edges:
|
||||
- to: emptyCase
|
||||
steps:
|
||||
- tool: Cutting
|
||||
doAfter: 0.5
|
||||
completed:
|
||||
- !type:SpawnPrototype
|
||||
prototype: CableApcStack1
|
||||
- to: caseWithTrigger
|
||||
steps:
|
||||
- component: PayloadTrigger
|
||||
store: payloadTrigger
|
||||
name: Trigger
|
||||
doAfter: 0.5
|
||||
|
||||
- node: caseWithTrigger
|
||||
actions:
|
||||
- !type:SpriteStateChange
|
||||
state: no-payload
|
||||
- !type:PlaySound
|
||||
sound: /Audio/Machines/button.ogg
|
||||
edges:
|
||||
- to: wiredCase
|
||||
steps:
|
||||
- tool: Prying
|
||||
doAfter: 0.5
|
||||
completed:
|
||||
- !type:EmptyContainer
|
||||
container: payloadTrigger
|
||||
- to: grenade
|
||||
steps:
|
||||
- tag: Payload
|
||||
store: payload
|
||||
name: Payload
|
||||
doAfter: 0.5
|
||||
|
||||
- node: grenade
|
||||
actions:
|
||||
- !type:SpriteStateChange
|
||||
state: complete
|
||||
- !type:PlaySound
|
||||
sound: /Audio/Machines/button.ogg
|
||||
- !type:AdminLog
|
||||
message: "A grenade was crafted"
|
||||
edges:
|
||||
- to: caseWithTrigger
|
||||
steps:
|
||||
- tool: Prying
|
||||
doAfter: 0.5
|
||||
completed:
|
||||
- !type:EmptyContainer
|
||||
container: payload
|
||||
@@ -0,0 +1,12 @@
|
||||
- type: construction
|
||||
name: Modular Grenade
|
||||
id: ModularGrenadeRecipe
|
||||
graph: ModularGrenadeGraph
|
||||
startNode: start
|
||||
targetNode: grenade
|
||||
category: Weapons
|
||||
description: Construct a grenade using a trigger and a payload.
|
||||
icon:
|
||||
sprite: Objects/Weapons/Grenades/modular.rsi
|
||||
state: complete
|
||||
objectType: Item
|
||||
@@ -18,4 +18,4 @@
|
||||
category: Weapons
|
||||
description: A simple weapon for tripping someone at a distance.
|
||||
icon: Objects/Weapons/Throwable/bola.rsi/icon.png
|
||||
objectType: Item
|
||||
objectType: Item
|
||||
21
Resources/Prototypes/Recipes/Lathes/devices.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
- type: latheRecipe
|
||||
id: TimerTrigger
|
||||
icon:
|
||||
sprite: Objects/Devices/timer.rsi
|
||||
state: timer
|
||||
result: TimerTrigger
|
||||
completetime: 500
|
||||
materials:
|
||||
Steel: 300
|
||||
Plastic: 200
|
||||
|
||||
- type: latheRecipe
|
||||
id: ChemicalPayload
|
||||
icon:
|
||||
sprite: Objects/Devices/payload.rsi
|
||||
state: payload-empty
|
||||
result: ChemicalPayload
|
||||
completetime: 500
|
||||
materials:
|
||||
Steel: 200
|
||||
Plastic: 300
|
||||
@@ -216,6 +216,9 @@
|
||||
- type: Tag
|
||||
id: Ore
|
||||
|
||||
- type: Tag
|
||||
id: Payload # for grenade/bomb crafting
|
||||
|
||||
- type: Tag
|
||||
id: PercussionInstrument
|
||||
|
||||
|
||||
BIN
Resources/Textures/Interface/VerbIcons/clock.svg.192dpi.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,2 @@
|
||||
sample:
|
||||
filter: true
|
||||
35
Resources/Textures/Objects/Devices/payload.rsi/meta.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"version": 1,
|
||||
|
||||
"license": "CC0-1.0",
|
||||
"copyright": "Taken from https://github.com/tgstation/tgstation/blob/master/icons/obj/assemblies/new_assemblies.dmi",
|
||||
|
||||
"size": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
},
|
||||
"states": [
|
||||
{
|
||||
"name": "payload-empty",
|
||||
"directions": 1
|
||||
},
|
||||
{
|
||||
"name": "payload-chemical-left",
|
||||
"directions": 1
|
||||
},
|
||||
{
|
||||
"name": "payload-chemical-right",
|
||||
"directions": 1
|
||||
},
|
||||
{
|
||||
"name": "payload-chemical-armed",
|
||||
"directions": 1,
|
||||
"delays": [ [ 0.2, 0.2, 0.2 ] ]
|
||||
},
|
||||
{
|
||||
"name": "payload-explosive-armed",
|
||||
"directions": 1,
|
||||
"delays": [ [ 0.2, 0.2, 0.2 ] ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 302 B |
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Resources/Textures/Objects/Devices/payload.rsi/payload-empty.png
Normal file
|
After Width: | Height: | Size: 289 B |
|
After Width: | Height: | Size: 443 B |
17
Resources/Textures/Objects/Devices/timer.rsi/meta.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"version": 1,
|
||||
|
||||
"license": "CC0-1.0",
|
||||
"copyright": "Taken from https://github.com/tgstation/tgstation/blob/master/icons/obj/assemblies/new_assemblies.dmi",
|
||||
|
||||
"size": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
},
|
||||
"states": [
|
||||
{
|
||||
"name": "timer",
|
||||
"directions": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Resources/Textures/Objects/Devices/timer.rsi/timer.png
Normal file
|
After Width: | Height: | Size: 255 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"version": 1,
|
||||
"license": "CC-BY-SA-3.0",
|
||||
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/29c0ed1b000619cb5398ef921000a8d4502ba0b6 and modified by Swept",
|
||||
"size": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
},
|
||||
"states": [
|
||||
{
|
||||
"name": "empty",
|
||||
"directions": 1
|
||||
},
|
||||
{
|
||||
"name": "wired",
|
||||
"directions": 1
|
||||
},
|
||||
{
|
||||
"name": "no-payload",
|
||||
"directions": 1
|
||||
},
|
||||
{
|
||||
"name": "complete",
|
||||
"directions": 1
|
||||
},
|
||||
{
|
||||
"name": "primed",
|
||||
"directions": 1,
|
||||
"delays": [
|
||||
[ 0.2, 0.2 ]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 393 B |
|
After Width: | Height: | Size: 1.8 KiB |