update ragdoll, add todo

This commit is contained in:
Reid 2023-08-12 03:20:20 -07:00
parent a8b217d45e
commit 6b985497ba
4 changed files with 11 additions and 6 deletions

View file

@ -13,6 +13,7 @@ An in-dev game that I plan to make a shooter game out of.
# Todo # Todo
### High priority ### High priority
* Add ingame output of the console
* Add tests * Add tests
* Add guns. Try it in default roblox-ts and slowly reimplement it into our component system. * Add guns. Try it in default roblox-ts and slowly reimplement it into our component system.
#### Medium priority #### Medium priority
@ -28,3 +29,4 @@ An in-dev game that I plan to make a shooter game out of.
### High Priority ### High Priority
#### Medium priority #### Medium priority
##### Low priority ##### 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

View file

@ -21,14 +21,12 @@ function sprint(_: World, client: clientState): void {
}) })
} }
if (client.isRunning && client.character) { if (client.isRunning) {
client.character.Humanoid.WalkSpeed = 24 client.character.Humanoid.WalkSpeed = 24
return return
} }
if (client.character) {
client.character.Humanoid.WalkSpeed = 16 client.character.Humanoid.WalkSpeed = 16
}
} }
export = sprint export = sprint

View file

@ -14,6 +14,8 @@ function playersArePlayerCharacters(world: World): void {
model: character model: character
}), }),
PlayerCharacter({ PlayerCharacter({
// I know this is kinda dumb, "why not the model component!!!"
// The model component doesnt retain types
character: character as CharacterRigR6, character: character as CharacterRigR6,
player: Players.GetPlayerFromCharacter(character) as Player, player: Players.GetPlayerFromCharacter(character) as Player,
humanoid: character.WaitForChild("Humanoid") as Humanoid humanoid: character.WaitForChild("Humanoid") as Humanoid

View file

@ -8,7 +8,7 @@ import { Model, PlayerCharacter } from "ReplicatedStorage/ecs/components"
*/ */
function playersRagdollOnDeath(world: World): void { function playersRagdollOnDeath(world: World): void {
for (const [_, playerCharacter, model] of world.query(PlayerCharacter, Model)) { for (const [_, playerCharacter, model] of world.query(PlayerCharacter, Model)) {
if (!model.model) continue if (!model.model || !playerCharacter.character) continue
playerCharacter.humanoid.BreakJointsOnDeath = false playerCharacter.humanoid.BreakJointsOnDeath = false
@ -32,6 +32,9 @@ function playersRagdollOnDeath(world: World): void {
v.Destroy() v.Destroy()
} }
}) })
// Makes it so their head doesn't just dangle
playerCharacter.character.HumanoidRootPart.ApplyImpulse(Vector3.FromNormalId(Enum.NormalId.Back).mul(100))
} }
} }