Skip to content

Commit

Permalink
Rename organ events to be same names as in med refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
0x6273 committed Feb 19, 2024
1 parent 2c6d8a8 commit 21c429a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Content.Server/Body/Systems/BrainSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<BrainComponent, AddedToPartInBodyEvent>((uid, _, args) => HandleMind(args.Body, uid));
SubscribeLocalEvent<BrainComponent, RemovedFromPartInBodyEvent>((uid, _, args) => HandleMind(uid, args.OldBody));
SubscribeLocalEvent<BrainComponent, OrganAddedToBodyEvent>((uid, _, args) => HandleMind(args.Body, uid));
SubscribeLocalEvent<BrainComponent, OrganRemovedFromBodyEvent>((uid, _, args) => HandleMind(uid, args.OldBody));
SubscribeLocalEvent<BrainComponent, PointAttemptEvent>(OnPointAttempt);
}

Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Species/Systems/NymphSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<NymphComponent, RemovedFromPartInBodyEvent>(OnRemovedFromPart);
SubscribeLocalEvent<NymphComponent, OrganRemovedFromBodyEvent>(OnRemovedFromPart);
}

private void OnRemovedFromPart(EntityUid uid, NymphComponent comp, RemovedFromPartInBodyEvent args)
private void OnRemovedFromPart(EntityUid uid, NymphComponent comp, ref OrganRemovedFromBodyEvent args)
{
if (!_timing.IsFirstTimePredicted)
return;
Expand Down
16 changes: 8 additions & 8 deletions Content.Shared/Body/Events/MechanismBodyEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ namespace Content.Shared.Body.Events;
// ways.

/// <summary>
/// Raised on a mechanism when it is added to a body part.
/// Raised on a mechanism when it is added to a body part.
/// </summary>
[ByRefEvent]
public readonly record struct AddedToPartEvent(EntityUid Part);
public readonly record struct OrganAddedEvent(EntityUid Part);

/// <summary>
/// Raised on a mechanism when it is added to a body part within a body.
/// Raised on a mechanism when it is added to a body part within a body.
/// </summary>
[ByRefEvent]
public readonly record struct AddedToPartInBodyEvent(EntityUid Body, EntityUid Part);
public readonly record struct OrganAddedToBodyEvent(EntityUid Body, EntityUid Part);

/// <summary>
/// Raised on a mechanism when it is removed from a body part.
/// Raised on a mechanism when it is removed from a body part.
/// </summary>
[ByRefEvent]
public readonly record struct RemovedFromPartEvent(EntityUid OldPart);
public readonly record struct OrganRemovedEvent(EntityUid OldPart);

/// <summary>
/// Raised on a mechanism when it is removed from a body part within a body.
/// Raised on a mechanism when it is removed from a body part within a body.
/// </summary>
[ByRefEvent]
public readonly record struct RemovedFromPartInBodyEvent(EntityUid OldBody, EntityUid OldPart);
public readonly record struct OrganRemovedFromBodyEvent(EntityUid OldBody, EntityUid OldPart);
8 changes: 4 additions & 4 deletions Content.Shared/Body/Systems/SharedBodySystem.Organs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ private void AddOrgan(
EntityUid parentPartUid)
{
organEnt.Comp.Body = bodyUid;
var addedEv = new AddedToPartEvent(parentPartUid);
var addedEv = new OrganAddedEvent(parentPartUid);
RaiseLocalEvent(organEnt, ref addedEv);

if (organEnt.Comp.Body is not null)
{
var addedInBodyEv = new AddedToPartInBodyEvent(bodyUid, parentPartUid);
var addedInBodyEv = new OrganAddedToBodyEvent(bodyUid, parentPartUid);
RaiseLocalEvent(organEnt, ref addedInBodyEv);
}

Expand All @@ -29,12 +29,12 @@ private void AddOrgan(

private void RemoveOrgan(Entity<OrganComponent> organEnt, EntityUid parentPartUid)
{
var removedEv = new RemovedFromPartEvent(parentPartUid);
var removedEv = new OrganRemovedEvent(parentPartUid);
RaiseLocalEvent(organEnt, ref removedEv);

if (organEnt.Comp.Body is { Valid: true } bodyUid)
{
var removedInBodyEv = new RemovedFromPartInBodyEvent(bodyUid, parentPartUid);
var removedInBodyEv = new OrganRemovedFromBodyEvent(bodyUid, parentPartUid);
RaiseLocalEvent(organEnt, ref removedInBodyEv);
}

Expand Down
4 changes: 2 additions & 2 deletions Content.Shared/Body/Systems/SharedBodySystem.Parts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ private void RecursiveBodyUpdate(Entity<BodyPartComponent> ent, EntityUid? bodyU

if (organComp.Body is { Valid: true } oldBodyUid)
{
var removedEv = new RemovedFromPartInBodyEvent(oldBodyUid, ent);
var removedEv = new OrganRemovedFromBodyEvent(oldBodyUid, ent);
RaiseLocalEvent(organ, ref removedEv);
}

organComp.Body = bodyUid;
if (bodyUid is not null)
{
var addedEv = new AddedToPartInBodyEvent(bodyUid.Value, ent);
var addedEv = new OrganAddedToBodyEvent(bodyUid.Value, ent);
RaiseLocalEvent(organ, ref addedEv);
}
}
Expand Down

0 comments on commit 21c429a

Please sign in to comment.