Compare commits
No commits in common. "6b985497ba3f60af44ba0cf4b8cb931c2f22b611" and "e7acbd72fa04eb7886aed2ad8c57f8e1ecde84fb" have entirely different histories.
6b985497ba
...
e7acbd72fa
7 changed files with 10 additions and 57 deletions
|
@ -13,7 +13,6 @@ 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,6 +26,6 @@ An in-dev game that I plan to make a shooter game out of.
|
|||
|
||||
# Fixes
|
||||
### High Priority
|
||||
* Currently, when resetting, sometimes your health goes back up. This is due to the reconciliation of health. Simply put, your health is not being set to zero inside of our entity component system, due to us not having the reset event currently like that. See it here: [StarterGui.SetCore](https://create.roblox.com/docs/reference/engine/classes/StarterGui#SetCore) It uses BindableEvents.
|
||||
#### Medium 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
|
|
@ -1,18 +0,0 @@
|
|||
import { World, useEvent } from "@rbxts/matter"
|
||||
import { StarterGui } from "@rbxts/services"
|
||||
import { clientState } from "ReplicatedStorage/ecs/state"
|
||||
import { getEvent } from "ReplicatedStorage/remotes"
|
||||
|
||||
const resetButtonCallback = new Instance("BindableEvent")
|
||||
StarterGui.SetCore("ResetButtonCallback", resetButtonCallback)
|
||||
|
||||
getEvent("resetButton")
|
||||
|
||||
function customReset(_: World, _client: clientState): void {
|
||||
const resetButtonEvent = getEvent("resetButton")
|
||||
for (const [,] of useEvent(resetButtonCallback, "Event")) {
|
||||
resetButtonEvent.FireServer()
|
||||
}
|
||||
}
|
||||
|
||||
export = customReset
|
|
@ -21,12 +21,14 @@ function sprint(_: World, client: clientState): void {
|
|||
})
|
||||
}
|
||||
|
||||
if (client.isRunning) {
|
||||
if (client.isRunning && client.character) {
|
||||
client.character.Humanoid.WalkSpeed = 24
|
||||
return
|
||||
}
|
||||
|
||||
if (client.character) {
|
||||
client.character.Humanoid.WalkSpeed = 16
|
||||
}
|
||||
}
|
||||
|
||||
export = sprint
|
|
@ -1,23 +0,0 @@
|
|||
import { World, useEvent } from "@rbxts/matter"
|
||||
import { Health, Model, PlayerCharacter } from "ReplicatedStorage/ecs/components"
|
||||
import { getEvent } from "ReplicatedStorage/remotes"
|
||||
|
||||
getEvent("resetButton")
|
||||
|
||||
function customReset(world: World): void {
|
||||
const resetButtonEvent = getEvent("resetButton")
|
||||
for (const [, player] of useEvent(resetButtonEvent, "OnServerEvent")) {
|
||||
for (const [id, playerCharacter, _model, health] of world.query(PlayerCharacter, Model, Health)) {
|
||||
if (playerCharacter.player !== player) continue
|
||||
world.insert(
|
||||
id,
|
||||
health.patch({
|
||||
health: 0,
|
||||
regeneration: 0
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export = customReset
|
|
@ -2,7 +2,7 @@ import { useThrottle, World } from "@rbxts/matter"
|
|||
import { Health } from "ReplicatedStorage/ecs/components"
|
||||
|
||||
/**
|
||||
* Health components regenerate health based on the regeneration value.
|
||||
* @todo
|
||||
*/
|
||||
function healthRegenerates(world: World): void {
|
||||
for (const [id, health] of world.query(Health)) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Health, Model, PlayerCharacter } from "ReplicatedStorage/ecs/components
|
|||
import { CharacterRigR6 } from "@rbxts/character-promise"
|
||||
|
||||
/**
|
||||
* Player characters are marked with the "PlayerCharacter" component, "Health" component, and "Model" component.
|
||||
* @todo
|
||||
*/
|
||||
function playersArePlayerCharacters(world: World): void {
|
||||
Players.GetPlayers().forEach((player, _) => {
|
||||
|
@ -14,8 +14,6 @@ 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
|
||||
|
|
|
@ -2,13 +2,11 @@ import { World, useEvent } from "@rbxts/matter"
|
|||
import { Model, PlayerCharacter } from "ReplicatedStorage/ecs/components"
|
||||
|
||||
/**
|
||||
* When players die, disconnect all Motor6D instances.
|
||||
*
|
||||
* The Motor6D instances are replaced with BallSocketContraints.
|
||||
* @todo
|
||||
*/
|
||||
function playersRagdollOnDeath(world: World): void {
|
||||
for (const [_, playerCharacter, model] of world.query(PlayerCharacter, Model)) {
|
||||
if (!model.model || !playerCharacter.character) continue
|
||||
if (!model.model) continue
|
||||
|
||||
playerCharacter.humanoid.BreakJointsOnDeath = false
|
||||
|
||||
|
@ -32,9 +30,6 @@ 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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue