Add hardlight spear implant (#587)

* Add hardlight spear implant

* Small fixes

* Fix collision layer
This commit is contained in:
Aviu00
2024-01-04 04:11:28 +09:00
committed by Aviu00
parent f8aca2617c
commit 4304673fd6
18 changed files with 235 additions and 5 deletions

View File

@@ -0,0 +1,12 @@
using Content.Shared.Actions;
namespace Content.Shared.White.HardlightSpear;
[RegisterComponent]
public sealed partial class HardlightSpearComponent : Component
{
}
public sealed partial class ActivateHardlightSpearImplantEvent : InstantActionEvent
{
}

View File

@@ -0,0 +1,79 @@
using System.Linq;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Implants.Components;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
using Content.Shared.Physics;
using Content.Shared.Popups;
using Content.Shared.Throwing;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Events;
using Robust.Shared.Spawners;
namespace Content.Shared.White.HardlightSpear;
public sealed class HardlightSpearSystem : EntitySystem
{
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HardlightSpearComponent, LandEvent>(OnLand);
SubscribeLocalEvent<HardlightSpearComponent, DroppedEvent>(OnDrop);
SubscribeLocalEvent<HardlightSpearComponent, GettingPickedUpAttemptEvent>(OnPickupAttempt);
SubscribeLocalEvent<HardlightSpearComponent, PreventCollideEvent>(OnPreventCollision);
SubscribeLocalEvent<SubdermalImplantComponent, ActivateHardlightSpearImplantEvent>(OnImplantActivate);
}
private void OnPreventCollision(EntityUid uid, HardlightSpearComponent component, ref PreventCollideEvent args)
{
// Opaque collision mask doesn't work for EmbeddableProjectileComponent
if (TryComp(args.OtherEntity, out FixturesComponent? fixtures) &&
fixtures.Fixtures.All(fix => (fix.Value.CollisionLayer & (int) CollisionGroup.Opaque) == 0))
{
args.Cancelled = true;
}
}
private void OnImplantActivate(EntityUid uid, SubdermalImplantComponent component,
ActivateHardlightSpearImplantEvent args)
{
if (!TryComp(component.ImplantedEntity, out TransformComponent? transform))
return;
var spear = EntityManager.SpawnEntity("SpearHardlight", transform.Coordinates);
if (_hands.TryPickupAnyHand(component.ImplantedEntity.Value, spear))
{
_audio.PlayPvs("/Audio/Weapons/ebladeon.ogg", spear);
args.Handled = true;
return;
}
Del(spear);
}
private void OnPickupAttempt(EntityUid uid, HardlightSpearComponent component, GettingPickedUpAttemptEvent args)
{
if (!HasComp<TimedDespawnComponent>(uid))
return;
args.Cancel();
_popup.PopupClient(Loc.GetString("hardlight-spear-pickup-failed"), uid, args.User);
}
private void OnDrop(EntityUid uid, HardlightSpearComponent component, DroppedEvent args)
{
EnsureComp<TimedDespawnComponent>(uid);
}
private void OnLand(EntityUid uid, HardlightSpearComponent component, ref LandEvent args)
{
EnsureComp<TimedDespawnComponent>(uid);
}
}

View File

@@ -0,0 +1,5 @@
hardlight-spear-pickup-failed = You can't pick up hardlight spear.
use-hardlight-spear-implant-action-name = Create hardlight spear
use-hardlight-spear-implant-action-description = Creates hardlight spear in your hands.
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.

View File

@@ -11,7 +11,7 @@ implanter-inject-text = Установка
implanter-empty-text = Пусто
implanter-implant-text = { $implantName }{ $lineBreak }{ $implantDescription }
implanter-contained-implant-text = [color=green]{ $desc }[/color]
implanter-label = [color=white]Имплант: { $currentEntities }{ $lineBreak }Режим: { $modeString }[/color]
implanter-label = [color=white]Имплант: { $implantName }{ $lineBreak }Режим: { $modeString }[/color]
## Implanter Actions

View File

@@ -0,0 +1,13 @@
hardlight-spear-pickup-failed = Вы не можете подобрать световое копьё.
use-hardlight-spear-implant-action-name = Создать световое копьё.
use-hardlight-spear-implant-action-description = Создает световое копьё в ваших руках.
uplink-hardlight-spear-implant-name = Имплантатор световое копьё
uplink-hardlight-spear-implant-desc = Имплант, вводимый в тело и активируемый по желанию пользователя. Он вызывает копье из твердого света, с помощью которого пользователь может сеять хаос.
ent-SpearHardlight = световое копьё
.desc = Копьё из твердого света.
ent-HardlightSpearImplanter = имплантатор световое копьё
ent-HardlightSpearImplant = имплант световое копьё
.desc = Этот имплант создаёт световое копьё в ваших руках.

View File

@@ -16,8 +16,8 @@
fix1:
shape: !type:PolygonShape
vertices:
- -0.40,-0.30
- -0.30,-0.40
- -0.20,-0.10
- -0.10,-0.20
- 0.40,0.30
- 0.30,0.40
density: 20
@@ -42,6 +42,7 @@
animation: WeaponArcThrust
soundHit:
path: /Audio/Weapons/bladeslice.ogg
range: 2 # Spears are long
- type: DamageOtherOnHit
damage:
types:

View File

@@ -12,3 +12,18 @@
sprite: Objects/Weapons/Grenades/smoke.rsi
state: icon
event: !type:ActivateImplantEvent
- type: entity
id: ActivateHardlightSpearImplant
name: use-hardlight-spear-implant-action-name
description: use-hardlight-spear-implant-action-description
noSpawn: true
components:
- type: InstantAction
useDelay: 1.5
itemIconStyle: BigAction
priority: -20
icon:
sprite: White/Objects/Weapons/hardlight_spear.rsi
state: spear
event: !type:ActivateHardlightSpearImplantEvent

View File

@@ -73,3 +73,14 @@
Telecrystal: 2
categories:
- UplinkImplants
- type: listing
id: UplinkHardlightSpearImplanter
name: uplink-hardlight-spear-implant-name
description: uplink-hardlight-spear-implant-desc
icon: { sprite: /Textures/White/Objects/Weapons/hardlight_spear.rsi, state: spear }
productEntity: HardlightSpearImplanter
cost:
Telecrystal: 15
categories:
- UplinkImplants

View File

@@ -1,7 +1,15 @@
- type: entity
id: SmokeImplanter
name: Имплант дыма
name: имплант дыма
parent: BaseImplantOnlyImplanterSyndi
components:
- type: Implanter
implant: SmokeImplant
- type: entity
id: HardlightSpearImplanter
name: hardlight spear implanter
parent: BaseImplantOnlyImplanterSyndi
components:
- type: Implanter
implant: HardlightSpearImplant

View File

@@ -1,7 +1,7 @@
- type: entity
parent: BaseSubdermalImplant
id: SmokeImplant
name: Имплант дыма
name: имплант дыма
description: Этот имплант выпускает облако дыма при активации.
noSpawn: true
components:
@@ -13,3 +13,13 @@
duration: 15
- type: SoundOnTrigger
sound: /Audio/Effects/smoke.ogg
- 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

View File

@@ -0,0 +1,42 @@
- type: entity
name: hardlight spear
parent: Spear
id: SpearHardlight
description: A spear made out of hardened light.
components:
- type: Sprite
sprite: White/Objects/Weapons/hardlight_spear.rsi
- type: MeleeWeapon
damage:
types:
Piercing: 18
Heat: 18
soundHit:
path: /Audio/Weapons/smash.ogg
- type: DamageOtherOnHit
damage:
types:
Piercing: 30
Heat: 30
- type: Wieldable
- type: IncreaseDamageOnWield
damage:
types:
Piercing: 4
Heat: 4
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 30 #excess damage avoids cost of spawning entities.
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: EmbeddableProjectile
offset: 0.15,0.15
deleteOnRemove: true
- type: HardlightSpear
- type: PointLight
radius: 1.5
energy: 2
color: yellow

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

View File

@@ -0,0 +1,34 @@
{
"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",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "spear"
},
{
"name": "inhand-left",
"directions": 4
},
{
"name": "inhand-right",
"directions": 4
},
{
"name": "wielded-inhand-left",
"directions": 4
},
{
"name": "wielded-inhand-right",
"directions": 4
},
{
"name": "equipped-BACKPACK",
"directions": 4
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B