@quenty/rogue-humanoid 10.6.0 → 10.7.0
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/CHANGELOG.md +12 -0
- package/package.json +15 -14
- package/src/Shared/RogueHumanoidBase.lua +62 -17
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [10.7.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rogue-humanoid@10.6.0...@quenty/rogue-humanoid@10.7.0) (2024-09-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Fix dependencies ([c18fcc4](https://github.com/Quenty/NevermoreEngine/commit/c18fcc4a83d77221d9695bbb708ec0403a094e07))
|
|
12
|
+
* Fix humanoid scaling via hack ([60bc727](https://github.com/Quenty/NevermoreEngine/commit/60bc7272cc0291a6a3934b4ed991afebd449d878))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
# [10.6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rogue-humanoid@10.5.0...@quenty/rogue-humanoid@10.6.0) (2024-08-09)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @quenty/rogue-humanoid
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/rogue-humanoid",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.7.0",
|
|
4
4
|
"description": "Roguelike humanoid properties which can be modified",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,22 +25,23 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/
|
|
29
|
-
"@quenty/
|
|
30
|
-
"@quenty/
|
|
31
|
-
"@quenty/
|
|
32
|
-
"@quenty/
|
|
33
|
-
"@quenty/
|
|
34
|
-
"@quenty/
|
|
35
|
-
"@quenty/
|
|
36
|
-
"@quenty/
|
|
37
|
-
"@quenty/
|
|
38
|
-
"@quenty/
|
|
28
|
+
"@quenty/adorneedata": "^7.6.0",
|
|
29
|
+
"@quenty/attributeutils": "^14.5.0",
|
|
30
|
+
"@quenty/baseobject": "^10.4.0",
|
|
31
|
+
"@quenty/binder": "^14.6.0",
|
|
32
|
+
"@quenty/brio": "^14.5.0",
|
|
33
|
+
"@quenty/characterutils": "^12.5.0",
|
|
34
|
+
"@quenty/loader": "^10.4.0",
|
|
35
|
+
"@quenty/maid": "^3.3.0",
|
|
36
|
+
"@quenty/playerhumanoidbinder": "^14.6.0",
|
|
37
|
+
"@quenty/rogue-properties": "^11.7.0",
|
|
38
|
+
"@quenty/rx": "^13.5.0",
|
|
39
|
+
"@quenty/servicebag": "^11.5.0",
|
|
39
40
|
"@quenty/table": "^3.5.0",
|
|
40
|
-
"@quenty/valueobject": "^13.
|
|
41
|
+
"@quenty/valueobject": "^13.5.0"
|
|
41
42
|
},
|
|
42
43
|
"publishConfig": {
|
|
43
44
|
"access": "public"
|
|
44
45
|
},
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "fb172906f3ee725269ec1e5f4daf9dca227e729d"
|
|
46
47
|
}
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
local require = require(script.Parent.loader).load(script)
|
|
6
6
|
|
|
7
7
|
local Players = game:GetService("Players")
|
|
8
|
+
local RunService = game:GetService("RunService")
|
|
8
9
|
|
|
9
|
-
local BaseObject = require("BaseObject")
|
|
10
10
|
local AttributeUtils = require("AttributeUtils")
|
|
11
|
+
local BaseObject = require("BaseObject")
|
|
12
|
+
local CharacterUtils = require("CharacterUtils")
|
|
13
|
+
local RogueHumanoidProperties = require("RogueHumanoidProperties")
|
|
11
14
|
local Rx = require("Rx")
|
|
15
|
+
local RxRootPartUtils = require("RxRootPartUtils")
|
|
12
16
|
local ValueObject = require("ValueObject")
|
|
13
|
-
local RogueHumanoidProperties = require("RogueHumanoidProperties")
|
|
14
|
-
local CharacterUtils = require("CharacterUtils")
|
|
15
17
|
|
|
16
18
|
local GROWTH_VALUE_NAMES = {
|
|
17
19
|
"HeadScale";
|
|
@@ -30,6 +32,11 @@ function RogueHumanoidBase.new(humanoid, serviceBag)
|
|
|
30
32
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
31
33
|
|
|
32
34
|
self._properties = RogueHumanoidProperties:GetPropertyTable(self._serviceBag, self._obj)
|
|
35
|
+
self._scaleState = self._maid:Add(ValueObject.fromObservable(Rx.combineLatest({
|
|
36
|
+
scale = self._properties.Scale:Observe();
|
|
37
|
+
maxSize = self._properties.ScaleMax:Observe();
|
|
38
|
+
minSize = self._properties.ScaleMin:Observe();
|
|
39
|
+
})))
|
|
33
40
|
|
|
34
41
|
if CharacterUtils.getPlayerFromCharacter(self._obj) == Players.LocalPlayer then
|
|
35
42
|
self._maid:GiveTask(self._properties.WalkSpeed:Observe():Subscribe(function(walkSpeed)
|
|
@@ -44,19 +51,11 @@ function RogueHumanoidBase.new(humanoid, serviceBag)
|
|
|
44
51
|
self._maid:GiveTask(self._properties.JumpHeight:Observe():Subscribe(function(jumpHeight)
|
|
45
52
|
self._obj.JumpHeight = jumpHeight
|
|
46
53
|
end))
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
self._scaleState = self._maid:Add(ValueObject.fromObservable(Rx.combineLatest({
|
|
50
|
-
scale = self._properties.Scale:Observe();
|
|
51
|
-
maxSize = self._properties.ScaleMax:Observe();
|
|
52
|
-
minSize = self._properties.ScaleMin:Observe();
|
|
53
|
-
})))
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
self:_updateScale(state)
|
|
55
|
+
if RunService:IsClient() then
|
|
56
|
+
self:_setupIgnoreCFrameChangesOnScaleChange()
|
|
58
57
|
end
|
|
59
|
-
end
|
|
58
|
+
end
|
|
60
59
|
|
|
61
60
|
self._maid:GiveTask(self._properties.MaxHealth:Observe():Subscribe(function(maxHealth)
|
|
62
61
|
local newMaxHealth = math.max(maxHealth, 1)
|
|
@@ -74,21 +73,67 @@ function RogueHumanoidBase.new(humanoid, serviceBag)
|
|
|
74
73
|
end
|
|
75
74
|
end))
|
|
76
75
|
|
|
76
|
+
self:_setupScaling()
|
|
77
|
+
|
|
78
|
+
return self
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
function RogueHumanoidBase:_setupScaling()
|
|
82
|
+
self._maid:GiveTask(self._scaleState:Observe():Pipe({
|
|
83
|
+
Rx.where(function(state)
|
|
84
|
+
return state ~= nil
|
|
85
|
+
end);
|
|
86
|
+
}):Subscribe(function(state)
|
|
87
|
+
self:_updateScale(state)
|
|
88
|
+
end))
|
|
89
|
+
|
|
77
90
|
self._maid:GiveTask(self._obj.ChildAdded:Connect(function(child)
|
|
78
|
-
if GROWTH_VALUE_NAMES[child.Name] then
|
|
91
|
+
if GROWTH_VALUE_NAMES[child.Name] and child:IsA("NumberValue") then
|
|
79
92
|
local state = self._scaleState.Value
|
|
80
93
|
if state then
|
|
81
94
|
self:_updateScaleValue(child, state)
|
|
82
95
|
end
|
|
83
96
|
end
|
|
84
97
|
end))
|
|
85
|
-
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
function RogueHumanoidBase:_setupIgnoreCFrameChangesOnScaleChange()
|
|
101
|
+
self._maid:GiveTask(RxRootPartUtils.observeHumanoidRootPartBrioFromHumanoid(self._obj):Subscribe(function(brio)
|
|
102
|
+
if brio:IsDead() then
|
|
103
|
+
return
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
local maid, rootPart = brio:ToMaidAndValue()
|
|
107
|
+
local lastSafeRootPartCFrame = rootPart.CFrame
|
|
108
|
+
local rootPartExperiencedTeleport = false
|
|
109
|
+
|
|
110
|
+
-- Unfortunately have to run every frame to capture this data
|
|
111
|
+
maid:GiveTask(RunService.PostSimulation:Connect(function()
|
|
112
|
+
lastSafeRootPartCFrame = rootPart.CFrame
|
|
113
|
+
rootPartExperiencedTeleport = false
|
|
114
|
+
end))
|
|
115
|
+
|
|
116
|
+
maid:GiveTask(rootPart:GetPropertyChangedSignal("CFrame"):Connect(function()
|
|
117
|
+
rootPartExperiencedTeleport = true
|
|
118
|
+
end))
|
|
119
|
+
maid:GiveTask(rootPart:GetPropertyChangedSignal("Size"):Connect(function()
|
|
120
|
+
rootPartExperiencedTeleport = true
|
|
121
|
+
end))
|
|
122
|
+
|
|
123
|
+
maid:GiveTask(self._scaleState.Changed:Connect(function()
|
|
124
|
+
if not rootPartExperiencedTeleport then
|
|
125
|
+
return
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
rootPart.CFrame = lastSafeRootPartCFrame
|
|
129
|
+
end))
|
|
130
|
+
end))
|
|
86
131
|
end
|
|
87
132
|
|
|
88
133
|
function RogueHumanoidBase:_updateScale(state)
|
|
89
134
|
for _, name in pairs(GROWTH_VALUE_NAMES) do
|
|
90
135
|
local numberValue = self._obj:FindFirstChild(name)
|
|
91
|
-
if not numberValue then
|
|
136
|
+
if not (numberValue and numberValue:IsA("NumberValue")) then
|
|
92
137
|
continue
|
|
93
138
|
end
|
|
94
139
|
|