Skip to content

Commit

Permalink
full rework mechs on mobstates, coils fix mechs, diagnostic hud show …
Browse files Browse the repository at this point in the history
…health bar for mechs, mechs fastest repair, add mech analyzer
  • Loading branch information
Rinary1 committed Oct 18, 2024
1 parent 9161b78 commit 70306ca
Show file tree
Hide file tree
Showing 11 changed files with 153 additions and 10 deletions.
5 changes: 3 additions & 2 deletions Content.Server/Mech/Systems/MechSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public override void Initialize()
SubscribeLocalEvent<MechComponent, MechEntryEvent>(OnMechEntry);
SubscribeLocalEvent<MechComponent, MechExitEvent>(OnMechExit);

SubscribeLocalEvent<MechComponent, DamageChangedEvent>(OnDamageChanged);
//SubscribeLocalEvent<MechComponent, DamageChangedEvent>(OnDamageChanged);
SubscribeLocalEvent<MechComponent, MechEquipmentRemoveMessage>(OnRemoveEquipmentMessage);

SubscribeLocalEvent<MechComponent, UpdateCanMoveEvent>(OnMechCanMoveEvent);
Expand Down Expand Up @@ -265,7 +265,7 @@ private void OnMechExit(EntityUid uid, MechComponent component, MechExitEvent ar
args.Handled = true;
}

private void OnDamageChanged(EntityUid uid, MechComponent component, DamageChangedEvent args)
/* private void OnDamageChanged(EntityUid uid, MechComponent component, DamageChangedEvent args)
{
var integrity = component.MaxIntegrity - args.Damageable.TotalDamage;
SetIntegrity(uid, integrity, component);
Expand All @@ -278,6 +278,7 @@ private void OnDamageChanged(EntityUid uid, MechComponent component, DamageChang
_damageable.TryChangeDamage(component.PilotSlot.ContainedEntity, damage);
}
}
*/

private void ToggleMechUi(EntityUid uid, MechComponent? component = null, EntityUid? user = null)
{
Expand Down
15 changes: 12 additions & 3 deletions Content.Shared/Mech/EntitySystems/SharedMechSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Content.Shared.Actions;
using Content.Shared.Destructible;
using Content.Shared.DoAfter;
using Content.Shared.Mobs;
using Content.Shared.DragDrop;
using Content.Shared.Emag.Components;
using Content.Shared.Emag.Systems;
Expand Down Expand Up @@ -50,7 +51,7 @@ public override void Initialize()
SubscribeLocalEvent<MechComponent, MechEjectPilotEvent>(OnEjectPilotEvent);
SubscribeLocalEvent<MechComponent, UserActivateInWorldEvent>(RelayInteractionEvent);
SubscribeLocalEvent<MechComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<MechComponent, DestructionEventArgs>(OnDestruction);
SubscribeLocalEvent<MechComponent, MobStateChangedEvent>(OnMobState);
SubscribeLocalEvent<MechComponent, GetAdditionalAccessEvent>(OnGetAdditionalAccess);
SubscribeLocalEvent<MechComponent, DragDropTargetEvent>(OnDragDrop);
SubscribeLocalEvent<MechComponent, CanDropTargetEvent>(OnCanDragDrop);
Expand Down Expand Up @@ -101,9 +102,17 @@ private void OnStartup(EntityUid uid, MechComponent component, ComponentStartup
UpdateAppearance(uid, component);
}

private void OnDestruction(EntityUid uid, MechComponent component, DestructionEventArgs args)
private void OnMobState(EntityUid uid, MechComponent component, MobStateChangedEvent args)
{
BreakMech(uid, component);
if (args.NewMobState == MobState.Critical)
{
BreakMech(uid, component);
}
if (args.NewMobState == MobState.Alive)
{
component.Broken = false;
UpdateAppearance(uid, component);
}
}

private void OnGetAdditionalAccess(EntityUid uid, MechComponent component, ref GetAdditionalAccessEvent args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ ent-HandheldRoboAnalyzerEmpty = { ent-HandheldRoboAnalyzer }
ent-HandheldRoboAnalyzerUnpowered = { ent-BaseHandheldRoboAnalyzer }
.desc = { ent-BaseHandheldRoboAnalyzer.desc }
.suffix = Переносной, Не требует энергии
ent-BaseHandheldMechAnalyzer = анализатор механоидов
.desc = Портативный анализатор механоидов.
ent-HandheldMechAnalyzer = { ent-BaseHandheldMechAnalyzer }
.desc = { ent-BaseHandheldMechAnalyzer.desc }
.suffix = Переносной, Требует энергию
ent-HandheldMechAnalyzerEmpty = { ent-HandheldMechAnalyzer }
.desc = { ent-HandheldMechAnalyzer.desc }
.suffix = Переносной, Пустой
ent-HandheldMechAnalyzerUnpowered = { ent-BaseHandheldMechAnalyzer }
.desc = { ent-BaseHandheldMechAnalyzer.desc }
.suffix = Переносной, Не требует энергии
ent-BaseHandheldCamera = бодикамера
.desc = Оно наблюдает за вами... И пикает..
ent-HandheldCamera = { ent-BaseHandheldCamera }
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Clothing/Eyes/hud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
damageContainers:
- Inorganic
- Silicon
- Mech # Sunrise-edit

- type: entity
parent: [ClothingEyesBase, ShowMedicalIcons]
Expand Down
24 changes: 20 additions & 4 deletions Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@
- type: DoAfter
- type: Repairable
fuelCost: 25
doAfterDelay: 10
doAfterDelay: 3
damage:
types:
Blunt: -15
Slash: -15
Piercing: -15
- type: UserInterface
interfaces:
enum.MechUiKey.Key:
Expand Down Expand Up @@ -123,17 +128,28 @@
- Alive
- Critical
- type: MobThresholds
currentThresholdState : Alive
thresholds:
0: Alive
1000: Critical
500: Critical
showOverlays: false
allowRevives: true
- type: HealthExaminable
examinableTypes:
- Blunt
- Slash
- Piercing
- Heat
- Shock
locPrefix: mech
- type: Appearance
- type: ContainerContainer
containers:
mech-pilot-slot: !type:ContainerSlot
mech-equipment-container: !type:Container
mech-battery-slot: !type:ContainerSlot
- type: Damageable
damageContainer: Inorganic
damageContainer: Mech
damageModifierSet: LightArmor
- type: FootstepModifier
footstepSoundCollection:
Expand All @@ -145,7 +161,7 @@
thresholds:
- trigger:
!type:DamageTrigger
damage: 1000
damage: 700
behaviors:
- !type:PlaySoundBehavior
sound:
Expand Down
3 changes: 2 additions & 1 deletion Resources/Prototypes/Entities/Objects/Tools/cable_coils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@
- type: Healing
delay: 1
damageContainers:
- Synth
- Synth #Sunrise-edit
- Silicon
- Mech #Sunrise-edit
damage:
types:
Heat: -5
Expand Down
9 changes: 9 additions & 0 deletions Resources/Prototypes/_Sunrise/Damage/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,12 @@
- Heat
- Shock
- Caustic

- type: damageContainer
id: Mech
supportedGroups:
- Brute
supportedTypes:
- Heat
- Shock
- Caustic
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,82 @@
id: HandheldRoboAnalyzerUnpowered
parent: BaseHandheldRoboAnalyzer
suffix: Handheld, Unpowered

# Handheld Mech Analyzer

- type: entity
id: BaseHandheldMechAnalyzer
parent: BaseItem
name: mech analyzer
description: A hand-held mech scaner.
abstract: true
components:
- type: Sprite
sprite: Objects/Specific/Mech/mecha_equipment.rsi
state: icon
layers:
- state: mecha_analyzer
- state: mecha_analyzer_anim
shader: unshaded
visible: true
map: [ "enum.PowerDeviceVisualLayers.Powered" ]
- type: Item
storedRotation: -90
- type: ActivatableUI
key: enum.HealthAnalyzerUiKey.Key
- type: UserInterface
interfaces:
enum.HealthAnalyzerUiKey.Key:
type: HealthAnalyzerBoundUserInterface
- type: HealthAnalyzer
scanningEndSound:
path: "/Audio/Items/Medical/healthscanner.ogg"
damageContainers:
- Mech
- type: Tag
tags:
- DiscreteHealthAnalyzer
- type: Appearance
- type: GenericVisualizer
visuals:
enum.PowerCellSlotVisuals.Enabled:
enum.PowerDeviceVisualLayers.Powered:
True: { visible: true }
False: { visible: false }
- type: GuideHelp
guides:
- Robotics

- type: entity
id: HandheldMechAnalyzer
parent:
- BaseHandheldMechAnalyzer
- BaseHandheldComputer
suffix: HandHeld, Powered

- type: entity
id: HandheldMechAnalyzerEmpty
parent: HandheldMechAnalyzer
suffix: HandHeld, Empty
components:
- type: Sprite
sprite: _Sunrise/Objects/Devices/roboanalyzer.rsi
state: icon
layers:
- state: icon
- state: analyzer
shader: unshaded
visible: false
map: [ "enum.PowerDeviceVisualLayers.Powered" ]
- type: ItemSlots
slots:
cell_slot:
name: power-cell-slot-component-slot-name-default

- type: entity
id: HandheldMechAnalyzerUnpowered
parent: BaseHandheldMechAnalyzer
suffix: Handheld, Unpowered

# Handheld Camera

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,25 @@
{
"name": "mecha_analyzer"
},
{
"name": "mecha_analyzer_anim",
"delays": [
[
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.5
]
]
},
{
"name": "mecha_medigun"
},
Expand Down

0 comments on commit 70306ca

Please sign in to comment.