Commit 8cbb6138 authored by Petter Reinholdtsen's avatar Petter Reinholdtsen

New upstream version 0.14

parent 4609650a
......@@ -64,9 +64,22 @@ if ws == nil then
update_settings = true
settings:set("support_websockets", tostring(ws))
end
if update_settings then settings:write() end
local settings = Settings(mypath .. "override.conf")
local x = settings:get("python")
if x ~= nil then
python_interpreter = x
end
x = settings:get_bool("restrict_to_local_connections")
if x ~= nil then
local_only = x
end
x = settings:get_bool("support_websockets")
if x ~= nil then
ws = x
end
local remote_address
if local_only then
remote_address = "127.0.0.1"
......@@ -146,7 +159,7 @@ minetest.register_globalstep(function(dtime)
if finished then break end
end
flush_block_buffer()
end)
......@@ -241,11 +254,11 @@ minetest.register_chatcommand("python",
minetest.register_chatcommand("apy",
{params="[<script> [<args>]]" ,
description="Run python script in raspberryjammod/mcpipy directory, without killing any previous script",
func = function(name, args) python(name, args, true) end })
minetest.register_chatcommand("apython",
func = function(name, args) python(name, args, false) end })
minetest.register_chatcommand("addpython",
{params="[<script> [<args>]]" ,
description="Run python script in raspberryjammod/mcpipy directory, without killing any previous script",
func = function(name, args) python(name, args, true) end })
func = function(name, args) python(name, args, false) end })
function python(name, args, kill_script)
if (kill_script and script_running) then
......@@ -267,7 +280,8 @@ function python(name, args, kill_script)
end
script_running = true
background_launch(script_window_id, '"' .. python_interpreter .. '" "' .. mypath .. path_separator .. "mcpipy" .. path_separator .. script .. '.py" ' .. argtext)
local mcpipy_path = mypath .. path_separator .. "mcpipy" .. path_separator
background_launch(script_window_id, mcpipy_path, '"' .. python_interpreter .. '" "' .. mcpipy_path .. script .. '.py" ' .. argtext)
return true
end
......@@ -388,11 +402,20 @@ local block_buffer_p1 = {}
local block_buffer_p2 = {}
function flush_block_buffer()
if #block_buffer >= 100 then
local vm = minetest.get_voxel_manip(block_buffer_p1,block_buffer_p2)
if #block_buffer >= 50 then
local vm = minetest.get_voxel_manip()
local emin,emax = vm:read_from_map(block_buffer_p1,block_buffer_p2)
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
local data = vm:get_data()
local param2 = vm:get_param2_data()
for i=1,#block_buffer do
vm:set_node_at(block_buffer[i].pos, block_buffer[i].node)
local v = block_buffer[i]
local index = area:indexp(v.pos)
data[index] = minetest.get_content_id(v.node.name)
param2[index] = v.node.param2
end
vm:set_data(data)
vm:set_param2_data(param2)
vm:update_liquids()
vm:write_to_map()
vm:update_map()
......@@ -408,6 +431,7 @@ end
local function buffered_set_node(pos, node)
-- ensure buffer cuboid is no more than about 10000 in size
local new_block_buffer_p1 = {x=block_buffer_p1.x,y=block_buffer_p1.y,z=block_buffer_p1.z}
local new_block_buffer_p2 = {x=block_buffer_p2.x,y=block_buffer_p2.y,z=block_buffer_p2.z}
if not block_buffer_p1.x or pos.x < block_buffer_p1.x then new_block_buffer_p1.x = pos.x end
......@@ -432,7 +456,7 @@ local function buffered_set_node(pos, node)
block_buffer_p1 = new_block_buffer_p1
block_buffer_p2 = new_block_buffer_p2
end
table.insert(block_buffer, {pos=pos, node=node})
end
......@@ -463,10 +487,10 @@ local function setNodes(args, node)
local y2 = math.max(tonumber(args[2]),tonumber(args[5]))
local z1 = math.min(-tonumber(args[3]),-tonumber(args[6]))
local z2 = math.max(-tonumber(args[3]),-tonumber(args[6]))
local volume = (x2+1-x1)*(y2+1-y1)*(z2+1-z1)
if 100 <= volume and volume <= 20000000 then
local volume = (x2+1-x1)*(y2+1-y1)*(z2+1-z1)
if 50 <= volume and volume <= 20000000 then
set_nodes_with_voxelmanip(x1,y1,z1,x2,y2,z2,node)
else
for ycoord = y1,y2 do
......@@ -554,10 +578,10 @@ function handle_events(cmd, args)
return nil
end
function background_launch(window_identifier, cmd)
function background_launch(window_identifier, working_dir, cmd)
-- TODO: non-Windows
if not is_windows then return false end
local cmdline = 'start "' .. window_identifier .. '" /MIN ' .. cmd
local cmdline = 'start "' .. window_identifier .. '" /D "' .. working_dir .. '" /MIN ' .. cmd
minetest.log("action", "launching ["..cmdline.."]")
ie.os.execute(cmdline)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment