mirror of
https://github.com/HybridDog/builtin_item.git
synced 2024-12-23 01:10:26 +01:00
Use new settings interface
This commit is contained in:
parent
2cea32d4d7
commit
143ab1f8dd
19
init.lua
19
init.lua
@ -6,7 +6,7 @@ if not core.get_gravity then
|
|||||||
local gravity,grav_updating = 10
|
local gravity,grav_updating = 10
|
||||||
function core.get_gravity()
|
function core.get_gravity()
|
||||||
if not grav_updating then
|
if not grav_updating then
|
||||||
gravity = tonumber(core.setting_get("movement_gravity")) or gravity
|
gravity = tonumber(core.settings:get("movement_gravity")) or gravity
|
||||||
grav_updating = true
|
grav_updating = true
|
||||||
core.after(50, function()
|
core.after(50, function()
|
||||||
grav_updating = false
|
grav_updating = false
|
||||||
@ -14,21 +14,6 @@ if not core.get_gravity then
|
|||||||
end
|
end
|
||||||
return gravity
|
return gravity
|
||||||
end
|
end
|
||||||
local set_setting = core.setting_set
|
|
||||||
function core.setting_set(name, v, ...)
|
|
||||||
if name == "gravity" then
|
|
||||||
name = "movement_gravity"
|
|
||||||
gravity = tonumber(v) or gravity
|
|
||||||
end
|
|
||||||
return set_setting(name, v, ...)
|
|
||||||
end
|
|
||||||
local get_setting = core.setting_get
|
|
||||||
function core.setting_get(name, ...)
|
|
||||||
if name == "gravity" then
|
|
||||||
name = "movement_gravity"
|
|
||||||
end
|
|
||||||
return get_setting(name, ...)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_nodes(pos)
|
local function get_nodes(pos)
|
||||||
@ -196,6 +181,6 @@ end
|
|||||||
|
|
||||||
minetest.register_entity(":__builtin:item", item_entity)
|
minetest.register_entity(":__builtin:item", item_entity)
|
||||||
|
|
||||||
if minetest.setting_get("log_mods") then
|
if minetest.settings:get("log_mods") then
|
||||||
minetest.log("action", "builtin_item loaded")
|
minetest.log("action", "builtin_item loaded")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user