Skip to content

Commit 6d3a0cb

Browse files
committed
Add //fixliquid chatcommand
1 parent ae2635c commit 6d3a0cb

File tree

6 files changed

+44
-11
lines changed

6 files changed

+44
-11
lines changed

ChatCommands.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ Can also create shapes other than cylinders, e.g. cones (see documentation above
234234
//cylinder y 10 10 0 walls:cobble
235235
//cylinder x 6 0 5 Dirt
236236
//cylinder z 20 10 20 default:desert_stone
237-
237+
238238
### `//hollowpyramid x/y/z/? <height> <node>`
239239

240240
Add hollow pyramid centered at WorldEdit position 1 along the given axis with height `<height>` composed of `<node>`.
@@ -345,6 +345,12 @@ Fixes the lighting in the current WorldEdit region.
345345

346346
//fixlight
347347

348+
### `//fixliquid`
349+
350+
Fixes the liquids in the current WorldEdit region.
351+
352+
//fixliquid
353+
348354
### `//drain`
349355

350356
Removes any fluid node within the current WorldEdit region.
@@ -447,11 +453,11 @@ This mode can be left with `//mtschemprob finish`. `//mtschemprob get` will disp
447453
Clears all objects within the WorldEdit region.
448454

449455
//clearobjects
450-
456+
451457
### `//shift x/y/z/?/up/down/left/right/front/back [+/-]<amount>`
452458

453459
Shifts the selection area by `[+|-]<amount>` without moving its contents.
454-
The shifting axis can be absolute (`x/y/z`) or relative (`up/down/left/right/front/back`).
460+
The shifting axis can be absolute (`x/y/z`) or relative (`up/down/left/right/front/back`).
455461

456462
//shift left 5
457463

@@ -461,22 +467,22 @@ Expands the selection by `<amount>` in the selected absolute or relative axis.
461467
If specified, the selection can be expanded in the opposite direction over the same axis by `[reverse amount]`.
462468

463469
//expand right 7 5
464-
470+
465471
### `//contract [+/-]x/y/z/?/up/down/left/right/front/back <amount> [reverse amount]`
466472

467473
Contracts the selection by `<amount>` in the selected absolute or relative axis.
468474
If specified, the selection can be contracted in the opposite direction over the same axis by `[reverse amount]`.
469475

470476
//expand right 7 5
471-
477+
472478
### `//outset [h/v] <amount>`
473479

474480
Expands the selection in all directions by `<amount>`. If specified,
475481
the selection can be expanded horizontally in the x and z axes using `h`
476482
or vertically in the y axis using `v`.
477483

478484
//outset v 5
479-
485+
480486
### `//inset [h/v] <amount>`
481487

482488
Contracts the selection in all directions by `<amount>`. If specified,

worldedit/manipulations.lua

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,13 +624,25 @@ function worldedit.fixlight(pos1, pos2)
624624
local pos1, pos2 = worldedit.sort_pos(pos1, pos2)
625625

626626
local vmanip = minetest.get_voxel_manip(pos1, pos2)
627+
vmanip:calc_lighting()
627628
vmanip:write_to_map()
628-
vmanip:update_map() -- this updates the lighting
629629

630630
return worldedit.volume(pos1, pos2)
631631
end
632632

633633

634+
--- Attempts to fix the liquid in a region.
635+
-- @return The number of nodes updated.
636+
function worldedit.fixliquid(pos1, pos2)
637+
local pos1, pos2 = worldedit.sort_pos(pos1, pos2)
638+
639+
local vmanip = minetest.get_voxel_manip(pos1, pos2)
640+
vmanip:update_liquids()
641+
vmanip:write_to_map()
642+
643+
return worldedit.volume(pos1, pos2)
644+
end
645+
634646
--- Clears all objects in a region.
635647
-- @return The number of objects cleared.
636648
function worldedit.clear_objects(pos1, pos2)

worldedit_commands/init.lua

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ worldedit.register_command("help", {
328328
else
329329
local def = worldedit.registered_commands[param]
330330
if not def then
331-
return false, S("Command not available: ") .. param
331+
return false, S("Command not available: @1", param)
332332
else
333333
return true, format_help_line(param, def)
334334
end
@@ -1236,6 +1236,18 @@ worldedit.register_command("fixlight", {
12361236
end,
12371237
})
12381238

1239+
worldedit.register_command("fixliquid", {
1240+
params = "",
1241+
description = S("Fix the liquids in the current WorldEdit region"),
1242+
privs = {worldedit=true},
1243+
require_pos = 2,
1244+
nodes_needed = check_region,
1245+
func = function(name)
1246+
local count = worldedit.fixliquid(worldedit.pos1[name], worldedit.pos2[name])
1247+
worldedit.player_notify(name, S("@1 nodes updated", count))
1248+
end,
1249+
})
1250+
12391251
worldedit.register_command("drain", {
12401252
params = "",
12411253
description = S("Remove any fluid node within the current WorldEdit region"),

worldedit_commands/locale/template.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Get help for WorldEdit commands=
2828
You are not allowed to use any WorldEdit commands.=
2929
Available commands: @1@nUse '//help <cmd>' to get more information, or '//help all' to list everything.=
3030
Available commands:@n=
31-
Command not available: =
31+
Command not available: @1=
3232
Enable or disable node inspection=
3333
inspector: inspection enabled for @1, currently facing the @2 axis=
3434
inspector: inspection disabled=
@@ -100,6 +100,7 @@ invalid usage: angle must be multiple of 90=
100100
Rotate oriented nodes in the current WorldEdit region around the Y axis by angle <angle> (90 degree increment)=
101101
@1 nodes oriented=
102102
Fix the lighting in the current WorldEdit region=
103+
Fix the liquids in the current WorldEdit region=
103104
@1 nodes updated=
104105
Remove any fluid node within the current WorldEdit region=
105106
Remove any plant, tree or foliage-like nodes in the selected region=

worldedit_commands/locale/worldedit_commands.de.tr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Get help for WorldEdit commands=Hilfe für WorldEdit-Befehle erhalten
3939
You are not allowed to use any WorldEdit commands.=Ihnen ist nicht erlaubt WorldEdit-Befehle zu nutzen.
4040
Available commands: @1@nUse '//help <cmd>' to get more information, or '//help all' to list everything.=Verfügbare Befehle: @1@n„//help <Befehl>“ benutzen, um mehr Informationen zu erhalten, oder „//help all“, um alles aufzulisten.
4141
Available commands:@n=Verfügbare Befehle:@n
42-
Command not available: =Befehl nicht verfügbar:
42+
Command not available: @1=Befehl nicht verfügbar: @1
4343
Enable or disable node inspection=Inspizieren von Blöcken ein- oder ausschalten
4444
inspector: inspection enabled for @1, currently facing the @2 axis=Inspektur: für @1 aktiviert, aktuell der @2-Achse zugewandt
4545
inspector: inspection disabled=Inspektur: deaktiviert
@@ -111,6 +111,7 @@ invalid usage: angle must be multiple of 90=Ungültige Verwendung: Winkel muss e
111111
Rotate oriented nodes in the current WorldEdit region around the Y axis by angle <angle> (90 degree increment)=
112112
@1 nodes oriented=
113113
Fix the lighting in the current WorldEdit region=Belichtung im aktuellen WorldEdit-Gebiet korrigieren
114+
Fix the liquids in the current WorldEdit region=Fixierung der Flüssigkeiten in der aktuellen WorldEdit-Gebiet
114115
@1 nodes updated=@1 Blöcke verändert
115116
Remove any fluid node within the current WorldEdit region=Alle flüssigen Blöcke im WorldEdit-Gebiet entfernen
116117
Remove any plant, tree or foliage-like nodes in the selected region=Alle Pflanzen, Baum oder Laub-ähnliche Blöcke im WorldEdit-Gebiet entfernen

worldedit_commands/locale/worldedit_commands.ru.tr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Get help for WorldEdit commands=Вывести информацию об исп
1616
You are not allowed to use any WorldEdit commands.=У вас нет привилегий, чтобы использовать команды WorldEdit.
1717
Available commands: @1@nUse '//help <cmd>' to get more information, or '//help all' to list everything.=Доступные команды: @1@nИспользуйте '//help <cmd>' для получения информации по команде или '//help all' для вывода подсказок по всем командам.
1818
Available commands:@n=Доступные команды:@n
19-
Command not available: =Команда не найдена:
19+
Command not available: @1=Команда не найдена: @1
2020
Enable or disable node inspection=Включить/отключить инспекцию блоков
2121
inspector: inspection enabled for @1, currently facing the @2 axis=inspector: инспекция включена для @1, текущий взор в направлении оси @2
2222
inspector: inspection disabled=inspector: инспекция отключена
@@ -88,6 +88,7 @@ invalid usage: angle must be multiple of 90=недопустимое испол
8888
Rotate oriented nodes in the current WorldEdit region around the Y axis by angle <angle> (90 degree increment)=Повернуть блоки в текущем WorldEdit-регионе вокруг оси Y на угол <angle> (шаг - 90 градусов)
8989
@1 nodes oriented=повёрнуто @1 нод(а/ы)
9090
Fix the lighting in the current WorldEdit region=Исправить освещение в текущем WorldEdit-регионе
91+
Fix the liquids in the current WorldEdit region=Исправить плавучие жидкости в текущем WorldEdit-регионе
9192
@1 nodes updated=обновлено @1 нод(а/ы)
9293
Remove any fluid node within the current WorldEdit region=Удалить любые жидкости в текущем WorldEdit-регионе
9394
Remove any plant, tree or foliage-like nodes in the selected region=Удалить любые растения, деревья или листье-подобные ноды в текущем WorldEdit-регионе

0 commit comments

Comments
 (0)