Compare commits
5 Commits
12270dc094
...
f7256633c0
Author | SHA1 | Date | |
---|---|---|---|
|
f7256633c0 | ||
|
99fa0ebd75 | ||
|
a97cccd2a1 | ||
|
3322ef90c4 | ||
|
b259906fd0 |
@ -283,13 +283,13 @@ Stack the current WorldEdit region `<count>` times by offset `<x>`, `<y>`, `<z>`
|
||||
//stack2 5 3 8 2
|
||||
//stack2 1 -1 -1 -1
|
||||
|
||||
### `//scale <factor>`
|
||||
### `//stretch <stretchx> <stretchy> <stretchz>`
|
||||
|
||||
Scale the current WorldEdit positions and region by a factor of positive integer `<factor>` with position 1 as the origin.
|
||||
Scale the current WorldEdit positions and region by a factor of `<stretchx>`, `<stretchy>`, `<stretchz>` along the X, Y, and Z axes, repectively, with position 1 as the origin.
|
||||
|
||||
//scale 2
|
||||
//scale 1
|
||||
//scale 10
|
||||
//scale 2 2 2
|
||||
//scale 1 2 1
|
||||
//scale 10 20 1
|
||||
|
||||
### `//transpose x/y/z/? x/y/z/?`
|
||||
|
||||
|
@ -208,12 +208,13 @@ function worldedit.pyramid(pos, axis, height, node_name, hollow)
|
||||
local other1, other2 = worldedit.get_axis_others(axis)
|
||||
|
||||
-- Set up voxel manipulator
|
||||
local manip, area = mh.init_axis_radius(pos, axis,
|
||||
height >= 0 and height or -height)
|
||||
-- FIXME: passing negative <radius> causes mis-sorted pos to be passed
|
||||
-- into mh.init() which is technically not allowed but works
|
||||
local manip, area = mh.init_axis_radius(pos, axis, height)
|
||||
local data = mh.get_empty_data(area)
|
||||
|
||||
-- Handle inverted pyramids
|
||||
local start_axis, end_axis, step
|
||||
local step
|
||||
if height > 0 then
|
||||
height = height - 1
|
||||
step = 1
|
||||
|
@ -1,10 +1,27 @@
|
||||
local modname = minetest.get_current_modname()
|
||||
|
||||
-- check compatibility
|
||||
if minetest.raycast == nil then
|
||||
error(
|
||||
"================================\n"..
|
||||
"This mod requires a suitable version of 0.4.16-dev/0.5.0-dev\n"..
|
||||
"that includes support for minetest.raycast() [since 7th July 2017]\n"..
|
||||
"================================\n"
|
||||
)
|
||||
function log_unavailable_error()
|
||||
minetest.log("error",
|
||||
"[MOD] " .. modname .. " is not compatible with current game version, " ..
|
||||
"you can disable it in the game settings!"
|
||||
)
|
||||
minetest.log("verbose",
|
||||
"[MOD] " .. modname .. " requires a suitable version of 0.4.16-dev or higher, " ..
|
||||
"that includes support for minetest.raycast() [since 7th July 2017]"
|
||||
)
|
||||
end
|
||||
|
||||
if minetest.is_singleplayer() then
|
||||
-- delay message until player is connected
|
||||
minetest.register_on_joinplayer(log_unavailable_error)
|
||||
else
|
||||
log_unavailable_error()
|
||||
end
|
||||
|
||||
-- exit here / do not load this mod
|
||||
return
|
||||
end
|
||||
|
||||
local BRUSH_MAX_DIST = 150
|
||||
|
@ -1,3 +1,11 @@
|
||||
local function above_or_under(placer, pointed_thing)
|
||||
if placer:get_player_control().sneak then
|
||||
return pointed_thing.above
|
||||
else
|
||||
return pointed_thing.under
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_tool(":worldedit:wand", {
|
||||
description = "WorldEdit Wand tool, Left-click to set 1st position, right-click to set 2nd",
|
||||
inventory_image = "worldedit_wand.png",
|
||||
@ -7,7 +15,7 @@ minetest.register_tool(":worldedit:wand", {
|
||||
on_use = function(itemstack, placer, pointed_thing)
|
||||
if placer ~= nil and pointed_thing ~= nil and pointed_thing.type == "node" then
|
||||
local name = placer:get_player_name()
|
||||
worldedit.pos1[name] = pointed_thing.under
|
||||
worldedit.pos1[name] = above_or_under(placer, pointed_thing)
|
||||
worldedit.mark_pos1(name)
|
||||
end
|
||||
return itemstack -- nothing consumed, nothing changed
|
||||
@ -16,7 +24,7 @@ minetest.register_tool(":worldedit:wand", {
|
||||
on_place = function(itemstack, placer, pointed_thing) -- Left Click
|
||||
if placer ~= nil and pointed_thing ~= nil and pointed_thing.type == "node" then
|
||||
local name = placer:get_player_name()
|
||||
worldedit.pos2[name] = pointed_thing.under
|
||||
worldedit.pos2[name] = above_or_under(placer, pointed_thing)
|
||||
worldedit.mark_pos2(name)
|
||||
end
|
||||
return itemstack -- nothing consumed, nothing changed
|
||||
|
@ -4,3 +4,4 @@ unified_inventory?
|
||||
inventory_plus?
|
||||
sfinv?
|
||||
creative?
|
||||
smart_inventory?
|
||||
|
@ -134,6 +134,55 @@ elseif rawget(_G, "inventory_plus") then --inventory++ installed
|
||||
inventory_plus.set_inventory_formspec(player, get_formspec(name, page))
|
||||
end
|
||||
end
|
||||
elseif rawget(_G, "smart_inventory") then -- smart_inventory installed
|
||||
-- redefinition: Update the code element on inventory page to show the we-page
|
||||
function worldedit.show_page(name, page)
|
||||
local state = smart_inventory.get_page_state("worldedit_gui", name)
|
||||
if state then
|
||||
state:get("code"):set_we_formspec(page)
|
||||
state.location.rootState:show() -- update inventory page
|
||||
end
|
||||
end
|
||||
|
||||
-- smart_inventory page callback. Contains just a "custom code" element
|
||||
local function smart_worldedit_gui_callback(state)
|
||||
local codebox = state:element("code", { name = "code", code = "" })
|
||||
function codebox:set_we_formspec(we_page)
|
||||
local new_formspec = get_formspec(state.location.rootState.location.player, we_page)
|
||||
new_formspec = new_formspec:gsub('button_exit','button') --no inventory closing
|
||||
self.data.code = "container[1,1]".. new_formspec .. "container_end[]"
|
||||
end
|
||||
codebox:set_we_formspec("worldedit_gui")
|
||||
|
||||
-- process input (the back button)
|
||||
state:onInput(function(state, fields, player)
|
||||
if fields.worldedit_gui then --main page
|
||||
state:get("code"):set_we_formspec("worldedit_gui")
|
||||
elseif fields.worldedit_gui_exit then --return to original page
|
||||
state:get("code"):set_we_formspec("worldedit_gui")
|
||||
state.location.parentState:get("crafting_button"):submit() -- switch to the crafting tab
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- all handler should return false to force inventory UI update
|
||||
local orig_register_gui_handler = worldedit.register_gui_handler
|
||||
worldedit.register_gui_handler = function(identifier, handler)
|
||||
local wrapper = function(...)
|
||||
handler(...)
|
||||
return false
|
||||
end
|
||||
orig_register_gui_handler(identifier, wrapper)
|
||||
end
|
||||
|
||||
-- register the inventory button
|
||||
smart_inventory.register_page({
|
||||
name = "worldedit_gui",
|
||||
tooltip = "Edit your World!",
|
||||
icon = "inventory_plus_worldedit_gui.png",
|
||||
smartfs_callback = smart_worldedit_gui_callback,
|
||||
sequence = 99
|
||||
})
|
||||
elseif rawget(_G, "sfinv") then --sfinv installed (part of minetest_game since 0.4.15)
|
||||
assert(sfinv.enabled)
|
||||
local orig_get = sfinv.pages["sfinv:crafting"].get
|
||||
|
Loading…
x
Reference in New Issue
Block a user