Hardlight spear tweaks (#3)
* - tweak: Increased hardlight spear throw force and use delay * - fix: Hardlight spear can now hit holocarps when thrown * - add: New sprites for hardlight spear * - fix: Fix duping hardlight spears by inserting them into containers
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Numerics;
|
||||
using Content.Server._White.Other.ChangeThrowForceSystem;
|
||||
using Content.Server.Inventory;
|
||||
using Content.Server.Pulling;
|
||||
using Content.Server.Stack;
|
||||
@@ -206,6 +207,12 @@ namespace Content.Server.Hands.Systems
|
||||
|
||||
var throwStrength = hands.ThrowForceMultiplier;
|
||||
|
||||
if (TryComp<ChangeThrowForceComponent>(throwEnt, out var thrownChangeForceComponent))
|
||||
{
|
||||
var component = EnsureComp<ChangeThrowForceComponent>(player);
|
||||
component.ThrowForce = thrownChangeForceComponent.ThrowForce;
|
||||
}
|
||||
|
||||
// Let other systems change the thrown entity (useful for virtual items)
|
||||
// or the throw strength.
|
||||
var ev = new BeforeThrowEvent(throwEnt, direction, throwStrength, player);
|
||||
@@ -220,6 +227,8 @@ namespace Content.Server.Hands.Systems
|
||||
|
||||
_throwingSystem.TryThrow(ev.ItemUid, ev.Direction, ev.ThrowStrength, ev.PlayerUid);
|
||||
|
||||
RemComp<ChangeThrowForceComponent>(player);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Content.Server._White.Other.ChangeThrowForceSystem;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class ChangeThrowForceComponent : Component
|
||||
{
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public float ThrowForce = 10f;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Content.Shared.Throwing;
|
||||
|
||||
namespace Content.Server._White.Other.ChangeThrowForceSystem;
|
||||
|
||||
public sealed class ChangeThrowForceSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<ChangeThrowForceComponent, BeforeThrowEvent>(HandleThrow);
|
||||
}
|
||||
|
||||
private void HandleThrow(EntityUid uid, ChangeThrowForceComponent component, ref BeforeThrowEvent args)
|
||||
{
|
||||
args.ThrowStrength = component.ThrowForce;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Implants.Components;
|
||||
using Content.Shared.Interaction.Events;
|
||||
@@ -7,6 +8,7 @@ using Content.Shared.Physics;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Events;
|
||||
using Robust.Shared.Spawners;
|
||||
@@ -25,6 +27,7 @@ public sealed class HardlightSpearSystem : EntitySystem
|
||||
|
||||
SubscribeLocalEvent<HardlightSpearComponent, LandEvent>(OnLand);
|
||||
SubscribeLocalEvent<HardlightSpearComponent, DroppedEvent>(OnDrop);
|
||||
SubscribeLocalEvent<HardlightSpearComponent, EntGotInsertedIntoContainerMessage>(OnInsert);
|
||||
SubscribeLocalEvent<HardlightSpearComponent, GettingPickedUpAttemptEvent>(OnPickupAttempt);
|
||||
SubscribeLocalEvent<HardlightSpearComponent, PreventCollideEvent>(OnPreventCollision);
|
||||
SubscribeLocalEvent<SubdermalImplantComponent, ActivateHardlightSpearImplantEvent>(OnImplantActivate);
|
||||
@@ -76,4 +79,10 @@ public sealed class HardlightSpearSystem : EntitySystem
|
||||
{
|
||||
EnsureComp<TimedDespawnComponent>(uid);
|
||||
}
|
||||
|
||||
private void OnInsert(EntityUid uid, HardlightSpearComponent component, EntGotInsertedIntoContainerMessage args)
|
||||
{
|
||||
if (!HasComp<BodyComponent>(args.Container.Owner))
|
||||
EnsureComp<TimedDespawnComponent>(uid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
noSpawn: true
|
||||
components:
|
||||
- type: InstantAction
|
||||
useDelay: 1.5
|
||||
useDelay: 2
|
||||
itemIconStyle: BigAction
|
||||
priority: -20
|
||||
icon:
|
||||
|
||||
@@ -42,3 +42,19 @@
|
||||
radius: 1.5
|
||||
energy: 2
|
||||
color: yellow
|
||||
- type: ChangeThrowForce
|
||||
throwForce: 20
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
fix1:
|
||||
shape: !type:PolygonShape
|
||||
vertices:
|
||||
- -0.20,-0.10
|
||||
- -0.10,-0.20
|
||||
- 0.40,0.30
|
||||
- 0.30,0.40
|
||||
density: 20
|
||||
mask:
|
||||
- Opaque
|
||||
restitution: 0.3
|
||||
friction: 0.2
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
- Energy
|
||||
- type: ReturnItemOnThrow
|
||||
- type: CultItem
|
||||
- type: ChangeThrowForce
|
||||
throwForce: 6.5
|
||||
|
||||
|
||||
- type: cultistFactoryProduction
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"version": 1,
|
||||
"license": "CC-BY-SA-3.0",
|
||||
"copyright": "Taken from monkestation at https://github.com/Monkestation/MonkeStation/commit/c995c9bda2c23386614ac1cb00aca552f573ba9f, equipped and wielded sprites by Aviu",
|
||||
"copyright": "Taken from monkestation at https://github.com/Monkestation/MonkeStation/commit/c995c9bda2c23386614ac1cb00aca552f573ba9f, equipped sprite by Aviu, wielded sprites by antohag",
|
||||
"size": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 442 B |
Binary file not shown.
|
Before Width: | Height: | Size: 375 B After Width: | Height: | Size: 436 B |
Reference in New Issue
Block a user