@@ -3,6 +3,7 @@ using Content.Server.Speech;
|
||||
using Content.Server.Speech.Components;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Verbs;
|
||||
|
||||
namespace Content.Server.Explosion.EntitySystems
|
||||
@@ -15,6 +16,7 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
SubscribeLocalEvent<TriggerOnVoiceComponent, ExaminedEvent>(OnVoiceExamine);
|
||||
SubscribeLocalEvent<TriggerOnVoiceComponent, GetVerbsEvent<AlternativeVerb>>(OnVoiceGetAltVerbs);
|
||||
SubscribeLocalEvent<TriggerOnVoiceComponent, ListenEvent>(OnListen);
|
||||
SubscribeLocalEvent<TriggerOnVoiceComponent, UseInHandEvent>(OnUseInHand);
|
||||
}
|
||||
|
||||
private void OnVoiceInit(EntityUid uid, TriggerOnVoiceComponent component, ComponentInit args)
|
||||
@@ -81,6 +83,21 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
});
|
||||
}
|
||||
|
||||
public void OnUseInHand(Entity<TriggerOnVoiceComponent> ent, ref UseInHandEvent args)
|
||||
{
|
||||
if(args.Handled)
|
||||
return;
|
||||
|
||||
if (ent.Comp.IsRecording)
|
||||
{
|
||||
StopRecording(ent);
|
||||
}
|
||||
else
|
||||
{
|
||||
StartRecording(ent, args.User);
|
||||
}
|
||||
}
|
||||
|
||||
public void StartRecording(Entity<TriggerOnVoiceComponent> ent, EntityUid user)
|
||||
{
|
||||
var component = ent.Comp;
|
||||
|
||||
@@ -47,16 +47,15 @@ public sealed class ExperimentalSyndicateTeleporter : EntitySystem
|
||||
if (component.Uses >= 4)
|
||||
continue;
|
||||
|
||||
component.ChargeCooldown += _timing.FrameTime;
|
||||
component.ChargeCooldown += frameTime;
|
||||
|
||||
if (component.ChargeCooldown <= component.NextRechargeAttempt)
|
||||
if (component.ChargeCooldown <= component.NextRechargeAttempt.TotalSeconds)
|
||||
continue;
|
||||
|
||||
if (_random.Next(0, 10) != 0)
|
||||
{
|
||||
component.ChargeCooldown = TimeSpan.Zero;
|
||||
component.ChargeCooldown = 0F;
|
||||
|
||||
if (!_random.Prob(0.1F))
|
||||
continue;
|
||||
}
|
||||
|
||||
component.Uses++;
|
||||
}
|
||||
@@ -102,7 +101,7 @@ public sealed class ExperimentalSyndicateTeleporter : EntitySystem
|
||||
|
||||
if (TryCheckWall(coords))
|
||||
{
|
||||
EmergencyTeleportation(args.User, xform, component, oldCoords);
|
||||
EmergencyTeleportation(args.User, xform, component, oldCoords, newOffset);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -119,9 +118,8 @@ public sealed class ExperimentalSyndicateTeleporter : EntitySystem
|
||||
args.PushMarkup(Loc.GetString("experimental-syndicate-teleporter-examine", ("uses", component.Uses)));
|
||||
}
|
||||
|
||||
private void EmergencyTeleportation(EntityUid uid, TransformComponent xform, ExperimentalSyndicateTeleporterComponent component, EntityCoordinates oldCoords)
|
||||
private void EmergencyTeleportation(EntityUid uid, TransformComponent xform, ExperimentalSyndicateTeleporterComponent component, EntityCoordinates oldCoords, Vector2 offset)
|
||||
{
|
||||
var offset = xform.LocalRotation.ToWorldVec().Normalized();
|
||||
var newOffset = offset + VectorRandomDirection(component, offset, component.EmergencyLength);
|
||||
|
||||
var coords = xform.Coordinates.Offset(newOffset).SnapToGrid(EntityManager);
|
||||
|
||||
@@ -17,7 +17,7 @@ public sealed partial class ExperimentalSyndicateTeleporterComponent : Component
|
||||
public int MaxTeleportRange = 8;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public int EmergencyLength = 3;
|
||||
public int EmergencyLength = 4;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public List<int> RandomRotations = new() {90, -90};
|
||||
@@ -41,5 +41,5 @@ public sealed partial class ExperimentalSyndicateTeleporterComponent : Component
|
||||
public TimeSpan NextRechargeAttempt = TimeSpan.FromSeconds(1);
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public TimeSpan ChargeCooldown = TimeSpan.Zero;
|
||||
public float ChargeCooldown = 0F;
|
||||
}
|
||||
|
||||
@@ -279,6 +279,7 @@
|
||||
- type: Spillable
|
||||
solution: injector
|
||||
- type: Item
|
||||
size: Tiny
|
||||
sprite: Objects/Specific/Chemistry/dropper.rsi
|
||||
- type: Appearance
|
||||
- type: SolutionContainerVisuals
|
||||
|
||||
Reference in New Issue
Block a user