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