mech tweaks (#15619)

This commit is contained in:
deltanedas
2023-04-24 21:00:36 +00:00
committed by GitHub
parent 808eee068f
commit dd4cf48c0a
4 changed files with 55 additions and 65 deletions

View File

@@ -16,6 +16,7 @@ using Content.Shared.Verbs;
using Content.Shared.Wires;
using Robust.Server.Containers;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.Map;
namespace Content.Server.Mech.Systems;
@@ -41,6 +42,7 @@ public sealed class MechSystem : SharedMechSystem
_sawmill = Logger.GetSawmill("mech");
SubscribeLocalEvent<MechComponent, InteractUsingEvent>(OnInteractUsing);
SubscribeLocalEvent<MechComponent, EntInsertedIntoContainerMessage>(OnInsertBattery);
SubscribeLocalEvent<MechComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<MechComponent, GetVerbsEvent<AlternativeVerb>>(OnAlternativeVerb);
SubscribeLocalEvent<MechComponent, MechOpenUiEvent>(OnOpenUi);
@@ -69,6 +71,7 @@ public sealed class MechSystem : SharedMechSystem
if (component.Broken || component.Integrity <= 0 || component.Energy <= 0)
args.Cancel();
}
private void OnInteractUsing(EntityUid uid, MechComponent component, InteractUsingEvent args)
{
if (TryComp<WiresPanelComponent>(uid, out var panel) && !panel.Open)
@@ -93,6 +96,18 @@ public sealed class MechSystem : SharedMechSystem
}
}
private void OnInsertBattery(EntityUid uid, MechComponent component, EntInsertedIntoContainerMessage args)
{
if (args.Container != component.BatterySlot || !TryComp<BatteryComponent>(args.Entity, out var battery))
return;
component.Energy = battery.CurrentCharge;
component.MaxEnergy = battery.MaxCharge;
Dirty(component);
_actionBlocker.UpdateCanMove(uid);
}
private void OnRemoveBattery(EntityUid uid, MechComponent component, RemoveBatteryEvent args)
{
if (args.Cancelled || args.Handled)
@@ -115,12 +130,6 @@ public sealed class MechSystem : SharedMechSystem
component.Integrity = component.MaxIntegrity;
component.Energy = component.MaxEnergy;
if (component.StartingBattery != null)
{
var battery = Spawn(component.StartingBattery, Transform(uid).Coordinates);
InsertBattery(uid, battery, component);
}
_actionBlocker.UpdateCanMove(uid);
Dirty(component);
}

View File

@@ -138,13 +138,6 @@ public sealed class MechComponent : Component
[DataField("startingEquipment", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public List<string> StartingEquipment = new();
/// <summary>
/// The battery the mech initially has when it spawns
/// Good for admemes and nukie mechs.
/// </summary>
[DataField("startingBattery", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? StartingBattery;
#region Action Prototypes
[DataField("mechCycleAction", customTypeSerializer: typeof(PrototypeIdSerializer<InstantActionPrototype>))]
public string MechCycleAction = "MechCycleEquipment";

View File

@@ -21,6 +21,14 @@
restitution: 0.3 # fite me
friction: 0.2
- type: Pullable
# Ripley APLU
- type: entity
id: BaseRipleyPart
parent: BaseMechPart
abstract: true
components:
- type: Sprite
drawdepth: Items
noRot: false
@@ -28,27 +36,15 @@
sprite: Objects/Specific/Mech/ripley_construction.rsi
- type: entity
id: BaseMechPartItem
parent: BaseMechPart
id: BaseRipleyPartItem
parent: BaseRipleyPart
abstract: true
components:
- type: Item
size: 50
- type: entity
id: BaseMechConstruct
parent: BaseMechPart
abstract: true
components:
- type: Appearance
- type: ContainerContainer
containers:
battery-container: !type:Container
- type: MechAssemblyVisuals
statePrefix: ripley
- type: entity
parent: BaseMechPart
parent: BaseRipleyPart
id: RipleyHarness
name: ripley harness
description: The core of the Ripley APLU.
@@ -88,7 +84,7 @@
noRot: true
- type: entity
parent: BaseMechPartItem
parent: BaseRipleyPartItem
id: RipleyLArm
name: ripley left arm
description: The left arm of the Ripley APLU. It belongs on the chassis of the mech.
@@ -100,7 +96,7 @@
- RipleyLArm
- type: entity
parent: BaseMechPartItem
parent: BaseRipleyPartItem
id: RipleyLLeg
name: ripley left leg
description: The left leg of the Ripley APLU. It belongs on the chassis of the mech.
@@ -112,7 +108,7 @@
- RipleyLLeg
- type: entity
parent: BaseMechPartItem
parent: BaseRipleyPartItem
id: RipleyRLeg
name: ripley right leg
description: The right leg of the Ripley APLU. It belongs on the chassis of the mech.
@@ -124,7 +120,7 @@
- RipleyRLeg
- type: entity
parent: BaseMechPartItem
parent: BaseRipleyPartItem
id: RipleyRArm
name: ripley right arm
description: The right arm of the Ripley APLU. It belongs on the chassis of the mech.
@@ -137,10 +133,16 @@
- type: entity
id: RipleyChassis
parent: BaseMechConstruct
parent: BaseRipleyPart
name: ripley chassis
description: An in-progress construction of the Ripley APLU mech.
components:
- type: Appearance
- type: ContainerContainer
containers:
battery-container: !type:Container
- type: MechAssemblyVisuals
statePrefix: ripley
- type: Sprite
noRot: true
state: ripley0

View File

@@ -3,19 +3,8 @@
save: false
abstract: true
components:
- type: Sprite
netsync: false
drawdepth: Mobs
noRot: true
sprite: Objects/Specific/Mech/mecha.rsi
layers:
- map: [ "enum.MechVisualLayers.Base" ]
state: ripley
- type: MobMover
- type: Mech
baseState: ripley
openState: ripley-open
brokenState: ripley-broken
- type: MechAir
- type: DoAfter
- type: Repairable
@@ -77,8 +66,16 @@
id: MechRipley
parent: BaseMech
name: Ripley APLU
description: Versatile and lightly armored, the Ripley is useful for almost any heavy work scenario. The "APLU" stands for Atonomous Power Loading Unit.
description: Versatile and lightly armored, the Ripley is useful for almost any heavy work scenario. The "APLU" stands for Autonomous Power Loading Unit.
components:
- type: Sprite
netsync: false
drawdepth: Mobs
noRot: true
sprite: Objects/Specific/Mech/mecha.rsi
layers:
- map: [ "enum.MechVisualLayers.Base" ]
state: ripley
- type: FootstepModifier
footstepSoundCollection:
path: /Audio/Mecha/sound_mecha_powerloader_step.ogg
@@ -102,18 +99,7 @@
parent: MechRipley
suffix: Battery
components:
- type: Mech
baseState: ripley
openState: ripley-open
brokenState: ripley-broken
startingBattery: PowerCellHigh
mechToPilotDamageMultiplier: 0.75
- type: MeleeWeapon
hidden: true
attackRate: 1
damage:
types:
Blunt: 14
- type: MovementSpeedModifier
baseWalkSpeed: 2.25
baseSprintSpeed: 3.6
- type: ContainerFill
containers:
mech-battery-slot:
- PowerCellHigh