medical scanner machine upgrading (#12487)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user