Builtin: update game
This commit is contained in:
parent
7d0f3170e4
commit
9bce637615
@ -19,8 +19,6 @@ ui = {}
|
||||
ui.childlist = {}
|
||||
ui.default = nil
|
||||
|
||||
local maintab = core.settings:get("maintab_LAST")
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function ui.add(child)
|
||||
--TODO check child
|
||||
@ -79,6 +77,7 @@ local function wordwrap_quickhack(str)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
local maintab = core.settings:get("maintab_LAST")
|
||||
local connect_time = tonumber(core.settings:get("connect_time"))
|
||||
|
||||
function ui.update()
|
||||
@ -203,7 +202,7 @@ end
|
||||
--------------------------------------------------------------------------------
|
||||
core.button_handler = function(fields)
|
||||
if fields["btn_reconnect_yes"] then
|
||||
if core.settings:get("maintab_LAST") == "local" then
|
||||
if maintab == "local" then
|
||||
gamedata.singleplayer = true
|
||||
gamedata.selected_world =
|
||||
tonumber(core.settings:get("mainmenu_last_selected_world"))
|
||||
|
@ -400,6 +400,9 @@ core.register_chatcommand("teleport", {
|
||||
end
|
||||
local teleportee = core.get_player_by_name(name)
|
||||
if teleportee then
|
||||
if teleportee:get_attach() then
|
||||
return false, "Can't teleport, you're attached to an object!"
|
||||
end
|
||||
teleportee:set_pos(p)
|
||||
return true, "Teleporting to " .. core.pos_to_string(p, 1)
|
||||
end
|
||||
@ -417,6 +420,9 @@ core.register_chatcommand("teleport", {
|
||||
end
|
||||
|
||||
if teleportee and p then
|
||||
if teleportee:get_attach() then
|
||||
return false, "Can't teleport, you're attached to an object!"
|
||||
end
|
||||
p = find_free_position_near(p)
|
||||
teleportee:set_pos(p)
|
||||
return true, "Teleporting to " .. target_name
|
||||
@ -437,6 +443,9 @@ core.register_chatcommand("teleport", {
|
||||
teleportee = core.get_player_by_name(teleportee_name)
|
||||
end
|
||||
if teleportee and p.x and p.y and p.z then
|
||||
if teleportee:get_attach() then
|
||||
return false, "Can't teleport, player is attached to an object!"
|
||||
end
|
||||
teleportee:set_pos(p)
|
||||
return true, "Teleporting " .. teleportee_name
|
||||
.. " to " .. core.pos_to_string(p, 1)
|
||||
@ -455,6 +464,9 @@ core.register_chatcommand("teleport", {
|
||||
end
|
||||
end
|
||||
if teleportee and p then
|
||||
if teleportee:get_attach() then
|
||||
return false, "Can't teleport, player is attached to an object!"
|
||||
end
|
||||
p = find_free_position_near(p)
|
||||
teleportee:set_pos(p)
|
||||
return true, "Teleporting " .. teleportee_name
|
||||
@ -984,13 +996,13 @@ core.register_chatcommand("clearobjects", {
|
||||
end
|
||||
|
||||
core.log("action", name .. " clears all objects ("
|
||||
.. options.mode .. " mode, by "
|
||||
.. name .. ").")
|
||||
core.chat_send_all("Clearing all objects. This may take long."
|
||||
.. options.mode .. " mode).")
|
||||
core.chat_send_all("Clearing all objects. This may take a long time."
|
||||
.. " You may experience a timeout.")
|
||||
core.clear_objects(options)
|
||||
core.log("action", "Object clearing done.")
|
||||
core.chat_send_all("*** Cleared all objects.")
|
||||
return true
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -1,44 +1,18 @@
|
||||
-- Minetest: builtin/item.lua
|
||||
|
||||
local random = math.random
|
||||
local vequals, vround, vadd = vector.equals, vector.round, vector.add
|
||||
|
||||
local builtin_shared = ...
|
||||
|
||||
local gravity = tonumber(core.settings:get("movement_gravity")) or 9.81
|
||||
local vequals, vround, vadd = vector.equals, vector.round, vector.add
|
||||
|
||||
|
||||
--
|
||||
-- Falling stuff
|
||||
--
|
||||
|
||||
local random = math.random
|
||||
local function drop_attached_node(p)
|
||||
local n = core.get_node(p)
|
||||
local drops = core.get_node_drops(n, "")
|
||||
local def = core.registered_items[n.name]
|
||||
if def and def.preserve_metadata then
|
||||
local oldmeta = core.get_meta(p):to_table().fields
|
||||
-- Copy pos and node because the callback can modify them.
|
||||
local pos_copy = {x=p.x, y=p.y, z=p.z}
|
||||
local node_copy = {name=n.name, param1=n.param1, param2=n.param2}
|
||||
local drop_stacks = {}
|
||||
for k, v in pairs(drops) do
|
||||
drop_stacks[k] = ItemStack(v)
|
||||
end
|
||||
drops = drop_stacks
|
||||
def.preserve_metadata(pos_copy, node_copy, oldmeta, drops)
|
||||
end
|
||||
if def and def.sounds and def.sounds.fall then
|
||||
core.sound_play(def.sounds.fall, {pos = p})
|
||||
end
|
||||
core.remove_node(p)
|
||||
for _, item in pairs(drops) do
|
||||
local pos = {
|
||||
x = p.x + random()/2 - 0.25,
|
||||
y = p.y + random()/2 - 0.25,
|
||||
z = p.z + random()/2 - 0.25,
|
||||
}
|
||||
core.add_item(pos, item)
|
||||
end
|
||||
end
|
||||
local drop_attached_node
|
||||
|
||||
core.register_entity(":__builtin:falling_node", {
|
||||
initial_properties = {
|
||||
@ -47,7 +21,7 @@ core.register_entity(":__builtin:falling_node", {
|
||||
textures = {},
|
||||
physical = true,
|
||||
is_visible = false,
|
||||
collide_with_objects = false,
|
||||
collide_with_objects = true,
|
||||
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
},
|
||||
|
||||
@ -159,22 +133,22 @@ core.register_entity(":__builtin:falling_node", {
|
||||
if def then
|
||||
core.add_node(np, self.node)
|
||||
if self.meta then
|
||||
local meta = core.get_meta(np)
|
||||
meta:from_table(self.meta)
|
||||
core.get_meta(np):from_table(self.meta)
|
||||
end
|
||||
-- Drop node if falls into a protected area
|
||||
if core.is_protected(np, "") then
|
||||
self.object:remove()
|
||||
drop_attached_node(np)
|
||||
return
|
||||
return true
|
||||
end
|
||||
if def.sounds and def.sounds.place then
|
||||
core.sound_play(def.sounds.place, {pos = np})
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
|
||||
core.check_for_falling(np)
|
||||
return
|
||||
return true
|
||||
end
|
||||
local vel = self.object:get_velocity()
|
||||
if vequals(vel, {x = 0, y = 0, z = 0}) then
|
||||
@ -217,6 +191,36 @@ function core.spawn_falling_node(pos)
|
||||
return convert_to_falling_node(pos, node)
|
||||
end
|
||||
|
||||
function drop_attached_node(p)
|
||||
local n = core.get_node(p)
|
||||
local drops = core.get_node_drops(n, "")
|
||||
local def = core.registered_items[n.name]
|
||||
if def and def.preserve_metadata then
|
||||
local oldmeta = core.get_meta(p):to_table().fields
|
||||
-- Copy pos and node because the callback can modify them.
|
||||
local pos_copy = {x=p.x, y=p.y, z=p.z}
|
||||
local node_copy = {name=n.name, param1=n.param1, param2=n.param2}
|
||||
local drop_stacks = {}
|
||||
for k, v in pairs(drops) do
|
||||
drop_stacks[k] = ItemStack(v)
|
||||
end
|
||||
drops = drop_stacks
|
||||
def.preserve_metadata(pos_copy, node_copy, oldmeta, drops)
|
||||
end
|
||||
if def and def.sounds and def.sounds.fall then
|
||||
core.sound_play(def.sounds.fall, {pos = p})
|
||||
end
|
||||
core.remove_node(p)
|
||||
for _, item in pairs(drops) do
|
||||
local pos = {
|
||||
x = p.x + random()/2 - 0.25,
|
||||
y = p.y + random()/2 - 0.25,
|
||||
z = p.z + random()/2 - 0.25,
|
||||
}
|
||||
core.add_item(pos, item)
|
||||
end
|
||||
end
|
||||
|
||||
function builtin_shared.check_attached_node(p, n)
|
||||
local def = core.registered_nodes[n.name]
|
||||
local d = {x = 0, y = 0, z = 0}
|
||||
@ -285,21 +289,18 @@ function core.check_single_for_falling(p)
|
||||
local pa = vadd(p, check_connected[i])
|
||||
local nc = core.get_node(pa)
|
||||
if core.get_item_group(nc.name, "attached_node2") ~= 0 then
|
||||
local connected
|
||||
for j = 1, 4 do
|
||||
local ptwo = vadd(pa, check_connected[j])
|
||||
local ntwo = core.get_node(ptwo)
|
||||
local def = core.registered_nodes[ntwo.name]
|
||||
if def and def.walkable then
|
||||
connected = true
|
||||
return false
|
||||
end
|
||||
end
|
||||
if not connected then
|
||||
|
||||
drop_attached_node(pa)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
|
@ -1,19 +1,22 @@
|
||||
--From Better HUD mod
|
||||
--Copyright (C) BlockMen (2013-2016)
|
||||
--[[
|
||||
From Better HUD mod
|
||||
Copyright (C) BlockMen (2013-2016)
|
||||
Copyright (C) MultiCraft Development Team (2019-2020)
|
||||
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 3.0 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3.0 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
]]
|
||||
|
||||
hud, hud_id = {}, {}
|
||||
|
||||
@ -113,6 +116,7 @@ function hud.remove_item(player, name)
|
||||
return false
|
||||
end
|
||||
|
||||
local i_name = player:get_player_name() .. "_" .. name
|
||||
local elem = hud_id[i_name]
|
||||
|
||||
if not elem then
|
||||
@ -121,7 +125,6 @@ function hud.remove_item(player, name)
|
||||
end
|
||||
|
||||
player:hud_remove(elem.id)
|
||||
elem = nil
|
||||
|
||||
return true
|
||||
end
|
||||
|
@ -1,24 +1,27 @@
|
||||
--From Stamina mod
|
||||
--Copyright (C) BlockMen (2013-2015)
|
||||
--Copyright (C) Auke Kok <sofar@foo-projects.org> (2016)
|
||||
--Copyright (C) Minetest Mods Team (2016-2019)
|
||||
--Copyright (C) MultiCraft Development Team (2016-2020)
|
||||
--[[
|
||||
From Stamina mod
|
||||
Copyright (C) BlockMen (2013-2015)
|
||||
Copyright (C) Auke Kok <sofar@foo-projects.org> (2016)
|
||||
Copyright (C) Minetest Mods Team (2016-2019)
|
||||
Copyright (C) MultiCraft Development Team (2016-2020)
|
||||
|
||||
--This program is free software; you can redistribute it and/or modify
|
||||
--it under the terms of the GNU Lesser General Public License as published by
|
||||
--the Free Software Foundation; either version 3.0 of the License, or
|
||||
--(at your option) any later version.
|
||||
--
|
||||
--This program is distributed in the hope that it will be useful,
|
||||
--but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
--GNU Lesser General Public License for more details.
|
||||
--
|
||||
--You should have received a copy of the GNU Lesser General Public License along
|
||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3.0 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
if not core.settings:get_bool("enable_damage") then
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
]]
|
||||
|
||||
if not core.settings:get_bool("enable_damage")
|
||||
or not core.settings:get_bool("enable_hunger") then
|
||||
return
|
||||
end
|
||||
|
||||
@ -135,10 +138,10 @@ end
|
||||
|
||||
function hunger.set_poisoned(player, poisoned)
|
||||
if poisoned then
|
||||
hud.change_item(player, "hunger", {text = "hunger_statbar_poisen.png"})
|
||||
hud.change_item(player, "hunger", {text = "hunger_poisen.png"})
|
||||
player:set_attribute(attribute.poisoned, "yes")
|
||||
else
|
||||
hud.change_item(player, "hunger", {text = "hunger_statbar_fg.png"})
|
||||
hud.change_item(player, "hunger", {text = "hunger.png"})
|
||||
player:set_attribute(attribute.poisoned, "no")
|
||||
end
|
||||
end
|
||||
@ -316,44 +319,14 @@ core.register_globalstep(function(dtime)
|
||||
end
|
||||
end)
|
||||
|
||||
function core.do_item_eat(hp_change, replace_with_item, poison, itemstack, player, pointed_thing)
|
||||
for _, callback in pairs(core.registered_on_item_eats) do
|
||||
local result = callback(hp_change, replace_with_item, poison, itemstack, player, pointed_thing)
|
||||
if result then
|
||||
return result
|
||||
end
|
||||
end
|
||||
|
||||
if not is_player(player) or not itemstack then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
function hunger.item_eat(hp_change, user, poison)
|
||||
if not poison then
|
||||
hunger.change_saturation(player, hp_change)
|
||||
hunger.set_exhaustion(player, 0)
|
||||
hunger.change_saturation(user, hp_change)
|
||||
hunger.set_exhaustion(user, 0)
|
||||
else
|
||||
hunger.change_saturation(player, hp_change)
|
||||
hunger.poison(player, -poison, settings.poison_tick)
|
||||
hunger.change_saturation(user, hp_change)
|
||||
hunger.poison(user, -poison, settings.poison_tick)
|
||||
end
|
||||
|
||||
itemstack:take_item()
|
||||
|
||||
if replace_with_item then
|
||||
if itemstack:is_empty() then
|
||||
itemstack:add_item(replace_with_item)
|
||||
else
|
||||
local inv = player:get_inventory()
|
||||
if inv:room_for_item("main", {name=replace_with_item}) then
|
||||
inv:add_item("main", replace_with_item)
|
||||
else
|
||||
local pos = player:getpos()
|
||||
pos.y = math.floor(pos.y - 1.0)
|
||||
core.add_item(pos, replace_with_item)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
||||
hud.register("hunger", {
|
||||
@ -362,8 +335,8 @@ hud.register("hunger", {
|
||||
alignment = {x = -1, y = -1},
|
||||
offset = {x = 8, y = -94},
|
||||
size = {x = 24, y = 24},
|
||||
text = "hunger_statbar_fg.png",
|
||||
background = "hunger_statbar_bg.png",
|
||||
text = "hunger.png",
|
||||
background = "hunger_gone.png",
|
||||
number = settings.visual_max
|
||||
})
|
||||
|
||||
|
@ -2,10 +2,13 @@
|
||||
|
||||
local builtin_shared = ...
|
||||
|
||||
local abs, atan2, cos, floor, max, sin, random = math.abs, math.atan2, math.cos, math.floor, math.max, math.sin, math.random
|
||||
local vadd, vnew, vmultiply, vnormalize, vsubtract = vector.add, vector.new, vector.multiply, vector.normalize, vector.subtract
|
||||
local abs, atan2, cos, floor, max, sin, random =
|
||||
math.abs, math.atan2, math.cos, math.floor, math.max, math.sin, math.random
|
||||
local vadd, vnew, vmultiply, vnormalize, vsubtract =
|
||||
vector.add, vector.new, vector.multiply, vector.normalize, vector.subtract
|
||||
|
||||
local creative_mode = core.settings:get_bool("creative_mode")
|
||||
local node_drop = core.settings:get_bool("node_drop") ~= false
|
||||
|
||||
local function copy_pointed_thing(pointed_thing)
|
||||
return {
|
||||
@ -550,37 +553,79 @@ function core.item_drop(itemstack, dropper, pos)
|
||||
-- environment failed
|
||||
end
|
||||
|
||||
local enable_damage = core.settings:get_bool("enable_damage")
|
||||
local enable_hunger = core.settings:get_bool("enable_damage") and core.settings:get_bool("enable_hunger")
|
||||
function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing, poison)
|
||||
for _, callback in pairs(core.registered_on_item_eats) do
|
||||
local result = callback(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||
if result then
|
||||
return result
|
||||
end
|
||||
end
|
||||
local def = itemstack:get_definition()
|
||||
if itemstack:take_item() ~= nil then
|
||||
if enable_hunger then
|
||||
hunger.item_eat(hp_change, user, poison)
|
||||
else
|
||||
user:set_hp(user:get_hp() + hp_change)
|
||||
end
|
||||
|
||||
local pos = user:get_pos()
|
||||
if not core.is_valid_pos(pos) then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if def and def.sound and def.sound.eat then
|
||||
core.sound_play(def.sound.eat, {
|
||||
pos = pos,
|
||||
max_hear_distance = 16})
|
||||
else
|
||||
core.sound_play("player_eat", {
|
||||
pos = pos,
|
||||
max_hear_distance = 10,
|
||||
gain = 0.3})
|
||||
end
|
||||
|
||||
local dir = user:get_look_dir()
|
||||
local ppos = {x = pos.x, y = pos.y + 1.3, z = pos.z}
|
||||
core.add_particlespawner({
|
||||
amount = 20,
|
||||
time = 0.1,
|
||||
minpos = ppos,
|
||||
maxpos = ppos,
|
||||
minvel = {x = dir.x - 1, y = 2, z = dir.z - 1},
|
||||
maxvel = {x = dir.x + 1, y = 2, z = dir.z + 1},
|
||||
minacc = {x = 0, y = -5, z = 0},
|
||||
maxacc = {x = 0, y = -9, z = 0},
|
||||
minexptime = 1,
|
||||
maxexptime = 1,
|
||||
minsize = 1,
|
||||
maxsize = 1,
|
||||
vertical = false,
|
||||
texture = def.inventory_image
|
||||
})
|
||||
|
||||
if replace_with_item then
|
||||
if itemstack:is_empty() then
|
||||
itemstack:add_item(replace_with_item)
|
||||
else
|
||||
local inv = user:get_inventory()
|
||||
-- Check if inv is null, since non-players don't have one
|
||||
if inv and inv:room_for_item("main", {name=replace_with_item}) then
|
||||
inv:add_item("main", replace_with_item)
|
||||
else
|
||||
pos.y = pos.y + 0.5
|
||||
core.add_item(pos, replace_with_item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
function core.item_eat(hp_change, replace_with_item, poison)
|
||||
return function(itemstack, user, pointed_thing) -- closure
|
||||
if user then
|
||||
local pos = user:get_pos()
|
||||
pos.y = pos.y + 1.3
|
||||
if not core.is_valid_pos(pos) then
|
||||
return
|
||||
end
|
||||
|
||||
local dir = user:get_look_dir()
|
||||
core.add_particlespawner({
|
||||
amount = 20,
|
||||
time = 0.1,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x = dir.x - 1, y = 2, z = dir.z - 1},
|
||||
maxvel = {x = dir.x + 1, y = 2, z = dir.z + 1},
|
||||
minacc = {x = 0, y = -5, z = 0},
|
||||
maxacc = {x = 0, y = -9, z = 0},
|
||||
minexptime = 1,
|
||||
maxexptime = 1,
|
||||
minsize = 1,
|
||||
maxsize = 1,
|
||||
vertical = false,
|
||||
texture = core.registered_items[itemstack:get_name()].inventory_image
|
||||
})
|
||||
core.sound_play("player_eat", {pos = pos, max_hear_distance = 10, gain = 0.3})
|
||||
if enable_damage then
|
||||
return core.do_item_eat(hp_change, replace_with_item, poison, itemstack, user, pointed_thing)
|
||||
end
|
||||
return core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing, poison)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -600,7 +645,7 @@ function core.handle_node_drops(pos, drops, digger)
|
||||
-- Add dropped items to object's inventory
|
||||
local inv = digger and digger:get_inventory()
|
||||
local give_item
|
||||
if creative_mode and inv then
|
||||
if (not node_drop or creative_mode) and inv then
|
||||
give_item = function(item)
|
||||
return inv:add_item("main", item)
|
||||
end
|
||||
|
@ -19,13 +19,15 @@ end
|
||||
|
||||
local time_to_live = tonumber(core.settings:get("item_entity_ttl")) or 600
|
||||
local gravity = tonumber(core.settings:get("movement_gravity")) or 9.81
|
||||
local collection = core.settings:get_bool("item_collection") or true
|
||||
local water_flow = core.settings:get_bool("item_water_flow") or true
|
||||
local collection = core.settings:get_bool("item_collection") ~= false
|
||||
local water_flow = core.settings:get_bool("item_water_flow") ~= false
|
||||
local lava_destroy = core.settings:get_bool("item_lava_destroy") ~= false
|
||||
|
||||
-- Water flow functions, based on QwertyMine3 (WTFPL), and TenPlus1 (MIT) mods
|
||||
local function quick_flow_logic(node, pos_testing, dir)
|
||||
local node_testing = core.get_node_or_nil(pos_testing)
|
||||
local liquid = node_testing and core.registered_nodes[node_testing.name].liquidtype
|
||||
if not node_testing then return 0 end
|
||||
local liquid = core.registered_nodes[node_testing.name] and core.registered_nodes[node_testing.name].liquidtype
|
||||
|
||||
if not liquid or liquid ~= "flowing" and liquid ~= "source" then
|
||||
return 0
|
||||
@ -210,7 +212,8 @@ core.register_entity(":__builtin:item", {
|
||||
local is_slippery = false
|
||||
|
||||
-- Destroy item when dropped into lava
|
||||
if def_inside and def_inside.groups and def_inside.groups.lava then
|
||||
if lava_destroy and def_inside
|
||||
and def_inside.groups and def_inside.groups.lava then
|
||||
core.sound_play("default_cool_lava", {
|
||||
pos = pos, max_hear_distance = 10})
|
||||
self.object:remove()
|
||||
|
@ -137,6 +137,9 @@ function core.register_item(name, itemdef)
|
||||
core.log("warning", "Node 'light_source' value exceeds maximum," ..
|
||||
" limiting to maximum: " ..name)
|
||||
end
|
||||
if itemdef.light_source == nil then
|
||||
itemdef.light_source = 0
|
||||
end
|
||||
setmetatable(itemdef, {__index = core.nodedef_default})
|
||||
core.registered_nodes[itemdef.name] = itemdef
|
||||
elseif itemdef.type == "craft" then
|
||||
@ -404,8 +407,7 @@ end
|
||||
|
||||
|
||||
function core.add_group(name, adding)
|
||||
local addgroup = {}
|
||||
addgroup = table.copy(core.registered_items[name].groups)
|
||||
local addgroup = table.copy(core.registered_items[name].groups) or {}
|
||||
for k, v in pairs(adding) do
|
||||
addgroup[k] = v
|
||||
end
|
||||
|
@ -9,7 +9,7 @@ local health_bar_definition = {
|
||||
offset = {x = -247, y = -94},
|
||||
size = {x = 24, y = 24},
|
||||
text = "heart.png",
|
||||
background = "heart_bg.png",
|
||||
background = "heart_gone.png",
|
||||
number = 20
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user