medical scanner machine upgrading (#12487)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Content.Server.EUI;
|
||||
using Content.Shared.Cloning;
|
||||
using Content.Shared.Eui;
|
||||
using Content.Server.Cloning.Systems;
|
||||
|
||||
namespace Content.Server.Cloning
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Timing;
|
||||
using Content.Server.Medical.Components;
|
||||
using Content.Server.Cloning.Components;
|
||||
using Content.Server.Power.Components;
|
||||
@@ -17,7 +16,7 @@ using Content.Shared.Cloning;
|
||||
using Content.Shared.MachineLinking.Events;
|
||||
using Content.Shared.IdentityManagement;
|
||||
|
||||
namespace Content.Server.Cloning.Systems
|
||||
namespace Content.Server.Cloning
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class CloningConsoleSystem : EntitySystem
|
||||
@@ -130,10 +129,12 @@ namespace Content.Server.Cloning.Systems
|
||||
if (!consoleComponent.CloningPodInRange || !consoleComponent.GeneticScannerInRange)
|
||||
return;
|
||||
|
||||
if (scannerComp.BodyContainer.ContainedEntity is null)
|
||||
var body = scannerComp.BodyContainer.ContainedEntity;
|
||||
|
||||
if (body is null)
|
||||
return;
|
||||
|
||||
if (!TryComp<MindComponent>(scannerComp.BodyContainer.ContainedEntity.Value, out var mindComp))
|
||||
if (!TryComp<MindComponent>(body, out var mindComp))
|
||||
return;
|
||||
|
||||
var mind = mindComp.Mind;
|
||||
@@ -141,7 +142,7 @@ namespace Content.Server.Cloning.Systems
|
||||
if (mind == null || mind.UserId.HasValue == false || mind.Session == null)
|
||||
return;
|
||||
|
||||
bool cloningSuccessful = _cloningSystem.TryCloning(cloningPodUid, scannerComp.BodyContainer.ContainedEntity.Value, mind, cloningPod);
|
||||
_cloningSystem.TryCloning(cloningPodUid, body.Value, mind, cloningPod, scannerComp.CloningFailChanceMultiplier);
|
||||
}
|
||||
|
||||
public void RecheckConnections(EntityUid console, EntityUid? cloningPod, EntityUid? scanner, CloningConsoleComponent? consoleComp = null)
|
||||
|
||||
@@ -32,7 +32,7 @@ using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Server.Cloning.Systems
|
||||
namespace Content.Server.Cloning
|
||||
{
|
||||
public sealed class CloningSystem : EntitySystem
|
||||
{
|
||||
@@ -152,7 +152,7 @@ namespace Content.Server.Cloning.Systems
|
||||
args.PushMarkup(Loc.GetString("cloning-pod-biomass", ("number", _material.GetMaterialAmount(uid, component.RequiredMaterial))));
|
||||
}
|
||||
|
||||
public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Mind.Mind mind, CloningPodComponent? clonePod)
|
||||
public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Mind.Mind mind, CloningPodComponent? clonePod, float failChanceModifier = 1)
|
||||
{
|
||||
if (!Resolve(uid, ref clonePod))
|
||||
return false;
|
||||
@@ -211,6 +211,8 @@ namespace Content.Server.Cloning.Systems
|
||||
damageable.Damage.DamageDict.TryGetValue("Cellular", out var cellularDmg))
|
||||
{
|
||||
var chance = Math.Clamp((float) (cellularDmg / 100), 0, 1);
|
||||
chance *= failChanceModifier;
|
||||
|
||||
if (cellularDmg > 0 && clonePod.ConnectedConsole != null)
|
||||
_chatSystem.TrySendInGameICMessage(clonePod.ConnectedConsole.Value, Loc.GetString("cloning-console-cellular-warning", ("percent", Math.Round(100 - (chance * 100)))), InGameICChatType.Speak, false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user