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

Commit

Permalink
Fixes #95
Browse files Browse the repository at this point in the history
  • Loading branch information
Pluviolithic committed Nov 29, 2023
1 parent 0d3fa9e commit d5d8ab1
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 27 deletions.
7 changes: 6 additions & 1 deletion src/client/UI/SettingsUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function SettingsUI:_initialize(): ()
return
end
if
settingSwitch.Name:match "Speed" and not selectors.hasGamepass(store:getState(), player.Name, "Speed")
settingSwitch.Name:match "Speed" and not selectors.hasGamepass(store:getState(), player.Name, "2xSpeed")
then
MarketplaceService:PromptGamePassPurchase(player, gamepassIDs["2xSpeed"].Value)
return
Expand Down Expand Up @@ -64,6 +64,11 @@ function SettingsUI:Refresh(): ()
continue
end
local settingValue = selectors.getSetting(store:getState(), player.Name, settingSwitch.Name)
if settingSwitch.Name == "2xSpeed" and not selectors.hasGamepass(store:getState(), player.Name, "2xSpeed") then
settingSwitch.On.Visible = false
settingSwitch.Off.Visible = true
continue
end
settingSwitch.On.Visible = settingValue
settingSwitch.Off.Visible = not settingValue
end
Expand Down
15 changes: 9 additions & 6 deletions src/server/Combat/Dummy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,27 @@ local function handleDummy(dummy)

humanoid:MoveTo(goalPosition + (humanoid.RootPart.Position - goalPosition).Unit * fightRange)

local currentAnimation, currentTrack = nil, nil
local animationInstances = getSortedAnimationInstances(animations.Fists:GetChildren())
local idleAnimation = ReplicatedStorage.CombatAnimations.Fists.Idle
local loadedIdleAnimation = humanoid:LoadAnimation(idleAnimation)
local runAnimations = true

local failed = false
local connection = nil
connection = store.changed:connect(function(newState)
if selectors.getCurrentTarget(newState, player.Name) ~= dummy then
failed = true
loadedIdleAnimation:Stop()
loadedIdleAnimation:Destroy()
end
end)

task.spawn(function()
humanoid:GetPropertyChangedSignal("MoveDirection"):Wait()
store:dispatch(actions.switchPlayerEnemy(player.Name, nil))
failed = true
loadedIdleAnimation:Stop()
end)

repeat
Expand All @@ -85,12 +94,6 @@ local function handleDummy(dummy)
return
end

local currentAnimation, currentTrack = nil, nil
local animationInstances = getSortedAnimationInstances(animations.Fists:GetChildren())
local idleAnimation = ReplicatedStorage.CombatAnimations.Fists.Idle
local loadedIdleAnimation = humanoid:LoadAnimation(idleAnimation)
local runAnimations = true

local currentIndex, maxIndex = 0, #animationInstances

loadedIdleAnimation.Priority = Enum.AnimationPriority.Idle
Expand Down
10 changes: 5 additions & 5 deletions src/server/Exchange/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,18 @@ local function handlePunchingBag(bag: any)

local currentAnimation, currentTrack = nil, nil
local animationInstances = getSortedAnimationInstances(animations:FindFirstChild("Fists"):GetChildren())
local currentIndex, maxIndex = 0, #animationInstances
local idleAnimation = ReplicatedStorage.CombatAnimations.Fists.Idle
local loadedIdleAnimation = humanoid:LoadAnimation(idleAnimation)
loadedIdleAnimation.Priority = Enum.AnimationPriority.Idle

local connection
connection = disableSwitch.Event:Connect(function(disablingPlayer: Player)
if disablingPlayer == player then
cancelled = true
connection:Disconnect()
currentTrack:Stop()
loadedIdleAnimation:Stop()

prompt.ActionText = "Start Training"
inUse = false
Expand All @@ -92,11 +97,6 @@ local function handlePunchingBag(bag: any)
end
end)

local currentIndex, maxIndex = 0, #animationInstances
local idleAnimation = ReplicatedStorage.CombatAnimations.Fists.Idle
local loadedIdleAnimation = humanoid:LoadAnimation(idleAnimation)
loadedIdleAnimation.Priority = Enum.AnimationPriority.Idle

task.spawn(function()
repeat
currentIndex = (currentIndex % maxIndex) + 1
Expand Down
2 changes: 1 addition & 1 deletion src/server/PlayerManager/PlayerStatusUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function PlayerStatusUI:_updateUIFields(state)

if
selectors.hasGamepass(state, self._player.Name, "VIP")
and selectors.getSetting(state, self._player.Name, "VIPNameTag")
and selectors.getSetting(state, self._player.Name, "VipNameTag")
then
self._player:SetAttribute("isVIP", true)
playerUIFrame.PlayerName.TextColor3 = Color3.fromRGB(255, 193, 7)
Expand Down
4 changes: 2 additions & 2 deletions src/server/PlayerManager/ProfileTemplate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ return {
},

SavedSettings = {
VIPChatTag = false,
VIPNameTag = false,
VipChatTag = false,
VipNameTag = false,
JumpscareCooldown = true,
},

Expand Down
1 change: 0 additions & 1 deletion src/server/PlayerManager/Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Remotes.Server:Get("SwitchSetting"):Connect(function(player, setting)
if type(selectors.getSetting(store:getState(), player.Name, setting)) ~= "boolean" then
return
end
-- check vip pass
if setting == "2xSpeed" then
if not selectors.hasGamepass(store:getState(), player.Name, "2xSpeed") then
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ return {
store:dispatch(actions.equipWeapon(player.Name, "Hero Blade"))
store:dispatch(actions.incrementPlayerMultiplier(player.Name, "Training DummyFearMultiplier", 0.5))
store:dispatch(actions.incrementPlayerMultiplier(player.Name, "PunchingBagStrengthMultiplier", 0.2))
store:dispatch(actions.switchSetting(player.Name, "VIPNameTag"))
store:dispatch(actions.switchSetting(player.Name, "VIPChatTag"))
player:SetAttribute("isVIP", true)
store:dispatch(actions.switchSetting(player.Name, "VipNameTag"))
store:dispatch(actions.switchSetting(player.Name, "VipChatTag"))
end,
[IDs["50PetStorage"].Value] = function(player: Player)
store:dispatch(actions.incrementPlayerStat(player.Name, "MaxPetCount", 50))
Expand Down Expand Up @@ -60,10 +59,6 @@ return {
store:dispatch(actions.incrementPlayerMultiplier(player.Name, "MaxFearMeterMultiplier", 2))
end,
[IDs["2xSpeed"].Value] = function(player: Player)
local humanoid = player.Character and player.Character:FindFirstChild "Humanoid"
if humanoid then
humanoid.WalkSpeed *= 2
end
store:dispatch(actions.switchSetting(player.Name, "2xSpeed"))
end,
[IDs["3xHatch"].Value] = true,
Expand Down
1 change: 1 addition & 0 deletions src/server/State/Actions/SettingsActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ return {
return {
setting = setting,
playerName = playerName,
shouldSave = true,
}
end),
}
2 changes: 1 addition & 1 deletion src/server/State/Middleware/SavePlayerDataMiddleware.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ local function getFilteredState(playerName, state)
if key:match "Multiplier" then
continue
end
if not profileTemplate[field][key] then
if type(profileTemplate[field][key]) == "nil" then
entry[key] = nil
end
end
Expand Down
6 changes: 3 additions & 3 deletions src/shared/State/DefaultStates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ return {
},

SavedSettings = {
VIPChatTag = false,
VIPNameTag = false,
VipChatTag = false,
VipNameTag = false,
JumpscareCooldown = true,
},

TempSettings = {
BackgroundMusic = true,
["2xSpeed"] = false,
["2xSpeed"] = true,
BrightMode = false,
ShowMyPets = true,
ShowOtherPets = true,
Expand Down

0 comments on commit d5d8ab1

Please sign in to comment.