Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #142 from Pluviolithic/dev
Browse files Browse the repository at this point in the history
Miscellaneous bug fixes
  • Loading branch information
Pluviolithic authored Jan 6, 2024
2 parents b3e46db + 181a012 commit 2238258
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/client/UI/Combat/BossUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ end)
playerStatePromise:andThen(function()
store.changed:connect(function(newState, oldState)
local currentEnemy = selectors.getCurrentTarget(newState, player.Name)
if not currentEnemy and BossUI.Enabled then
if (not currentEnemy or not CollectionService:HasTag(currentEnemy, "Boss")) and BossUI.Enabled then
BossUI.Enabled = false
BossUI.Background.FearCounter.Text = ""
BossUI.Background.DamageCounter.Text = ""
Expand Down
2 changes: 1 addition & 1 deletion src/client/UI/TutorialUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ tutorialFunctions = {
if subStep == 1 then
rolloutTutorialText "You are now stronger! Try defeating an enemy!"
subStep += 1
Remotes.Client:Get("SetTutorialFearMeterPercent"):SendToServer(0.95)
Remotes.Client:Get("SetTutorialFearMeterPercent"):SendToServer(0.98)
return
end

Expand Down
3 changes: 1 addition & 2 deletions src/server/Combat/Enemies/ApplyEnemyAnimations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ return function(enemy, info, janitor)
local currentIndex, animationTrack, animation = 0, nil, nil

task.spawn(function()
local engagedPlayers = table.clone(info.EngagedPlayers)
while damagePlayers and enemy:FindFirstChild "Humanoid" do
currentIndex, animation = animationUtilities.getNextIndexAndAnimationTrack(animationInstances, currentIndex)
animationTrack = enemy.Humanoid:LoadAnimation(animation)
Expand All @@ -62,7 +61,7 @@ return function(enemy, info, janitor)
local delayTime = if sound.Delay.Value > 0.1 then sound.Delay.Value - 0.1 else 0.1
local damageToDeal = enemy.Configuration.Damage.Value
task.delay(delayTime, function()
dealDamageToPlayers(engagedPlayers, damageToDeal)
dealDamageToPlayers(info.EngagedPlayers, damageToDeal)
end)
end
task.spawn(function()
Expand Down
8 changes: 7 additions & 1 deletion src/server/Combat/Enemies/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,15 @@ local function handleEnemy(enemy)
end
end, true)

--local debounceCounter = 0
local runServiceJanitor = Janitor.new()
playerJanitor:Add(runServiceJanitor)
runServiceJanitor:Add(RunService.Stepped:Connect(function()
runServiceJanitor:Add(RunService.Stepped:Connect(function() -- dt)
-- if debounceCounter < 0.1 then
-- debounceCounter += dt
-- return
-- end
-- debounceCounter = 0
humanoid = if player.Character then player.Character:FindFirstChild "Humanoid" else nil
if not humanoid then
runServiceJanitor:Destroy()
Expand Down
2 changes: 1 addition & 1 deletion src/server/PlayerManager/Tutorial.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Remotes.Server:Get("IncrementTutorialStep"):Connect(function(player)
end)

Remotes.Server:Get("SetTutorialFearMeterPercent"):Connect(function(player, amount)
if (amount == 0 or amount == 0.95) and selectors.getTutorialStep(store:getState(), player.Name) == 3 then
if (amount == 0 or amount == 0.98) and selectors.getTutorialStep(store:getState(), player.Name) == 3 then
store:dispatch(
actions.setPlayerStat(
player.Name,
Expand Down
31 changes: 27 additions & 4 deletions src/server/State/Middleware/UpdateLeaderstatsMiddleware.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,48 @@ local ReplicatedStorage = game:GetService "ReplicatedStorage"
local selectors = require(ReplicatedStorage.Common.State.selectors)
local formatter = require(ReplicatedStorage.Common.Utils.Formatter)

-- https://zerowidthspace.me/
local zeroWidthSpace = ""

return function(nextDispatch, store)
return function(action)
nextDispatch(action)
if not action.playerName or not selectors.isPlayerLoaded(store:getState(), action.playerName) then
return
end

local player = Players:FindFirstChild(action.playerName)
local actionPlayer = Players:FindFirstChild(action.playerName)

if not player then
if not actionPlayer then
return
end

local leaderstats = player:FindFirstChild "leaderstats"
local leaderstats = actionPlayer:FindFirstChild "leaderstats"

if leaderstats then
for _, stat in leaderstats:GetChildren() do
stat.Value =
formatter.formatNumberWithSuffix(selectors.getStat(store:getState(), player.Name, stat.Name))
formatter.formatNumberWithSuffix(selectors.getStat(store:getState(), actionPlayer.Name, stat.Name))
end

local playerStrengthInfo = {}
for _, player in Players:GetPlayers() do
if not player:FindFirstChild "leaderstats" then
continue
end

local strength = selectors.getStat(store:getState(), player.Name, "Strength")
table.insert(playerStrengthInfo, {
Strength = strength,
StrengthStat = player.leaderstats.Strength,
FormattedStrength = formatter.formatNumberWithSuffix(strength),
})
end
table.sort(playerStrengthInfo, function(a, b)
return a.Strength < b.Strength
end)
for index, info in ipairs(playerStrengthInfo) do
info.StrengthStat.Value = `{zeroWidthSpace:rep(index - 1)}{info.FormattedStrength}`
end
end
end
Expand Down

0 comments on commit 2238258

Please sign in to comment.