mirror of
https://github.com/HybridDog/we_undo.git
synced 2025-01-22 04:21:34 +01:00
Support the /p command
This commit is contained in:
parent
517011cf9e
commit
920f60cbf0
11
README.md
11
README.md
@ -7,16 +7,17 @@ Related issues:
|
|||||||
* https://forum.minetest.net/viewtopic.php?p=296543#p296543
|
* https://forum.minetest.net/viewtopic.php?p=296543#p296543
|
||||||
|
|
||||||
Supported chatcommands:
|
Supported chatcommands:
|
||||||
* pos1
|
* /pos1
|
||||||
* pos2
|
* /pos2
|
||||||
* set (without //y)
|
* /p
|
||||||
|
* /set (without /y confirmation)
|
||||||
|
|
||||||
Ignored chatcommands:
|
Ignored chatcommands:
|
||||||
* fixlight
|
* /fixlight
|
||||||
|
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
* Make it also work on command confirmation (//y)
|
* Make it also work on command confirmation (/y)
|
||||||
* Implement more commands
|
* Implement more commands
|
||||||
* Add mod load time info
|
* Add mod load time info
|
||||||
* Add settingtypes.txt for the settings
|
* Add settingtypes.txt for the settings
|
||||||
|
23
init.lua
23
init.lua
@ -55,6 +55,7 @@ end
|
|||||||
local journal = {}
|
local journal = {}
|
||||||
local function add_to_history(data, name)
|
local function add_to_history(data, name)
|
||||||
name = name or command_invoker
|
name = name or command_invoker
|
||||||
|
assert(name, "Player name isn't known")
|
||||||
journal[name] = journal[name] or {
|
journal[name] = journal[name] or {
|
||||||
ring = {},
|
ring = {},
|
||||||
start = 0,
|
start = 0,
|
||||||
@ -243,6 +244,28 @@ override_chatcommand("/pos2",
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
-- Punch before the /p command's punch
|
||||||
|
table.insert(minetest.registered_on_punchnodes, 1, function(_,_, player)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local typ = worldedit.set_pos[name]
|
||||||
|
if typ == "pos1"
|
||||||
|
or typ == "pos1only" then
|
||||||
|
add_to_history({
|
||||||
|
type = "marker",
|
||||||
|
mem_use = 9 * 7,
|
||||||
|
id = 1,
|
||||||
|
pos = worldedit.pos1[name]
|
||||||
|
}, name)
|
||||||
|
elseif typ == "pos2" then
|
||||||
|
add_to_history({
|
||||||
|
type = "marker",
|
||||||
|
mem_use = 9 * 7,
|
||||||
|
id = 2,
|
||||||
|
pos = worldedit.pos2[name]
|
||||||
|
}, name)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
undo_funcs.marker = function(name, data)
|
undo_funcs.marker = function(name, data)
|
||||||
local pos = data.pos
|
local pos = data.pos
|
||||||
local i = "pos" .. data.id
|
local i = "pos" .. data.id
|
||||||
|
Loading…
Reference in New Issue
Block a user