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 1 commit
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 @@ -9,3 +9,6 @@ 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.
2 changes: 2 additions & 0 deletions Resources/Locale/ru-RU/_white/prototypes/actions/types.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-ActivateHardlightSpearImplant = Создать световое копьё
.desc = Создает световое копьё в ваших руках.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ent-HardlightSpearImplanter = { ent-BaseImplanter }
.desc = { ent-BaseImplanter.desc }
.suffix = световое копьё
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-HardlightSpearImplant = имплант световое копьё
.desc = Этот имплант создаёт световое копьё в ваших руках.
Spatison marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-HardlightSpear = световое копьё
.desc = Копьё из твердого света.
3 changes: 3 additions & 0 deletions Resources/Locale/ru-RU/_white/store/uplink-catalog.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ uplink-experimental-syndicate-teleporter-desc = Телепортер синди

uplink-ebow-name = Маленький энергетический арбалет
uplink-ebow-desc = Довольно тихое оружие, которое автоматически перезаряжается и оглушает. Хорошо сочетается с другими видами оружия.

uplink-hardlight-spear-implant-name = Имплант светового копья
uplink-hardlight-spear-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
14 changes: 14 additions & 0 deletions Resources/Prototypes/_White/Actions/types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- 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
17 changes: 17 additions & 0 deletions Resources/Prototypes/_White/Catalog/uplink_catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@
categories:
- UplinkWeapons
conditions:
- !type:StoreWhitelistCondition
blacklist:
tags:
- NukeOpsUplink
saleLimit: 1
Spatison marked this conversation as resolved.
Show resolved Hide resolved

- 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:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- type: entity
id: HardlightSpearImplanter
name: hardlight spear implanter
parent: BaseImplantOnlyImplanterSyndi
components:
- type: Implanter
implant: HardlightSpearImplant
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- 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
Spatison marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
- type: entity
name: hardlight spear
parent: Spear
id: HardlightSpear
description: A spear made out of hardened light.
components:
- type: Sprite
sprite: _White/Objects/Weapons/Melee/Spear/hardlight_spear.rsi
Spatison marked this conversation as resolved.
Show resolved Hide resolved
- type: MeleeWeapon
damage:
types:
Piercing: 18
Heat: 18
soundHit:
path: /Audio/Weapons/smash.ogg
- type: DamageOtherOnHit
damage:
types:
Piercing: 20
Heat: 20
- type: Wieldable
- type: IncreaseDamageOnWield
damage:
types:
Piercing: 4
Heat: 4
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 30
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: EmbeddableProjectile
offset: 0.15,0.15
deleteOnRemove: true
- type: DespawnOnLandItem
- type: ThrowingItemModifier
- type: PointLight
radius: 1.5
energy: 2
color: yellow
- 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading