Fix startup

This commit is contained in:
teknomunk 2024-04-03 06:19:11 +00:00
parent 6076e35e98
commit 5f233819f8
2 changed files with 16 additions and 5 deletions

View File

@ -2,8 +2,8 @@ local mod = mcl_physics
local registered_environment_effects = {}
function mod.register_enviornment_effect(effect)
local list = registered_effects
function mod.register_environment_effect(effect)
local list = registered_environment_effects
list[#list + 1] = effect
end
@ -22,7 +22,7 @@ function mod.get_environment_effect(pos, vel, staticdata, mass)
end
end
if vector.length(v) > 0.01 or vector.length(a) > vector.length(a) > 0.01 then
if vector.length(v) > 0.01 or vector.length(a) > 0.01 then
return v,a
else
return -- nil,nil

View File

@ -7,7 +7,7 @@ dofile(modpath.."/api.lua")
-- TODO: move to Flowlib
local FLOW_SPEED = 1.39
mod.register_effect(function(pos, vel, staticdata)
mod.register_environment_effect(function(pos, vel, staticdata)
-- Get the node and node definition
local node = minetest.get_node_or_nil(pos)
if not node then return end
@ -36,5 +36,16 @@ mod.register_effect(function(pos, vel, staticdata)
end)
-- Node effects
mod.register_effect
mod.register_environment_effect(function(pos, vel, staticdata)
local pos_r = vector.round(pos)
local node = minetest.get_node(pos_r)
local nodedef = minetest.registered_nodes[node.name]
if not nodedef then return end
if nodedef._mcl_physics_effect then
return nodedef._mcl_physics_effect(pos, vel, staticdata)
end
return -- nil,nil
end)