@rbxts/humanoid-stat-manager 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/init.luau CHANGED
@@ -6,7 +6,7 @@ local Players = _services.Players
6
6
  local RunService = _services.RunService
7
7
  local observeCharacters = TS.import(script, TS.getModule(script, "@rbxts", "roblox-observers").out["observe-characters"]).observeCharacters
8
8
  local _shared = TS.import(script, script, "shared")
9
- local _internalCreateModifier = _shared._internalCreateModifier
9
+ local createModifier = _shared.createModifier
10
10
  local pruneExpiredModifiers = _shared.pruneExpiredModifiers
11
11
  local calculateStat = _shared.calculateStat
12
12
  local REMOTE_NAME = "ServerToClient"
@@ -17,7 +17,7 @@ local clientHumanoid
17
17
  local remote
18
18
  local initialized = false
19
19
  local clientAddInternal, clientRemoveInternal
20
- local function init()
20
+ local function _init()
21
21
  if initialized then
22
22
  return nil
23
23
  end
@@ -102,7 +102,7 @@ local HumanoidStatManager = {}
102
102
  do
103
103
  local _container = HumanoidStatManager
104
104
  local function init()
105
- init()
105
+ _init()
106
106
  end
107
107
  _container.init = init
108
108
  local function addModifier(char, modifier)
@@ -138,7 +138,7 @@ function addModifierServer(char, modifier)
138
138
  local _object = table.clone(modifier)
139
139
  setmetatable(_object, nil)
140
140
  _object.id = id
141
- local internalMod = _internalCreateModifier(_object)
141
+ local internalMod = createModifier(_object)
142
142
  table.insert(modifiers, internalMod)
143
143
  return function()
144
144
  local _char_1 = char
@@ -169,7 +169,7 @@ function addModifierClient(char, modifier)
169
169
  if char ~= Players.LocalPlayer.Character then
170
170
  error("HumanoidStatManager: Client can only modify the LocalPlayer\'s character.")
171
171
  end
172
- local internalMod = _internalCreateModifier(modifier)
172
+ local internalMod = createModifier(modifier)
173
173
  clientAddInternal(internalMod)
174
174
  return function()
175
175
  clientRemoveInternal(internalMod.id)
package/out/shared.d.ts CHANGED
@@ -7,10 +7,3 @@ export interface Modifier {
7
7
  startTime?: number;
8
8
  priority?: number;
9
9
  }
10
- export declare const BASE_STATS: {
11
- WalkSpeed: number;
12
- JumpHeight: number;
13
- };
14
- export declare function calculateStat(stat: Modifier['stat'], modifiers: Modifier[]): number;
15
- export declare function pruneExpiredModifiers(modifiers: Modifier[]): void;
16
- export declare function _internalCreateModifier(modifier: Omit<Modifier, 'startTime'>): Modifier;
package/out/shared.luau CHANGED
@@ -3,10 +3,12 @@ local TS = _G[script]
3
3
  local _services = TS.import(script, TS.getModule(script, "@rbxts", "services"))
4
4
  local HttpService = _services.HttpService
5
5
  local StarterPlayer = _services.StarterPlayer
6
+ --* @internal
6
7
  local BASE_STATS = {
7
8
  WalkSpeed = StarterPlayer.CharacterWalkSpeed,
8
9
  JumpHeight = StarterPlayer.CharacterJumpHeight,
9
10
  }
11
+ --* @internal
10
12
  local function calculateStat(stat, modifiers)
11
13
  local base = BASE_STATS[stat]
12
14
  local setMod
@@ -40,6 +42,7 @@ local function calculateStat(stat, modifiers)
40
42
  end
41
43
  return if setMod then setMod.value else base
42
44
  end
45
+ --* @internal
43
46
  local function pruneExpiredModifiers(modifiers)
44
47
  local now = tick()
45
48
  for i = #modifiers - 1, 0, -1 do
@@ -59,7 +62,8 @@ local function pruneExpiredModifiers(modifiers)
59
62
  end
60
63
  end
61
64
  end
62
- local function _internalCreateModifier(modifier)
65
+ --* @internal
66
+ local function createModifier(modifier)
63
67
  local _object = table.clone(modifier)
64
68
  setmetatable(_object, nil)
65
69
  local _left = "id"
@@ -74,6 +78,6 @@ end
74
78
  return {
75
79
  calculateStat = calculateStat,
76
80
  pruneExpiredModifiers = pruneExpiredModifiers,
77
- _internalCreateModifier = _internalCreateModifier,
81
+ createModifier = createModifier,
78
82
  BASE_STATS = BASE_STATS,
79
83
  }
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
- {
2
- "name": "@rbxts/humanoid-stat-manager",
3
- "version": "1.0.3",
4
- "description": "",
5
- "main": "out/init.lua",
6
- "scripts": {
7
- "build": "rbxtsc",
8
- "watch": "rbxtsc -w",
9
- "prepublishOnly": "npm run build"
10
- },
11
- "keywords": [],
12
- "author": "",
13
- "license": "ISC",
14
- "type": "commonjs",
15
- "types": "out/index.d.ts",
16
- "files": [
17
- "out",
18
- "!**/*.tsbuildinfo"
19
- ],
20
- "publishConfig": {
21
- "access": "public"
22
- },
23
- "devDependencies": {
24
- "@rbxts/compiler-types": "^3.0.0-types.0",
25
- "@rbxts/types": "^1.0.896",
26
- "roblox-ts": "^3.0.0",
27
- "typescript": "^5.9.3"
28
- },
29
- "dependencies": {
30
- "@rbxts/roblox-observers": "^1.0.8",
31
- "@rbxts/services": "^1.6.0"
32
- }
33
- }
1
+ {
2
+ "name": "@rbxts/humanoid-stat-manager",
3
+ "version": "1.0.5",
4
+ "description": "",
5
+ "main": "out/init.lua",
6
+ "scripts": {
7
+ "build": "rbxtsc",
8
+ "watch": "rbxtsc -w",
9
+ "prepublishOnly": "npm run build"
10
+ },
11
+ "keywords": [],
12
+ "author": "",
13
+ "license": "ISC",
14
+ "type": "commonjs",
15
+ "types": "out/index.d.ts",
16
+ "files": [
17
+ "out",
18
+ "!**/*.tsbuildinfo"
19
+ ],
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "devDependencies": {
24
+ "@rbxts/compiler-types": "^3.0.0-types.0",
25
+ "@rbxts/types": "^1.0.896",
26
+ "roblox-ts": "^3.0.0",
27
+ "typescript": "^5.9.3"
28
+ },
29
+ "dependencies": {
30
+ "@rbxts/roblox-observers": "^1.0.8",
31
+ "@rbxts/services": "^1.6.0"
32
+ }
33
+ }