Buckaroo Banzai 3466f84540
Some checks failed
luacheck / luacheck (push) Has been cancelled
test / build (push) Has been cancelled
Composition tool (#6)
* persist template metadata

* composition tool

* composition utils

* wip

* wip

* use swap_node for handles

* formspec

* wip

* set composition origin to first min-pos

* composition duplication and we area

* wallmounted replacement

---------

Co-authored-by: BuckarooBanzay <BuckarooBanzay@users.noreply.github.com>
2025-01-04 14:03:09 +01:00
2024-06-09 09:57:49 +02:00
2024-09-15 17:45:14 +02:00
2025-01-04 14:03:09 +01:00
2025-01-04 14:03:09 +01:00
2025-01-04 14:03:09 +01:00
2025-01-04 14:03:09 +01:00
2025-01-04 14:03:09 +01:00
2025-01-04 14:03:09 +01:00
2024-02-29 19:29:14 +01:00
2024-02-29 13:15:18 +01:00
2024-02-29 13:15:18 +01:00
2023-06-23 14:54:41 +02:00
2024-09-23 11:43:13 +02:00
2025-01-04 14:03:09 +01:00
2023-06-30 18:05:49 +02:00
2024-09-15 17:45:14 +02:00
2024-04-14 17:38:14 +02:00
2025-01-04 14:03:09 +01:00
2025-01-04 14:03:09 +01:00
2023-06-23 14:11:49 +02:00
2024-04-14 17:38:14 +02:00
2024-03-15 11:05:33 +01:00
2024-09-23 12:57:09 +02:00
2024-03-15 11:35:35 +01:00
2025-01-04 14:03:09 +01:00
2024-02-29 13:15:18 +01:00
2024-02-29 13:15:18 +01:00
2024-02-29 13:15:18 +01:00
2023-06-30 18:13:10 +02:00
2023-06-23 22:08:44 +02:00
2025-01-04 14:03:09 +01:00
2024-04-15 09:03:49 +02:00

Pick and place tool for minetest

luacheck License ContentDB

Features

  • Select and place areas on the fly
  • Configure an area with "handles" to pick and place them quickly
  • Rotation around the y-axis

Screenshots

Placement tool

Pickup handles

Howto

Quick pick-and-place

Simple copy+paste operation

  • Use the green pick_and_place:pick tool to select the area to use
  • First click for first position and second click for the second position
  • This will convert the pick-tool to a blue pick_and_place:place tool in your inventory
  • Use the place-tool to place your build anywhere in the world with the help of the preview-overlay
  • The schematic can be rotated around the y-axis with the menu that pops up on right-click

Pro-tip: hold the aux key to switch to removal-mode

Configure a template area

Create a template for frequent reuse

  • Use the white pick_and_place:configure tool to select an area for your template
  • First click for first position and second click for the second position
  • This will create "handle" nodes on every corner of the build
  • Right-click one of corners to create a placement-tool for the template
  • Place as needed

Replacements

The pick_and_place:replacement node can be used to randomize node placement.

If you pick-and-place a replacement node the default node-placement is replaced with the configured inventory- and group-configuration.

  • Inventory: Upon placement a random slot of the replacement inventory is selected and placed instead of the node
  • The param2 value is preserved and rotateable
  • A "group" can be specified to place the same randomized slot across the whole group and placement

Note: holding the "zoom" button on place disables the replacement engine

Snapping to grid

Grid-snapping can be enabled with /pnp_snap on while holding a place-tool. Disabling it can be done with /pnp_snap off

Modding api

pick_and_place.register_on_place(fn)

register a function callback for after placement

local mynodeid = minetest.get_content_id("my:node")
pick_and_place.register_on_place(function(pos1, pos2, nodeids)
    if nodeids[mynodeid] then
        -- nodeid matches, do something after the schematic has been placed into the world
    end
end)

pick_and_place.register_on_before_place(fn)

register a function callback for after placement

local mynodeid = minetest.get_content_id("my:node")
pick_and_place.register_on_before_place(function(pos1, pos2, nodeids)
    if nodeids[mynodeid] then
        -- nodeid matches, do something before the schematic has been placed into the world
        -- note: nodeids are from the to-be-placed schematic, not the current world-data
    end
end)

pick_and_place.register_on_remove(fn)

register a function callback for after area removal

pick_and_place.register_on_remove(function(pos1, pos2, nodeids)
    -- TODO: cleanup stuff here
end)

pick_and_place.register_on_before_remove(fn)

register a function callback for before area removal

pick_and_place.register_on_before_remove(function(pos1, pos2, nodeids)
    -- TODO: cleanup stuff here (nodes and metadata are still present in-world)
end)

Portability

The placement tool can be shared across worlds if the nodes are available there.

Limitations

The schematic data is stored in the tool and may not scale well beyond a certain size

Licenses

  • Code: MIT
  • Media: CC-BY-SA 3.0
Description
No description provided
Readme Multiple Licenses 6.6 MiB
Languages
Lua 100%