Added checkpoint file and moved global functions

master
Austin Shenk 2013-01-17 20:23:22 -05:00
parent 5a280a45fc
commit 5cf80ac884
1 changed files with 5 additions and 31 deletions

View File

@ -11,6 +11,10 @@ if(file == nil) then
io.write("initialized")
io.flush()
io.close()
io.output(minetest.get_worldpath().."/adventures_checkpoints")
io.write("initialized")
io.flush()
io.close()
io.output(minetest.get_worldpath().."/adventures_previousmode")
io.write("initialized")
io.flush()
@ -18,37 +22,7 @@ if(file == nil) then
end
local modpath=minetest.get_modpath("adventures")
dofile(modpath.."/tables.lua")
function adventures.positionToString(pos)
return tostring(pos.x)..tostring(pos.y)..tostring(pos.z)
end
function adventures.snapPosition(meta, pos)
local newPos = {x=pos.x,y=pos.y,z=pos.z}
if(meta:get_int("width")%2 == 0) then
newPos.x = newPos.x-0.5
newPos.z = newPos.z-0.5
end
if(meta:get_int("height")%2 == 0) then
newPos.y = newPos.y+0.5
end
newPos.x = newPos.x+meta:get_int("x")
newPos.y = newPos.y+meta:get_int("y")
newPos.z = newPos.z+meta:get_int("z")
return newPos
end
function adventures.findArea(meta, pos, delta)
local node = minetest.env:get_node(pos)
local areaPos = {x=pos.x+meta:get_int("x")-delta.x,y=pos.y+meta:get_int("y")-delta.y,z=pos.z+meta:get_int("z")-delta.z}
local objects = minetest.env:get_objects_inside_radius(areaPos, 1)
local name = node.name:sub(1,-7).."area"
for i,_ in ipairs(objects) do
if(objects[i]:get_entity_name() == name) then
return objects[i]
end
end
end
dofile(modpath.."/global.lua")
dofile(modpath.."/decode.lua")
local creative = minetest.setting_get("creative_mode")
print("CREATIVE: "..creative)