From 6b985497ba3f60af44ba0cf4b8cb931c2f22b611 Mon Sep 17 00:00:00 2001 From: reidlab Date: Sat, 12 Aug 2023 03:20:20 -0700 Subject: [PATCH] update ragdoll, add todo --- readme.md | 4 +++- src/ReplicatedStorage/ecs/systems/client/sprint.ts | 6 ++---- .../ecs/systems/server/playersArePlayerCharacters.ts | 2 ++ .../ecs/systems/server/playersRagdollOnDeath.ts | 5 ++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index 6d48048..86842cc 100644 --- a/readme.md +++ b/readme.md @@ -13,6 +13,7 @@ An in-dev game that I plan to make a shooter game out of. # Todo ### High priority +* Add ingame output of the console * Add tests * Add guns. Try it in default roblox-ts and slowly reimplement it into our component system. #### Medium priority @@ -27,4 +28,5 @@ An in-dev game that I plan to make a shooter game out of. # Fixes ### High Priority #### Medium priority -##### Low priority \ No newline at end of file +##### Low priority +* Sometimes I get errors in [`./src/ReplicatedStorage/ecs/systems/client/sprint.ts`](./src/ReplicatedStorage/ecs/systems/client/sprint.ts) due to the character not being initialized yet, should probably fix that before it gets worse with other systems \ No newline at end of file diff --git a/src/ReplicatedStorage/ecs/systems/client/sprint.ts b/src/ReplicatedStorage/ecs/systems/client/sprint.ts index 14b1e39..4cf41b0 100644 --- a/src/ReplicatedStorage/ecs/systems/client/sprint.ts +++ b/src/ReplicatedStorage/ecs/systems/client/sprint.ts @@ -21,14 +21,12 @@ function sprint(_: World, client: clientState): void { }) } - if (client.isRunning && client.character) { + if (client.isRunning) { client.character.Humanoid.WalkSpeed = 24 return } - if (client.character) { - client.character.Humanoid.WalkSpeed = 16 - } + client.character.Humanoid.WalkSpeed = 16 } export = sprint \ No newline at end of file diff --git a/src/ServerScriptService/ecs/systems/server/playersArePlayerCharacters.ts b/src/ServerScriptService/ecs/systems/server/playersArePlayerCharacters.ts index 8e3a5c2..014d80f 100644 --- a/src/ServerScriptService/ecs/systems/server/playersArePlayerCharacters.ts +++ b/src/ServerScriptService/ecs/systems/server/playersArePlayerCharacters.ts @@ -14,6 +14,8 @@ function playersArePlayerCharacters(world: World): void { model: character }), PlayerCharacter({ + // I know this is kinda dumb, "why not the model component!!!" + // The model component doesnt retain types character: character as CharacterRigR6, player: Players.GetPlayerFromCharacter(character) as Player, humanoid: character.WaitForChild("Humanoid") as Humanoid diff --git a/src/ServerScriptService/ecs/systems/server/playersRagdollOnDeath.ts b/src/ServerScriptService/ecs/systems/server/playersRagdollOnDeath.ts index 87df53f..7d5fdde 100644 --- a/src/ServerScriptService/ecs/systems/server/playersRagdollOnDeath.ts +++ b/src/ServerScriptService/ecs/systems/server/playersRagdollOnDeath.ts @@ -8,7 +8,7 @@ import { Model, PlayerCharacter } from "ReplicatedStorage/ecs/components" */ function playersRagdollOnDeath(world: World): void { for (const [_, playerCharacter, model] of world.query(PlayerCharacter, Model)) { - if (!model.model) continue + if (!model.model || !playerCharacter.character) continue playerCharacter.humanoid.BreakJointsOnDeath = false @@ -32,6 +32,9 @@ function playersRagdollOnDeath(world: World): void { v.Destroy() } }) + + // Makes it so their head doesn't just dangle + playerCharacter.character.HumanoidRootPart.ApplyImpulse(Vector3.FromNormalId(Enum.NormalId.Back).mul(100)) } }