Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Port] Hardlight Spear / Световое Копье #77

Merged
merged 6 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Content.Server/Hands/Systems/HandsSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Numerics;
using Content.Server._White.Throwing;
using Content.Server.Inventory;
using Content.Server.Stack;
using Content.Server.Stunnable;
Expand Down Expand Up @@ -206,6 +207,11 @@ hands.ActiveHandEntity is not { } throwEnt ||

var throwStrength = hands.ThrowForceMultiplier;

// WD EDIT START
if (TryComp<ThrowingItemModifierComponent>(throwEnt, out var throwingItemModifier))
throwStrength *= throwingItemModifier.ThrowingMultiplier;
Spatison marked this conversation as resolved.
Show resolved Hide resolved
Spatison marked this conversation as resolved.
Show resolved Hide resolved
// WD EDIT END

// Let other systems change the thrown entity (useful for virtual items)
// or the throw strength.
var ev = new BeforeThrowEvent(throwEnt, direction, throwStrength, player);
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/OfferItem/OfferItemSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public void Receive(EntityUid uid, OfferItemComponent? component = null)
("item", Identity.Entity(offerItem.Item.Value, EntityManager)),
("target", Identity.Entity(uid, EntityManager)))
, component.Target.Value, Filter.PvsExcept(component.Target.Value, entityManager: EntityManager), true);

RaiseLocalEvent(offerItem.Item.Value, new HandedEvent(component.Target.Value, uid)); // WD EDIT
}

offerItem.Item = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Content.Server._White.DespawnOnLandItem;

[RegisterComponent]
public sealed partial class DespawnOnLandItemComponent : Component
{
[DataField]
public float TimeDespawnOnLand = 3f;
Spatison marked this conversation as resolved.
Show resolved Hide resolved
}
33 changes: 33 additions & 0 deletions Content.Server/_White/DespawnOnLandItem/DespawnOnLandItemSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Content.Shared.Body.Components;
using Content.Shared.Interaction.Events;
using Content.Shared.OfferItem;
using Robust.Shared.Containers;
using Robust.Shared.Spawners;

namespace Content.Server._White.DespawnOnLandItem;

public sealed class DespawnOnLandItemSystem : EntitySystem
{
public override void Initialize()
{
SubscribeLocalEvent<DespawnOnLandItemComponent, DroppedEvent>(OnDrop);
SubscribeLocalEvent<DespawnOnLandItemComponent, HandedEvent>(OnHanded);
SubscribeLocalEvent<DespawnOnLandItemComponent, EntGotInsertedIntoContainerMessage>(OnInsert);
}

private void OnDrop(EntityUid uid, DespawnOnLandItemComponent component, DroppedEvent args)
{
EnsureComp<TimedDespawnComponent>(uid).Lifetime = component.TimeDespawnOnLand;
}

private void OnHanded(EntityUid uid, DespawnOnLandItemComponent component, HandedEvent args)
{
EnsureComp<TimedDespawnComponent>(uid).Lifetime = component.TimeDespawnOnLand;
}

private void OnInsert(EntityUid uid, DespawnOnLandItemComponent component, EntGotInsertedIntoContainerMessage args)
{
if (!HasComp<BodyComponent>(args.Container.Owner))
EnsureComp<TimedDespawnComponent>(uid).Lifetime = component.TimeDespawnOnLand;
}
}
13 changes: 13 additions & 0 deletions Content.Server/_White/Implants/Spawn/SpawnImplantComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Robust.Shared.Audio;

namespace Content.Server._White.Implants.Spawn;

[RegisterComponent]
public sealed partial class SpawnImplantComponent : Component
{
[DataField(required: true)]
public string SpawnId = string.Empty;

[DataField]
public SoundSpecifier SoundOnSpawn = new SoundPathSpecifier("/Audio/Weapons/ebladeon.ogg");
}
34 changes: 34 additions & 0 deletions Content.Server/_White/Implants/Spawn/SpawnImplantSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Implants.Components;
using Robust.Shared.Audio.Systems;

namespace Content.Server._White.Implants.Spawn;

public sealed class SpawnImplantSystem : EntitySystem
{
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;

public override void Initialize()
{
SubscribeLocalEvent<SubdermalImplantComponent, ActivateSpawnImplantEvent>(OnImplantActivate);
}

private void OnImplantActivate(EntityUid uid, SubdermalImplantComponent component, ActivateSpawnImplantEvent args)
{
if (!TryComp(uid, out SpawnImplantComponent? implant)
|| !TryComp(component.ImplantedEntity, out TransformComponent? transform))
return;

var spear = EntityManager.SpawnEntity(implant.SpawnId, transform.Coordinates);

if (_hands.TryPickupAnyHand(component.ImplantedEntity.Value, spear))
{
_audio.PlayPvs(implant.SoundOnSpawn, spear);
args.Handled = true;
return;
}

Del(spear);
}
}
Spatison marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Content.Server._White.Throwing;

[RegisterComponent]
public sealed partial class ThrowingItemModifierComponent : Component
{
[DataField]
public float ThrowingMultiplier = 2.0f;
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,5 @@ public sealed partial class UseDnaScramblerImplantEvent : InstantActionEvent
{

}

public sealed partial class ActivateSpawnImplantEvent : InstantActionEvent; // WD EDIT
9 changes: 9 additions & 0 deletions Content.Shared/OfferItem/SharedOfferItemSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,12 @@ protected bool IsInOfferMode(EntityUid? entity, OfferItemComponent? component =
return entity != null && Resolve(entity.Value, ref component, false) && component.IsInOfferMode;
}
}

// WD EDIT START
[Serializable]
public sealed class HandedEvent(EntityUid user, EntityUid target) : EntityEventArgs
{
public EntityUid User = user;
public EntityUid Target = target;
}
Spatison marked this conversation as resolved.
Show resolved Hide resolved
// WD EDIT END
4 changes: 4 additions & 0 deletions Content.Shared/Throwing/ThrownItemSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public sealed class ThrownItemSystem : EntitySystem
[Dependency] private readonly SharedGravitySystem _gravity = default!;

private const string ThrowingFixture = "throw-fixture";
private const string Fixture1 = "fix1"; // WD EDIT
Spatison marked this conversation as resolved.
Show resolved Hide resolved

public override void Initialize()
{
Expand Down Expand Up @@ -66,6 +67,9 @@ private void HandleCollision(EntityUid uid, ThrownItemComponent component, ref S
return;

// WD EDIT START
if (args.OurFixtureId != Fixture1)
return;

if (component.Processed.Contains(args.OtherEntity))
return;
// WD EDIT END
Expand Down
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/_white/store/uplink-catalog.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ uplink-betrayal-knife-desc = Syndicate teleporter, when used, moves 3-8 meters f
uplink-ebow-name = Small energy crossbow
uplink-ebow-desc = A fairly quiet weapon that automatically reloads and stuns. It goes well with other types of weapons.

uplink-hardlight-spear-implant-name = Hardlight spear implanter
uplink-hardlight-spear-implant-desc = An implant injected into the body, and later activated at the user's will. It will summon a spear made out of hardlight that the user can use to wreak havoc.

uplink-smoke-implant-name = Smoke implant
uplink-smoke-implant-desc = Releases a cloud of smoke when activated.
5 changes: 4 additions & 1 deletion Resources/Locale/ru-RU/_white/prototypes/actions/types.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
ent-ActivateHardlightSpearImplant = Создать световое копьё
.desc = Создает световое копьё в ваших руках.

ent-ActivateSmokeImplant = Выпустить облако дыма
.desc = Выпускает облако дыма вокруг вас.
.desc = Выпускает облако дыма вокруг вас.
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
ent-HardlightSpearImplanter = { ent-BaseImplanter }
.desc = { ent-BaseImplanter.desc }
.suffix = световое копьё

ent-SmokeImplanter = { ent-BaseImplanter }
.desc = { ent-BaseImplanter.desc }
.desc = { ent-BaseImplanter.desc }
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
ent-HardlightSpearImplant = имплант световое копьё
.desc = Этот имплант создаёт световое копьё в ваших руках.

ent-SmokeImplant = имплант дыма
.desc = Этот имплант выпускает облако дыма при активации.
.desc = Этот имплант выпускает облако дыма при активации.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-HardlightSpear = световое копьё
.desc = Копьё из твердого света.
5 changes: 4 additions & 1 deletion Resources/Locale/ru-RU/_white/store/uplink-catalog.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ uplink-experimental-syndicate-teleporter-desc = Телепортер синди
uplink-ebow-name = Маленький энергетический арбалет
uplink-ebow-desc = Довольно тихое оружие, которое автоматически перезаряжается и оглушает. Хорошо сочетается с другими видами оружия.

uplink-hardlight-spear-implant-name = Имплант светового копья
uplink-hardlight-spear-implant-desc = Имплант, вводимый в тело и активируемый по желанию пользователя. Он вызывает копье из твердого света, с помощью которого пользователь может сеять хаос.

uplink-smoke-implant-name = Имплант дыма
uplink-smoke-implant-desc = Выпускает облако дыма при активации.
uplink-smoke-implant-desc = Выпускает облако дыма при активации.
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Objects/Fun/darts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
- 0.10,-0.20
density: 20
mask:
- ItemMask
- ThrownItem # WD EDIT
restitution: 0.3
friction: 0.2
- type: Sprite
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Objects/Materials/shards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
bounds: "-0.2,-0.2,0.2,0.2"
density: 30
mask:
- ItemMask
- ThrownItem # WD EDIT
Spatison marked this conversation as resolved.
Show resolved Hide resolved
- type: DamageOtherOnHit
damage:
types:
Expand Down
16 changes: 16 additions & 0 deletions Resources/Prototypes/Entities/Objects/Misc/tiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@
damage:
types:
Blunt: 5
# WD EDIT START
- type: Fixtures
fixtures:
fix1:
shape: !type:PolygonShape
vertices:
- -0.25,-0.25
- -0.30,-0.25
- 0.25,0.25
- -0.25,0.25
density: 20
mask:
- ThrownItem
restitution: 0.3
friction: 0.2
# WD EDIT END

- type: entity
name: steel tile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- 0.30,0.40
density: 20
mask:
- ItemMask
- ThrownItem # WD EDIT
restitution: 0.3
friction: 0.2
- type: Sharp
Expand Down
15 changes: 15 additions & 0 deletions Resources/Prototypes/_White/Actions/types.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
- type: entity
id: ActivateHardlightSpearImplant
name: Create hardlight spear
description: Creates hardlight spear in your hands.
Spatison marked this conversation as resolved.
Show resolved Hide resolved
noSpawn: true
components:
- type: InstantAction
useDelay: 1.5
itemIconStyle: BigAction
priority: -20
icon:
sprite: _White/Objects/Weapons/Melee/Spear/hardlight_spear.rsi
state: spear
event: !type:ActivateSpawnImplantEvent

Spatison marked this conversation as resolved.
Show resolved Hide resolved
- type: entity
id: ActivateSmokeImplant
name: Release a cloud of smoke
Expand Down
19 changes: 18 additions & 1 deletion Resources/Prototypes/_White/Catalog/uplink_catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@
- NukeOpsUplink
saleLimit: 1

- type: listing
id: UplinkHardlightSpearImplanter
name: uplink-hardlight-spear-implant-name
description: uplink-hardlight-spear-implant-desc
icon: { sprite: /Textures/_White/Objects/Weapons/Melee/Spear/hardlight_spear.rsi, state: spear }
productEntity: HardlightSpearImplanter
cost:
Telecrystal: 12
categories:
- UplinkImplants
conditions:
- !type:StoreWhitelistCondition
blacklist:
tags:
- NukeOpsUplink
saleLimit: 1

Spatison marked this conversation as resolved.
Show resolved Hide resolved
- type: listing
id: UplinkSmokeImplanter
name: uplink-smoke-implant-name
Expand All @@ -61,4 +78,4 @@
cost:
Telecrystal: 2
categories:
- UplinkImplants
- UplinkImplants
11 changes: 10 additions & 1 deletion Resources/Prototypes/_White/Entities/Objects/Misc/implanters.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
- type: entity
parent: BaseImplantOnlyImplanterSyndi
id: HardlightSpearImplanter
name: hardlight spear implanter
suffix: hardlight spear
components:
- type: Implanter
implant: HardlightSpearImplant

- type: entity
parent: BaseImplantOnlyImplanterSyndi
id: SmokeImplanter
suffix: smoke
components:
- type: Implanter
implant: SmokeImplant
implant: SmokeImplant
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
- type: entity
parent: BaseSubdermalImplant
id: HardlightSpearImplant
name: hardlight spear implant
description: This implant creates hardlight spear in your hands.
noSpawn: true
components:
- type: SubdermalImplant
implantAction: ActivateHardlightSpearImplant
- type: SpawnImplant
spawnId: HardlightSpear

- type: entity
parent: BaseSubdermalImplant
id: SmokeImplant
Expand All @@ -12,4 +24,4 @@
spreadAmount: 25
duration: 15
- type: SoundOnTrigger
sound: /Audio/Effects/smoke.ogg
sound: /Audio/Effects/smoke.ogg
Loading
Loading