figura-skin/scripts/soggy.lua
2025-11-23 01:10:42 -08:00

35 lines
2 KiB
Lua

local utils = require("scripts.libs.utils")
local tw = 1 -- top wetness
local bw = 1 -- bottom wetness
local driptime = 4 -- recommended to change based on how low you have TW/BW
local offset = vec(0, 0, 0)
local offset2 = vec(0, 0, 0)
events.TICK:register(function ()
if player:isInRain() then
tw = tw - 0.005
bw = bw - 0.005
if tw <= 0.6 then tw = 0.6 end
if bw <= 0.6 then bw = 0.6 end
end
offset = vec((math.random() - 0.5), math.random(), (math.random() - 0.5)) -- random offset of particles
offset2 = vec(math.random(-1, 1), math.random(-1, 1), math.random(-1, 1)) -- velocity
if player:isInWater() then bw = 0.6 end
if player:isUnderwater() then tw = 0.6 end
if not player:isUnderwater() and tw ~= 1 and not player:isInRain() then tw = tw + 0.005 end
if not player:isInWater() and bw ~= 1 and not player:isInRain() then bw = bw + 0.005 end
if bw >= 1 then bw = 1 end
if tw >= 1 then tw = 1 end
if world.getTime() % driptime == 0 and tw ~= 1 and not (player:isUnderwater()) then for _ = 0, driptime * 0.5 do particles:newParticle("falling_dripstone_water",player:getPos():add(offset + vec(0, 0.7, 0)), offset2) end end
if world.getTime() % driptime == 0 and bw ~= 1 and not (player:isInWater()) then for _ = 0, driptime * 0.5 do particles:newParticle("falling_dripstone_water",player:getPos():add(offset), offset2:mul(0.5)) end end
utils.forEachNonGroup(models.models.main.LeftArm, function (part) part:setColor(tw, tw, tw) end)
utils.forEachNonGroup(models.models.main.RightArm, function (part) part:setColor(tw, tw, tw) end)
utils.forEachNonGroup(models.models.main.Head, function (part) part:setColor(tw, tw, tw) end)
utils.forEachNonGroup(models.models.main.Body, function (part) part:setColor(tw, tw, tw) end)
utils.forEachNonGroup(models.models.main.LeftLeg, function (part) part:setColor(bw, bw,bw) end)
utils.forEachNonGroup(models.models.main.RightLeg, function (part) part:setColor(bw, bw, bw) end)
end)