Slay bobby pt. 1 (#5632)
This commit is contained in:
@@ -1,109 +0,0 @@
|
||||
using Content.Shared.Body.Behavior;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Body.Part;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Body.Behavior
|
||||
{
|
||||
public abstract class MechanismBehavior : SharedMechanismBehavior
|
||||
{
|
||||
private SharedMechanismComponent _parent = default!;
|
||||
|
||||
public override SharedBodyComponent? Body => Part?.Body;
|
||||
|
||||
public override SharedBodyPartComponent? Part => Parent.Part;
|
||||
|
||||
public override SharedMechanismComponent Parent => _parent;
|
||||
|
||||
public override IEntity Owner => Parent.Owner;
|
||||
|
||||
public override void Initialize(SharedMechanismComponent parent)
|
||||
{
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public override void Startup()
|
||||
{
|
||||
if (Part == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Body == null)
|
||||
{
|
||||
AddedToPart(Part);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddedToPartInBody(Body, Part);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update(float frameTime) { }
|
||||
|
||||
public override void AddedToBody(SharedBodyComponent body)
|
||||
{
|
||||
DebugTools.AssertNotNull(Body);
|
||||
DebugTools.AssertNotNull(body);
|
||||
|
||||
OnAddedToBody(body);
|
||||
}
|
||||
|
||||
public override void AddedToPart(SharedBodyPartComponent part)
|
||||
{
|
||||
DebugTools.AssertNotNull(Part);
|
||||
DebugTools.AssertNotNull(part);
|
||||
|
||||
OnAddedToPart(part);
|
||||
}
|
||||
|
||||
public override void AddedToPartInBody(SharedBodyComponent body, SharedBodyPartComponent part)
|
||||
{
|
||||
DebugTools.AssertNotNull(Body);
|
||||
DebugTools.AssertNotNull(body);
|
||||
DebugTools.AssertNotNull(Part);
|
||||
DebugTools.AssertNotNull(part);
|
||||
|
||||
OnAddedToPartInBody(body, part);
|
||||
}
|
||||
|
||||
public override void RemovedFromBody(SharedBodyComponent old)
|
||||
{
|
||||
DebugTools.AssertNull(Body);
|
||||
DebugTools.AssertNotNull(old);
|
||||
|
||||
OnRemovedFromBody(old);
|
||||
}
|
||||
|
||||
public override void RemovedFromPart(SharedBodyPartComponent old)
|
||||
{
|
||||
DebugTools.AssertNull(Part);
|
||||
DebugTools.AssertNotNull(old);
|
||||
|
||||
OnRemovedFromPart(old);
|
||||
}
|
||||
|
||||
public override void RemovedFromPartInBody(SharedBodyComponent oldBody, SharedBodyPartComponent oldPart)
|
||||
{
|
||||
DebugTools.AssertNull(Body);
|
||||
DebugTools.AssertNull(Part);
|
||||
DebugTools.AssertNotNull(oldBody);
|
||||
DebugTools.AssertNotNull(oldPart);
|
||||
|
||||
OnRemovedFromPartInBody(oldBody, oldPart);
|
||||
}
|
||||
|
||||
protected virtual void OnAddedToBody(SharedBodyComponent body) { }
|
||||
|
||||
protected virtual void OnAddedToPart(SharedBodyPartComponent part) { }
|
||||
|
||||
protected virtual void OnAddedToPartInBody(SharedBodyComponent body, SharedBodyPartComponent part) { }
|
||||
|
||||
protected virtual void OnRemovedFromBody(SharedBodyComponent old) { }
|
||||
|
||||
protected virtual void OnRemovedFromPart(SharedBodyPartComponent old) { }
|
||||
|
||||
protected virtual void OnRemovedFromPartInBody(SharedBodyComponent oldBody, SharedBodyPartComponent oldPart) { }
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Alert;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Body.Behavior;
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Server.Temperature.Systems;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user