add typed character to PlayerCharacter component

This commit is contained in:
Reid 2023-07-19 00:49:57 -07:00
parent 5302ecc6cc
commit 31559be3b8
4 changed files with 26 additions and 1 deletions

View file

@ -1,7 +1,14 @@
{ {
"name": "goopler", "name": "goopler",
"description": "An in-dev game that I plan to make a shooter game out of.", "description": "An in-dev game that I plan to make a shooter game out of.",
"keywords": ["roblox", "roblox-ts", "rojo", "matter", "roblox-matter", "ecs"], "keywords": [
"roblox",
"roblox-ts",
"rojo",
"matter",
"roblox-matter",
"ecs"
],
"version": "1.0.0", "version": "1.0.0",
"main": "index.js", "main": "index.js",
"license": "MIT", "license": "MIT",
@ -25,6 +32,7 @@
"typescript": "^5.1.3" "typescript": "^5.1.3"
}, },
"dependencies": { "dependencies": {
"@rbxts/character-promise": "^1.0.2",
"@rbxts/matter": "^0.6.2-ts.6", "@rbxts/matter": "^0.6.2-ts.6",
"@rbxts/plasma": "^0.4.1-ts.1", "@rbxts/plasma": "^0.4.1-ts.1",
"@rbxts/rewire": "^0.3.0", "@rbxts/rewire": "^0.3.0",

View file

@ -1,3 +1,5 @@
import { CharacterRigR6 } from "@rbxts/character-promise"
/** /**
* The Model component. * The Model component.
* *
@ -47,6 +49,7 @@ export interface Damage {
* Holds the Humanoid and Player. * Holds the Humanoid and Player.
*/ */
export interface PlayerCharacter { export interface PlayerCharacter {
character: CharacterRigR6,
humanoid: Humanoid, humanoid: Humanoid,
player: Player player: Player
} }

View file

@ -1,6 +1,7 @@
import { Players } from "@rbxts/services" import { Players } from "@rbxts/services"
import { World, useEvent } from "@rbxts/matter" import { World, useEvent } from "@rbxts/matter"
import { Health, Model, PlayerCharacter } from "ReplicatedStorage/ecs/components" import { Health, Model, PlayerCharacter } from "ReplicatedStorage/ecs/components"
import { CharacterRigR6 } from "@rbxts/character-promise"
/** /**
* @todo * @todo
@ -13,6 +14,7 @@ function playersArePlayerCharacters(world: World): void {
model: character model: character
}), }),
PlayerCharacter({ PlayerCharacter({
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

@ -74,6 +74,13 @@
"@nodelib/fs.scandir" "2.1.5" "@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0" fastq "^1.6.0"
"@rbxts/character-promise@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@rbxts/character-promise/-/character-promise-1.0.2.tgz#1afd8e156dd85c966652f688d4209f6a232d4ed3"
integrity sha512-5RYqcCywWqTrSAvkE2mrNWnLoqoOfmZGZn7+50pcAulbXbZd4svgHDY7+yUbevVIcQDa5meEKrVkt7sC0YBBVw==
dependencies:
"@rbxts/validate-tree" "^2.0.1"
"@rbxts/compiler-types@^2.0.4-types.1": "@rbxts/compiler-types@^2.0.4-types.1":
version "2.0.4-types.1" version "2.0.4-types.1"
resolved "https://registry.yarnpkg.com/@rbxts/compiler-types/-/compiler-types-2.0.4-types.1.tgz#d37edf0766aa41895085c92795c6e65261355a53" resolved "https://registry.yarnpkg.com/@rbxts/compiler-types/-/compiler-types-2.0.4-types.1.tgz#d37edf0766aa41895085c92795c6e65261355a53"
@ -109,6 +116,11 @@
resolved "https://registry.yarnpkg.com/@rbxts/types/-/types-1.0.689.tgz#a53f657636dc5b74475749508ded1fbef3e21ccd" resolved "https://registry.yarnpkg.com/@rbxts/types/-/types-1.0.689.tgz#a53f657636dc5b74475749508ded1fbef3e21ccd"
integrity sha512-+5fBORSpfR1FVMXTm/wgs1aDDDZugRjx666QS+X5bJnTQD5HA77dz5X7Gsy6+2nFpnrVeR+IFUznU2OV3Ustow== integrity sha512-+5fBORSpfR1FVMXTm/wgs1aDDDZugRjx666QS+X5bJnTQD5HA77dz5X7Gsy6+2nFpnrVeR+IFUznU2OV3Ustow==
"@rbxts/validate-tree@^2.0.1":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@rbxts/validate-tree/-/validate-tree-2.0.2.tgz#2a1807eaa391a482822207177ff5dcd4b8f811b2"
integrity sha512-OA0E9ZjEeOpPa3XeV5/oC51aro2QFcL5dItufbagYZW8TOsX8C+FDXLx+A/ulMwcF42WcFNcQybxzcWSS/QSrA==
"@types/json-schema@^7.0.9": "@types/json-schema@^7.0.9":
version "7.0.12" version "7.0.12"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb"