Re-enable snoring

This commit is contained in:
NullBite 2023-06-26 02:14:06 -04:00
parent 779c71b281
commit 48892c5700
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A
3 changed files with 55 additions and 27 deletions

View File

@ -13,7 +13,7 @@
- [.] fix data api - [.] fix data api
- [.] ConfigAPI - [.] ConfigAPI
- [.] reimplement avatar settings - [.] reimplement avatar settings
- [ ] fix sound - [.] fix sound
- [ ] fix Blockbench animations - [ ] fix Blockbench animations
- [.] fix or disable custom commands (can probably use `/figura run`) - [.] fix or disable custom commands (can probably use `/figura run`)
- [ ] fix armor, won't re-enable until cleanup - [ ] fix armor, won't re-enable until cleanup

@ -1 +1 @@
Subproject commit 72f20234f07abc22e5b00de45302caa03e946088 Subproject commit a8155f594112cfbb96ae7eb1af330f303f679824

View File

@ -22,6 +22,7 @@ PartsManager=require("nulllib.PartsManager")
UVManager=require("nulllib.UVManager") UVManager=require("nulllib.UVManager")
sharedstate=require("nulllib.sharedstate") sharedstate=require("nulllib.sharedstate")
sharedconfig=require("nulllib.sharedconfig") sharedconfig=require("nulllib.sharedconfig")
statemonitor=require("nulllib.statemonitor")
-- shortcuts for /figura run so i don't have to type so much -- shortcuts for /figura run so i don't have to type so much
C={} C={}
@ -66,6 +67,7 @@ do
["armor_enabled"]=true, ["armor_enabled"]=true,
["vanilla_enabled"]=false, ["vanilla_enabled"]=false,
["snore_enabled"]=true, ["snore_enabled"]=true,
["snore_augh"]=false,
["print_settings"]=false, ["print_settings"]=false,
["vanilla_partial"]=false, ["vanilla_partial"]=false,
["tail_enabled"]=true, ["tail_enabled"]=true,
@ -363,29 +365,57 @@ function setArmor(state)
sharedconfig.save("armor_enabled", state) sharedconfig.save("armor_enabled", state)
end end
local function snore() end local snore
-- TODO re-enable snoring -- TODO re-enable snoring
-- do do
-- local snore_enabled=false local snores={sounds["sounds.snore-1"], sounds["sounds.snore-2"], sounds["sounds.snore-3"]}
-- local snore_index=1
-- function snore() local snore_index=1
-- if snore_enabled then local is_snoring=false
-- -- TODO
-- -- sound.playCustomSound(SNORES[snore_index], ---Set optimal settings for random player sounds
-- -- player.getPos(), vectors.of{20,1}) ---@param sound Sound
-- snore_index=snore_index%#SNORES+1 ---@return Sound
-- end local function sound_settings(sound)
-- end return sound:volume(1):pitch(1):pos(player:getPos())
-- end
-- function setSnoring(state)
-- setState("snore_enabled", state) local function state_not_sleeping()
-- ping.setSnoring(skin_state.snore_enabled) -- return not player:getPose() ~= "SLEEPING"
-- end return player:getPose() ~= "SLEEPING"
-- end
-- function ping.setSnoring(state)
-- snore_enabled=state local function snore_purr()
-- end if not is_snoring then
-- end is_snoring=true
local purr_sound=sound_settings(sounds["entity.cat.purr"]):loop(true):play()
local function stop_playback()
purr_sound:stop()
is_snoring=false
end
statemonitor.register("snore", state_not_sleeping, stop_playback, 5, true)
end
end
local function snore_augh()
if sharedconfig.load("snore_enabled") then
if timers.cooldown(20*4, "snore") then
sound_settings(snores[snore_index]):stop():play()
snore_index=snore_index%#snores+1
print(snore_index)
end
end
end
function snore()
if sharedconfig.load("snore_augh") then
snore_augh()
else
snore_purr()
end
end
end
--- Toggle Vanilla --- --- Toggle Vanilla ---
function setVanilla(state) function setVanilla(state)
@ -646,9 +676,7 @@ function tick()
if world.getTimeOfDay() % 20 == 0 then if world.getTimeOfDay() % 20 == 0 then
if player:getPose() == "SLEEPING" then if player:getPose() == "SLEEPING" then
if timers.cooldown(20*4, "snore") then snore()
snore()
end
end end
-- Sync state every 10 seconds -- Sync state every 10 seconds