Антаг без ПДА - фикс от визденов (с костылями) (#788)

* Апстрима будет

* Also this
This commit is contained in:
BIGZi0348
2024-11-22 22:21:34 +03:00
committed by GitHub
parent 165838f5ef
commit 04e165c804
12 changed files with 259 additions and 133 deletions

View File

@@ -108,22 +108,38 @@ public abstract class SharedSubdermalImplantSystem : EntitySystem
/// </summary>
public void AddImplants(EntityUid uid, IEnumerable<String> implants)
{
var coords = Transform(uid).Coordinates;
foreach (var id in implants)
{
var ent = Spawn(id, coords);
if (TryComp<SubdermalImplantComponent>(ent, out var implant))
{
ForceImplant(uid, ent, implant);
}
else
{
Log.Warning($"Found invalid starting implant '{id}' on {uid} {ToPrettyString(uid):implanted}");
Del(ent);
}
AddImplant(uid, id);
}
}
/// <summary>
/// Adds a single implant to a person, and returns the implant.
/// Logs any implant ids that don't have <see cref="SubdermalImplantComponent"/>.
/// </summary>
/// <returns>
/// The implant, if it was successfully created. Otherwise, null.
/// </returns>>
public EntityUid? AddImplant(EntityUid uid, String implantId) // WD EDIT AHEAD OF WIZDEN UPSTREAM
{
var coords = Transform(uid).Coordinates;
var ent = Spawn(implantId, coords);
if (TryComp<SubdermalImplantComponent>(ent, out var implant))
{
ForceImplant(uid, ent, implant);
}
else
{
Log.Warning($"Found invalid starting implant '{implantId}' on {uid} {ToPrettyString(uid):implanted}");
Del(ent);
return null;
}
return ent;
}
/// <summary>
/// Forces an implant into a person
/// Good for on spawn related code or admin additions
@@ -184,7 +200,7 @@ public abstract class SharedSubdermalImplantSystem : EntitySystem
var relayEv = new ImplantRelayEvent<T>(args);
foreach (var implant in implantContainer.ContainedEntities)
{
if (args is HandledEntityEventArgs { Handled : true })
if (args is HandledEntityEventArgs { Handled: true })
return;
RaiseLocalEvent(implant, relayEv);
@@ -223,7 +239,7 @@ public abstract class SharedSubdermalImplantSystem : EntitySystem
// Remove the implant from the donor's implant container
_container.Remove(donorImplant, donorImplantContainer, force: true);
if(!TryComp<SubdermalImplantComponent>(donorImplant, out var subdermal))
if (!TryComp<SubdermalImplantComponent>(donorImplant, out var subdermal))
return;
// Insert the implant into the recipient's implant container