Compare commits
6 Commits
74506315b5
...
eb6c6f1fe2
Author | SHA1 | Date | |
---|---|---|---|
eb6c6f1fe2 | |||
a8b2b841f8 | |||
da20d7517b | |||
658f197051 | |||
35401336d2 | |||
56a46ae567 |
2
nulllib
2
nulllib
@ -1 +1 @@
|
||||
Subproject commit a65b6b323dc7c3c80f0305b28f126cd9d2b317ac
|
||||
Subproject commit 33d6ecaa03a4b4b9a63474cb7f26b5b14e83956c
|
97
script.lua
97
script.lua
@ -188,6 +188,9 @@ for _, v in pairs(EMISSIVES) do
|
||||
v:setColor(COLORS.neutral)
|
||||
end
|
||||
|
||||
local gay_idiot_uuid="3dad78e8-6979-404f-820e-952ce20964a0" -- boy fren
|
||||
--gay_idiot_uuid="468554f1-27cd-4ea1-9308-3dd14a9b1a12" -- alt account (testing)
|
||||
|
||||
-- }}}
|
||||
|
||||
-- PartsManager rules {{{
|
||||
@ -370,6 +373,21 @@ function setArmor(state)
|
||||
sharedconfig.save("armor_enabled", state)
|
||||
end
|
||||
|
||||
do
|
||||
local purr_sound
|
||||
|
||||
---@param state boolean
|
||||
function purr(state)
|
||||
if state and not purr_sound then
|
||||
purr_sound=sound_settings(sounds["entity.cat.purr"]):loop(true):play()
|
||||
elseif not state then
|
||||
purr_sound:stop()
|
||||
purr_sound=nil
|
||||
end
|
||||
return purr_sound
|
||||
end
|
||||
end
|
||||
|
||||
local snore
|
||||
do
|
||||
local snores={sounds["sounds.snore-1"], sounds["sounds.snore-2"], sounds["sounds.snore-3"]}
|
||||
@ -383,16 +401,8 @@ do
|
||||
end
|
||||
|
||||
local function snore_purr()
|
||||
if not is_snoring then
|
||||
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
|
||||
|
||||
purr(true)
|
||||
statemonitor.register("snore", state_not_sleeping, function() purr(false) end, 5, true)
|
||||
end
|
||||
|
||||
local function snore_augh()
|
||||
@ -419,7 +429,8 @@ function pings.meow()
|
||||
sound_settings(sounds["entity.cat.ambient"]):play()
|
||||
end
|
||||
events.CHAT_SEND_MESSAGE:register(function(msg)
|
||||
if sharedconfig.load("is_cat") then pings.meow() end
|
||||
if sharedconfig.load("is_cat") and string.match(msg, '^/') == nil then
|
||||
pings.meow() end
|
||||
return msg end,
|
||||
"chat_meow")
|
||||
|
||||
@ -672,22 +683,70 @@ function hostTick()
|
||||
sharedstate.set("health", player:getHealth())
|
||||
end
|
||||
|
||||
local gay_idiot_check
|
||||
do
|
||||
local nearby=false
|
||||
local nearby_ticks=0
|
||||
function pings.set_gay_idiot_nearby(state)
|
||||
if state then
|
||||
pings.expr("owo")
|
||||
purr(true)
|
||||
else
|
||||
pings.expr("neutral")
|
||||
purr(false)
|
||||
end
|
||||
end
|
||||
|
||||
local function set_gay_idiot_nearby(state)
|
||||
if state ~= nearby then
|
||||
nearby=state
|
||||
pings.set_gay_idiot_nearby(state)
|
||||
end
|
||||
end
|
||||
|
||||
---@param frequency? integer time since last check, default 1
|
||||
function gay_idiot_check(frequency)
|
||||
frequency=frequency or 1
|
||||
nearby_ticks=nearby_ticks or 0
|
||||
local gay_idiot=world.getEntity(gay_idiot_uuid)
|
||||
|
||||
-- if exists
|
||||
if gay_idiot ~= nil then
|
||||
-- if nearby then add to timer
|
||||
local distance = (gay_idiot:getPos() - player:getPos()):length()
|
||||
if distance <= 1 then
|
||||
nearby_ticks=nearby_ticks+frequency
|
||||
else
|
||||
nearby_ticks=0
|
||||
end
|
||||
|
||||
set_gay_idiot_nearby(nearby_ticks>=5*20)
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function tick()
|
||||
STATE.current.color_check=player:isInLava() ~= (player:getDimensionName()=="minecraft:the_nether")
|
||||
STATE.current.color_check=player:isInLava() ~=
|
||||
(player:getDimensionName()=="minecraft:the_nether")
|
||||
if STATE.old.color_check~=STATE.current.color_check then
|
||||
setColor()
|
||||
end
|
||||
-- optimization, only execute these once a second --
|
||||
if world.getTimeOfDay() % 20 == 0 then
|
||||
|
||||
-- optimization, only execute these with certain frequency --
|
||||
if world.getTime() % 5 == 0 then -- 1/4 second
|
||||
if player:getPose() == "SLEEPING" then
|
||||
snore()
|
||||
end
|
||||
|
||||
-- Sync state every 10 seconds
|
||||
if world.getTimeOfDay() % (20*10) == 0 then
|
||||
sharedstate.sync()
|
||||
end
|
||||
if host:isHost() then gay_idiot_check(5) end
|
||||
|
||||
-- unneeded for now but can uncomment if needed
|
||||
--if world.getTime() % 20 == 0 then -- 1 second
|
||||
-- Sync state every 10 seconds
|
||||
if world.getTime() % (20*10) == 0 then
|
||||
sharedstate.sync()
|
||||
end
|
||||
--end
|
||||
end
|
||||
|
||||
hostTick()
|
||||
|
Loading…
x
Reference in New Issue
Block a user