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;
_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);
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)
}
}
+ 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)
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);
}
[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";
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
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.
- type: ItemMapper
mapLayers:
ripley_l_arm+o:
- whitelist:
+ whitelist:
tags:
- RipleyLArm
ripley_r_arm+o:
- whitelist:
+ whitelist:
tags:
- RipleyRArm
ripley_l_leg+o:
- whitelist:
+ whitelist:
tags:
- RipleyLLeg
ripley_r_leg+o:
- whitelist:
+ whitelist:
tags:
- RipleyRLeg
sprite: Objects/Specific/Mech/ripley_construction.rsi
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.
- 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.
- 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.
- 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.
- 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
- type: Construction
graph: Ripley
node: start
- defaultTarget: ripley
\ No newline at end of file
+ defaultTarget: ripley
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
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
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
\ No newline at end of file
+ - type: ContainerFill
+ containers:
+ mech-battery-slot:
+ - PowerCellHigh