diff --git a/Content.Client/Silicons/Borgs/BorgSystem.cs b/Content.Client/Silicons/Borgs/BorgSystem.cs index 5d2e5fa070..e92ce5cc77 100644 --- a/Content.Client/Silicons/Borgs/BorgSystem.cs +++ b/Content.Client/Silicons/Borgs/BorgSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.Silicons.Borgs; +using Content.Shared.Mobs; +using Content.Shared.Silicons.Borgs; using Content.Shared.Silicons.Borgs.Components; using Robust.Client.GameObjects; using Robust.Shared.Containers; @@ -22,7 +23,7 @@ public sealed class BorgSystem : SharedBorgSystem { if (args.Sprite == null) return; - UpdateBorgAppearnce(uid, component, args.Component, args.Sprite); + UpdateBorgAppearance(uid, component, args.Component, args.Sprite); } protected override void OnInserted(EntityUid uid, BorgChassisComponent component, EntInsertedIntoContainerMessage args) @@ -31,7 +32,7 @@ public sealed class BorgSystem : SharedBorgSystem return; base.OnInserted(uid, component, args); - UpdateBorgAppearnce(uid, component); + UpdateBorgAppearance(uid, component); } protected override void OnRemoved(EntityUid uid, BorgChassisComponent component, EntRemovedFromContainerMessage args) @@ -40,10 +41,10 @@ public sealed class BorgSystem : SharedBorgSystem return; base.OnRemoved(uid, component, args); - UpdateBorgAppearnce(uid, component); + UpdateBorgAppearance(uid, component); } - private void UpdateBorgAppearnce(EntityUid uid, + private void UpdateBorgAppearance(EntityUid uid, BorgChassisComponent? component = null, AppearanceComponent? appearance = null, SpriteComponent? sprite = null) @@ -51,6 +52,15 @@ public sealed class BorgSystem : SharedBorgSystem if (!Resolve(uid, ref component, ref appearance, ref sprite)) return; + if (_appearance.TryGetData(uid, MobStateVisuals.State, out var state, appearance)) + { + if (state != MobState.Alive) + { + sprite.LayerSetVisible(BorgVisualLayers.Light, false); + return; + } + } + if (!_appearance.TryGetData(uid, BorgVisuals.HasPlayer, out var hasPlayer, appearance)) hasPlayer = false; diff --git a/Content.Server/Medical/DefibrillatorSystem.cs b/Content.Server/Medical/DefibrillatorSystem.cs index dd9f1ec91e..a1e2d53d17 100644 --- a/Content.Server/Medical/DefibrillatorSystem.cs +++ b/Content.Server/Medical/DefibrillatorSystem.cs @@ -218,11 +218,9 @@ public sealed class DefibrillatorSystem : EntitySystem } else { - _mobThreshold.SetAllowRevives(target, true, thresholds); if (_mobState.IsDead(target, mob)) _damageable.TryChangeDamage(target, component.ZapHeal, true, origin: uid); _mobState.ChangeMobState(target, MobState.Critical, mob, uid); - _mobThreshold.SetAllowRevives(target, false, thresholds); if (_mind.TryGetMind(target, out var mindId, out var mind) && mind.Session is { } playerSession) diff --git a/Content.Server/Silicons/Borgs/BorgSystem.cs b/Content.Server/Silicons/Borgs/BorgSystem.cs index 883cb3b3d8..7de351a70f 100644 --- a/Content.Server/Silicons/Borgs/BorgSystem.cs +++ b/Content.Server/Silicons/Borgs/BorgSystem.cs @@ -11,6 +11,8 @@ using Content.Shared.IdentityManagement; using Content.Shared.Interaction; using Content.Shared.Mind; using Content.Shared.Mind.Components; +using Content.Shared.Mobs; +using Content.Shared.Mobs.Systems; using Content.Shared.Movement.Systems; using Content.Shared.PowerCell; using Content.Shared.PowerCell.Components; @@ -39,6 +41,7 @@ public sealed partial class BorgSystem : SharedBorgSystem [Dependency] private readonly HandsSystem _hands = default!; [Dependency] private readonly MetaDataSystem _metaData = default!; [Dependency] private readonly SharedMindSystem _mind = default!; + [Dependency] private readonly MobStateSystem _mobState = default!; [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!; [Dependency] private readonly PowerCellSystem _powerCell = default!; [Dependency] private readonly ThrowingSystem _throwing = default!; @@ -56,6 +59,7 @@ public sealed partial class BorgSystem : SharedBorgSystem SubscribeLocalEvent(OnChassisInteractUsing); SubscribeLocalEvent(OnMindAdded); SubscribeLocalEvent(OnMindRemoved); + SubscribeLocalEvent(OnMobStateChanged); SubscribeLocalEvent(OnPowerCellChanged); SubscribeLocalEvent(OnPowerCellSlotEmpty); SubscribeLocalEvent(OnUIOpenAttempt); @@ -98,7 +102,7 @@ public sealed partial class BorgSystem : SharedBorgSystem { if (_mind.TryGetMind(used, out _, out var mind) && mind.Session != null) { - if (!CanPlayerBeBorgged(mind.Session)) + if (!CanPlayerBeBorged(mind.Session)) { Popup.PopupEntity(Loc.GetString("borg-player-not-allowed"), used, args.User); return; @@ -154,6 +158,19 @@ public sealed partial class BorgSystem : SharedBorgSystem BorgDeactivate(uid, component); } + private void OnMobStateChanged(EntityUid uid, BorgChassisComponent component, MobStateChangedEvent args) + { + if (args.NewMobState == MobState.Alive) + { + if (_mind.TryGetMind(uid, out _, out _)) + _powerCell.SetPowerCellDrawEnabled(uid, true); + } + else + { + _powerCell.SetPowerCellDrawEnabled(uid, false); + } + } + private void OnPowerCellChanged(EntityUid uid, BorgChassisComponent component, PowerCellChangedEvent args) { UpdateBatteryAlert(uid); @@ -172,7 +189,7 @@ public sealed partial class BorgSystem : SharedBorgSystem if (_powerCell.HasDrawCharge(uid, draw)) { // only reenable the powerdraw if a player has the role. - if (!draw.Drawing && _mind.TryGetMind(uid, out _, out _)) + if (!draw.Drawing && _mind.TryGetMind(uid, out _, out _) && _mobState.IsAlive(uid)) _powerCell.SetPowerCellDrawEnabled(uid, true); EnableBorgAbilities(uid, component); @@ -213,7 +230,7 @@ public sealed partial class BorgSystem : SharedBorgSystem if (!_mind.TryGetMind(uid, out var mindId, out var mind) || mind.Session == null) return; - if (!CanPlayerBeBorgged(mind.Session)) + if (!CanPlayerBeBorged(mind.Session)) { Popup.PopupEntity(Loc.GetString("borg-player-not-allowed-eject"), uid); Container.RemoveEntity(containerEnt, uid); @@ -249,7 +266,7 @@ public sealed partial class BorgSystem : SharedBorgSystem /// /// Activates the borg, enabling all of its modules. /// - public void EnableBorgAbilities(EntityUid uid, BorgChassisComponent component) + public void EnableBorgAbilities(EntityUid uid, BorgChassisComponent component, PowerCellDrawComponent? powerCell = null) { if (component.Activated) return; @@ -302,7 +319,7 @@ public sealed partial class BorgSystem : SharedBorgSystem /// Checks that a player has fulfilled the requirements for the borg job. /// If they don't have enough hours, they cannot be placed into a chassis. /// - public bool CanPlayerBeBorgged(ICommonSession session) + public bool CanPlayerBeBorged(ICommonSession session) { if (_banManager.GetJobBans(session.UserId)?.Contains(BorgJobId) == true) return false; diff --git a/Content.Server/Zombies/ZombieSystem.Transform.cs b/Content.Server/Zombies/ZombieSystem.Transform.cs index 18bbd7e7a8..9c51b052fe 100644 --- a/Content.Server/Zombies/ZombieSystem.Transform.cs +++ b/Content.Server/Zombies/ZombieSystem.Transform.cs @@ -198,12 +198,10 @@ namespace Content.Server.Zombies if (TryComp(target, out var tempComp)) tempComp.ColdDamage.ClampMax(0); - _mobThreshold.SetAllowRevives(target, true); //Heals the zombie from all the damage it took while human if (TryComp(target, out var damageablecomp)) _damageable.SetAllDamage(target, damageablecomp, 0); _mobState.ChangeMobState(target, MobState.Alive); - _mobThreshold.SetAllowRevives(target, false); var factionComp = EnsureComp(target); foreach (var id in new List(factionComp.Factions)) diff --git a/Content.Shared/Alert/AlertType.cs b/Content.Shared/Alert/AlertType.cs index e0a7ac99f8..68db360231 100644 --- a/Content.Shared/Alert/AlertType.cs +++ b/Content.Shared/Alert/AlertType.cs @@ -49,7 +49,9 @@ namespace Content.Shared.Alert Debug5, Debug6, SuitPower, - BorgHealth + BorgHealth, + BorgCrit, + BorgDead } } diff --git a/Content.Shared/Mobs/Systems/MobStateSystem.StateMachine.cs b/Content.Shared/Mobs/Systems/MobStateSystem.StateMachine.cs index 25b63d5b80..2fa522dea5 100644 --- a/Content.Shared/Mobs/Systems/MobStateSystem.StateMachine.cs +++ b/Content.Shared/Mobs/Systems/MobStateSystem.StateMachine.cs @@ -36,7 +36,8 @@ public partial class MobStateSystem } /// - /// Change the MobState and trigger MobState update events + /// Change the MobState without triggering UpdateMobState events. + /// WARNING: use this sparingly when you need to override other systems (MobThresholds) /// /// Target Entity we want to change the MobState of /// The new MobState we want to set @@ -48,9 +49,7 @@ public partial class MobStateSystem if (!Resolve(entity, ref component)) return; - var ev = new UpdateMobStateEvent {Target = entity, Component = component, Origin = origin, State = mobState}; - RaiseLocalEvent(entity, ref ev); - ChangeState(entity, component, ev.State); + ChangeState(entity, component, mobState, origin: origin); } #endregion diff --git a/Resources/Prototypes/Alerts/alerts.yml b/Resources/Prototypes/Alerts/alerts.yml index e71a8ed381..bc3137b07f 100644 --- a/Resources/Prototypes/Alerts/alerts.yml +++ b/Resources/Prototypes/Alerts/alerts.yml @@ -197,6 +197,24 @@ minSeverity: 0 maxSeverity: 4 +- type: alert + id: BorgCrit + category: Health + icons: + - sprite: /Textures/Interface/Alerts/borg_critical.rsi + state: critical + name: alerts-crit-name + description: alerts-crit-desc + +- type: alert + id: BorgDead + category: Health + icons: + - sprite: /Textures/Interface/Alerts/borg_dead.rsi + state: dead + name: alerts-dead-name + description: alerts-dead-desc + - type: alert id: BorgBattery category: Battery diff --git a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml index c0b89e783b..42fea8fda4 100644 --- a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml +++ b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml @@ -1,4 +1,5 @@ - type: entity + parent: BaseMob id: BaseBorgChassis name: cyborg description: A man-machine hybrid that assists in station activity. They love being asked to state their laws over and over. @@ -8,23 +9,16 @@ - type: Reactive groups: Acidic: [Touch] - - type: Input - context: "human" - - type: InputMover - type: DamageOnHighSpeedImpact damage: types: Blunt: 5 soundHit: path: /Audio/Effects/hit_kick.ogg - - type: Clickable - type: CombatMode - type: NoSlip - type: StaticPrice price: 1250 - - type: InteractionOutline - - type: Physics - bodyType: KinematicController - type: Fixtures fixtures: fix1: @@ -41,18 +35,24 @@ baseSprintSpeed : 4.5 - type: Sprite sprite: Mobs/Silicon/chassis.rsi - noRot: true - drawdepth: Mobs + - type: RotationVisuals + horizontalRotation: 90 - type: MobState allowedStates: - Alive + - Critical + - Dead - type: MobThresholds thresholds: 0: Alive - 150: Dead + 100: Critical + 200: Dead stateAlertDict: Alive: BorgHealth + Critical: BorgCrit + Dead: BorgDead showOverlays: false + allowRevives: true - type: HealthExaminable examinableTypes: - Blunt @@ -113,15 +113,12 @@ slots: cell_slot: name: power-cell-slot-component-slot-name-default - - type: DoAfter - - type: Eye - type: Body - type: StatusEffects allowed: - Stun - KnockedDown - SlowedDown - - type: Actions - type: TypingIndicator proto: robot - type: Speech @@ -148,7 +145,7 @@ volume: 5 - trigger: !type:DamageTrigger - damage: 150 + damage: 300 behaviors: - !type:PlaySoundBehavior sound: /Audio/Effects/metalbreak.ogg @@ -190,10 +187,7 @@ - type: Pullable - type: Puller needsHands: false - - type: Examiner - - type: Appearance - type: StandingState - - type: Alerts - type: Tag tags: - ShoesRequiredStepTriggerImmune diff --git a/Resources/Textures/Interface/Alerts/borg_alive.rsi/health0.png b/Resources/Textures/Interface/Alerts/borg_alive.rsi/health0.png index b94d636d0f..ab8c3ac9ca 100644 Binary files a/Resources/Textures/Interface/Alerts/borg_alive.rsi/health0.png and b/Resources/Textures/Interface/Alerts/borg_alive.rsi/health0.png differ diff --git a/Resources/Textures/Interface/Alerts/borg_alive.rsi/health1.png b/Resources/Textures/Interface/Alerts/borg_alive.rsi/health1.png index c58c73f604..507f254882 100644 Binary files a/Resources/Textures/Interface/Alerts/borg_alive.rsi/health1.png and b/Resources/Textures/Interface/Alerts/borg_alive.rsi/health1.png differ diff --git a/Resources/Textures/Interface/Alerts/borg_alive.rsi/health2.png b/Resources/Textures/Interface/Alerts/borg_alive.rsi/health2.png index 2447ba0fe3..160f153af8 100644 Binary files a/Resources/Textures/Interface/Alerts/borg_alive.rsi/health2.png and b/Resources/Textures/Interface/Alerts/borg_alive.rsi/health2.png differ diff --git a/Resources/Textures/Interface/Alerts/borg_alive.rsi/health3.png b/Resources/Textures/Interface/Alerts/borg_alive.rsi/health3.png index fd4e7ccde3..be9ff364eb 100644 Binary files a/Resources/Textures/Interface/Alerts/borg_alive.rsi/health3.png and b/Resources/Textures/Interface/Alerts/borg_alive.rsi/health3.png differ diff --git a/Resources/Textures/Interface/Alerts/borg_alive.rsi/health4.png b/Resources/Textures/Interface/Alerts/borg_alive.rsi/health4.png index 449d4428b8..1ef65e48a0 100644 Binary files a/Resources/Textures/Interface/Alerts/borg_alive.rsi/health4.png and b/Resources/Textures/Interface/Alerts/borg_alive.rsi/health4.png differ diff --git a/Resources/Textures/Interface/Alerts/borg_critical.rsi/critical.png b/Resources/Textures/Interface/Alerts/borg_critical.rsi/critical.png new file mode 100644 index 0000000000..cd11538d50 Binary files /dev/null and b/Resources/Textures/Interface/Alerts/borg_critical.rsi/critical.png differ diff --git a/Resources/Textures/Interface/Alerts/borg_critical.rsi/meta.json b/Resources/Textures/Interface/Alerts/borg_critical.rsi/meta.json new file mode 100644 index 0000000000..cc3906665a --- /dev/null +++ b/Resources/Textures/Interface/Alerts/borg_critical.rsi/meta.json @@ -0,0 +1,21 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "https://github.com/tgstation/tgstation/blob/42ebbb4202b472cf94561974a30e00a0b00e11bc/icons/mob/screen1_robot.dmi", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "critical", + "delays": [ + [ + 0.1, + 0.1, + 0.1 + ] + ] + } + ] +} diff --git a/Resources/Textures/Interface/Alerts/borg_dead.rsi/dead.png b/Resources/Textures/Interface/Alerts/borg_dead.rsi/dead.png new file mode 100644 index 0000000000..c060f9b180 Binary files /dev/null and b/Resources/Textures/Interface/Alerts/borg_dead.rsi/dead.png differ diff --git a/Resources/Textures/Interface/Alerts/borg_dead.rsi/meta.json b/Resources/Textures/Interface/Alerts/borg_dead.rsi/meta.json new file mode 100644 index 0000000000..bb68e6e4ee --- /dev/null +++ b/Resources/Textures/Interface/Alerts/borg_dead.rsi/meta.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "https://github.com/tgstation/tgstation/blob/42ebbb4202b472cf94561974a30e00a0b00e11bc/icons/mob/screen1_robot.dmi", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "dead" + } + ] +}