Skip to content

Commit

Permalink
Fix Burrowed Larva not appearing on end card (RMC-14#5064)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rainbeon authored Dec 6, 2024
1 parent 3278288 commit a6c2401
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Content.Shared/_RMC14/Xenonids/Hive/SharedXenoHiveSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public void JoinBurrowedLarva(Entity<HiveComponent> hive, EntityUid user)
if (hive.Comp.BurrowedLarva <= 0)
return;

EntityUid? spawned = null;
EntityUid? larva = null;

bool TrySpawnAt<T>() where T : Component
{
Expand All @@ -295,7 +295,7 @@ bool TrySpawnAt<T>() where T : Component
continue;

var position = _transform.GetMoverCoordinates(uid);
spawned = SpawnAtPosition(hive.Comp.BurrowedLarvaId, position);
larva = SpawnAtPosition(hive.Comp.BurrowedLarvaId, position);
return true;
}

Expand All @@ -309,21 +309,20 @@ bool TrySpawnAt<T>() where T : Component
return;
}

if (spawned == null)
if (larva == null)
return;

hive.Comp.BurrowedLarva--;
Dirty(hive);

_xeno.MakeXeno(spawned.Value);
_hive.SetHive(spawned.Value, hive);
_xeno.MakeXeno(larva.Value);
_hive.SetHive(larva.Value, hive);

if (TryComp(user, out ActorComponent? actor))
{
if (!_mind.TryGetMind(actor.PlayerSession.UserId, out var mind))
mind = _mind.CreateMind(actor.PlayerSession.UserId);
var newMind = _mind.CreateMind(actor.PlayerSession.UserId, EntityManager.GetComponent<MetaDataComponent>(larva.Value).EntityName);

_mind.TransferTo(mind.Value, spawned, ghostCheckOverride: true);
_mind.TransferTo(newMind, larva, ghostCheckOverride: true);
}

_adminLog.Add(LogType.RMCBurrowedLarva, $"{ToPrettyString(user):player} took a burrowed larva from hive {ToPrettyString(hive):hive}.");
Expand Down

0 comments on commit a6c2401

Please sign in to comment.