Skip to content

Commit

Permalink
Finishing arachne system
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus committed Jun 10, 2024
1 parent a90fe7f commit 8432e2c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
16 changes: 4 additions & 12 deletions Content.Server/Arachne/ArachneSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ public override void Initialize()

private void OnInit(EntityUid uid, ArachneComponent component, ComponentInit args)
{
if (_prototypeManager.TryIndex<WorldTargetActionPrototype>("SpinWeb", out var spinWeb))
_actions.AddAction(uid, new WorldTargetAction(spinWeb), null);
_actions.AddAction(uid, ref component.WebActionEntity, component.WebActionId);
}

private void AddCocoonVerb(EntityUid uid, ArachneComponent component, GetVerbsEvent<InnateVerb> args)
Expand Down Expand Up @@ -244,13 +243,11 @@ private void OnSpinWeb(SpinWebActionEvent args)
}

_popupSystem.PopupEntity(Loc.GetString("spin-web-start-third-person", ("spider", Identity.Entity(args.Performer, EntityManager))), args.Performer,
Filter.PvsExcept(args.Performer).RemoveWhereAttachedEntity(entity => !ExamineSystemShared.InRangeUnOccluded(args.Performer, entity, ExamineRange, null)),
true,
Shared.Popups.PopupType.MediumCaution);
_popupSystem.PopupEntity(Loc.GetString("spin-web-start-second-person"), args.Performer, args.Performer, Shared.Popups.PopupType.Medium);

var ev = new ArachneWebDoAfterEvent(coords);
var doAfterArgs = new DoAfterArgs(args.Performer, arachne.WebDelay, ev, args.Performer)
var doAfterArgs = new DoAfterArgs(EntityManager, args.Performer, arachne.WebDelay, ev, args.Performer)
{
BreakOnUserMove = true,
};
Expand All @@ -261,9 +258,6 @@ private void OnSpinWeb(SpinWebActionEvent args)
private void StartCocooning(EntityUid uid, ArachneComponent component, EntityUid target)
{
_popupSystem.PopupEntity(Loc.GetString("cocoon-start-third-person", ("target", Identity.Entity(target, EntityManager)), ("spider", Identity.Entity(uid, EntityManager))), uid,
// TODO: We need popup occlusion lmao
Filter.PvsExcept(uid).RemoveWhereAttachedEntity(entity => !ExamineSystemShared.InRangeUnOccluded(uid, entity, ExamineRange, null)),
true,
Shared.Popups.PopupType.MediumCaution);

_popupSystem.PopupEntity(Loc.GetString("cocoon-start-second-person", ("target", Identity.Entity(target, EntityManager))), uid, uid, Shared.Popups.PopupType.Medium);
Expand All @@ -277,7 +271,7 @@ private void StartCocooning(EntityUid uid, ArachneComponent component, EntityUid
// Who knows, there's no docs!
var ev = new ArachneCocoonDoAfterEvent();

var args = new DoAfterArgs(uid, delay, ev, uid, target: target)
var args = new DoAfterArgs(EntityManager, uid, delay, ev, uid, target: target)
{
BreakOnUserMove = true,
BreakOnTargetMove = true,
Expand All @@ -293,12 +287,10 @@ private void OnWebDoAfter(EntityUid uid, ArachneComponent component, ArachneWebD

_hungerSystem.ModifyHunger(uid, -8);
if (TryComp<ThirstComponent>(uid, out var thirst))
_thirstSystem.UpdateThirst(thirst, -20);
_thirstSystem.ModifyThirst(uid, thirst, -20);

Spawn("ArachneWeb", args.Coords.SnapToGrid());
_popupSystem.PopupEntity(Loc.GetString("spun-web-third-person", ("spider", Identity.Entity(uid, EntityManager))), uid,
Filter.PvsExcept(uid).RemoveWhereAttachedEntity(entity => !ExamineSystemShared.InRangeUnOccluded(uid, entity, ExamineRange, null)),
true,
Shared.Popups.PopupType.MediumCaution);
_popupSystem.PopupEntity(Loc.GetString("spun-web-second-person"), uid, uid, Shared.Popups.PopupType.Medium);
args.Handled = true;
Expand Down
10 changes: 10 additions & 0 deletions Content.Shared/Arachne/ArachneComponent.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Shared.Arachne
{
[RegisterComponent]
Expand All @@ -18,5 +21,12 @@ public sealed partial class ArachneComponent : Component

[DataField("webBloodReagent")]
public string WebBloodReagent = "Blood";

[DataField("webActionId",
customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? WebActionId = "SpinWeb";

[DataField("dispelActionEntity")]
public EntityUid? WebActionEntity;
}
}

0 comments on commit 8432e2c

Please sign in to comment.