-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;
{
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)
return;
base.OnInserted(uid, component, args);
- UpdateBorgAppearnce(uid, component);
+ UpdateBorgAppearance(uid, component);
}
protected override void OnRemoved(EntityUid uid, BorgChassisComponent component, EntRemovedFromContainerMessage args)
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)
if (!Resolve(uid, ref component, ref appearance, ref sprite))
return;
+ if (_appearance.TryGetData<MobState>(uid, MobStateVisuals.State, out var state, appearance))
+ {
+ if (state != MobState.Alive)
+ {
+ sprite.LayerSetVisible(BorgVisualLayers.Light, false);
+ return;
+ }
+ }
+
if (!_appearance.TryGetData<bool>(uid, BorgVisuals.HasPlayer, out var hasPlayer, appearance))
hasPlayer = false;
}
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)
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;
[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!;
SubscribeLocalEvent<BorgChassisComponent, AfterInteractUsingEvent>(OnChassisInteractUsing);
SubscribeLocalEvent<BorgChassisComponent, MindAddedMessage>(OnMindAdded);
SubscribeLocalEvent<BorgChassisComponent, MindRemovedMessage>(OnMindRemoved);
+ SubscribeLocalEvent<BorgChassisComponent, MobStateChangedEvent>(OnMobStateChanged);
SubscribeLocalEvent<BorgChassisComponent, PowerCellChangedEvent>(OnPowerCellChanged);
SubscribeLocalEvent<BorgChassisComponent, PowerCellSlotEmptyEvent>(OnPowerCellSlotEmpty);
SubscribeLocalEvent<BorgChassisComponent, ActivatableUIOpenAttemptEvent>(OnUIOpenAttempt);
{
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;
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);
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);
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);
/// <summary>
/// Activates the borg, enabling all of its modules.
/// </summary>
- public void EnableBorgAbilities(EntityUid uid, BorgChassisComponent component)
+ public void EnableBorgAbilities(EntityUid uid, BorgChassisComponent component, PowerCellDrawComponent? powerCell = null)
{
if (component.Activated)
return;
/// 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.
/// </summary>
- public bool CanPlayerBeBorgged(ICommonSession session)
+ public bool CanPlayerBeBorged(ICommonSession session)
{
if (_banManager.GetJobBans(session.UserId)?.Contains(BorgJobId) == true)
return false;
if (TryComp<TemperatureComponent>(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<DamageableComponent>(target, out var damageablecomp))
_damageable.SetAllDamage(target, damageablecomp, 0);
_mobState.ChangeMobState(target, MobState.Alive);
- _mobThreshold.SetAllowRevives(target, false);
var factionComp = EnsureComp<NpcFactionMemberComponent>(target);
foreach (var id in new List<string>(factionComp.Factions))
Debug5,
Debug6,
SuitPower,
- BorgHealth
+ BorgHealth,
+ BorgCrit,
+ BorgDead
}
}
}
/// <summary>
- /// 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)
/// </summary>
/// <param name="entity">Target Entity we want to change the MobState of</param>
/// <param name="mobState">The new MobState we want to set</param>
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
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
- 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.
- 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:
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
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
volume: 5
- trigger:
!type:DamageTrigger
- damage: 150
+ damage: 300
behaviors:
- !type:PlaySoundBehavior
sound: /Audio/Effects/metalbreak.ogg
- type: Pullable
- type: Puller
needsHands: false
- - type: Examiner
- - type: Appearance
- type: StandingState
- - type: Alerts
- type: Tag
tags:
- ShoesRequiredStepTriggerImmune
--- /dev/null
+{
+ "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
+ ]
+ ]
+ }
+ ]
+}
--- /dev/null
+{
+ "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"
+ }
+ ]
+}