minetest->multicraft

This commit is contained in:
4aiman Konsorumaniakku 2015-07-05 12:53:53 +03:00
parent a2784b58bf
commit 57296803b6
4 changed files with 33 additions and 33 deletions

View File

@ -117,7 +117,7 @@ local function main_button_handler(this, fields, name, tabdata)
bool = 'true'
end
core.setting_set("enable_damage", bool)
minetest.setting_save()
multicraft.setting_save()
return true
end

View File

@ -166,13 +166,13 @@ local function main_button_handler(this, fields, name, tabdata)
bool = 'true'
end
core.setting_set("enable_damage", bool)
minetest.setting_save()
multicraft.setting_save()
return true
end
if fields["cb_enable_damage"] then
core.setting_set("enable_damage", fields["cb_enable_damage"])
minetest.setting_save()
multicraft.setting_save()
return true
end

View File

@ -333,17 +333,17 @@ if damage_enabled then
end
end
minetest.register_on_joinplayer(function(player)
multicraft.register_on_joinplayer(function(player)
init_hunger(player)
local pll = player:get_player_name()
state[pll] = {}
end)
local function get_field(item,field)
if minetest.registered_nodes[item] then return minetest.registered_nodes[item][field] end
if minetest.registered_items[item] then return minetest.registered_items[item][field] end
if minetest.registered_craftitems[item] then return minetest.registered_craftitems[item][field] end
if minetest.registered_tools[item] then return minetest.registered_tools[item][field] end
if multicraft.registered_nodes[item] then return multicraft.registered_nodes[item][field] end
if multicraft.registered_items[item] then return multicraft.registered_items[item][field] end
if multicraft.registered_craftitems[item] then return multicraft.registered_craftitems[item][field] end
if multicraft.registered_tools[item] then return multicraft.registered_tools[item][field] end
return ""
end
@ -352,10 +352,10 @@ local function get_on_eat(item)
end
if damage_enabled then
minetest.after(0, function(dtime)
multicraft.after(0, function(dtime)
local global_dtime = 0
local doit = false
minetest.register_globalstep(function(dtime)
multicraft.register_globalstep(function(dtime)
global_dtime = global_dtime + dtime
if global_dtime>1 then
doit = true
@ -369,7 +369,7 @@ if damage_enabled then
save_time=save_time+dtime
end
local players = minetest.get_connected_players()
local players = multicraft.get_connected_players()
for i,player in ipairs(players) do
local pll = player:get_player_name()
local pos = player:getpos()
@ -385,7 +385,7 @@ if damage_enabled then
if (death_timer[pll] or 0) > max_being_hungry_time then
death_timer[pll] = 0
minetest.chat_send_all(death_message .. pll)
multicraft.chat_send_all(death_message .. pll)
food_level[pll] = max_drumsticks
food_saturation[pll] = max_drumsticks
food_exhaustion[pll] = 0
@ -440,7 +440,7 @@ if damage_enabled then
local dist = distance(oldpos[pll],pos)
oldpos[pll] = pos
local node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
local node = multicraft.get_node({x=pos.x, y=pos.y-1, z=pos.z})
local name = node.name
if not jumped[pll] then
@ -467,9 +467,9 @@ if damage_enabled then
end
pos.y=pos.y+1
local node = minetest.get_node(pos)
local node = multicraft.get_node(pos)
local name = node.name
if minetest.get_item_group(name, "water") ~= 0 then
if multicraft.get_item_group(name, "water") ~= 0 then
state[pll].swim = true
end
@ -548,7 +548,7 @@ if damage_enabled then
end)
end
minetest.register_on_dignode(function(pos, oldnode, digger)
multicraft.register_on_dignode(function(pos, oldnode, digger)
if not digger then return end
local pll = digger:get_player_name()
state[pll].dig = true
@ -559,16 +559,16 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
end
end)
minetest.after(0,function(dtime)
for cou,def in pairs(minetest.registered_items) do
multicraft.after(0,function(dtime)
for cou,def in pairs(multicraft.registered_items) do
if get_points(def['name']) ~= false then
def['on_use'] = minetest.item_eat(1)
minetest.register_item(':' .. def.name, def)
def['on_use'] = multicraft.item_eat(1)
multicraft.register_item(':' .. def.name, def)
end
end
end )
minetest.register_chatcommand("hunger", {
multicraft.register_chatcommand("hunger", {
privs = {server = true},
func = function(name, param)
food_level[name] = 0
@ -576,7 +576,7 @@ minetest.register_chatcommand("hunger", {
end
})
minetest.register_on_respawnplayer(function(player)
multicraft.register_on_respawnplayer(function(player)
init_hunger(player, true)
end)

View File

@ -495,12 +495,12 @@ adbs.dd = {
local yaw = self.object:getyaw() -- jump, if there's something that can be juped on
local x = -math.sin(yaw)
local z = math.cos(yaw)
local nm = minetest.get_node({x = posf.x+x,y = posf.y+1,z = posf.z+z}).name
local nm2 = minetest.get_node({x = posf.x+x,y = posf.y+2,z = posf.z+z}).name
if minetest.registered_nodes[nm]
and minetest.registered_nodes[nm].walkable
and minetest.registered_nodes[nm2]
and not minetest.registered_nodes[nm2].walkable
local nm = multicraft.get_node({x = posf.x+x,y = posf.y+1,z = posf.z+z}).name
local nm2 = multicraft.get_node({x = posf.x+x,y = posf.y+2,z = posf.z+z}).name
if multicraft.registered_nodes[nm]
and multicraft.registered_nodes[nm].walkable
and multicraft.registered_nodes[nm2]
and not multicraft.registered_nodes[nm2].walkable
then
self:jump()
end
@ -1533,7 +1533,7 @@ function adbs.register_spawn(name,
if aocw > aocnt then return end
if not adbs.spawning_mobs[nm] then return end
local test = minetest.get_node(pos).name
local test = multicraft.get_node(pos).name
if test:find('water')
then
return
@ -1541,7 +1541,7 @@ function adbs.register_spawn(name,
--print(test)
end
pos.y = pos.y+1
local test = minetest.get_node(pos).name
local test = multicraft.get_node(pos).name
if test:find('water')
then
return