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' bool = 'true'
end end
core.setting_set("enable_damage", bool) core.setting_set("enable_damage", bool)
minetest.setting_save() multicraft.setting_save()
return true return true
end end
@ -225,4 +225,4 @@ function create_tab_server()
main_button_handler, main_button_handler,
nil) nil)
return retval return retval
end end

View File

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

View File

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

View File

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