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);
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Content.Shared.Construction.Prototypes;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.MedicalScanner;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.Medical.Components
|
||||
{
|
||||
@@ -11,6 +13,15 @@ namespace Content.Server.Medical.Components
|
||||
public ContainerSlot BodyContainer = default!;
|
||||
public EntityUid? ConnectedConsole;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float CloningFailChanceMultiplier = 1f;
|
||||
|
||||
[DataField("machinePartCloningFailChance", customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
|
||||
public string MachinePartCloningFailChance = "ScanningModule";
|
||||
|
||||
[DataField("partRatingCloningFailChanceMultiplier")]
|
||||
public float PartRatingFailMultiplier = 0.75f;
|
||||
|
||||
// ECS this out!, when DragDropSystem and InteractionSystem refactored
|
||||
public override bool DragDropOn(DragDropEvent eventArgs)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Climbing;
|
||||
using Content.Server.Cloning;
|
||||
using Content.Server.Medical.Components;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Destructible;
|
||||
@@ -10,8 +11,8 @@ using Content.Shared.Verbs;
|
||||
using Robust.Shared.Containers;
|
||||
using Content.Server.MachineLinking.System;
|
||||
using Content.Server.MachineLinking.Events;
|
||||
using Content.Server.Cloning.Systems;
|
||||
using Content.Server.Cloning.Components;
|
||||
using Content.Server.Construction;
|
||||
using Content.Server.MobState;
|
||||
using Robust.Server.Containers;
|
||||
|
||||
@@ -43,6 +44,8 @@ namespace Content.Server.Medical
|
||||
SubscribeLocalEvent<MedicalScannerComponent, DragDropEvent>(HandleDragDropOn);
|
||||
SubscribeLocalEvent<MedicalScannerComponent, PortDisconnectedEvent>(OnPortDisconnected);
|
||||
SubscribeLocalEvent<MedicalScannerComponent, AnchorStateChangedEvent>(OnAnchorChanged);
|
||||
SubscribeLocalEvent<MedicalScannerComponent, RefreshPartsEvent>(OnRefreshParts);
|
||||
SubscribeLocalEvent<MedicalScannerComponent, UpgradeExamineEvent>(OnUpgradeExamine);
|
||||
}
|
||||
|
||||
private void OnComponentInit(EntityUid uid, MedicalScannerComponent scannerComponent, ComponentInit args)
|
||||
@@ -224,5 +227,17 @@ namespace Content.Server.Medical
|
||||
_climbSystem.ForciblySetClimbing(contained, uid);
|
||||
UpdateAppearance(scannerComponent.Owner, scannerComponent);
|
||||
}
|
||||
|
||||
private void OnRefreshParts(EntityUid uid, MedicalScannerComponent component, RefreshPartsEvent args)
|
||||
{
|
||||
var ratingFail = args.PartRatings[component.MachinePartCloningFailChance];
|
||||
|
||||
component.CloningFailChanceMultiplier = MathF.Pow(component.PartRatingFailMultiplier, ratingFail - 1);
|
||||
}
|
||||
|
||||
private void OnUpgradeExamine(EntityUid uid, MedicalScannerComponent component, UpgradeExamineEvent args)
|
||||
{
|
||||
args.AddPercentageUpgrade("medical-scanner-upgrade-cloning", component.CloningFailChanceMultiplier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,3 +2,5 @@
|
||||
|
||||
medical-scanner-verb-enter = Enter
|
||||
medical-scanner-verb-noun-occupant = occupant
|
||||
|
||||
medical-scanner-upgrade-cloning = Cloning fail chance
|
||||
|
||||
@@ -230,11 +230,10 @@
|
||||
- type: MachineBoard
|
||||
prototype: MedicalScanner
|
||||
requirements:
|
||||
ScanningModule: 1
|
||||
Manipulator: 1
|
||||
Laser: 1
|
||||
ScanningModule: 2
|
||||
Capacitor: 1
|
||||
materialRequirements:
|
||||
Glass: 1
|
||||
Glass: 5
|
||||
Cable: 1
|
||||
|
||||
- type: entity
|
||||
|
||||
@@ -64,6 +64,9 @@
|
||||
- type: Climbable
|
||||
- type: ApcPowerReceiver
|
||||
powerLoad: 200 #Receives most of its power from the console
|
||||
- type: UpgradePowerDraw #upgrade it for the meme?
|
||||
powerDrawMultiplier: 0.75
|
||||
scaling: Exponential
|
||||
- type: EmptyOnMachineDeconstruct
|
||||
containers:
|
||||
- scanner-bodyContainer
|
||||
|
||||
Reference in New Issue
Block a user