From 8187e000720c7478362aa7f10d5d9abe8f30b2da Mon Sep 17 00:00:00 2001 From: Morb <14136326+Morb0@users.noreply.github.com> Date: Tue, 8 Aug 2023 03:28:59 +0300 Subject: [PATCH] [Trait] Wheelchair bound (#18785) * Init commit * move to shared and remove all from component * maybe that * Use SharedBuckleSystem * Rename to WheelchairBound * Move Carriage to prototype * Update sprite to TG, add folded sprite, rename carriage to wheelchair * Fix wheelchair rsi path * Add stand & down for buckling * Add wheelchair inhand sprites * Move wheelchair down in file & fix fold sprite & add suffix Vehicle * Use new wheelchair id * Add standing & speed reset on component remove * Split system to leg paralyzed and wheelchair bound * Rename to LegsParalyzed * Rename in prototype * Move LegsParalyzed to shared --------- Co-authored-by: Ray --- .../Assorted/WheelchairBoundComponent.cs | 15 ++++++ .../Traits/Assorted/WheelchairBoundSystem.cs | 21 ++++++++ .../Traits/Assorted/LegsParalyzedComponent.cs | 12 +++++ .../Traits/Assorted/LegsParalyzedSystem.cs | 46 +++++++++++++++++ Resources/Locale/en-US/traits/traits.ftl | 3 ++ .../Entities/Objects/Vehicles/buckleable.yml | 48 ++++++++++++++++++ Resources/Prototypes/Traits/disabilities.yml | 8 +++ .../Vehicles/wheelchair.rsi/inhand-left.png | Bin 0 -> 676 bytes .../Vehicles/wheelchair.rsi/inhand-right.png | Bin 0 -> 629 bytes .../Objects/Vehicles/wheelchair.rsi/meta.json | 26 ++++++++++ .../Vehicles/wheelchair.rsi/vehicle.png | Bin 0 -> 2603 bytes .../wheelchair.rsi/vehicle_folded.png | Bin 0 -> 584 bytes 12 files changed, 179 insertions(+) create mode 100644 Content.Server/Traits/Assorted/WheelchairBoundComponent.cs create mode 100644 Content.Server/Traits/Assorted/WheelchairBoundSystem.cs create mode 100644 Content.Shared/Traits/Assorted/LegsParalyzedComponent.cs create mode 100644 Content.Shared/Traits/Assorted/LegsParalyzedSystem.cs create mode 100644 Resources/Textures/Objects/Vehicles/wheelchair.rsi/inhand-left.png create mode 100644 Resources/Textures/Objects/Vehicles/wheelchair.rsi/inhand-right.png create mode 100644 Resources/Textures/Objects/Vehicles/wheelchair.rsi/meta.json create mode 100644 Resources/Textures/Objects/Vehicles/wheelchair.rsi/vehicle.png create mode 100644 Resources/Textures/Objects/Vehicles/wheelchair.rsi/vehicle_folded.png diff --git a/Content.Server/Traits/Assorted/WheelchairBoundComponent.cs b/Content.Server/Traits/Assorted/WheelchairBoundComponent.cs new file mode 100644 index 0000000000..5e307b12db --- /dev/null +++ b/Content.Server/Traits/Assorted/WheelchairBoundComponent.cs @@ -0,0 +1,15 @@ +using Robust.Shared.Prototypes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; + +namespace Content.Server.Traits.Assorted; + +/// +/// On adding spawns wheelchair prototype and tries buckle player to it, then self removing +/// +[RegisterComponent, Access(typeof(WheelchairBoundSystem))] +public sealed class WheelchairBoundComponent : Component +{ + [ViewVariables(VVAccess.ReadWrite)] + [DataField("wheelchairPrototype", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string WheelchairPrototype = "VehicleWheelchair"; +} diff --git a/Content.Server/Traits/Assorted/WheelchairBoundSystem.cs b/Content.Server/Traits/Assorted/WheelchairBoundSystem.cs new file mode 100644 index 0000000000..c827d37681 --- /dev/null +++ b/Content.Server/Traits/Assorted/WheelchairBoundSystem.cs @@ -0,0 +1,21 @@ +using Content.Shared.Buckle; +using Content.Shared.Traits.Assorted; + +namespace Content.Server.Traits.Assorted; + +public sealed class WheelchairBoundSystem : EntitySystem +{ + [Dependency] private readonly SharedBuckleSystem _buckleSystem = default!; + + public override void Initialize() + { + SubscribeLocalEvent(OnStartup); + } + + private void OnStartup(EntityUid uid, WheelchairBoundComponent component, ComponentStartup args) + { + var wheelchair = Spawn(component.WheelchairPrototype, Transform(uid).Coordinates); + _buckleSystem.TryBuckle(uid, uid, wheelchair); + RemComp(uid); + } +} diff --git a/Content.Shared/Traits/Assorted/LegsParalyzedComponent.cs b/Content.Shared/Traits/Assorted/LegsParalyzedComponent.cs new file mode 100644 index 0000000000..a3cdb4ab33 --- /dev/null +++ b/Content.Shared/Traits/Assorted/LegsParalyzedComponent.cs @@ -0,0 +1,12 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Traits.Assorted; + +/// +/// Set player speed to zero and standing state to down, simulating leg paralysis. +/// Used for Wheelchair bound trait. +/// +[RegisterComponent, NetworkedComponent, Access(typeof(LegsParalyzedSystem))] +public sealed class LegsParalyzedComponent : Component +{ +} diff --git a/Content.Shared/Traits/Assorted/LegsParalyzedSystem.cs b/Content.Shared/Traits/Assorted/LegsParalyzedSystem.cs new file mode 100644 index 0000000000..47d5999b30 --- /dev/null +++ b/Content.Shared/Traits/Assorted/LegsParalyzedSystem.cs @@ -0,0 +1,46 @@ +using Content.Shared.Body.Systems; +using Content.Shared.Buckle.Components; +using Content.Shared.Movement.Components; +using Content.Shared.Movement.Systems; +using Content.Shared.Standing; + +namespace Content.Shared.Traits.Assorted; + +public sealed class LegsParalyzedSystem : EntitySystem +{ + [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifierSystem = default!; + [Dependency] private readonly StandingStateSystem _standingSystem = default!; + [Dependency] private readonly SharedBodySystem _bodySystem = default!; + + public override void Initialize() + { + SubscribeLocalEvent(OnStartup); + SubscribeLocalEvent(OnShutdown); + SubscribeLocalEvent(OnBuckleChange); + } + + private void OnStartup(EntityUid uid, LegsParalyzedComponent component, ComponentStartup args) + { + // TODO: In future probably must be surgery related wound + var movementSpeed = EnsureComp(uid); + _movementSpeedModifierSystem.ChangeBaseSpeed(uid, 0, 0, 20, movementSpeed); + } + + private void OnShutdown(EntityUid uid, LegsParalyzedComponent component, ComponentShutdown args) + { + _standingSystem.Stand(uid); + _bodySystem.UpdateMovementSpeed(uid); + } + + private void OnBuckleChange(EntityUid uid, LegsParalyzedComponent component, ref BuckleChangeEvent args) + { + if (args.Buckling) + { + _standingSystem.Stand(args.BuckledEntity); + } + else + { + _standingSystem.Down(args.BuckledEntity); + } + } +} diff --git a/Resources/Locale/en-US/traits/traits.ftl b/Resources/Locale/en-US/traits/traits.ftl index fd9cd1dce8..3e315d3889 100644 --- a/Resources/Locale/en-US/traits/traits.ftl +++ b/Resources/Locale/en-US/traits/traits.ftl @@ -28,3 +28,6 @@ trait-archaic-accent-desc = You speak in a way that many others find outdated trait-accentless-name = Accentless trait-accentless-desc = You don't have the accent that your species would usually have + +trait-wheelchair-bound-name = Wheelchair Bound +trait-wheelchair-bound-desc = You cannot move without your wheelchair. Wheelchair included. diff --git a/Resources/Prototypes/Entities/Objects/Vehicles/buckleable.yml b/Resources/Prototypes/Entities/Objects/Vehicles/buckleable.yml index e1d3212327..08f870ef04 100644 --- a/Resources/Prototypes/Entities/Objects/Vehicles/buckleable.yml +++ b/Resources/Prototypes/Entities/Objects/Vehicles/buckleable.yml @@ -428,3 +428,51 @@ components: - type: Foldable folded: true + +- type: entity + id: VehicleWheelchair + parent: [BaseVehicle, BaseFoldable, BaseItem] + name: Wheelchair + description: A chair with big wheels. It looks like you can move in this on your own. + components: + - type: Vehicle + northOver: true + hasKey: true + northOverride: 0 + southOverride: 0 + - type: Sprite + sprite: Objects/Vehicles/wheelchair.rsi + layers: + - state: vehicle + map: ["enum.VehicleVisualLayers.AutoAnimate", "unfoldedLayer"] + - state: vehicle_folded + map: ["foldedLayer"] + visible: false + netsync: false + noRot: true + - type: MovementSpeedModifier + baseWalkSpeed: 2 + baseSprintSpeed: 2 + - type: Strap + buckleOffset: "0,0" + maxBuckleDistance: 1 + - type: Fixtures + fixtures: + fix1: + shape: + !type:PhysShapeCircle + radius: 0.2 + density: 360 + restitution: 0.0 + mask: + - MobMask + layer: + - TableLayer + +- type: entity + parent: VehicleWheelchair + id: VehicleWheelchairFolded + suffix: folded + components: + - type: Foldable + folded: true diff --git a/Resources/Prototypes/Traits/disabilities.yml b/Resources/Prototypes/Traits/disabilities.yml index fd845aa8d2..9869eb8536 100644 --- a/Resources/Prototypes/Traits/disabilities.yml +++ b/Resources/Prototypes/Traits/disabilities.yml @@ -49,3 +49,11 @@ description: trait-uncloneable-desc components: - type: Uncloneable + +- type: trait + id: WheelchairBound + name: trait-wheelchair-bound-name + description: trait-wheelchair-bound-desc + components: + - type: WheelchairBound + - type: LegsParalyzed diff --git a/Resources/Textures/Objects/Vehicles/wheelchair.rsi/inhand-left.png b/Resources/Textures/Objects/Vehicles/wheelchair.rsi/inhand-left.png new file mode 100644 index 0000000000000000000000000000000000000000..b047753f0ba16cc327f24ffd01e7837b65cc5215 GIT binary patch literal 676 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=oCO|{#S9F5M?jcysy3fA0|Qf- zr;B4q#hkaZ47;=(1={|%ma{qwDjR*|S+);Q<0Yy(R`<1U~;c z8g;8Of7kK!v&jozH7_kMT=DMTvR&!dUd0>qaW@pkF!VfTN{|s}c)Wu_;yCL83q6Ko zg^Vz%#d-^_W~Cl~{IPrg^{lOL%68Y*3hDO<9=qlg>#+TH>g0{FYs0h*)hByyyZu&f z<9ntBox2$Ps;uTdD%!c?m~5}xjI(JM++rQ}#<_ zzDL|Fuy7Gw!M!7HeZTzKl2o0wyr%uT7I*Z@Ki9ur zVl{U=*Gf;u=7S7-R%kch`?!{>LcXd0)O4n#+M-Xcwabs`xUd?`-MR8Y z#^Q?=YgW!@xjg^0VoUOq2vzPNZ=;!vn>q`Odlb`|D%@99a2cqX+kBg7udPsfTEg<@ zm1pWItR7v434yy>)0tN3q_zt!iO;5T~PwPF)I#x71=RWdXI`m>*)X|v@N?k1f sm%cxLpXD^mkCjtoxBoY0dHjdX^?{A1uisB$V6tQIboFyt=akR{0I|+5ssI20 literal 0 HcmV?d00001 diff --git a/Resources/Textures/Objects/Vehicles/wheelchair.rsi/inhand-right.png b/Resources/Textures/Objects/Vehicles/wheelchair.rsi/inhand-right.png new file mode 100644 index 0000000000000000000000000000000000000000..0cac50016630c0a7ddac1fe5d8df77aaf17a8988 GIT binary patch literal 629 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=oCO|{#S9F5M?jcysy3fA0|S$~ zr;B4q#hkaZ4A&hp5O86C8Q(amtxJlNbDaY}t9t`;0UMu#FTd_1E(OKFU`NN3il2;M zNLz|^=1%$0TsFVOM?|~l_-o%2zt|52GAqcKGT@~&O%~kDQTzUT@4@$X^UN*h`te?o ziC(_eo&m)S%e)K$b4#-0QbZk=X*!PeS5^#Gp^b8$#(a_y(=v9r!JZF-%QcX zdm-bu2me;Bi_n`s)9!EGf90c>XMEaYn`l?WTflx^$ddilwfpUd70Y(ZhONH3_->Aw zhVl5UEjIe{=k*{?u#!zo?##1`icAEBcatx4Vd1@s~rn0 zF1L{3o0+`Z|K^UUI7i!!QTOi2e@NmD`=|1vns39o>EBf(PVHsuKhP$j`zxK}&`(xg XZM$_AYwdRf(-DKGtDnm{r-UW|2_*_L literal 0 HcmV?d00001 diff --git a/Resources/Textures/Objects/Vehicles/wheelchair.rsi/meta.json b/Resources/Textures/Objects/Vehicles/wheelchair.rsi/meta.json new file mode 100644 index 0000000000..8c69fc1225 --- /dev/null +++ b/Resources/Textures/Objects/Vehicles/wheelchair.rsi/meta.json @@ -0,0 +1,26 @@ +{ + "version": 1, + "size": { + "x": 32, + "y": 32 + }, + "license": "CC-BY-SA-3.0", + "copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/8f6e48e30ff85cb58b5b0a91add4a1741b971f0f", + "states": [ + { + "name": "vehicle", + "directions": 4 + }, + { + "name": "vehicle_folded" + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + } + ] +} diff --git a/Resources/Textures/Objects/Vehicles/wheelchair.rsi/vehicle.png b/Resources/Textures/Objects/Vehicles/wheelchair.rsi/vehicle.png new file mode 100644 index 0000000000000000000000000000000000000000..c18335d0323e6408760c2feb723d0a895603aa35 GIT binary patch literal 2603 zcmV+`3e@$9P)Be{?$89EmtZa5Ja zT%eH5GocKHA`(g&E)=3uhYN|5sf;0sWDJ=zw7>mZ-}&#>+3%j-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{mq93(JIGE}7r z1qj9UAt89)0Af7?4H3vZbLLE*UffGBbcZNxDVP8$17LmY)~$JsAPga}9Oh;mXrhfS zUAj2IUX6mhC9V$7keQ^HZ9^1d36K}ih#Cw6hIt>xGSBIG3`zSvpik&FZQ8i18w6p* zkPHz~dTELt*ZUyxTflQO9eE2~jEEDUZ-gwf!KAv9tF?!qZb^mF7q2F#aNUZ<> N002ovPDHLkV1gX=>O=ql literal 0 HcmV?d00001 diff --git a/Resources/Textures/Objects/Vehicles/wheelchair.rsi/vehicle_folded.png b/Resources/Textures/Objects/Vehicles/wheelchair.rsi/vehicle_folded.png new file mode 100644 index 0000000000000000000000000000000000000000..ecc42ed4eb593fad604bb1dbf5eda423c84c1ca9 GIT binary patch literal 584 zcmV-O0=NB%P)P*+BW!@*%ZVrhs}24KEiF1>d$D-4F`WHL!W!!S&~jYgyM9LB(cpw((+ zLU;hDmBt9v>2zEaMdxq)e?FflDFpybEK?fy`~75&UQliZt|gim$pjGf_x{$xD)s8t z>$MvU25vf?dgG9>(g2VyK^6>a3}G+8T))S@%2MeP0EhrQdJHVVX0w^M`aJVW0G413 z1DYTM%$hVNVC$)sDuoGv4Wy;Zfg^>Z1r3KobEPomnBHs8?LYRZF(!cCKw9ht2nx{z z!ZDRkj&VQV=0;3)LY!+^Q=}CT*aH+B5kXE3CMEO>7_(z?UM7GvrI-Ph0O`hxaSuRw z?U-f+B=BD+v;o)&r7tDY6fz5z