Noch mehr mods
This commit is contained in:
parent
a063db5d3b
commit
cf017b2ca1
527 changed files with 21113 additions and 181 deletions
52
mods/airutils/water_splash.lua
Normal file
52
mods/airutils/water_splash.lua
Normal file
|
@ -0,0 +1,52 @@
|
|||
local function calculateVelocity(magnitude, angle)
|
||||
-- Calcula os componentes do vetor usando ângulo polar
|
||||
-- Supondo que o ângulo é dado no plano XY, com z = 0
|
||||
local velocity = {
|
||||
x = magnitude * math.cos(angle),
|
||||
y = 0, -- Se a velocidade não tem componente z
|
||||
z = magnitude * math.sin(angle),
|
||||
}
|
||||
|
||||
return velocity
|
||||
end
|
||||
|
||||
local function water_particle(pos, accell)
|
||||
if airutils.splash_texture == nil then return end
|
||||
if airutils.splash_texture == "" then return end
|
||||
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x = 0, y = 0, z = 0},
|
||||
acceleration = accell, --{x = 0, y = 0, z = 0},
|
||||
expirationtime = 2.0,
|
||||
size = 4.8,
|
||||
collisiondetection = false,
|
||||
collision_removal = false,
|
||||
vertical = false,
|
||||
texture = airutils.splash_texture,
|
||||
})
|
||||
end
|
||||
|
||||
function airutils.add_splash(pos, yaw, x_pos)
|
||||
local direction = yaw
|
||||
|
||||
local spl_pos = vector.new(pos)
|
||||
--water_particle(spl_pos, {x=0,y=0,z=0})
|
||||
|
||||
--right
|
||||
local move = x_pos/10
|
||||
spl_pos.x = spl_pos.x + move * math.cos(direction)
|
||||
spl_pos.z = spl_pos.z + move * math.sin(direction)
|
||||
|
||||
local velocity = calculateVelocity(0.2, yaw)
|
||||
water_particle(spl_pos, velocity)
|
||||
|
||||
--left
|
||||
direction = direction - math.rad(180)
|
||||
spl_pos = vector.new(pos)
|
||||
spl_pos.x = spl_pos.x + move * math.cos(direction)
|
||||
spl_pos.z = spl_pos.z + move * math.sin(direction)
|
||||
|
||||
velocity = calculateVelocity(0.2, yaw - math.rad(180))
|
||||
water_particle(spl_pos, velocity)
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue