Wheelchair fixes (#18901)

* Remove netsync

* Replace OnStartup with OnMapInit

* Dont remove component

* Remove component ensure

* Remove using

* Cancel all moving or stand events

* Fix description

* Revert "Replace OnStartup with OnMapInit"

This reverts commit 5b7470d0dfa7a7c127dec6a06534b339f140ffac.

* Remove stand events cancel
This commit is contained in:
Morb
2023-08-13 10:29:39 +03:00
committed by GitHub
parent cd80ba392f
commit fb5f8dadbb
3 changed files with 16 additions and 6 deletions

View File

@@ -16,6 +16,5 @@ public sealed class WheelchairBoundSystem : EntitySystem
{ {
var wheelchair = Spawn(component.WheelchairPrototype, Transform(uid).Coordinates); var wheelchair = Spawn(component.WheelchairPrototype, Transform(uid).Coordinates);
_buckleSystem.TryBuckle(uid, uid, wheelchair); _buckleSystem.TryBuckle(uid, uid, wheelchair);
RemComp<WheelchairBoundComponent>(uid);
} }
} }

View File

@@ -1,8 +1,9 @@
using Content.Shared.Body.Systems; using Content.Shared.Body.Systems;
using Content.Shared.Buckle.Components; using Content.Shared.Buckle.Components;
using Content.Shared.Movement.Components; using Content.Shared.Movement.Events;
using Content.Shared.Movement.Systems; using Content.Shared.Movement.Systems;
using Content.Shared.Standing; using Content.Shared.Standing;
using Content.Shared.Throwing;
namespace Content.Shared.Traits.Assorted; namespace Content.Shared.Traits.Assorted;
@@ -17,13 +18,14 @@ public sealed class LegsParalyzedSystem : EntitySystem
SubscribeLocalEvent<LegsParalyzedComponent, ComponentStartup>(OnStartup); SubscribeLocalEvent<LegsParalyzedComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<LegsParalyzedComponent, ComponentShutdown>(OnShutdown); SubscribeLocalEvent<LegsParalyzedComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<LegsParalyzedComponent, BuckleChangeEvent>(OnBuckleChange); SubscribeLocalEvent<LegsParalyzedComponent, BuckleChangeEvent>(OnBuckleChange);
SubscribeLocalEvent<LegsParalyzedComponent, ThrowPushbackAttemptEvent>(OnThrowPushbackAttempt);
SubscribeLocalEvent<LegsParalyzedComponent, UpdateCanMoveEvent>(OnUpdateCanMoveEvent);
} }
private void OnStartup(EntityUid uid, LegsParalyzedComponent component, ComponentStartup args) private void OnStartup(EntityUid uid, LegsParalyzedComponent component, ComponentStartup args)
{ {
// TODO: In future probably must be surgery related wound // TODO: In future probably must be surgery related wound
var movementSpeed = EnsureComp<MovementSpeedModifierComponent>(uid); _movementSpeedModifierSystem.ChangeBaseSpeed(uid, 0, 0, 20);
_movementSpeedModifierSystem.ChangeBaseSpeed(uid, 0, 0, 20, movementSpeed);
} }
private void OnShutdown(EntityUid uid, LegsParalyzedComponent component, ComponentShutdown args) private void OnShutdown(EntityUid uid, LegsParalyzedComponent component, ComponentShutdown args)
@@ -43,4 +45,14 @@ public sealed class LegsParalyzedSystem : EntitySystem
_standingSystem.Down(args.BuckledEntity); _standingSystem.Down(args.BuckledEntity);
} }
} }
private void OnUpdateCanMoveEvent(EntityUid uid, LegsParalyzedComponent component, UpdateCanMoveEvent args)
{
args.Cancel();
}
private void OnThrowPushbackAttempt(EntityUid uid, LegsParalyzedComponent component, ThrowPushbackAttemptEvent args)
{
args.Cancel();
}
} }

View File

@@ -431,7 +431,7 @@
id: VehicleWheelchair id: VehicleWheelchair
parent: [BaseVehicle, BaseFoldable, BaseItem] parent: [BaseVehicle, BaseFoldable, BaseItem]
name: Wheelchair name: Wheelchair
description: A chair with big wheels. It looks like you can move in this on your own. description: A chair with big wheels. It looks like you can move in these on your own.
components: components:
- type: Vehicle - type: Vehicle
northOver: true northOver: true
@@ -446,7 +446,6 @@
- state: vehicle_folded - state: vehicle_folded
map: ["foldedLayer"] map: ["foldedLayer"]
visible: false visible: false
netsync: false
noRot: true noRot: true
- type: MovementSpeedModifier - type: MovementSpeedModifier
baseWalkSpeed: 2 baseWalkSpeed: 2