Replacement for Minimal Development Test (PR) (#9450)
4
games/minimal/LICENSE.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
License information for Developer Test
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
The same license as for Minetest applies.
|
52
games/minimal/README.md
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# Minimal development test
|
||||||
|
|
||||||
|
This is a basic testing environment that contains a bunch of things to test the engine, but it could also be used as a minimal testbed for testing out mods.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
* Basic nodes for mapgen
|
||||||
|
* Basic, minimal map generator
|
||||||
|
* Lots of example nodes for testing drawtypes, param2, light level, and many other node properties
|
||||||
|
* Example entities
|
||||||
|
* Other example items
|
||||||
|
* Formspec test (via `/test_formspec` command)
|
||||||
|
* Automated unit tests (disabled by default)
|
||||||
|
* Tools for manipulating nodes and entities, like the "Param2 Tool"
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
Basically, just create a world and start. A few important things to note:
|
||||||
|
|
||||||
|
* Items are gotten from the “Chest of Everything” (`chest_of_everything:chest`)
|
||||||
|
* When you lost your initial items, type in `/stuff` command to get them back
|
||||||
|
* By default, Creative Mode activates infinite node placement. This behavior can be changed with the `devtest_infplace` setting
|
||||||
|
* Use the `/infplace` command to toggle infinite node placement in-game
|
||||||
|
* Use the Param2 Tool to change the param2 of nodes; it's useful to experiment with the various drawtype test nodes
|
||||||
|
* Check out the game settings and server commands for additional tests and features
|
||||||
|
* Creative Mode does nothing (apart from default engine behavior)
|
||||||
|
|
||||||
|
Confused by a certain node or item? Check out for inline code comments.
|
||||||
|
|
||||||
|
### Example tests
|
||||||
|
|
||||||
|
* You can use this to test what happens if a player is simultaneously in 2 nodes with `damage_per_second` but with a different value.
|
||||||
|
* Or use the Falling Node Tool on various test nodes to see how they behave when falling.
|
||||||
|
* You could also use this as a testbed for dependency-free mods, e.g. to test out how your formspecs behave without theming.
|
||||||
|
|
||||||
|
## Random notes
|
||||||
|
|
||||||
|
* Experimental/strange/unstructured tests can be found in the `experimental` mod
|
||||||
|
* Textures of drawtype test nodes have a red dot at the top left corner. This is to see whether the textures are oriented properly
|
||||||
|
|
||||||
|
## Design philosophy
|
||||||
|
|
||||||
|
This should loosely follow the following principles:
|
||||||
|
|
||||||
|
* Engine testing: The main focus of this is to aid testing of *engine* features, such as mapgen or node drawtypes
|
||||||
|
* Mod testing: The secondary focus is to help modders as well, either as a minimal testbed for mods or even as a code example
|
||||||
|
* Minimal interference: Under default settings, it shall not interfere with APIs except on explicit user wish. Non-trivial tests and features need to be enabled by a setting first
|
||||||
|
* Convenience: Have various tools to make usage easier and more convenient
|
||||||
|
* Reproducing engine bugs: When an engine bug was found, consider creating a test case
|
||||||
|
* Clarity: Textures and names need to be designed to keep different things clearly visually apart at a glance
|
||||||
|
* Low loading time: It must load blazing-fast so stuff can be tested quickly
|
||||||
|
|
@ -1,2 +1,2 @@
|
|||||||
name = Minimal development test
|
name = Minimal development test
|
||||||
|
description = Testing environment to help with testing the engine features of Minetest. It can also be helpful in mod development.
|
||||||
|
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 152 B |
BIN
games/minimal/menu/header.png
Normal file
After Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 217 B |
334
games/minimal/mods/basenodes/init.lua
Normal file
@ -0,0 +1,334 @@
|
|||||||
|
local WATER_ALPHA = 160
|
||||||
|
local WATER_VISC = 1
|
||||||
|
local LAVA_VISC = 7
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Node definitions
|
||||||
|
--
|
||||||
|
|
||||||
|
-- Register nodes
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:stone", {
|
||||||
|
description = "Stone",
|
||||||
|
tiles = {"default_stone.png"},
|
||||||
|
groups = {cracky=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:desert_stone", {
|
||||||
|
description = "Desert Stone",
|
||||||
|
tiles = {"default_desert_stone.png"},
|
||||||
|
groups = {cracky=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:dirt_with_grass", {
|
||||||
|
description = "Dirt with Grass",
|
||||||
|
tiles ={"default_grass.png",
|
||||||
|
-- a little dot on the bottom to distinguish it from dirt
|
||||||
|
"default_dirt.png^basenodes_dirt_with_grass_bottom.png",
|
||||||
|
{name = "default_dirt.png^default_grass_side.png",
|
||||||
|
tileable_vertical = false}},
|
||||||
|
groups = {crumbly=3, soil=1},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:dirt_with_snow", {
|
||||||
|
description = "Dirt with Snow",
|
||||||
|
tiles ={"basenodes_dirt_with_snow.png",
|
||||||
|
-- a little dot on the bottom to distinguish it from dirt
|
||||||
|
"default_dirt.png^basenodes_dirt_with_snow_bottom.png",
|
||||||
|
{name = "default_dirt.png^default_snow_side.png",
|
||||||
|
tileable_vertical = false}},
|
||||||
|
groups = {crumbly=3, soil=1},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:dirt", {
|
||||||
|
description = "Dirt",
|
||||||
|
tiles ={"default_dirt.png"},
|
||||||
|
groups = {crumbly=3, soil=1},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:sand", {
|
||||||
|
description = "Sand",
|
||||||
|
tiles ={"default_sand.png"},
|
||||||
|
groups = {crumbly=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:desert_sand", {
|
||||||
|
description = "Desert Sand",
|
||||||
|
tiles ={"default_desert_sand.png"},
|
||||||
|
groups = {crumbly=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:gravel", {
|
||||||
|
description = "Gravel",
|
||||||
|
tiles ={"default_gravel.png"},
|
||||||
|
groups = {crumbly=2},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:junglegrass", {
|
||||||
|
description = "Jungle Grass",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles ={"default_junglegrass.png"},
|
||||||
|
inventory_image = "default_junglegrass.png",
|
||||||
|
wield_image = "default_junglegrass.png",
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
groups = {snappy=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:tree", {
|
||||||
|
description = "Normal Tree Trunk",
|
||||||
|
tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {choppy=2,oddly_breakable_by_hand=1},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:leaves", {
|
||||||
|
description = "Normal Leaves",
|
||||||
|
drawtype = "allfaces_optional",
|
||||||
|
tiles = {"default_leaves.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {snappy=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:jungletree", {
|
||||||
|
description = "Jungle Tree Trunk",
|
||||||
|
tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {choppy=2,oddly_breakable_by_hand=1},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:jungleleaves", {
|
||||||
|
description = "Jungle Leaves",
|
||||||
|
drawtype = "allfaces_optional",
|
||||||
|
tiles = {"default_jungleleaves.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {snappy=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:pine_tree", {
|
||||||
|
description = "Pine Tree Trunk",
|
||||||
|
tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png", "default_pine_tree.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {choppy=2,oddly_breakable_by_hand=1},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:pine_needles", {
|
||||||
|
description = "Pine Needles",
|
||||||
|
drawtype = "allfaces_optional",
|
||||||
|
tiles = {"default_pine_needles.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {snappy=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:water_source", {
|
||||||
|
description = "Water Source",
|
||||||
|
drawtype = "liquid",
|
||||||
|
tiles = {"default_water.png"},
|
||||||
|
special_tiles = {
|
||||||
|
{name = "default_water.png", backface_culling = false},
|
||||||
|
{name = "default_water.png", backface_culling = true},
|
||||||
|
},
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
pointable = false,
|
||||||
|
diggable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
drowning = 1,
|
||||||
|
liquidtype = "source",
|
||||||
|
liquid_alternative_flowing = "basenodes:water_flowing",
|
||||||
|
liquid_alternative_source = "basenodes:water_source",
|
||||||
|
liquid_viscosity = WATER_VISC,
|
||||||
|
post_effect_color = {a = 64, r = 100, g = 100, b = 200},
|
||||||
|
groups = {water = 3, liquid = 3},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:water_flowing", {
|
||||||
|
description = "Flowing Water",
|
||||||
|
drawtype = "flowingliquid",
|
||||||
|
tiles = {"default_water_flowing.png"},
|
||||||
|
special_tiles = {
|
||||||
|
{name = "default_water_flowing.png", backface_culling = false},
|
||||||
|
{name = "default_water_flowing.png", backface_culling = false},
|
||||||
|
},
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "flowingliquid",
|
||||||
|
walkable = false,
|
||||||
|
pointable = false,
|
||||||
|
diggable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
drowning = 1,
|
||||||
|
liquidtype = "flowing",
|
||||||
|
liquid_alternative_flowing = "basenodes:water_flowing",
|
||||||
|
liquid_alternative_source = "basenodes:water_source",
|
||||||
|
liquid_viscosity = WATER_VISC,
|
||||||
|
post_effect_color = {a = 64, r = 100, g = 100, b = 200},
|
||||||
|
groups = {water = 3, liquid = 3},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:river_water_source", {
|
||||||
|
description = "River Water Source",
|
||||||
|
drawtype = "liquid",
|
||||||
|
tiles = { "default_river_water.png" },
|
||||||
|
special_tiles = {
|
||||||
|
{name = "default_river_water.png", backface_culling = false},
|
||||||
|
{name = "default_river_water.png", backface_culling = true},
|
||||||
|
},
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
pointable = false,
|
||||||
|
diggable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
drowning = 1,
|
||||||
|
liquidtype = "source",
|
||||||
|
liquid_alternative_flowing = "basenodes:river_water_flowing",
|
||||||
|
liquid_alternative_source = "basenodes:river_water_source",
|
||||||
|
liquid_viscosity = 1,
|
||||||
|
liquid_renewable = false,
|
||||||
|
liquid_range = 2,
|
||||||
|
post_effect_color = {a = 103, r = 30, g = 76, b = 90},
|
||||||
|
groups = {water = 3, liquid = 3, },
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:river_water_flowing", {
|
||||||
|
description = "Flowing River Water",
|
||||||
|
drawtype = "flowingliquid",
|
||||||
|
tiles = {"default_river_water_flowing.png"},
|
||||||
|
special_tiles = {
|
||||||
|
{name = "default_river_water_flowing.png", backface_culling = false},
|
||||||
|
{name = "default_river_water_flowing.png", backface_culling = false},
|
||||||
|
},
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "flowingliquid",
|
||||||
|
walkable = false,
|
||||||
|
pointable = false,
|
||||||
|
diggable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
drowning = 1,
|
||||||
|
liquidtype = "flowing",
|
||||||
|
liquid_alternative_flowing = "basenodes:river_water_flowing",
|
||||||
|
liquid_alternative_source = "basenodes:river_water_source",
|
||||||
|
liquid_viscosity = 1,
|
||||||
|
liquid_renewable = false,
|
||||||
|
liquid_range = 2,
|
||||||
|
post_effect_color = {a = 103, r = 30, g = 76, b = 90},
|
||||||
|
groups = {water = 3, liquid = 3, },
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:lava_flowing", {
|
||||||
|
description = "Flowing Lava",
|
||||||
|
drawtype = "flowingliquid",
|
||||||
|
tiles = {"default_lava_flowing.png"},
|
||||||
|
special_tiles = {
|
||||||
|
{name="default_lava_flowing.png", backface_culling = false},
|
||||||
|
{name="default_lava_flowing.png", backface_culling = false},
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
light_source = minetest.LIGHT_MAX,
|
||||||
|
walkable = false,
|
||||||
|
pointable = false,
|
||||||
|
diggable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
drowning = 1,
|
||||||
|
damage_per_second = 4,
|
||||||
|
liquidtype = "flowing",
|
||||||
|
liquid_alternative_flowing = "basenodes:lava_flowing",
|
||||||
|
liquid_alternative_source = "basenodes:lava_source",
|
||||||
|
liquid_viscosity = LAVA_VISC,
|
||||||
|
post_effect_color = {a=192, r=255, g=64, b=0},
|
||||||
|
groups = {lava=3, liquid=1},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:lava_source", {
|
||||||
|
description = "Lava Source",
|
||||||
|
drawtype = "liquid",
|
||||||
|
tiles = { "default_lava.png" },
|
||||||
|
special_tiles = {
|
||||||
|
{name = "default_lava.png", backface_culling = false},
|
||||||
|
{name = "default_lava.png", backface_culling = true},
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
light_source = minetest.LIGHT_MAX,
|
||||||
|
walkable = false,
|
||||||
|
pointable = false,
|
||||||
|
diggable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
drowning = 1,
|
||||||
|
damage_per_second = 4,
|
||||||
|
liquidtype = "source",
|
||||||
|
liquid_alternative_flowing = "basenodes:lava_flowing",
|
||||||
|
liquid_alternative_source = "basenodes:lava_source",
|
||||||
|
liquid_viscosity = LAVA_VISC,
|
||||||
|
post_effect_color = {a=192, r=255, g=64, b=0},
|
||||||
|
groups = {lava=3, liquid=1},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:cobble", {
|
||||||
|
description = "Cobblestone",
|
||||||
|
tiles ={"default_cobble.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {cracky=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:mossycobble", {
|
||||||
|
description = "Mossy Cobblestone",
|
||||||
|
tiles ={"default_mossycobble.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {cracky=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:apple", {
|
||||||
|
description = "Apple",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles ={"default_apple.png"},
|
||||||
|
inventory_image = "default_apple.png",
|
||||||
|
paramtype = "light",
|
||||||
|
is_ground_content = false,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
groups = {dig_immediate=3},
|
||||||
|
|
||||||
|
-- Make eatable because why not?
|
||||||
|
on_use = minetest.item_eat(2),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:ice", {
|
||||||
|
description = "Ice",
|
||||||
|
tiles ={"default_ice.png"},
|
||||||
|
groups = {cracky=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- The snow nodes intentionally have different tints to make them more
|
||||||
|
-- distinguishable
|
||||||
|
minetest.register_node("basenodes:snow", {
|
||||||
|
description = "Snow Sheet",
|
||||||
|
tiles = {"basenodes_snow_sheet.png"},
|
||||||
|
groups = {crumbly=3},
|
||||||
|
walkable = false,
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("basenodes:snowblock", {
|
||||||
|
description = "Snow Block",
|
||||||
|
tiles ={"default_snow.png"},
|
||||||
|
groups = {crumbly=3},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
2
games/minimal/mods/basenodes/mod.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
name = basenodes
|
||||||
|
description = Contains basic nodes for mapgen
|
After Width: | Height: | Size: 187 B |
After Width: | Height: | Size: 166 B |
After Width: | Height: | Size: 177 B |
BIN
games/minimal/mods/basenodes/textures/basenodes_snow_sheet.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
games/minimal/mods/basenodes/textures/default_apple.png
Normal file
After Width: | Height: | Size: 102 B |
BIN
games/minimal/mods/basenodes/textures/default_cobble.png
Normal file
After Width: | Height: | Size: 340 B |
BIN
games/minimal/mods/basenodes/textures/default_desert_sand.png
Normal file
After Width: | Height: | Size: 293 B |
BIN
games/minimal/mods/basenodes/textures/default_desert_stone.png
Normal file
After Width: | Height: | Size: 584 B |
BIN
games/minimal/mods/basenodes/textures/default_dirt.png
Normal file
After Width: | Height: | Size: 790 B |
BIN
games/minimal/mods/basenodes/textures/default_grass.png
Normal file
After Width: | Height: | Size: 697 B |
BIN
games/minimal/mods/basenodes/textures/default_grass_side.png
Normal file
After Width: | Height: | Size: 796 B |
BIN
games/minimal/mods/basenodes/textures/default_gravel.png
Normal file
After Width: | Height: | Size: 171 B |
BIN
games/minimal/mods/basenodes/textures/default_ice.png
Normal file
After Width: | Height: | Size: 369 B |
BIN
games/minimal/mods/basenodes/textures/default_junglegrass.png
Normal file
After Width: | Height: | Size: 201 B |
BIN
games/minimal/mods/basenodes/textures/default_jungleleaves.png
Normal file
After Width: | Height: | Size: 399 B |
BIN
games/minimal/mods/basenodes/textures/default_jungletree.png
Normal file
After Width: | Height: | Size: 730 B |
BIN
games/minimal/mods/basenodes/textures/default_jungletree_top.png
Normal file
After Width: | Height: | Size: 714 B |
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 172 B |
BIN
games/minimal/mods/basenodes/textures/default_lava_flowing.png
Normal file
After Width: | Height: | Size: 91 B |
BIN
games/minimal/mods/basenodes/textures/default_leaves.png
Normal file
After Width: | Height: | Size: 883 B |
BIN
games/minimal/mods/basenodes/textures/default_mossycobble.png
Normal file
After Width: | Height: | Size: 574 B |
BIN
games/minimal/mods/basenodes/textures/default_pine_needles.png
Normal file
After Width: | Height: | Size: 648 B |
BIN
games/minimal/mods/basenodes/textures/default_pine_tree.png
Normal file
After Width: | Height: | Size: 604 B |
BIN
games/minimal/mods/basenodes/textures/default_pine_tree_top.png
Normal file
After Width: | Height: | Size: 174 B |
BIN
games/minimal/mods/basenodes/textures/default_river_water.png
Normal file
After Width: | Height: | Size: 496 B |
After Width: | Height: | Size: 99 B |
BIN
games/minimal/mods/basenodes/textures/default_sand.png
Normal file
After Width: | Height: | Size: 554 B |
BIN
games/minimal/mods/basenodes/textures/default_snow.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
games/minimal/mods/basenodes/textures/default_snow_side.png
Normal file
After Width: | Height: | Size: 152 B |
BIN
games/minimal/mods/basenodes/textures/default_stone.png
Normal file
After Width: | Height: | Size: 313 B |
BIN
games/minimal/mods/basenodes/textures/default_tree.png
Normal file
After Width: | Height: | Size: 659 B |
BIN
games/minimal/mods/basenodes/textures/default_tree_top.png
Normal file
After Width: | Height: | Size: 175 B |
Before Width: | Height: | Size: 302 B After Width: | Height: | Size: 302 B |
BIN
games/minimal/mods/basenodes/textures/default_water_flowing.png
Normal file
After Width: | Height: | Size: 115 B |
295
games/minimal/mods/basetools/init.lua
Normal file
@ -0,0 +1,295 @@
|
|||||||
|
--
|
||||||
|
-- Tool definitions
|
||||||
|
--
|
||||||
|
|
||||||
|
--[[ TOOLS SUMMARY:
|
||||||
|
|
||||||
|
Tool types:
|
||||||
|
|
||||||
|
* Hand: basic tool/weapon (just for convenience, not optimized for testing)
|
||||||
|
* Pickaxe: dig cracky
|
||||||
|
* Axe: dig choppy
|
||||||
|
* Shovel: dig crumbly
|
||||||
|
* Shears: dig snappy
|
||||||
|
* Sword: deal damage
|
||||||
|
* Dagger: deal damage, but faster
|
||||||
|
|
||||||
|
Tool materials:
|
||||||
|
|
||||||
|
* Dirt: dig nodes of rating 3, one use only
|
||||||
|
* Wood: dig nodes of rating 3
|
||||||
|
* Stone: dig nodes of rating 3 or 2
|
||||||
|
* Steel: dig nodes of rating 3, 2 or 1
|
||||||
|
* Mese: dig "everything" instantly
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- The hand
|
||||||
|
minetest.register_item(":", {
|
||||||
|
type = "none",
|
||||||
|
wield_image = "wieldhand.png",
|
||||||
|
wield_scale = {x=1,y=1,z=2.5},
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
max_drop_level = 0,
|
||||||
|
groupcaps = {
|
||||||
|
crumbly = {times={[3]=1.50}, uses=0, maxlevel=0},
|
||||||
|
snappy = {times={[3]=1.50}, uses=0, maxlevel=0},
|
||||||
|
oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=2.00}, uses=0, maxlevel=0},
|
||||||
|
},
|
||||||
|
damage_groups = {fleshy=1},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Mese Pickaxe: special tool that digs "everything" instantly
|
||||||
|
minetest.register_tool("basetools:pick_mese", {
|
||||||
|
description = "Mese Pickaxe",
|
||||||
|
inventory_image = "basetools_mesepick.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
max_drop_level=3,
|
||||||
|
groupcaps={
|
||||||
|
cracky={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
|
||||||
|
crumbly={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
|
||||||
|
snappy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
|
||||||
|
choppy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
|
||||||
|
dig_immediate={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Pickaxes: Dig cracky
|
||||||
|
--
|
||||||
|
|
||||||
|
-- This should break after only 1 use
|
||||||
|
minetest.register_tool("basetools:pick_dirt", {
|
||||||
|
description = "Dirt Pickaxe",
|
||||||
|
inventory_image = "basetools_dirtpick.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=0,
|
||||||
|
groupcaps={
|
||||||
|
cracky={times={[3]=2.00}, uses=1, maxlevel=0}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_tool("basetools:pick_wood", {
|
||||||
|
description = "Wooden Pickaxe",
|
||||||
|
inventory_image = "basetools_woodpick.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=0,
|
||||||
|
groupcaps={
|
||||||
|
cracky={times={[3]=2.00}, uses=30, maxlevel=0}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("basetools:pick_stone", {
|
||||||
|
description = "Stone Pickaxe",
|
||||||
|
inventory_image = "basetools_stonepick.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=0,
|
||||||
|
groupcaps={
|
||||||
|
cracky={times={[2]=1.20, [3]=0.80}, uses=60, maxlevel=0}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("basetools:pick_steel", {
|
||||||
|
description = "Steel Pickaxe",
|
||||||
|
inventory_image = "basetools_steelpick.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=1,
|
||||||
|
groupcaps={
|
||||||
|
cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=0}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("basetools:pick_steel_l1", {
|
||||||
|
description = "Steel Pickaxe Level 1",
|
||||||
|
inventory_image = "basetools_steelpick_l1.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=1,
|
||||||
|
groupcaps={
|
||||||
|
cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=1}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("basetools:pick_steel_l2", {
|
||||||
|
description = "Steel Pickaxe Level 2",
|
||||||
|
inventory_image = "basetools_steelpick_l2.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=1,
|
||||||
|
groupcaps={
|
||||||
|
cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=2}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Shovels (dig crumbly)
|
||||||
|
--
|
||||||
|
|
||||||
|
minetest.register_tool("basetools:shovel_wood", {
|
||||||
|
description = "Wooden Shovel",
|
||||||
|
inventory_image = "basetools_woodshovel.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=0,
|
||||||
|
groupcaps={
|
||||||
|
crumbly={times={[3]=0.50}, uses=30, maxlevel=0}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("basetools:shovel_stone", {
|
||||||
|
description = "Stone Shovel",
|
||||||
|
inventory_image = "basetools_stoneshovel.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=0,
|
||||||
|
groupcaps={
|
||||||
|
crumbly={times={[2]=0.50, [3]=0.30}, uses=60, maxlevel=0}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("basetools:shovel_steel", {
|
||||||
|
description = "Steel Shovel",
|
||||||
|
inventory_image = "basetools_steelshovel.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=1,
|
||||||
|
groupcaps={
|
||||||
|
crumbly={times={[1]=1.00, [2]=0.70, [3]=0.60}, uses=90, maxlevel=0}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Axes (dig choppy)
|
||||||
|
--
|
||||||
|
|
||||||
|
minetest.register_tool("basetools:axe_wood", {
|
||||||
|
description = "Wooden Axe",
|
||||||
|
inventory_image = "basetools_woodaxe.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=0,
|
||||||
|
groupcaps={
|
||||||
|
choppy={times={[3]=0.80}, uses=30, maxlevel=0},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("basetools:axe_stone", {
|
||||||
|
description = "Stone Axe",
|
||||||
|
inventory_image = "basetools_stoneaxe.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=0,
|
||||||
|
groupcaps={
|
||||||
|
choppy={times={[2]=1.00, [3]=0.60}, uses=60, maxlevel=0},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("basetools:axe_steel", {
|
||||||
|
description = "Steel Axe",
|
||||||
|
inventory_image = "basetools_steelaxe.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=1,
|
||||||
|
groupcaps={
|
||||||
|
choppy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=90, maxlevel=0},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Shears (dig snappy)
|
||||||
|
--
|
||||||
|
|
||||||
|
minetest.register_tool("basetools:shears_wood", {
|
||||||
|
description = "Wooden Shears",
|
||||||
|
inventory_image = "basetools_woodshears.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=0,
|
||||||
|
groupcaps={
|
||||||
|
snappy={times={[3]=1.00}, uses=30, maxlevel=0},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("basetools:shears_stone", {
|
||||||
|
description = "Stone Shears",
|
||||||
|
inventory_image = "basetools_stoneshears.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=0,
|
||||||
|
groupcaps={
|
||||||
|
snappy={times={[2]=1.00, [3]=0.50}, uses=60, maxlevel=0},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("basetools:shears_steel", {
|
||||||
|
description = "Steel Shears",
|
||||||
|
inventory_image = "basetools_steelshears.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
max_drop_level=1,
|
||||||
|
groupcaps={
|
||||||
|
snappy={times={[1]=1.00, [2]=0.50, [3]=0.25}, uses=90, maxlevel=0},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Swords (deal damage)
|
||||||
|
--
|
||||||
|
|
||||||
|
minetest.register_tool("basetools:sword_wood", {
|
||||||
|
description = "Wooden Sword",
|
||||||
|
inventory_image = "basetools_woodsword.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
damage_groups = {fleshy=2},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
minetest.register_tool("basetools:sword_stone", {
|
||||||
|
description = "Stone Sword",
|
||||||
|
inventory_image = "basetools_stonesword.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
max_drop_level=0,
|
||||||
|
damage_groups = {fleshy=4},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
minetest.register_tool("basetools:sword_steel", {
|
||||||
|
description = "Steel Sword",
|
||||||
|
inventory_image = "basetools_steelsword.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
max_drop_level=1,
|
||||||
|
damage_groups = {fleshy=6},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Fire/Ice sword: Deal damage to non-fleshy damage groups
|
||||||
|
minetest.register_tool("basetools:sword_fire", {
|
||||||
|
description = "Fire Sword",
|
||||||
|
inventory_image = "basetools_firesword.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
max_drop_level=0,
|
||||||
|
damage_groups = {icy=6},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
minetest.register_tool("basetools:sword_ice", {
|
||||||
|
description = "Ice Sword",
|
||||||
|
inventory_image = "basetools_icesword.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
max_drop_level=0,
|
||||||
|
damage_groups = {firy=6},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dagger: Low damage, fast punch interval
|
||||||
|
--
|
||||||
|
minetest.register_tool("basetools:dagger_steel", {
|
||||||
|
description = "Steel Dagger",
|
||||||
|
inventory_image = "basetools_steeldagger.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 0.5,
|
||||||
|
max_drop_level=0,
|
||||||
|
damage_groups = {fleshy=2},
|
||||||
|
}
|
||||||
|
})
|
2
games/minimal/mods/basetools/mod.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
name = basetools
|
||||||
|
description = Contains basic digging tools
|
BIN
games/minimal/mods/basetools/textures/basetools_dirtpick.png
Normal file
After Width: | Height: | Size: 307 B |
BIN
games/minimal/mods/basetools/textures/basetools_firesword.png
Normal file
After Width: | Height: | Size: 190 B |
BIN
games/minimal/mods/basetools/textures/basetools_icesword.png
Normal file
After Width: | Height: | Size: 190 B |
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 155 B |
BIN
games/minimal/mods/basetools/textures/basetools_steelaxe.png
Normal file
After Width: | Height: | Size: 131 B |
BIN
games/minimal/mods/basetools/textures/basetools_steeldagger.png
Normal file
After Width: | Height: | Size: 154 B |
BIN
games/minimal/mods/basetools/textures/basetools_steelpick.png
Normal file
After Width: | Height: | Size: 159 B |
BIN
games/minimal/mods/basetools/textures/basetools_steelpick_l1.png
Normal file
After Width: | Height: | Size: 190 B |
BIN
games/minimal/mods/basetools/textures/basetools_steelpick_l2.png
Normal file
After Width: | Height: | Size: 177 B |
BIN
games/minimal/mods/basetools/textures/basetools_steelshears.png
Normal file
After Width: | Height: | Size: 208 B |
BIN
games/minimal/mods/basetools/textures/basetools_steelshovel.png
Normal file
After Width: | Height: | Size: 140 B |
BIN
games/minimal/mods/basetools/textures/basetools_steelsword.png
Normal file
After Width: | Height: | Size: 163 B |
BIN
games/minimal/mods/basetools/textures/basetools_stoneaxe.png
Normal file
After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 155 B |
BIN
games/minimal/mods/basetools/textures/basetools_stoneshears.png
Normal file
After Width: | Height: | Size: 224 B |
BIN
games/minimal/mods/basetools/textures/basetools_stoneshovel.png
Normal file
After Width: | Height: | Size: 134 B |
BIN
games/minimal/mods/basetools/textures/basetools_stonesword.png
Normal file
After Width: | Height: | Size: 159 B |
BIN
games/minimal/mods/basetools/textures/basetools_woodaxe.png
Normal file
After Width: | Height: | Size: 121 B |
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 149 B |
BIN
games/minimal/mods/basetools/textures/basetools_woodshears.png
Normal file
After Width: | Height: | Size: 212 B |
BIN
games/minimal/mods/basetools/textures/basetools_woodshovel.png
Normal file
After Width: | Height: | Size: 133 B |
BIN
games/minimal/mods/basetools/textures/basetools_woodsword.png
Normal file
After Width: | Height: | Size: 139 B |
@ -1,95 +1,26 @@
|
|||||||
-- bucket (Minetest 0.4 mod)
|
-- Bucket: Punch liquid source or flowing liquid to collect it
|
||||||
-- A bucket, which can pick up water and lava
|
|
||||||
|
|
||||||
minetest.register_alias("bucket", "bucket:bucket_empty")
|
minetest.register_tool("bucket:bucket", {
|
||||||
minetest.register_alias("bucket_water", "bucket:bucket_water")
|
description = "Bucket",
|
||||||
minetest.register_alias("bucket_lava", "bucket:bucket_lava")
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'bucket:bucket_empty 1',
|
|
||||||
recipe = {
|
|
||||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
|
||||||
{'', 'default:steel_ingot', ''},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
bucket = {}
|
|
||||||
bucket.liquids = {}
|
|
||||||
|
|
||||||
-- Register a new liquid
|
|
||||||
-- source = name of the source node
|
|
||||||
-- flowing = name of the flowing node
|
|
||||||
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
|
|
||||||
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
|
|
||||||
-- This function can be called from any mod (that depends on bucket).
|
|
||||||
function bucket.register_liquid(source, flowing, itemname, inventory_image)
|
|
||||||
bucket.liquids[source] = {
|
|
||||||
source = source,
|
|
||||||
flowing = flowing,
|
|
||||||
itemname = itemname,
|
|
||||||
}
|
|
||||||
bucket.liquids[flowing] = bucket.liquids[source]
|
|
||||||
|
|
||||||
if itemname ~= nil then
|
|
||||||
minetest.register_craftitem(itemname, {
|
|
||||||
inventory_image = inventory_image,
|
|
||||||
stack_max = 1,
|
|
||||||
liquids_pointable = true,
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
-- Must be pointing to node
|
|
||||||
if pointed_thing.type ~= "node" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
-- Check if pointing to a liquid
|
|
||||||
n = minetest.get_node(pointed_thing.under)
|
|
||||||
if bucket.liquids[n.name] == nil then
|
|
||||||
-- Not a liquid
|
|
||||||
minetest.add_node(pointed_thing.above, {name=source})
|
|
||||||
elseif n.name ~= source then
|
|
||||||
-- It's a liquid
|
|
||||||
minetest.add_node(pointed_thing.under, {name=source})
|
|
||||||
end
|
|
||||||
return {name="bucket:bucket_empty"}
|
|
||||||
end
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_craftitem("bucket:bucket_empty", {
|
|
||||||
inventory_image = "bucket.png",
|
inventory_image = "bucket.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
liquids_pointable = true,
|
liquids_pointable = true,
|
||||||
|
groups = { disable_repair = 1 },
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
-- Must be pointing to node
|
-- Must be pointing to node
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- Check if pointing to a liquid source
|
-- Check if pointing to a liquid
|
||||||
n = minetest.get_node(pointed_thing.under)
|
local n = minetest.get_node(pointed_thing.under)
|
||||||
liquiddef = bucket.liquids[n.name]
|
local def = minetest.registered_nodes[n.name]
|
||||||
if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then
|
if def ~= nil and (def.liquidtype == "source" or def.liquidtype == "flowing") then
|
||||||
minetest.add_node(pointed_thing.under, {name="air"})
|
minetest.add_node(pointed_thing.under, {name="air"})
|
||||||
return {name=liquiddef.itemname}
|
local inv = user:get_inventory()
|
||||||
|
if inv then
|
||||||
|
inv:add_item("main", ItemStack(n.name))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
bucket.register_liquid(
|
|
||||||
"default:water_source",
|
|
||||||
"default:water_flowing",
|
|
||||||
"bucket:bucket_water",
|
|
||||||
"bucket_water.png"
|
|
||||||
)
|
|
||||||
|
|
||||||
bucket.register_liquid(
|
|
||||||
"default:lava_source",
|
|
||||||
"default:lava_flowing",
|
|
||||||
"bucket:bucket_lava",
|
|
||||||
"bucket_lava.png"
|
|
||||||
)
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "bucket:bucket_lava",
|
|
||||||
burntime = 60,
|
|
||||||
})
|
|
||||||
|
@ -1,3 +1,2 @@
|
|||||||
name = bucket
|
name = bucket
|
||||||
description = Minimal bucket to place and pick up liquids
|
description = Minimal bucket to pick up liquids
|
||||||
depends = default
|
|
||||||
|
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 168 B |
27
games/minimal/mods/chest/init.lua
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
minetest.register_node("chest:chest", {
|
||||||
|
description = "Chest",
|
||||||
|
tiles ={"chest_chest.png^[sheet:2x2:0,0", "chest_chest.png^[sheet:2x2:0,0",
|
||||||
|
"chest_chest.png^[sheet:2x2:1,0", "chest_chest.png^[sheet:2x2:1,0",
|
||||||
|
"chest_chest.png^[sheet:2x2:1,0", "chest_chest.png^[sheet:2x2:0,1"},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {dig_immediate=2,choppy=3},
|
||||||
|
is_ground_content = false,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("formspec",
|
||||||
|
"size[8,9]"..
|
||||||
|
"list[current_name;main;0,0;8,4;]"..
|
||||||
|
"list[current_player;main;0,5;8,4;]" ..
|
||||||
|
"listring[]")
|
||||||
|
meta:set_string("infotext", "Chest")
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("main", 8*4)
|
||||||
|
end,
|
||||||
|
can_dig = function(pos,player)
|
||||||
|
local meta = minetest.get_meta(pos);
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return inv:is_empty("main")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
2
games/minimal/mods/chest/mod.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
name = chest
|
||||||
|
description = A simple chest to store items
|
BIN
games/minimal/mods/chest/textures/chest_chest.png
Normal file
After Width: | Height: | Size: 163 B |
135
games/minimal/mods/chest_of_everything/init.lua
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
local F = minetest.formspec_escape
|
||||||
|
|
||||||
|
-- Create a detached inventory
|
||||||
|
local inv_everything = minetest.create_detached_inventory("everything", {
|
||||||
|
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
allow_put = function(inv, listname, index, stack, player)
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
allow_take = function(inv, listname, index, stack, player)
|
||||||
|
return -1
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
local inv_trash = minetest.create_detached_inventory("trash", {
|
||||||
|
allow_take = function(inv, listname, index, stack, player)
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
on_put = function(inv, listname, index, stack, player)
|
||||||
|
inv:set_list("main", {})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
inv_trash:set_size("main", 1)
|
||||||
|
|
||||||
|
local max_page = 1
|
||||||
|
|
||||||
|
local function get_chest_formspec(page)
|
||||||
|
local start = 0 + (page-1)*32
|
||||||
|
return "size[8,9]"..
|
||||||
|
"list[detached:everything;main;0,0;8,4;"..start.."]"..
|
||||||
|
"list[current_player;main;0,5;8,4;]" ..
|
||||||
|
"label[6,4;Trash:]" ..
|
||||||
|
"list[detached:trash;main;7,4;1,1]" ..
|
||||||
|
"button[0,4;1,1;chest_of_everything_prev;"..F("<").."]"..
|
||||||
|
"button[1,4;1,1;chest_of_everything_next;"..F(">").."]"..
|
||||||
|
"label[2,4;"..F("Page: "..page).."]"..
|
||||||
|
"listring[detached:everything;main]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[detached:trash;main]"
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("chest_of_everything:chest", {
|
||||||
|
description = "Chest of Everything",
|
||||||
|
tiles ={"chest_of_everything_chest.png^[sheet:2x2:0,0", "chest_of_everything_chest.png^[sheet:2x2:0,0",
|
||||||
|
"chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:1,0",
|
||||||
|
"chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:0,1"},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {dig_immediate=2,choppy=3},
|
||||||
|
is_ground_content = false,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("infotext", "Chest of Everything")
|
||||||
|
meta:set_int("page", 1)
|
||||||
|
meta:set_string("formspec", get_chest_formspec(1))
|
||||||
|
end,
|
||||||
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
|
if formname == "" then
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local page = meta:get_int("page")
|
||||||
|
if fields.chest_of_everything_prev then
|
||||||
|
page = page - 1
|
||||||
|
elseif fields.chest_of_everything_next then
|
||||||
|
page = page + 1
|
||||||
|
end
|
||||||
|
if page < 1 then
|
||||||
|
page = 1
|
||||||
|
end
|
||||||
|
if page > max_page then
|
||||||
|
page = max_page
|
||||||
|
end
|
||||||
|
meta:set_int("page", page)
|
||||||
|
meta:set_string("formspec", get_chest_formspec(page))
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_on_mods_loaded(function()
|
||||||
|
local items = {}
|
||||||
|
for itemstring,_ in pairs(minetest.registered_items) do
|
||||||
|
if itemstring ~= "" and itemstring ~= "unknown" and itemstring ~= "ignore" then
|
||||||
|
table.insert(items, itemstring)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--[[ Sort items in this order:
|
||||||
|
* Chest of Everything
|
||||||
|
* Test tools
|
||||||
|
* Other tools
|
||||||
|
* Craftitems
|
||||||
|
* Other items
|
||||||
|
* Dummy items ]]
|
||||||
|
local function compare(item1, item2)
|
||||||
|
local def1 = minetest.registered_items[item1]
|
||||||
|
local def2 = minetest.registered_items[item2]
|
||||||
|
local tool1 = def1.type == "tool"
|
||||||
|
local tool2 = def2.type == "tool"
|
||||||
|
local testtool1 = minetest.get_item_group(item1, "testtool") == 1
|
||||||
|
local testtool2 = minetest.get_item_group(item2, "testtool") == 1
|
||||||
|
local dummy1 = minetest.get_item_group(item1, "dummy") == 1
|
||||||
|
local dummy2 = minetest.get_item_group(item2, "dummy") == 1
|
||||||
|
local craftitem1 = def1.type == "craft"
|
||||||
|
local craftitem2 = def2.type == "craft"
|
||||||
|
if item1 == "chest_of_everything:chest" then
|
||||||
|
return true
|
||||||
|
elseif item2 == "chest_of_everything:chest" then
|
||||||
|
return false
|
||||||
|
elseif dummy1 and not dummy2 then
|
||||||
|
return false
|
||||||
|
elseif not dummy1 and dummy2 then
|
||||||
|
return true
|
||||||
|
elseif testtool1 and not testtool2 then
|
||||||
|
return true
|
||||||
|
elseif not testtool1 and testtool2 then
|
||||||
|
return false
|
||||||
|
elseif tool1 and not tool2 then
|
||||||
|
return true
|
||||||
|
elseif not tool1 and tool2 then
|
||||||
|
return false
|
||||||
|
elseif craftitem1 and not craftitem2 then
|
||||||
|
return true
|
||||||
|
elseif not craftitem1 and craftitem2 then
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return item1 < item2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(items, compare)
|
||||||
|
inv_everything:set_size("main", #items)
|
||||||
|
max_page = math.ceil(#items / 32)
|
||||||
|
for i=1, #items do
|
||||||
|
inv_everything:add_item("main", items[i])
|
||||||
|
end
|
||||||
|
end)
|
2
games/minimal/mods/chest_of_everything/mod.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
name = chest_of_everything
|
||||||
|
description = Adds the chest of everything from which you can take all items
|
After Width: | Height: | Size: 210 B |
@ -1,137 +0,0 @@
|
|||||||
--
|
|
||||||
-- Aliases for map generator outputs
|
|
||||||
--
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_alias("mapgen_stone", "default:stone")
|
|
||||||
minetest.register_alias("mapgen_dirt", "default:dirt")
|
|
||||||
minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
|
|
||||||
minetest.register_alias("mapgen_sand", "default:sand")
|
|
||||||
minetest.register_alias("mapgen_water_source", "default:water_source")
|
|
||||||
minetest.register_alias("mapgen_river_water_source", "default:river_water_source")
|
|
||||||
minetest.register_alias("mapgen_lava_source", "default:lava_source")
|
|
||||||
minetest.register_alias("mapgen_gravel", "default:gravel")
|
|
||||||
|
|
||||||
minetest.register_alias("mapgen_tree", "default:tree")
|
|
||||||
minetest.register_alias("mapgen_leaves", "default:leaves")
|
|
||||||
minetest.register_alias("mapgen_apple", "default:apple")
|
|
||||||
minetest.register_alias("mapgen_junglegrass", "default:junglegrass")
|
|
||||||
|
|
||||||
minetest.register_alias("mapgen_cobble", "default:cobble")
|
|
||||||
minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
|
|
||||||
minetest.register_alias("mapgen_mossycobble", "default:mossycobble")
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Ore generation
|
|
||||||
--
|
|
||||||
|
|
||||||
|
|
||||||
-- Blob ore first to avoid other ores inside blobs
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "blob",
|
|
||||||
ore = "default:clay",
|
|
||||||
wherein = {"default:sand"},
|
|
||||||
clust_scarcity = 24*24*24,
|
|
||||||
clust_size = 7,
|
|
||||||
y_min = -15,
|
|
||||||
y_max = 0,
|
|
||||||
noise_threshold = 0,
|
|
||||||
noise_params = {
|
|
||||||
offset=0.35,
|
|
||||||
scale=0.2,
|
|
||||||
spread={x=5, y=5, z=5},
|
|
||||||
seed=-316,
|
|
||||||
octaves=1,
|
|
||||||
persist=0.5
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "default:stone_with_coal",
|
|
||||||
wherein = "default:stone",
|
|
||||||
clust_scarcity = 8*8*8,
|
|
||||||
clust_num_ores = 8,
|
|
||||||
clust_size = 3,
|
|
||||||
y_min = -31000,
|
|
||||||
y_max = 64,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "default:stone_with_iron",
|
|
||||||
wherein = "default:stone",
|
|
||||||
clust_scarcity = 12*12*12,
|
|
||||||
clust_num_ores = 3,
|
|
||||||
clust_size = 2,
|
|
||||||
y_min = -15,
|
|
||||||
y_max = 2,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "default:stone_with_iron",
|
|
||||||
wherein = "default:stone",
|
|
||||||
clust_scarcity = 9*9*9,
|
|
||||||
clust_num_ores = 5,
|
|
||||||
clust_size = 3,
|
|
||||||
y_min = -63,
|
|
||||||
y_max = -16,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "default:stone_with_iron",
|
|
||||||
wherein = "default:stone",
|
|
||||||
clust_scarcity = 7*7*7,
|
|
||||||
clust_num_ores = 5,
|
|
||||||
clust_size = 3,
|
|
||||||
y_min = -31000,
|
|
||||||
y_max = -64,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Register biomes for biome API
|
|
||||||
--
|
|
||||||
|
|
||||||
|
|
||||||
minetest.clear_registered_biomes()
|
|
||||||
minetest.clear_registered_decorations()
|
|
||||||
|
|
||||||
minetest.register_biome({
|
|
||||||
name = "default:grassland",
|
|
||||||
--node_dust = "",
|
|
||||||
node_top = "default:dirt_with_grass",
|
|
||||||
depth_top = 1,
|
|
||||||
node_filler = "default:dirt",
|
|
||||||
depth_filler = 1,
|
|
||||||
--node_stone = "",
|
|
||||||
--node_water_top = "",
|
|
||||||
--depth_water_top = ,
|
|
||||||
--node_water = "",
|
|
||||||
y_min = 5,
|
|
||||||
y_max = 31000,
|
|
||||||
heat_point = 50,
|
|
||||||
humidity_point = 50,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_biome({
|
|
||||||
name = "default:grassland_ocean",
|
|
||||||
--node_dust = "",
|
|
||||||
node_top = "default:sand",
|
|
||||||
depth_top = 1,
|
|
||||||
node_filler = "default:sand",
|
|
||||||
depth_filler = 2,
|
|
||||||
--node_stone = "",
|
|
||||||
--node_water_top = "",
|
|
||||||
--depth_water_top = ,
|
|
||||||
--node_water = "",
|
|
||||||
y_min = -31000,
|
|
||||||
y_max = 4,
|
|
||||||
heat_point = 50,
|
|
||||||
humidity_point = 50,
|
|
||||||
})
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
name = default
|
|
||||||
description = Minimal default, adds basic nodes
|
|
Before Width: | Height: | Size: 109 B |
Before Width: | Height: | Size: 157 B |
Before Width: | Height: | Size: 515 B |
Before Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 144 B |
Before Width: | Height: | Size: 121 B |
Before Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 83 B |
Before Width: | Height: | Size: 138 B |
Before Width: | Height: | Size: 374 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 719 B |
Before Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 283 B |