Skip to content

Commit 8c1f4e2

Browse files
committed
updated cocoon version
1 parent c8b67a4 commit 8c1f4e2

File tree

8 files changed

+57
-7
lines changed

8 files changed

+57
-7
lines changed

Content.Server/SS220/CultYogg/Corruption/CultYoggCocoonSystem.cs

+34-5
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,24 @@
44
using Content.Shared.Interaction.Events;
55
using Robust.Shared.Audio.Systems;
66
using Content.Shared.SS220.CultYogg.Corruption;
7-
using Content.Shared.Inventory.Events;
7+
using Robust.Shared.Containers;
8+
using Robust.Shared.Timing;
9+
using JetBrains.FormatRipper.Elf;
810

911
namespace Content.Server.SS220.CultYogg.Corruption;
1012

1113
public sealed class CultYoggCocoonSystem : EntitySystem
1214
{
1315
[Dependency] private readonly SharedHandsSystem _hands = default!;
1416
[Dependency] private readonly SharedAudioSystem _audio = default!;
15-
17+
[Dependency] private readonly IGameTiming _timing = default!;
1618

1719
public override void Initialize()
1820
{
1921
base.Initialize();
2022

2123
SubscribeLocalEvent<CultYoggCocoonComponent, UseInHandEvent>(OnUseInHand);
22-
SubscribeLocalEvent<CultYoggWeaponComponent, DroppedEvent>(OnUnequip);
24+
SubscribeLocalEvent<CultYoggWeaponComponent, EntGotRemovedFromContainerMessage>(OnRemove);
2325
}
2426
private void OnUseInHand(Entity<CultYoggCocoonComponent> ent, ref UseInHandEvent args)
2527
{
@@ -35,6 +37,7 @@ private void OnUseInHand(Entity<CultYoggCocoonComponent> ent, ref UseInHandEvent
3537
comp.SoftDeletedOriginalEntity = corruptComp.SoftDeletedOriginalEntity;
3638
comp.Recipe = corruptComp.Recipe;
3739
}
40+
3841
EntityManager.DeleteEntity(ent);
3942
_hands.PickupOrDrop(args.User, newEnt);
4043
if (ent.Comp.Sound != null)
@@ -46,8 +49,34 @@ private void OnUseInHand(Entity<CultYoggCocoonComponent> ent, ref UseInHandEvent
4649

4750
args.Handled = true;
4851
}
49-
private void OnUnequip(Entity<CultYoggWeaponComponent> ent, ref DroppedEvent args)
52+
private void OnRemove(Entity<CultYoggWeaponComponent> ent, ref EntGotRemovedFromContainerMessage args)
53+
{
54+
ent.Comp.BeforeCocooningTime = _timing.CurTime + ent.Comp.CocooningCooldown;
55+
}
56+
public override void Update(float frameTime)
5057
{
51-
;
58+
base.Update(frameTime);
59+
60+
var query = EntityQueryEnumerator<CultYoggWeaponComponent>();
61+
while (query.MoveNext(out var ent, out var comp))
62+
{
63+
if (comp.BeforeCocooningTime is null)
64+
continue;
65+
66+
if (_timing.CurTime < comp.BeforeCocooningTime)
67+
continue;
68+
69+
if (!TryComp<CultYoggCorruptedComponent>(ent, out var corruptComp))
70+
return;
71+
72+
var coords = Transform(ent).Coordinates;
73+
var newEnt = Spawn(comp.Item, coords);
74+
75+
var corrComp = EnsureComp<CultYoggCorruptedComponent>(newEnt);
76+
corrComp.SoftDeletedOriginalEntity = corruptComp.SoftDeletedOriginalEntity;
77+
corrComp.Recipe = corruptComp.Recipe;
78+
79+
EntityManager.DeleteEntity(ent);
80+
}
5281
}
5382
}

Content.Server/SS220/CultYogg/Corruption/CultYoggWeaponComponent.cs

+12
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,16 @@ namespace Content.Server.SS220.CultYogg.Corruption;
1010

1111
public sealed partial class CultYoggWeaponComponent : Component
1212
{
13+
/// <summary>
14+
/// how much time required to cocoon enity
15+
/// </summary>
16+
[DataField]
17+
public TimeSpan CocooningCooldown = TimeSpan.FromSeconds(5);
18+
19+
public TimeSpan? BeforeCocooningTime;
20+
/// <summary>
21+
/// What kind of entity it will cocoon in.
22+
/// </summary>
23+
[DataField("item", required: true)]
24+
public ProtoId<EntityPrototype>? Item { get; private set; }
1325
}

Resources/Prototypes/SS220/CultYogg/beach.yml

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
suffix: CultYogg
88
description: description
99
components:
10+
- type: CultYoggWeapon
11+
item: CultYoggCocoonBeach
1012
- type: Sprite
1113
sprite: SS220/Objects/Weapons/Melee/cult_yogg_beach.rsi
1214
state: icon

Resources/Prototypes/SS220/CultYogg/claw.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
22

33
- type: entity
4-
name: cult claw
4+
name: Claw
55
parent: BaseItem
66
id: ClawCultYogg
77
suffix: CultYogg
88
description: description
99
components:
10+
- type: CultYoggWeapon
11+
item: CultYoggCocoonClaw
1012
- type: Sprite
1113
sprite: SS220/Objects/Weapons/Melee/cult_yogg_claw.rsi
1214
state: icon

Resources/Prototypes/SS220/CultYogg/cultcocoon.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
suffix: Horn
4343
components:
4444
- type: CultYoggCocoon
45-
item: HornCultYogg
45+
item:
4646
sound:
4747
path: /Audio/Effects/unwrap.ogg
4848

Resources/Prototypes/SS220/CultYogg/horn.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
id: HornCultYogg
55
suffix: CultYogg
66
components:
7+
- type: CultYoggWeapon
8+
item: CultYoggCocoonHorn
79
- type: Gun
810
soundGunshot: /Audio/Weapons/Guns/Gunshots/harpoon.ogg
911
soundEmpty: null

Resources/Prototypes/SS220/CultYogg/spikegun.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
suffix: CultYogg
66
components:
77
- type: CultYoggWeapon
8+
item: CultYoggCocoonSpikegun
89
- type: AmmoCounter
910
- type: Gun
1011
soundGunshot: /Audio/Weapons/Guns/Gunshots/harpoon.ogg

Resources/Prototypes/SS220/CultYogg/spitballer.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
suffix: CultYogg
55
id: Spitballer
66
components:
7+
- type: CultYoggWeapon
8+
item: CultYoggCocoonSpitballer
79
- type: Gun
810
cameraRecoilScalar: 1
911
fireRate: 11

0 commit comments

Comments
 (0)