Aaron Suen 79324d4aa0 Replace exportdb with configdb
- Open up room for potential for more config
  options (which properties to export, additional
  indirectly-depended media, etc).
- Restructure API to use items as well.  For now,
  I am assuming there are no legacy applications
  that need to be supported so the old methods
  are immediately removed; may be re-added
  if compat turns out to be needed.
2022-11-27 09:36:52 -05:00
2022-11-23 14:54:33 -05:00
2022-11-23 14:31:36 -05:00
2022-11-23 11:43:55 -05:00
2022-11-23 11:43:55 -05:00
2022-11-27 09:36:52 -05:00
2022-11-27 09:36:52 -05:00
2022-11-27 09:36:52 -05:00
2022-11-26 11:24:52 -05:00
2022-11-27 09:36:52 -05:00
2022-11-23 17:27:26 -05:00
2022-11-23 14:23:26 -05:00
2022-11-23 11:43:55 -05:00
2022-11-23 11:43:55 -05:00
2022-11-26 23:37:52 -05:00
2022-11-23 14:54:33 -05:00
2022-11-26 23:41:08 -05:00

Node/Item Definition Ripper

You're making a puzzle/adventure game, and you need building materials for the scenery. It's a bother to make all original artwork, or you like the look and feel of something that already exists, but it comes with all this extra functionality that you don't want...

This mod will allow you to export the "superficial" definitions and media for selected items. This includes visuals, sounds, and basic physical properties (solid/liquid/gas, climbable, lighting) but none of the callbacks or other gameplay behavior. This makes them ideal for use as "inert" decorative nodes in "adventure" gameplay modes where most of the scenery is non-interactable.

The hope is that this mod will allow experienced creative-mode builders to use familiar tools to build scenery, backgrounds, maps and levels, and then export those things for use in games. Formats like schematics, worldedit or modgen provide the "geometry" aspect of map export; this mod can be used to get the "material" aspect.

Usage

Add the mod to a game that has all the things loaded that you want to export, instruct the mod which items to export (using chat commands), and it will dump the start of a mod that can be used to import item registrations into your game.

You will get a folder in your worldpath containing a skeletal mod:

  • All media files referenced by the items, split into textures/sounds/models.
  • An exported.lua file with each definition.

You will need to provide your own init.lua, mod.conf and other infrastructure, but the exported definitions are kept in a separate file so you can safely overwrite it later (e.g. if you add definitions) without destroying your custom logic.

exported.lua takes a register_item-like function as a file-level parameter. This function will receive a single parameter with the definition table; it does NOT get an item name. There is a _raw_name key inside the definition from which you will need to derive your own name in a manner you deem appropriate (you have an opportunity to customize before registration here).

Example:

local modname = minetest.get_current_modname()
loadfile(minetest.get_modpath(modname) .. "/exported.lua")(function(def)
	local myname = modname .. ":" .. def._raw_name:gsub(":", "__")
	def._raw_name = nil
	minetest.register_item(myname, def)
end)

By keeping your custom logic and overrides in a separate set of files, and not modifying the defripper output files, you can just delete and reimport the auto-generated content any time you want to change the set of items you're exporting, or any time you pull updates from upstream and want to marge them into your own version.

Licensing Warning

You are still responsible for complying with licensing for all media files in the export. This includes:

  • Tracing the origin of each file (the names should match, and be unique in any sane setup) and identifying the author and original license.
  • Including attribution/credit in your resultant project.
  • Complying with sublicensing requirements when selecting the license for your own projet containing these media.
  • Anything else required by the license that applies to any file you use.

This tool may also rip media from "private" mods you might have installed, including things you don't actually have the right to redistribute; you are responsible for manually ensuring these are not included in any product you create using this tool.

Commands

Minetest "items" includes all nodes, craftitems and tools. The definition ripper mod supports exporting all of them, though it is more focused on nodes.

Basic commands:

  • /defripper - re-export all item definitions already marked for export (saved in mod storage).
  • /defripper_clear - clear all saved definitions.
  • /defripper_add <pattern> - add all definitions whose technical name (modname:item_name) matches the given lua pattern.
  • /defripper_rm <pattern> - remove all definitions whose technical name (modname:item_name) matches the given lua pattern.
  • /defripper_inv - add all definitions for items currently in the player's inventory.

Area-scanning commands:

  • For each of these commands, if the defripper_node_inv setting is true (default false), it will descend into node meta inventories and rip items found there as well.
  • /defripper_here [rx [ry [rz]]] - rip all nodes/items within a cuboid/rectanguloid centered around the player, right now.
  • /defripper_step [rx [ry [rz [step]]]] - rip all nodes/items within a cuboid/rectanguloid centered around the player, continuously, every time the player moves step nodes, until the server is restarted or command is re-run to change it. /defripper_step 0 disables it.
Description
No description provided
Readme MIT 130 KiB
Languages
Lua 100%