Make CloningSystem properly reset and not use static (#2448)
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.GameObjects.Components.Observer;
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
@@ -19,6 +17,7 @@ using Robust.Server.GameObjects.Components.UserInterface;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -76,12 +75,12 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
HandleGhostReturn);
|
||||
}
|
||||
|
||||
public void Update(float frametime)
|
||||
public void Update(float frameTime)
|
||||
{
|
||||
if (_bodyContainer.ContainedEntity != null &&
|
||||
Powered)
|
||||
{
|
||||
_cloningProgress += frametime;
|
||||
_cloningProgress += frameTime;
|
||||
_cloningProgress = MathHelper.Clamp(_cloningProgress, 0f, _cloningTime);
|
||||
}
|
||||
|
||||
@@ -122,7 +121,9 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
|
||||
private CloningPodBoundUserInterfaceState GetUserInterfaceState()
|
||||
{
|
||||
return new CloningPodBoundUserInterfaceState(CloningSystem.getIdToUser(), _cloningProgress,
|
||||
var idToUser = EntitySystem.Get<CloningSystem>().GetIdToUser();
|
||||
|
||||
return new CloningPodBoundUserInterfaceState(idToUser, _cloningProgress,
|
||||
(_status == CloningPodStatus.Cloning));
|
||||
}
|
||||
|
||||
@@ -152,11 +153,12 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
switch (message.Button)
|
||||
{
|
||||
case UiButton.Clone:
|
||||
|
||||
if (message.ScanId == null) return;
|
||||
|
||||
var cloningSystem = EntitySystem.Get<CloningSystem>();
|
||||
|
||||
if (_bodyContainer.ContainedEntity != null ||
|
||||
!CloningSystem.Minds.TryGetValue(message.ScanId.Value, out var mind))
|
||||
!cloningSystem.Minds.TryGetValue(message.ScanId.Value, out var mind))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user