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:
Aviu00
2024-01-31 21:47:18 +09:00
committed by GitHub
parent 699f42c45b
commit 27d4cf977f
10 changed files with 63 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -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);
}
}

View File

@@ -20,7 +20,7 @@
noSpawn: true
components:
- type: InstantAction
useDelay: 1.5
useDelay: 2
itemIconStyle: BigAction
priority: -20
icon:

View File

@@ -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

View File

@@ -33,6 +33,8 @@
- Energy
- type: ReturnItemOnThrow
- type: CultItem
- type: ChangeThrowForce
throwForce: 6.5
- type: cultistFactoryProduction

View File

@@ -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