From b21c3d368077aa3a1c42ff1582cda6263c018585 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Wed, 6 Mar 2019 17:01:02 -0500 Subject: updated cottages, areasprotector, bees, biome_lib, technic, facade, farming redo, homedecor, maptools, mesecons, moreblocks, moreores, pipeworks, quartz, travelnet, unified_inventory, unifieddyes, xban2 delete the playeranim mod, not 5.0.0 compatible. --- anvil/init.lua | 152 ++--- areasprotector/depends.txt | 1 + areasprotector/init.lua | 4 +- .../textures/areasprotector_protector.png | Bin 274 -> 0 bytes bees/init.lua | 3 +- biome_lib/growth.lua | 80 +++ biome_lib/init.lua | 693 ++++++++++----------- biome_lib/search_functions.lua | 60 ++ concrete/init.lua | 8 +- cottages/functions.lua | 42 ++ cottages/init.lua | 25 + cottages/locale/de.txt | 27 + cottages/locale/template.txt | 36 +- cottages/nodes_feldweg.lua | 108 +++- cottages/nodes_furniture.lua | 10 +- cottages/nodes_hay.lua | 135 ++++ cottages/nodes_historic.lua | 19 +- cottages/nodes_mining.lua | 4 +- cottages/nodes_pitchfork.lua | 114 ++++ cottages/nodes_roof.lua | 24 +- cottages/nodes_straw.lua | 79 +-- cottages/nodes_water.lua | 312 ++++++++++ cottages/textures/cottages_pitchfork.png | Bin 0 -> 1262 bytes extranodes/init.lua | 2 +- facade/README.md | 1 + facade/init.lua | 280 +++++++-- facade/license.txt | 243 +------- facade/models/corner_bricks.obj | 64 ++ facade/models/files.txt | 1 - facade/models/license.txt | 18 + facade/models/nbe files/corner_bricks.nbe | Bin 0 -> 323 bytes facade/models/nbe files/rgspro.nbe | Bin 0 -> 291 bytes facade/models/nbe files/rgspro_corner.nbe | Bin 0 -> 446 bytes facade/models/nbe files/rgspro_inner.nbe | Bin 0 -> 443 bytes facade/models/nbe lua files/corner_bricks.lua | 26 + facade/models/nbe lua files/rgspro.lua | 25 + facade/models/nbe lua files/rgspro_corner.lua | 28 + facade/models/nbe lua files/rgspro_inner.lua | 28 + facade/models/obj_info.txt | 3 + facade/models/rgspro.obj | 49 ++ facade/models/rgspro_corner.obj | 94 +++ facade/models/rgspro_inner.obj | 94 +++ facade/screenshot4.png | Bin 0 -> 454035 bytes facade/textures/facade_rgspro.png | Bin 0 -> 91 bytes facade/textures/license.txt | 10 + facade/textures/texures license.txt | 4 - farming/README.md | 4 +- farming/api.txt | 6 + farming/crops/barley.lua | 10 +- farming/crops/beans.lua | 2 +- farming/crops/blueberry.lua | 1 + farming/crops/carrot.lua | 1 + farming/crops/grapes.lua | 2 +- farming/crops/pineapple.lua | 1 + farming/crops/raspberry.lua | 1 + farming/crops/ryeoatrice.lua | 162 +++++ farming/farming.conf_example | 1 + farming/food.lua | 32 + farming/grass.lua | 5 +- farming/hoes.lua | 140 +++++ farming/init.lua | 11 +- farming/license.txt | 25 +- farming/lucky_block.lua | 4 + farming/textures/farming_bread_multigrain.png | Bin 0 -> 583 bytes farming/textures/farming_flour_multigrain.png | Bin 0 -> 161 bytes farming/textures/farming_jaffa_cake.png | Bin 0 -> 185 bytes farming/textures/farming_oat.png | Bin 0 -> 274 bytes farming/textures/farming_oat_1.png | Bin 0 -> 114 bytes farming/textures/farming_oat_2.png | Bin 0 -> 143 bytes farming/textures/farming_oat_3.png | Bin 0 -> 173 bytes farming/textures/farming_oat_4.png | Bin 0 -> 190 bytes farming/textures/farming_oat_5.png | Bin 0 -> 219 bytes farming/textures/farming_oat_6.png | Bin 0 -> 236 bytes farming/textures/farming_oat_7.png | Bin 0 -> 255 bytes farming/textures/farming_oat_8.png | Bin 0 -> 310 bytes farming/textures/farming_oat_seed.png | Bin 0 -> 142 bytes farming/textures/farming_rice.png | Bin 0 -> 325 bytes farming/textures/farming_rice_1.png | Bin 0 -> 114 bytes farming/textures/farming_rice_2.png | Bin 0 -> 143 bytes farming/textures/farming_rice_3.png | Bin 0 -> 173 bytes farming/textures/farming_rice_4.png | Bin 0 -> 189 bytes farming/textures/farming_rice_5.png | Bin 0 -> 217 bytes farming/textures/farming_rice_6.png | Bin 0 -> 245 bytes farming/textures/farming_rice_7.png | Bin 0 -> 261 bytes farming/textures/farming_rice_8.png | Bin 0 -> 336 bytes farming/textures/farming_rice_bread.png | Bin 0 -> 392 bytes farming/textures/farming_rice_flour.png | Bin 0 -> 272 bytes farming/textures/farming_rice_seed.png | Bin 0 -> 201 bytes farming/textures/farming_rye.png | Bin 0 -> 242 bytes farming/textures/farming_rye_1.png | Bin 0 -> 114 bytes farming/textures/farming_rye_2.png | Bin 0 -> 143 bytes farming/textures/farming_rye_3.png | Bin 0 -> 173 bytes farming/textures/farming_rye_4.png | Bin 0 -> 189 bytes farming/textures/farming_rye_5.png | Bin 0 -> 217 bytes farming/textures/farming_rye_6.png | Bin 0 -> 237 bytes farming/textures/farming_rye_7.png | Bin 0 -> 254 bytes farming/textures/farming_rye_8.png | Bin 0 -> 310 bytes farming/textures/farming_rye_seed.png | Bin 0 -> 142 bytes farming/textures/farming_scythe_mithril.png | Bin 0 -> 172 bytes homedecor/wardrobe.lua | 29 +- maptools/.editorconfig | 13 + maptools/.luacheckrc | 29 + maptools/.pre-commit-config.yaml | 9 + maptools/LICENSE.md | 2 +- maptools/aliases.lua | 2 +- maptools/config.lua | 2 +- maptools/craftitems.lua | 2 +- maptools/default_nodes.lua | 45 +- maptools/init.lua | 74 +-- maptools/nodes.lua | 30 +- maptools/textures/fire_basic_flame_animated.png | Bin 1233 -> 1191 bytes maptools/textures/maptools_adminpick.png | Bin 285 -> 283 bytes maptools/textures/maptools_copper_coin.png | Bin 214 -> 213 bytes maptools/textures/maptools_gold_coin.png | Bin 215 -> 213 bytes maptools/textures/maptools_infinitefuel.png | Bin 388 -> 381 bytes maptools/textures/maptools_silver_coin.png | Bin 215 -> 213 bytes maptools/textures/maptools_smoke.png | Bin 303 -> 296 bytes maptools/textures/maptools_superapple.png | Bin 231 -> 230 bytes maptools/tools.lua | 19 +- .../doc/blinkyplant/description.html | 1 + .../doc/commandblock/description.html | 1 + mesecons_delayer/doc/delayer/description.html | 2 +- .../doc/nodedetector/description.html | 1 + .../doc/objectdetector/description.html | 1 + mesecons_extrawires/doc/corner/description.html | 2 +- mesecons_extrawires/doc/crossing/description.html | 2 +- mesecons_extrawires/doc/mese/description.html | 2 +- mesecons_extrawires/doc/tjunction/description.html | 2 +- mesecons_extrawires/doc/vertical/description.html | 2 +- mesecons_fpga/doc/fpga/description.html | 3 +- mesecons_gates/doc/and/description.html | 1 + mesecons_gates/doc/diode/description.html | 1 + mesecons_gates/doc/nand/description.html | 1 + mesecons_gates/doc/nor/description.html | 1 + mesecons_gates/doc/not/description.html | 1 + mesecons_gates/doc/or/description.html | 1 + mesecons_gates/doc/xor/description.html | 1 + .../doc/waterturbine/description.html | 1 + mesecons_insulated/doc/insulated/description.html | 2 +- .../doc/lightstone_blue/description.html | 1 + .../doc/lightstone_darkgrey/description.html | 1 + .../doc/lightstone_green/description.html | 1 + .../doc/lightstone_lightgrey/description.html | 1 + .../doc/lightstone_red/description.html | 1 + .../doc/lightstone_yellow/description.html | 1 + .../doc/luacontroller/description.html | 2 + mesecons_luacontroller/init.lua | 67 +- mesecons_movestones/doc/movestone/description.html | 1 + .../doc/movestone_sticky/description.html | 2 + mesecons_pistons/doc/piston/description.html | 2 + .../doc/piston_sticky/description.html | 3 + mesecons_pistons/init.lua | 17 +- .../doc/powerplant/description.html | 1 + mesecons_random/doc/ghoststone/description.html | 1 + mesecons_random/doc/removestone/description.html | 1 + .../doc/solarpanel/description.html | 1 + mesecons_torch/doc/torch/description.html | 1 + mesecons_wires/doc/mesecon/description.html | 2 +- moreblocks/.editorconfig | 13 + moreblocks/.luacheckrc | 37 +- moreblocks/.pre-commit-config.yaml | 9 + moreblocks/CHANGELOG.md | 5 + moreblocks/LICENSE.md | 2 +- moreblocks/README.md | 2 +- moreblocks/aliases.lua | 2 +- moreblocks/circular_saw.lua | 2 +- moreblocks/config.lua | 2 +- moreblocks/crafting.lua | 2 +- moreblocks/init.lua | 2 +- moreblocks/locale/de.txt | 7 +- moreblocks/locale/es.txt | 97 +-- moreblocks/locale/fr.txt | 4 +- moreblocks/locale/it.txt | 2 +- moreblocks/locale/template.txt | 106 ++-- moreblocks/nodes.lua | 17 +- moreblocks/ownership.lua | 2 +- moreblocks/redefinitions.lua | 2 +- moreblocks/stairsplus/API.md | 2 +- moreblocks/stairsplus/aliases.lua | 2 +- moreblocks/stairsplus/common.lua | 18 +- moreblocks/stairsplus/conversion.lua | 2 +- moreblocks/stairsplus/custom.lua | 16 +- moreblocks/stairsplus/defs.lua | 4 +- moreblocks/stairsplus/init.lua | 2 +- moreblocks/stairsplus/microblocks.lua | 4 +- moreblocks/stairsplus/panels.lua | 4 +- moreblocks/stairsplus/recipes.lua | 2 +- moreblocks/stairsplus/registrations.lua | 2 +- moreblocks/stairsplus/slabs.lua | 2 +- moreblocks/stairsplus/slopes.lua | 4 +- moreblocks/stairsplus/stairs.lua | 4 +- moreblocks/textures/moreblocks_cactus_brick.png | Bin 718 -> 697 bytes moreblocks/textures/moreblocks_cactus_checker.png | Bin 693 -> 685 bytes .../textures/moreblocks_checker_stone_tile.png | Bin 306 -> 299 bytes .../textures/moreblocks_circle_stone_bricks.png | Bin 448 -> 446 bytes .../textures/moreblocks_circular_saw_bottom.png | Bin 579 -> 574 bytes .../textures/moreblocks_circular_saw_side.png | Bin 478 -> 474 bytes .../textures/moreblocks_circular_saw_top.png | Bin 441 -> 439 bytes moreblocks/textures/moreblocks_clean_glass.png | Bin 177 -> 176 bytes moreblocks/textures/moreblocks_coal_checker.png | Bin 744 -> 738 bytes .../textures/moreblocks_coal_glass_stairsplus.png | Bin 166 -> 165 bytes .../textures/moreblocks_coal_stone_bricks.png | Bin 484 -> 481 bytes moreblocks/textures/moreblocks_copperpatina.png | Bin 325 -> 306 bytes moreblocks/textures/moreblocks_dirt_compressed.png | Bin 318 -> 292 bytes .../textures/moreblocks_glass_stairsplus.png | Bin 215 -> 170 bytes moreblocks/textures/moreblocks_iron_stone.png | Bin 230 -> 229 bytes .../textures/moreblocks_iron_stone_bricks.png | Bin 485 -> 483 bytes moreblocks/textures/moreblocks_junglestick.png | Bin 122 -> 121 bytes .../textures/moreblocks_split_stone_tile.png | Bin 273 -> 272 bytes .../textures/moreblocks_split_stone_tile_top.png | Bin 279 -> 278 bytes .../moreblocks_super_glow_glass_stairsplus.png | Bin 171 -> 170 bytes moreblocks/textures/moreblocks_sweeper.png | Bin 310 -> 309 bytes moreblocks/textures/moreblocks_tar.png | Bin 270 -> 266 bytes moreblocks/textures/moreblocks_trap_box_glass.png | Bin 160 -> 153 bytes moreblocks/textures/moreblocks_tree_stairsplus.png | Bin 311 -> 286 bytes moreblocks/textures/moreblocks_wood_tile.png | Bin 396 -> 389 bytes .../textures/moreblocks_wood_tile_center.png | Bin 288 -> 282 bytes moreblocks/textures/moreblocks_wood_tile_full.png | Bin 436 -> 433 bytes .../textures/moreblocks_wood_tile_offset.png | Bin 289 -> 284 bytes moreores/.editorconfig | 13 + moreores/.luacheckrc | 31 + moreores/.pre-commit-config.yaml | 9 + moreores/CHANGELOG.md | 15 +- moreores/LICENSE.md | 2 +- moreores/depends.txt | 1 + moreores/init.lua | 293 ++++----- moreores/locale/de.txt | 1 - moreores/locale/it.txt | 2 +- moreores/locale/nl.txt | 1 - moreores/mg.lua | 2 +- .../textures/moreores_copper_rail_crossing.png | Bin 249 -> 246 bytes .../textures/moreores_copper_rail_t_junction.png | Bin 333 -> 306 bytes moreores/textures/moreores_silver_block.png | Bin 265 -> 261 bytes moreores/textures/moreores_tool_silvershovel.png | Bin 201 -> 200 bytes pipeworks/lua_tube.lua | 5 +- playeranim/LICENSE.md | 23 - playeranim/README.md | 47 -- playeranim/depends.txt | 2 - playeranim/description.txt | 1 - playeranim/init.lua | 301 --------- playeranim/mod.conf | 3 - playeranim/model.lua | 99 --- playeranim/screenshot.png | Bin 88380 -> 0 bytes playeranim/settingtypes.txt | 18 - quartz/README.txt | 8 +- quartz/depends.txt | 3 +- quartz/description.txt | 2 +- quartz/init.lua | 65 +- quartz/mod.conf | 5 +- technic/init.lua | 4 +- technic/items.lua | 6 +- technic/locale/de.txt | 8 +- technic/locale/es.txt | 2 +- technic/locale/template.txt | 2 +- technic/machines/HV/cables.lua | 2 +- technic/machines/LV/cables.lua | 2 +- technic/machines/LV/geothermal.lua | 2 +- technic/machines/LV/water_mill.lua | 2 +- technic/machines/MV/cables.lua | 2 +- technic/machines/MV/hydro_turbine.lua | 4 +- technic/machines/MV/lighting.lua | 4 +- technic/machines/other/injector.lua | 8 +- technic/machines/register/alloy_recipes.lua | 2 +- technic/machines/register/battery_box.lua | 8 +- technic/machines/register/cables.lua | 2 +- technic/machines/register/common.lua | 6 +- technic/machines/register/generator.lua | 10 +- technic/machines/register/machine_base.lua | 2 +- technic/tools/flashlight.lua | 2 +- technic/tools/mining_drill.lua | 2 +- technic/tools/prospector.lua | 4 +- technic/tools/sonic_screwdriver.lua | 2 +- technic_chests/README.md | 2 +- technic_chests/locale/tr.txt | 2 +- technic_worldgen/locale/template.txt | 42 +- technic_worldgen/locale/tr.txt | 28 +- technic_worldgen/nodes.lua | 10 +- travelnet/config.lua | 53 ++ travelnet/doors.lua | 9 +- travelnet/elevator.lua | 16 +- travelnet/init.lua | 51 ++ travelnet/locale/de.txt | 2 + travelnet/locale/template.txt | 2 + travelnet/travelnet.lua | 15 +- unified_inventory/register.lua | 25 +- unifieddyes/init.lua | 2 +- xban2/gui.lua | 2 +- 287 files changed, 3500 insertions(+), 1890 deletions(-) delete mode 100644 areasprotector/textures/areasprotector_protector.png create mode 100644 biome_lib/growth.lua create mode 100644 biome_lib/search_functions.lua create mode 100644 cottages/functions.lua create mode 100644 cottages/nodes_hay.lua create mode 100644 cottages/nodes_pitchfork.lua create mode 100644 cottages/nodes_water.lua create mode 100644 cottages/textures/cottages_pitchfork.png create mode 100644 facade/models/corner_bricks.obj delete mode 100644 facade/models/files.txt create mode 100644 facade/models/license.txt create mode 100644 facade/models/nbe files/corner_bricks.nbe create mode 100644 facade/models/nbe files/rgspro.nbe create mode 100644 facade/models/nbe files/rgspro_corner.nbe create mode 100644 facade/models/nbe files/rgspro_inner.nbe create mode 100644 facade/models/nbe lua files/corner_bricks.lua create mode 100644 facade/models/nbe lua files/rgspro.lua create mode 100644 facade/models/nbe lua files/rgspro_corner.lua create mode 100644 facade/models/nbe lua files/rgspro_inner.lua create mode 100644 facade/models/rgspro.obj create mode 100644 facade/models/rgspro_corner.obj create mode 100644 facade/models/rgspro_inner.obj create mode 100644 facade/screenshot4.png create mode 100644 facade/textures/facade_rgspro.png create mode 100644 facade/textures/license.txt delete mode 100644 facade/textures/texures license.txt create mode 100644 farming/crops/ryeoatrice.lua create mode 100644 farming/textures/farming_bread_multigrain.png create mode 100644 farming/textures/farming_flour_multigrain.png create mode 100644 farming/textures/farming_jaffa_cake.png create mode 100644 farming/textures/farming_oat.png create mode 100644 farming/textures/farming_oat_1.png create mode 100644 farming/textures/farming_oat_2.png create mode 100644 farming/textures/farming_oat_3.png create mode 100644 farming/textures/farming_oat_4.png create mode 100644 farming/textures/farming_oat_5.png create mode 100644 farming/textures/farming_oat_6.png create mode 100644 farming/textures/farming_oat_7.png create mode 100644 farming/textures/farming_oat_8.png create mode 100644 farming/textures/farming_oat_seed.png create mode 100644 farming/textures/farming_rice.png create mode 100644 farming/textures/farming_rice_1.png create mode 100644 farming/textures/farming_rice_2.png create mode 100644 farming/textures/farming_rice_3.png create mode 100644 farming/textures/farming_rice_4.png create mode 100644 farming/textures/farming_rice_5.png create mode 100644 farming/textures/farming_rice_6.png create mode 100644 farming/textures/farming_rice_7.png create mode 100644 farming/textures/farming_rice_8.png create mode 100644 farming/textures/farming_rice_bread.png create mode 100644 farming/textures/farming_rice_flour.png create mode 100644 farming/textures/farming_rice_seed.png create mode 100644 farming/textures/farming_rye.png create mode 100644 farming/textures/farming_rye_1.png create mode 100644 farming/textures/farming_rye_2.png create mode 100644 farming/textures/farming_rye_3.png create mode 100644 farming/textures/farming_rye_4.png create mode 100644 farming/textures/farming_rye_5.png create mode 100644 farming/textures/farming_rye_6.png create mode 100644 farming/textures/farming_rye_7.png create mode 100644 farming/textures/farming_rye_8.png create mode 100644 farming/textures/farming_rye_seed.png create mode 100644 farming/textures/farming_scythe_mithril.png create mode 100644 maptools/.editorconfig create mode 100644 maptools/.luacheckrc create mode 100644 maptools/.pre-commit-config.yaml create mode 100644 moreblocks/.editorconfig create mode 100644 moreblocks/.pre-commit-config.yaml create mode 100644 moreores/.editorconfig create mode 100644 moreores/.luacheckrc create mode 100644 moreores/.pre-commit-config.yaml delete mode 100644 playeranim/LICENSE.md delete mode 100644 playeranim/README.md delete mode 100644 playeranim/depends.txt delete mode 100644 playeranim/description.txt delete mode 100644 playeranim/init.lua delete mode 100644 playeranim/mod.conf delete mode 100644 playeranim/model.lua delete mode 100644 playeranim/screenshot.png delete mode 100644 playeranim/settingtypes.txt diff --git a/anvil/init.lua b/anvil/init.lua index e4bc8bd..fa554cd 100644 --- a/anvil/init.lua +++ b/anvil/init.lua @@ -6,9 +6,9 @@ --------------------------------------------------------------------------------------- anvil = { - setting = { - item_displacement = 7/16, - } + setting = { + item_displacement = 7/16, + } } minetest.register_alias("castle:anvil", "anvil:anvil") @@ -24,7 +24,7 @@ minetest.register_tool("anvil:hammer", { _doc_items_usagehelp = S("Use this hammer to strike blows upon an anvil bearing a damaged tool and you can repair it. It can also be used for smashing stone, but it is not well suited to this task."), image = "anvil_tool_steelhammer.png", inventory_image = "anvil_tool_steelhammer.png", - + tool_capabilities = { full_punch_interval = 0.8, max_drop_level=1, @@ -133,27 +133,29 @@ minetest.register_node("anvil:anvil", { {-0.35,-0.1,-0.2,0.35,0.1,0.2}, } }, + on_construct = function(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() inv:set_size("input", 1) end, - + after_place_node = function(pos, placer) local meta = minetest.get_meta(pos) meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext",placer:get_player_name().."'s anvil") end, - + can_dig = function(pos,player) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - + if not inv:is_empty("input") then return false end return true end, - + allow_metadata_inventory_put = function(pos, listname, index, stack, player) local meta = minetest.get_meta(pos) if listname~="input" then @@ -162,30 +164,33 @@ minetest.register_node("anvil:anvil", { if (listname=='input' and(stack:get_wear() == 0 or minetest.get_item_group(stack:get_name(), "not_repaired_by_anvil") ~= 0 - or stack:get_name() == "technic:water_can" + or stack:get_name() == "technic:water_can" or stack:get_name() == "technic:lava_can" )) then - + minetest.chat_send_player( player:get_player_name(), S('This anvil is for damaged tools only.')) return 0 end - + if meta:get_inventory():room_for_item("input", stack) then return stack:get_count() end return 0 end, - + allow_metadata_inventory_take = function(pos, listname, index, stack, player) if listname~="input" then return 0 end return stack:get_count() end, - + on_rightclick = function(pos, node, clicker, itemstack) + local meta = minetest.get_meta(pos) + local name = clicker:get_player_name() + + if name ~= meta:get_string("owner") then return itemstack end if itemstack:get_count() == 0 then - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() + local inv = meta:get_inventory() if not inv:is_empty("input") then local return_stack = inv:get_stack("input", 1) inv:set_stack("input", 1, nil) @@ -193,7 +198,7 @@ minetest.register_node("anvil:anvil", { clicker:get_inventory():set_stack("main", wield_index, return_stack) remove_item(pos, node) return return_stack - end + end end local this_def = minetest.registered_nodes[node.name] if this_def.allow_metadata_inventory_put(pos, "input", 1, itemstack:peek_item(), clicker) > 0 then @@ -203,9 +208,10 @@ minetest.register_node("anvil:anvil", { inv:add_item("input", s) update_item(pos,node) end + return itemstack end, - + on_punch = function(pos, node, puncher) if( not( pos ) or not( node ) or not( puncher )) then return @@ -214,7 +220,10 @@ minetest.register_node("anvil:anvil", { local wielded = puncher:get_wielded_item() local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - + if meta:get_string("owner") ~= puncher:get_player_name() then + return + end + if wielded:get_count() == 0 then if not inv:is_empty("input") then local return_stack = inv:get_stack("input", 1) @@ -222,60 +231,59 @@ minetest.register_node("anvil:anvil", { local wield_index = puncher:get_wield_index() puncher:get_inventory():set_stack("main", wield_index, return_stack) remove_item(pos, node) - end + end end - + -- only punching with the hammer is supposed to work if wielded:get_name() ~= 'anvil:hammer' then return end - local input = inv:get_stack('input',1) - + -- only tools can be repaired - if( not( input ) - or input:is_empty() - or input:get_name() == "technic:water_can" - or input:get_name() == "technic:lava_can" ) then + if( not( input ) + or input:is_empty() + or input:get_name() == "technic:water_can" + or input:get_name() == "technic:lava_can" ) then return end - + -- 65535 is max damage local damage_state = 40-math.floor(input:get_wear()/1638) - + local tool_name = input:get_name() local hud2 = nil local hud3 = nil if( input:get_wear()>0 ) then hud2 = puncher:hud_add({ - hud_elem_type = "statbar", - text = "default_cloud.png^[colorize:#ff0000:256", - number = 40, - direction = 0, -- left to right - position = {x=0.5, y=0.65}, - alignment = {x = 0, y = 0}, - offset = {x = -320, y = 0}, - size = {x=32, y=32}, + hud_elem_type = "statbar", + text = "default_cloud.png^[colorize:#ff0000:256", + number = 40, + direction = 0, -- left to right + position = {x=0.5, y=0.65}, + alignment = {x = 0, y = 0}, + offset = {x = -320, y = 0}, + size = {x=32, y=32}, }) hud3 = puncher:hud_add({ - hud_elem_type = "statbar", - text = "default_cloud.png^[colorize:#00ff00:256", - number = damage_state, - direction = 0, -- left to right - position = {x=0.5, y=0.65}, - alignment = {x = 0, y = 0}, - offset = {x = -320, y = 0}, - size = {x=32, y=32}, + hud_elem_type = "statbar", + text = "default_cloud.png^[colorize:#00ff00:256", + number = damage_state, + direction = 0, -- left to right + position = {x=0.5, y=0.65}, + alignment = {x = 0, y = 0}, + offset = {x = -320, y = 0}, + size = {x=32, y=32}, }) end minetest.after(2, function() - if( puncher ) then - puncher:hud_remove(hud2) - puncher:hud_remove(hud3) + if( puncher ) then + puncher:hud_remove(hud2) + puncher:hud_remove(hud3) end end) - + -- tell the player when the job is done if( input:get_wear() == 0 ) then local tool_desc @@ -290,28 +298,28 @@ minetest.register_node("anvil:anvil", { pos.y = pos.y + anvil.setting.item_displacement minetest.sound_play({name="anvil_clang"}, {pos=pos}) minetest.add_particlespawner({ - amount = 10, - time = 0.1, - minpos = pos, - maxpos = pos, - minvel = {x=2, y=3, z=2}, - maxvel = {x=-2, y=1, z=-2}, - minacc = {x=0, y= -10, z=0}, - maxacc = {x=0, y= -10, z=0}, - minexptime = 0.5, - maxexptime = 1, - minsize = 1, - maxsize = 1, - collisiondetection = true, - vertical = false, - texture = "anvil_spark.png", + amount = 10, + time = 0.1, + minpos = pos, + maxpos = pos, + minvel = {x=2, y=3, z=2}, + maxvel = {x=-2, y=1, z=-2}, + minacc = {x=0, y= -10, z=0}, + maxacc = {x=0, y= -10, z=0}, + minexptime = 0.5, + maxexptime = 1, + minsize = 1, + maxsize = 1, + collisiondetection = true, + vertical = false, + texture = "anvil_spark.png", }) end - + -- do the actual repair input:add_wear( -5000 ) -- equals to what technic toolshop does in 5 seconds inv:set_stack("input", 1, input) - + -- damage the hammer slightly wielded:add_wear( 100 ) puncher:set_wielded_item( wielded ) @@ -358,16 +366,18 @@ minetest.register_lbm({ minetest.register_craft({ output = "anvil:anvil", recipe = { - {"default:steel_ingot","default:steel_ingot","default:steel_ingot"}, - {'', "default:steel_ingot",'' }, - {"default:steel_ingot","default:steel_ingot","default:steel_ingot"} }, + {"default:steel_ingot","default:steel_ingot","default:steel_ingot"}, + {'', "default:steel_ingot",'' }, + {"default:steel_ingot","default:steel_ingot","default:steel_ingot"} + } }) minetest.register_craft({ output = "anvil:hammer", recipe = { - {"default:steel_ingot","default:steel_ingot","default:steel_ingot"}, - {"default:steel_ingot","default:steel_ingot","default:steel_ingot"}, - {"group:stick", '', ''} }, + {"default:steel_ingot","default:steel_ingot","default:steel_ingot"}, + {"default:steel_ingot","default:steel_ingot","default:steel_ingot"}, + {"group:stick","",""} + } }) diff --git a/areasprotector/depends.txt b/areasprotector/depends.txt index a18cd91..2d857d9 100644 --- a/areasprotector/depends.txt +++ b/areasprotector/depends.txt @@ -1 +1,2 @@ areas +basic_materials diff --git a/areasprotector/init.lua b/areasprotector/init.lua index 370e975..b2ac282 100644 --- a/areasprotector/init.lua +++ b/areasprotector/init.lua @@ -24,7 +24,7 @@ minetest.register_node("areasprotector:protector",{ tiles = { "default_steel_block.png", "default_steel_block.png", - "default_steel_block.png^areasprotector_protector.png" + "default_steel_block.png^basic_materials_padlock.png" }, paramtype = "light", drawtype = "nodebox", @@ -149,5 +149,5 @@ minetest.register_node("areasprotector:display_node", { minetest.register_craft({ output = "areasprotector:protector", type = "shapeless", - recipe = {"default:steelblock","default:steel_ingot"}, + recipe = {"default:steelblock","basic_materials:padlock"}, }) diff --git a/areasprotector/textures/areasprotector_protector.png b/areasprotector/textures/areasprotector_protector.png deleted file mode 100644 index 1351832..0000000 Binary files a/areasprotector/textures/areasprotector_protector.png and /dev/null differ diff --git a/bees/init.lua b/bees/init.lua index 79be907..b00219b 100644 --- a/bees/init.lua +++ b/bees/init.lua @@ -705,7 +705,7 @@ minetest.register_abm({ local p = {x = pos.x, y = pos.y - 1, z = pos.z} local nod = minetest.get_node_or_nil(p) - local def = minetest.registered_nodes[nod.name] + local def = nod and minetest.registered_nodes[nod.name] if not def or def.walkable then return end @@ -769,6 +769,7 @@ minetest.register_craftitem('bees:bottle_honey', { inventory_image = 'bees_bottle_honey.png', stack_max = 12, on_use = minetest.item_eat(3, "vessels:glass_bottle"), + groups = {vessel = 1}, }) minetest.register_craftitem('bees:wax', { diff --git a/biome_lib/growth.lua b/biome_lib/growth.lua new file mode 100644 index 0000000..56ba4ef --- /dev/null +++ b/biome_lib/growth.lua @@ -0,0 +1,80 @@ +local time_scale = ... + +-- The growing ABM + +function biome_lib:grow_plants(opts) + + local options = opts + + options.height_limit = options.height_limit or 5 + options.ground_nodes = options.ground_nodes or { "default:dirt_with_grass" } + options.grow_nodes = options.grow_nodes or { "default:dirt_with_grass" } + options.seed_diff = options.seed_diff or 0 + + local n + + if type(options.grow_plant) == "table" then + n = "multi: "..options.grow_plant[1]..", ..." + else + n = options.grow_plant + end + + options.label = options.label or "biome_lib grow_plants(): "..n + + if options.grow_delay*time_scale >= 1 then + options.interval = options.grow_delay*time_scale + else + options.interval = 1 + end + + minetest.register_abm({ + nodenames = { options.grow_plant }, + interval = options.interval, + chance = options.grow_chance, + label = options.label, + action = function(pos, node, active_object_count, active_object_count_wider) + local p_top = {x=pos.x, y=pos.y+1, z=pos.z} + local p_bot = {x=pos.x, y=pos.y-1, z=pos.z} + local n_top = minetest.get_node(p_top) + local n_bot = minetest.get_node(p_bot) + local root_node = minetest.get_node({x=pos.x, y=pos.y-options.height_limit, z=pos.z}) + local walldir = nil + if options.need_wall and options.verticals_list then + walldir = biome_lib:find_adjacent_wall(p_top, options.verticals_list, options.choose_random_wall) + end + if (n_top.name == "air" or n_top.name == "default:snow") + and (not options.need_wall or (options.need_wall and walldir)) then + -- corner case for changing short junglegrass + -- to dry shrub in desert + if n_bot.name == options.dry_early_node and options.grow_plant == "junglegrass:short" then + minetest.swap_node(pos, { name = "default:dry_shrub" }) + + elseif options.grow_vertically and walldir then + if biome_lib:search_downward(pos, options.height_limit, options.ground_nodes) then + minetest.swap_node(p_top, { name = options.grow_plant, param2 = walldir}) + end + + elseif not options.grow_result and not options.grow_function then + minetest.swap_node(pos, biome_lib.air) + + else + biome_lib:replace_object(pos, options.grow_result, options.grow_function, options.facedir, options.seed_diff) + end + end + end + }) +end + + +-- spawn_tree() on generate is routed through here so that other mods can hook +-- into it. + +function biome_lib:generate_tree(pos, nodes_or_function_or_model) + minetest.spawn_tree(pos, nodes_or_function_or_model) +end + +-- and this one's for the call used in the growing code + +function biome_lib:grow_tree(pos, nodes_or_function_or_model) + minetest.spawn_tree(pos, nodes_or_function_or_model) +end diff --git a/biome_lib/init.lua b/biome_lib/init.lua index f79c1d7..e54f9a4 100644 --- a/biome_lib/init.lua +++ b/biome_lib/init.lua @@ -84,6 +84,22 @@ biome_lib.perlin_humidity = PerlinNoise(humidity_seeddiff, humidity_octaves, hum -- Local functions +local function get_biome_data(pos, perlin_fertile) + local fertility = perlin_fertile:get2d({x=pos.x, y=pos.z}) + + if type(minetest.get_biome_data) == "function" then + local data = minetest.get_biome_data(pos) + if data then + return fertility, data.heat / 100, data.humidity / 100 + end + end + + local temperature = biome_lib.perlin_temperature:get2d({x=pos.x, y=pos.z}) + local humidity = biome_lib.perlin_humidity:get2d({x=pos.x+150, y=pos.z+50}) + + return fertility, temperature, humidity +end + function biome_lib:is_node_loaded(node_pos) local n = minetest.get_node_or_nil(node_pos) if (not n) or (n.name == "ignore") then @@ -198,6 +214,87 @@ function biome_lib:register_generate_plant(biomedef, nodes_or_function_or_model) end end +-- Function to check whether a position matches the given biome definition +-- Returns true when the surface can be populated + +local function populate_single_surface(biome, pos, perlin_fertile_area, checkair) + local p_top = { x = pos.x, y = pos.y + 1, z = pos.z } + + if math.random(1, 100) <= biome.rarity then + return + end + + local fertility, temperature, humidity = get_biome_data(pos, perlin_fertile_area) + + local pos_biome_ok = pos.y >= biome.min_elevation and pos.y <= biome.max_elevation + and fertility > biome.plantlife_limit + and temperature <= biome.temp_min and temperature >= biome.temp_max + and humidity <= biome.humidity_min and humidity >= biome.humidity_max + + if not pos_biome_ok then + return -- Y position mismatch, outside of biome + end + + local biome_surfaces_string = dump(biome.surface) + local surface_ok = false + + if not biome.depth then + local dest_node = minetest.get_node(pos) + if string.find(biome_surfaces_string, dest_node.name) then + surface_ok = true + else + if string.find(biome_surfaces_string, "group:") then + for j = 1, #biome.surface do + if string.find(biome.surface[j], "^group:") + and minetest.get_item_group(dest_node.name, biome.surface[j]) then + surface_ok = true + break + end + end + end + end + elseif not string.find(biome_surfaces_string, + minetest.get_node({ x = pos.x, y = pos.y-biome.depth-1, z = pos.z }).name) then + surface_ok = true + end + + if not surface_ok then + return -- Surface does not match the given node group/name + end + + if checkair and minetest.get_node(p_top).name ~= "air" then + return + end + + if biome.below_nodes and + not string.find(dump(biome.below_nodes), + minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name + ) then + return -- Node below does not match + end + + if biome.ncount and + #minetest.find_nodes_in_area( + {x=pos.x-1, y=pos.y, z=pos.z-1}, + {x=pos.x+1, y=pos.y, z=pos.z+1}, + biome.neighbors + ) <= biome.ncount then + return -- Not enough similar biome nodes around + end + + if biome.near_nodes and + #minetest.find_nodes_in_area( + {x=pos.x-biome.near_nodes_size, y=pos.y-biome.near_nodes_vertical, z=pos.z-biome.near_nodes_size}, + {x=pos.x+biome.near_nodes_size, y=pos.y+biome.near_nodes_vertical, z=pos.z+biome.near_nodes_size}, + biome.near_nodes + ) < biome.near_nodes_count then + return -- Long distance neighbours do not match + end + + -- Position fits into given biome + return true +end + function biome_lib:populate_surfaces(biome, nodes_or_function_or_model, snodes, checkair) biome_lib:set_defaults(biome) @@ -208,47 +305,8 @@ function biome_lib:populate_surfaces(biome, nodes_or_function_or_model, snodes, local perlin_fertile_area = minetest.get_perlin(biome.seed_diff, perlin_octaves, perlin_persistence, perlin_scale) for i = 1, #snodes do - local pos = snodes[i] - local p_top = { x = pos.x, y = pos.y + 1, z = pos.z } - local noise1 = perlin_fertile_area:get2d({x=pos.x, y=pos.z}) - local noise2 = biome_lib.perlin_temperature:get2d({x=pos.x, y=pos.z}) - local noise3 = biome_lib.perlin_humidity:get2d({x=pos.x+150, y=pos.z+50}) - local biome_surfaces_string = dump(biome.surface) - local surface_ok = false - - if not biome.depth then - local dest_node = minetest.get_node(pos) - if string.find(biome_surfaces_string, dest_node.name) then - surface_ok = true - else - if string.find(biome_surfaces_string, "group:") then - for j = 1, #biome.surface do - if string.find(biome.surface[j], "^group:") - and minetest.get_item_group(dest_node.name, biome.surface[j]) then - surface_ok = true - break - end - end - end - end - elseif not string.find(biome_surfaces_string, minetest.get_node({ x = pos.x, y = pos.y-biome.depth-1, z = pos.z }).name) then - surface_ok = true - end - - if surface_ok - and pos.y >= biome.min_elevation - and pos.y <= biome.max_elevation - and noise1 > biome.plantlife_limit - and noise2 <= biome.temp_min - and noise2 >= biome.temp_max - and noise3 <= biome.humidity_min - and noise3 >= biome.humidity_max - and (not checkair or minetest.get_node(p_top).name == "air") - and (not biome.ncount or #(minetest.find_nodes_in_area({x=pos.x-1, y=pos.y, z=pos.z-1}, {x=pos.x+1, y=pos.y, z=pos.z+1}, biome.neighbors)) > biome.ncount) - and (not biome.near_nodes or #(minetest.find_nodes_in_area({x=pos.x-biome.near_nodes_size, y=pos.y-biome.near_nodes_vertical, z=pos.z-biome.near_nodes_size}, {x=pos.x+biome.near_nodes_size, y=pos.y+biome.near_nodes_vertical, z=pos.z+biome.near_nodes_size}, biome.near_nodes)) >= biome.near_nodes_count) - and math.random(1,100) > biome.rarity - and (not biome.below_nodes or string.find(dump(biome.below_nodes), minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name) ) - then + local pos = vector.new(snodes[i]) + if populate_single_surface(biome, pos, perlin_fertile_area, checkair) then in_biome_nodes[#in_biome_nodes + 1] = pos end end @@ -257,73 +315,77 @@ function biome_lib:populate_surfaces(biome, nodes_or_function_or_model, snodes, local num_in_biome_nodes = #in_biome_nodes - if num_in_biome_nodes > 0 then - for i = 1, math.min(biome.max_count, num_in_biome_nodes) do - local tries = 0 - local spawned = false - while tries < 2 and not spawned do - local pos = in_biome_nodes[math.random(1, num_in_biome_nodes)] - if biome.spawn_replace_node then - pos.y = pos.y-1 + if num_in_biome_nodes == 0 then + return + end + + for i = 1, math.min(biome.max_count, num_in_biome_nodes) do + local tries = 0 + local spawned = false + while tries < 2 and not spawned do + local pos = in_biome_nodes[math.random(1, num_in_biome_nodes)] + if biome.spawn_replace_node then + pos.y = pos.y-1 + end + local p_top = { x = pos.x, y = pos.y + 1, z = pos.z } + + if not (biome.avoid_nodes and biome.avoid_radius + and minetest.find_node_near(p_top, biome.avoid_radius + + math.random(-1.5,2), biome.avoid_nodes)) then + if biome.delete_above then + minetest.swap_node(p_top, biome_lib.air) + minetest.swap_node({x=p_top.x, y=p_top.y+1, z=p_top.z}, biome_lib.air) end - local p_top = { x = pos.x, y = pos.y + 1, z = pos.z } - if not (biome.avoid_nodes and biome.avoid_radius and minetest.find_node_near(p_top, biome.avoid_radius + math.random(-1.5,2), biome.avoid_nodes)) then - if biome.delete_above then - minetest.swap_node(p_top, biome_lib.air) - minetest.swap_node({x=p_top.x, y=p_top.y+1, z=p_top.z}, biome_lib.air) - end + if biome.delete_above_surround then + minetest.swap_node({x=p_top.x-1, y=p_top.y, z=p_top.z}, biome_lib.air) + minetest.swap_node({x=p_top.x+1, y=p_top.y, z=p_top.z}, biome_lib.air) + minetest.swap_node({x=p_top.x, y=p_top.y, z=p_top.z-1}, biome_lib.air) + minetest.swap_node({x=p_top.x, y=p_top.y, z=p_top.z+1}, biome_lib.air) - if biome.delete_above_surround then - minetest.swap_node({x=p_top.x-1, y=p_top.y, z=p_top.z}, biome_lib.air) - minetest.swap_node({x=p_top.x+1, y=p_top.y, z=p_top.z}, biome_lib.air) - minetest.swap_node({x=p_top.x, y=p_top.y, z=p_top.z-1}, biome_lib.air) - minetest.swap_node({x=p_top.x, y=p_top.y, z=p_top.z+1}, biome_lib.air) + minetest.swap_node({x=p_top.x-1, y=p_top.y+1, z=p_top.z}, biome_lib.air) + minetest.swap_node({x=p_top.x+1, y=p_top.y+1, z=p_top.z}, biome_lib.air) + minetest.swap_node({x=p_top.x, y=p_top.y+1, z=p_top.z-1}, biome_lib.air) + minetest.swap_node({x=p_top.x, y=p_top.y+1, z=p_top.z+1}, biome_lib.air) + end - minetest.swap_node({x=p_top.x-1, y=p_top.y+1, z=p_top.z}, biome_lib.air) - minetest.swap_node({x=p_top.x+1, y=p_top.y+1, z=p_top.z}, biome_lib.air) - minetest.swap_node({x=p_top.x, y=p_top.y+1, z=p_top.z-1}, biome_lib.air) - minetest.swap_node({x=p_top.x, y=p_top.y+1, z=p_top.z+1}, biome_lib.air) - end + if biome.spawn_replace_node then + minetest.swap_node(pos, biome_lib.air) + end - if biome.spawn_replace_node then - minetest.swap_node(pos, biome_lib.air) - end + local objtype = type(nodes_or_function_or_model) - local objtype = type(nodes_or_function_or_model) - - if objtype == "table" then - if nodes_or_function_or_model.axiom then - biome_lib:generate_tree(p_top, nodes_or_function_or_model) - spawned = true - else - local fdir = nil - if biome.random_facedir then - fdir = math.random(biome.random_facedir[1], biome.random_facedir[2]) - end - minetest.swap_node(p_top, { name = nodes_or_function_or_model[math.random(#nodes_or_function_or_model)], param2 = fdir }) - spawned = true - end - elseif objtype == "string" and - minetest.registered_nodes[nodes_or_function_or_model] then + if objtype == "table" then + if nodes_or_function_or_model.axiom then + biome_lib:generate_tree(p_top, nodes_or_function_or_model) + spawned = true + else local fdir = nil if biome.random_facedir then fdir = math.random(biome.random_facedir[1], biome.random_facedir[2]) end - minetest.swap_node(p_top, { name = nodes_or_function_or_model, param2 = fdir }) - spawned = true - elseif objtype == "function" then - nodes_or_function_or_model(pos) - spawned = true - elseif objtype == "string" and pcall(loadstring(("return %s(...)"): - format(nodes_or_function_or_model)),pos) then + minetest.swap_node(p_top, { name = nodes_or_function_or_model[math.random(#nodes_or_function_or_model)], param2 = fdir }) spawned = true - else - biome_lib:dbg("Warning: Ignored invalid definition for object "..dump(nodes_or_function_or_model).." that was pointed at {"..dump(pos).."}") end + elseif objtype == "string" and + minetest.registered_nodes[nodes_or_function_or_model] then + local fdir = nil + if biome.random_facedir then + fdir = math.random(biome.random_facedir[1], biome.random_facedir[2]) + end + minetest.swap_node(p_top, { name = nodes_or_function_or_model, param2 = fdir }) + spawned = true + elseif objtype == "function" then + nodes_or_function_or_model(pos) + spawned = true + elseif objtype == "string" and pcall(loadstring(("return %s(...)"): + format(nodes_or_function_or_model)),pos) then + spawned = true else - tries = tries + 1 + biome_lib:dbg("Warning: Ignored invalid definition for object "..dump(nodes_or_function_or_model).." that was pointed at {"..dump(pos).."}") end + else + tries = tries + 1 end end end @@ -333,51 +395,52 @@ end -- a surface during the initial map read stage. function biome_lib:generate_block_with_air_checking() - if #biome_lib.blocklist_aircheck > 0 then + if #biome_lib.blocklist_aircheck == 0 then + return + end - local minp = biome_lib.blocklist_aircheck[1][1] - local maxp = biome_lib.blocklist_aircheck[1][2] + local minp = biome_lib.blocklist_aircheck[1][1] + local maxp = biome_lib.blocklist_aircheck[1][2] - -- use the block hash as a unique key into the surface nodes - -- tables, so that we can write the tables thread-safely. + -- use the block hash as a unique key into the surface nodes + -- tables, so that we can write the tables thread-safely. - local blockhash = minetest.hash_node_position(minp) + local blockhash = minetest.hash_node_position(minp) - if not biome_lib.surface_nodes_aircheck.blockhash then + if not biome_lib.surface_nodes_aircheck.blockhash then - if type(minetest.find_nodes_in_area_under_air) == "function" then -- use newer API call - biome_lib.surface_nodes_aircheck.blockhash = - minetest.find_nodes_in_area_under_air(minp, maxp, biome_lib.surfaceslist_aircheck) - else - local search_area = minetest.find_nodes_in_area(minp, maxp, biome_lib.surfaceslist_aircheck) + if type(minetest.find_nodes_in_area_under_air) == "function" then -- use newer API call + biome_lib.surface_nodes_aircheck.blockhash = + minetest.find_nodes_in_area_under_air(minp, maxp, biome_lib.surfaceslist_aircheck) + else + local search_area = minetest.find_nodes_in_area(minp, maxp, biome_lib.surfaceslist_aircheck) - -- search the generated block for air-bounded surfaces the slow way. + -- search the generated block for air-bounded surfaces the slow way. - biome_lib.surface_nodes_aircheck.blockhash = {} + biome_lib.surface_nodes_aircheck.blockhash = {} - for i = 1, #search_area do - local pos = search_area[i] - local p_top = { x=pos.x, y=pos.y+1, z=pos.z } - if minetest.get_node(p_top).name == "air" then - biome_lib.surface_nodes_aircheck.blockhash[#biome_lib.surface_nodes_aircheck.blockhash + 1] = pos - end + for i = 1, #search_area do + local pos = search_area[i] + local p_top = { x=pos.x, y=pos.y+1, z=pos.z } + if minetest.get_node(p_top).name == "air" then + biome_lib.surface_nodes_aircheck.blockhash[#biome_lib.surface_nodes_aircheck.blockhash + 1] = pos end end - biome_lib.actioncount_aircheck.blockhash = 1 + end + biome_lib.actioncount_aircheck.blockhash = 1 + else + if biome_lib.actioncount_aircheck.blockhash <= #biome_lib.actionslist_aircheck then + -- [1] is biome, [2] is node/function/model + biome_lib:populate_surfaces( + biome_lib.actionslist_aircheck[biome_lib.actioncount_aircheck.blockhash][1], + biome_lib.actionslist_aircheck[biome_lib.actioncount_aircheck.blockhash][2], + biome_lib.surface_nodes_aircheck.blockhash, true) + biome_lib.actioncount_aircheck.blockhash = biome_lib.actioncount_aircheck.blockhash + 1 else - if biome_lib.actioncount_aircheck.blockhash <= #biome_lib.actionslist_aircheck then - -- [1] is biome, [2] is node/function/model - biome_lib:populate_surfaces( - biome_lib.actionslist_aircheck[biome_lib.actioncount_aircheck.blockhash][1], - biome_lib.actionslist_aircheck[biome_lib.actioncount_aircheck.blockhash][2], - biome_lib.surface_nodes_aircheck.blockhash, true) - biome_lib.actioncount_aircheck.blockhash = biome_lib.actioncount_aircheck.blockhash + 1 - else - if biome_lib.surface_nodes_aircheck.blockhash then - table.remove(biome_lib.blocklist_aircheck, 1) - biome_lib.surface_nodes_aircheck.blockhash = nil - end + if biome_lib.surface_nodes_aircheck.blockhash then + table.remove(biome_lib.blocklist_aircheck, 1) + biome_lib.surface_nodes_aircheck.blockhash = nil end end end @@ -387,66 +450,60 @@ end -- checking for air during the initial map read stage. function biome_lib:generate_block_no_aircheck() - if #biome_lib.blocklist_no_aircheck > 0 then + if #biome_lib.blocklist_no_aircheck == 0 then + return + end - local minp = biome_lib.blocklist_no_aircheck[1][1] - local maxp = biome_lib.blocklist_no_aircheck[1][2] + local minp = biome_lib.blocklist_no_aircheck[1][1] + local maxp = biome_lib.blocklist_no_aircheck[1][2] - local blockhash = minetest.hash_node_position(minp) + local blockhash = minetest.hash_node_position(minp) - if not biome_lib.surface_nodes_no_aircheck.blockhash then + if not biome_lib.surface_nodes_no_aircheck.blockhash then - -- directly read the block to be searched into the chunk cache + -- directly read the block to be searched into the chunk cache - biome_lib.surface_nodes_no_aircheck.blockhash = - minetest.find_nodes_in_area(minp, maxp, biome_lib.surfaceslist_no_aircheck) - biome_lib.actioncount_no_aircheck.blockhash = 1 + biome_lib.surface_nodes_no_aircheck.blockhash = + minetest.find_nodes_in_area(minp, maxp, biome_lib.surfaceslist_no_aircheck) + biome_lib.actioncount_no_aircheck.blockhash = 1 + else + if biome_lib.actioncount_no_aircheck.blockhash <= #biome_lib.actionslist_no_aircheck then + biome_lib:populate_surfaces( + biome_lib.actionslist_no_aircheck[biome_lib.actioncount_no_aircheck.blockhash][1], + biome_lib.actionslist_no_aircheck[biome_lib.actioncount_no_aircheck.blockhash][2], + biome_lib.surface_nodes_no_aircheck.blockhash, false) + biome_lib.actioncount_no_aircheck.blockhash = biome_lib.actioncount_no_aircheck.blockhash + 1 else - if biome_lib.actioncount_no_aircheck.blockhash <= #biome_lib.actionslist_no_aircheck then - biome_lib:populate_surfaces( - biome_lib.actionslist_no_aircheck[biome_lib.actioncount_no_aircheck.blockhash][1], - biome_lib.actionslist_no_aircheck[biome_lib.actioncount_no_aircheck.blockhash][2], - biome_lib.surface_nodes_no_aircheck.blockhash, false) - biome_lib.actioncount_no_aircheck.blockhash = biome_lib.actioncount_no_aircheck.blockhash + 1 - else - if biome_lib.surface_nodes_no_aircheck.blockhash then - table.remove(biome_lib.blocklist_no_aircheck, 1) - biome_lib.surface_nodes_no_aircheck.blockhash = nil - end + if biome_lib.surface_nodes_no_aircheck.blockhash then + table.remove(biome_lib.blocklist_no_aircheck, 1) + biome_lib.surface_nodes_no_aircheck.blockhash = nil end end end end --- "Record" the chunks being generated by the core mapgen - -minetest.register_on_generated(function(minp, maxp, blockseed) - biome_lib.blocklist_aircheck[#biome_lib.blocklist_aircheck + 1] = { minp, maxp } -end) - -minetest.register_on_generated(function(minp, maxp, blockseed) - biome_lib.blocklist_no_aircheck[#biome_lib.blocklist_no_aircheck + 1] = { minp, maxp } -end) - -- "Play" them back, populating them with new stuff in the process +local step_duration = tonumber(minetest.settings:get("dedicated_server_step")) minetest.register_globalstep(function(dtime) - if dtime < 0.2 -- don't attempt to populate if lag is already too high - and math.random(100) <= biome_lib.queue_run_ratio - and (#biome_lib.blocklist_aircheck > 0 or #biome_lib.blocklist_no_aircheck > 0) then - biome_lib.globalstep_start_time = minetest.get_us_time() - biome_lib.globalstep_runtime = 0 - while (#biome_lib.blocklist_aircheck > 0 or #biome_lib.blocklist_no_aircheck > 0) - and biome_lib.globalstep_runtime < 200000 do -- 0.2 seconds, in uS. - if #biome_lib.blocklist_aircheck > 0 then - biome_lib:generate_block_with_air_checking() - end - if #biome_lib.blocklist_no_aircheck > 0 then - biome_lib:generate_block_no_aircheck() - end - biome_lib.globalstep_runtime = minetest.get_us_time() - biome_lib.globalstep_start_time + if dtime >= step_duration + 0.1 -- don't attempt to populate if lag is already too high + or math.random(100) > biome_lib.queue_run_ratio + or (#biome_lib.blocklist_aircheck == 0 and #biome_lib.blocklist_no_aircheck == 0) then + return + end + + biome_lib.globalstep_start_time = minetest.get_us_time() + biome_lib.globalstep_runtime = 0 + while (#biome_lib.blocklist_aircheck > 0 or #biome_lib.blocklist_no_aircheck > 0) + and biome_lib.globalstep_runtime < 200000 do -- 0.2 seconds, in uS. + if #biome_lib.blocklist_aircheck > 0 then + biome_lib:generate_block_with_air_checking() end + if #biome_lib.blocklist_no_aircheck > 0 then + biome_lib:generate_block_no_aircheck() + end + biome_lib.globalstep_runtime = minetest.get_us_time() - biome_lib.globalstep_start_time end end) @@ -454,24 +511,26 @@ end) -- to prevent unpopulated map areas minetest.register_on_shutdown(function() - if #biome_lib.blocklist_aircheck > 0 then - print("[biome_lib] Stand by, playing out the rest of the aircheck mapblock log") - print("(there are "..#biome_lib.blocklist_aircheck.." entries)...") - while true do - biome_lib:generate_block_with_air_checking(0.1) - if #biome_lib.blocklist_aircheck == 0 then return end - end + if #biome_lib.blocklist_aircheck == 0 then + return + end + + print("[biome_lib] Stand by, playing out the rest of the aircheck mapblock log") + print("(there are "..#biome_lib.blocklist_aircheck.." entries)...") + while #biome_lib.blocklist_aircheck > 0 do + biome_lib:generate_block_with_air_checking(0.1) end end) minetest.register_on_shutdown(function() - if #biome_lib.blocklist_no_aircheck > 0 then - print("[biome_lib] Stand by, playing out the rest of the no-aircheck mapblock log") - print("(there are "..#biome_lib.blocklist_no_aircheck.." entries)...") - while true do - biome_lib:generate_block_no_aircheck(0.1) - if #biome_lib.blocklist_no_aircheck == 0 then return end - end + if #biome_lib.blocklist_aircheck == 0 then + return + end + + print("[biome_lib] Stand by, playing out the rest of the no-aircheck mapblock log") + print("(there are "..#biome_lib.blocklist_no_aircheck.." entries)...") + while #biome_lib.blocklist_no_aircheck > 0 do + biome_lib:generate_block_no_aircheck(0.1) end end) @@ -519,127 +578,99 @@ function biome_lib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa) local p_top = { x = pos.x, y = pos.y + 1, z = pos.z } local n_top = minetest.get_node(p_top) local perlin_fertile_area = minetest.get_perlin(biome.seed_diff, perlin_octaves, perlin_persistence, perlin_scale) - local noise1 = perlin_fertile_area:get2d({x=p_top.x, y=p_top.z}) - local noise2 = biome_lib.perlin_temperature:get2d({x=p_top.x, y=p_top.z}) - local noise3 = biome_lib.perlin_humidity:get2d({x=p_top.x+150, y=p_top.z+50}) - if noise1 > biome.plantlife_limit - and noise2 <= biome.temp_min - and noise2 >= biome.temp_max - and noise3 <= biome.humidity_min - and noise3 >= biome.humidity_max - and biome_lib:is_node_loaded(p_top) then - local n_light = minetest.get_node_light(p_top, nil) - if not (biome.avoid_nodes and biome.avoid_radius and minetest.find_node_near(p_top, biome.avoid_radius + math.random(-1.5,2), biome.avoid_nodes)) - and n_light >= biome.light_min - and n_light <= biome.light_max - and (not(biome.neighbors and biome.ncount) or #(minetest.find_nodes_in_area({x=pos.x-1, y=pos.y, z=pos.z-1}, {x=pos.x+1, y=pos.y, z=pos.z+1}, biome.neighbors)) > biome.ncount ) - and (not(biome.near_nodes and biome.near_nodes_count and biome.near_nodes_size) or #(minetest.find_nodes_in_area({x=pos.x-biome.near_nodes_size, y=pos.y-biome.near_nodes_vertical, z=pos.z-biome.near_nodes_size}, {x=pos.x+biome.near_nodes_size, y=pos.y+biome.near_nodes_vertical, z=pos.z+biome.near_nodes_size}, biome.near_nodes)) >= biome.near_nodes_count) - and (not(biome.air_count and biome.air_size) or #(minetest.find_nodes_in_area({x=p_top.x-biome.air_size, y=p_top.y, z=p_top.z-biome.air_size}, {x=p_top.x+biome.air_size, y=p_top.y, z=p_top.z+biome.air_size}, "air")) >= biome.air_count) - and pos.y >= biome.min_elevation - and pos.y <= biome.max_elevation - then - local walldir = biome_lib:find_adjacent_wall(p_top, biome.verticals_list, biome.choose_random_wall) - if biome.alt_wallnode and walldir then - if n_top.name == "air" then - minetest.swap_node(p_top, { name = biome.alt_wallnode, param2 = walldir }) - end - else - local currentsurface = minetest.get_node(pos).name - if currentsurface ~= "default:water_source" - or (currentsurface == "default:water_source" and #(minetest.find_nodes_in_area({x=pos.x, y=pos.y-biome.depth_max-1, z=pos.z}, {x=pos.x, y=pos.y, z=pos.z}, {"default:dirt", "default:dirt_with_grass", "default:sand"})) > 0 ) - then - local rnd = math.random(1, biome.spawn_plants_count) - local plant_to_spawn = biome.spawn_plants[rnd] - local fdir = biome.facedir - if biome.random_facedir then - fdir = math.random(biome.random_facedir[1],biome.random_facedir[2]) - end - if type(biome.spawn_plants) == "string" then - assert(loadstring(biome.spawn_plants.."(...)"))(pos) - elseif not biome.spawn_on_side and not biome.spawn_on_bottom and not biome.spawn_replace_node then - if n_top.name == "air" then - minetest.swap_node(p_top, { name = plant_to_spawn, param2 = fdir }) - end - elseif biome.spawn_replace_node then - minetest.swap_node(pos, { name = plant_to_spawn, param2 = fdir }) - - elseif biome.spawn_on_side then - local onside = biome_lib:find_open_side(pos) - if onside then - minetest.swap_node(onside.newpos, { name = plant_to_spawn, param2 = onside.facedir }) - end - elseif biome.spawn_on_bottom then - if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "air" then - minetest.swap_node({x=pos.x, y=pos.y-1, z=pos.z}, { name = plant_to_spawn, param2 = fdir} ) - end - end - end - end - end - end - end - }) -end --- The growing ABM + local fertility, temperature, humidity = get_biome_data(pos, perlin_fertile_area) -function biome_lib:grow_plants(opts) + local pos_biome_ok = pos.y >= biome.min_elevation and pos.y <= biome.max_elevation + and fertility > biome.plantlife_limit + and temperature <= biome.temp_min and temperature >= biome.temp_max + and humidity <= biome.humidity_min and humidity >= biome.humidity_max + and biome_lib:is_node_loaded(p_top) - local options = opts + if not pos_biome_ok then + return -- Outside of biome + end - options.height_limit = options.height_limit or 5 - options.ground_nodes = options.ground_nodes or { "default:dirt_with_grass" } - options.grow_nodes = options.grow_nodes or { "default:dirt_with_grass" } - options.seed_diff = options.seed_diff or 0 + local n_light = minetest.get_node_light(p_top, nil) + if n_light < biome.light_min or n_light > biome.light_max then + return -- Too dark or too bright + end - local n + if biome.avoid_nodes and biome.avoid_radius and minetest.find_node_near( + p_top, biome.avoid_radius + math.random(-1.5,2), biome.avoid_nodes) then + return -- Nodes to avoid are nearby + end - if type(options.grow_plant) == "table" then - n = "multi: "..options.grow_plant[1]..", ..." - else - n = options.grow_plant - end + if biome.neighbors and biome.ncount and + #minetest.find_nodes_in_area( + {x=pos.x-1, y=pos.y, z=pos.z-1}, + {x=pos.x+1, y=pos.y, z=pos.z+1}, + biome.neighbors + ) <= biome.ncount then + return -- Near neighbour nodes are not present + end - options.label = options.label or "biome_lib grow_plants(): "..n + local NEAR_DST = biome.near_nodes_size + if biome.near_nodes and biome.near_nodes_count and biome.near_nodes_size and + #minetest.find_nodes_in_area( + {x=pos.x-NEAR_DST, y=pos.y-biome.near_nodes_vertical, z=pos.z-NEAR_DST}, + {x=pos.x+NEAR_DST, y=pos.y+biome.near_nodes_vertical, z=pos.z+NEAR_DST}, + biome.near_nodes + ) < biome.near_nodes_count then + return -- Far neighbour nodes are not present + end - if options.grow_delay*time_scale >= 1 then - options.interval = options.grow_delay*time_scale - else - options.interval = 1 - end + if (biome.air_count and biome.air_size) and + #minetest.find_nodes_in_area( + {x=p_top.x-biome.air_size, y=p_top.y, z=p_top.z-biome.air_size}, + {x=p_top.x+biome.air_size, y=p_top.y, z=p_top.z+biome.air_size}, + "air" + ) < biome.air_count then + return -- Not enough air + end - minetest.register_abm({ - nodenames = { options.grow_plant }, - interval = options.interval, - chance = options.grow_chance, - label = options.label, - action = function(pos, node, active_object_count, active_object_count_wider) - local p_top = {x=pos.x, y=pos.y+1, z=pos.z} - local p_bot = {x=pos.x, y=pos.y-1, z=pos.z} - local n_top = minetest.get_node(p_top) - local n_bot = minetest.get_node(p_bot) - local root_node = minetest.get_node({x=pos.x, y=pos.y-options.height_limit, z=pos.z}) - local walldir = nil - if options.need_wall and options.verticals_list then - walldir = biome_lib:find_adjacent_wall(p_top, options.verticals_list, options.choose_random_wall) + local walldir = biome_lib:find_adjacent_wall(p_top, biome.verticals_list, biome.choose_random_wall) + if biome.alt_wallnode and walldir then + if n_top.name == "air" then + minetest.swap_node(p_top, { name = biome.alt_wallnode, param2 = walldir }) + end + return end - if (n_top.name == "air" or n_top.name == "default:snow") - and (not options.need_wall or (options.need_wall and walldir)) then - -- corner case for changing short junglegrass - -- to dry shrub in desert - if n_bot.name == options.dry_early_node and options.grow_plant == "junglegrass:short" then - minetest.swap_node(pos, { name = "default:dry_shrub" }) - - elseif options.grow_vertically and walldir then - if biome_lib:search_downward(pos, options.height_limit, options.ground_nodes) then - minetest.swap_node(p_top, { name = options.grow_plant, param2 = walldir}) - end - elseif not options.grow_result and not options.grow_function then - minetest.swap_node(pos, biome_lib.air) + local currentsurface = minetest.get_node(pos).name - else - biome_lib:replace_object(pos, options.grow_result, options.grow_function, options.facedir, options.seed_diff) + if currentsurface == "default:water_source" and + #minetest.find_nodes_in_area( + {x=pos.x, y=pos.y-biome.depth_max-1, z=pos.z}, + vector.new(pos), + {"default:dirt", "default:dirt_with_grass", "default:sand"} + ) == 0 then + return -- On water but no ground nearby + end + + local rnd = math.random(1, biome.spawn_plants_count) + local plant_to_spawn = biome.spawn_plants[rnd] + local fdir = biome.facedir + if biome.random_facedir then + fdir = math.random(biome.random_facedir[1],biome.random_facedir[2]) + end + if type(biome.spawn_plants) == "string" then + assert(loadstring(biome.spawn_plants.."(...)"))(pos) + elseif not biome.spawn_on_side and not biome.spawn_on_bottom and not biome.spawn_replace_node then + if n_top.name == "air" then + minetest.swap_node(p_top, { name = plant_to_spawn, param2 = fdir }) + end + elseif biome.spawn_replace_node then + minetest.swap_node(pos, { name = plant_to_spawn, param2 = fdir }) + + elseif biome.spawn_on_side then + local onside = biome_lib:find_open_side(pos) + if onside then + minetest.swap_node(onside.newpos, { name = plant_to_spawn, param2 = onside.facedir }) + end + elseif biome.spawn_on_bottom then + if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "air" then + minetest.swap_node({x=pos.x, y=pos.y-1, z=pos.z}, { name = plant_to_spawn, param2 = fdir} ) end end end @@ -657,15 +688,13 @@ function biome_lib:replace_object(pos, replacement, grow_function, walldir, seed return elseif growtype == "function" then local perlin_fertile_area = minetest.get_perlin(seeddiff, perlin_octaves, perlin_persistence, perlin_scale) - local noise1 = perlin_fertile_area:get2d({x=pos.x, y=pos.z}) - local noise2 = biome_lib.perlin_temperature:get2d({x=pos.x, y=pos.z}) - grow_function(pos,noise1,noise2,walldir) + local fertility, temperature, _ = get_biome_data(pos, perlin_fertile_area) + grow_function(pos, fertility, temperature, walldir) return elseif growtype == "string" then local perlin_fertile_area = minetest.get_perlin(seeddiff, perlin_octaves, perlin_persistence, perlin_scale) - local noise1 = perlin_fertile_area:get2d({x=pos.x, y=pos.z}) - local noise2 = biome_lib.perlin_temperature:get2d({x=pos.x, y=pos.z}) - assert(loadstring(grow_function.."(...)"))(pos,noise1,noise2,walldir) + local fertility, temperature, _ = get_biome_data(pos, perlin_fertile_area) + assert(loadstring(grow_function.."(...)"))(pos, fertility, temperature, walldir) return elseif growtype == "nil" then minetest.swap_node(pos, { name = replacement, param2 = walldir}) @@ -675,71 +704,11 @@ function biome_lib:replace_object(pos, replacement, grow_function, walldir, seed end end --- function to decide if a node has a wall that's in verticals_list{} --- returns wall direction of valid node, or nil if invalid. - -function biome_lib:find_adjacent_wall(pos, verticals, randomflag) - local verts = dump(verticals) - if randomflag then - local walltab = {} - - if string.find(verts, minetest.get_node({ x=pos.x-1, y=pos.y, z=pos.z }).name) then walltab[#walltab + 1] = 3 end - if string.find(verts, minetest.get_node({ x=pos.x+1, y=pos.y, z=pos.z }).name) then walltab[#walltab + 1] = 2 end - if string.find(verts, minetest.get_node({ x=pos.x , y=pos.y, z=pos.z-1 }).name) then walltab[#walltab + 1] = 5 end - if string.find(verts, minetest.get_node({ x=pos.x , y=pos.y, z=pos.z+1 }).name) then walltab[#walltab + 1] = 4 end - - if #walltab > 0 then return walltab[math.random(1, #walltab)] end - - else - if string.find(verts, minetest.get_node({ x=pos.x-1, y=pos.y, z=pos.z }).name) then return 3 end - if string.find(verts, minetest.get_node({ x=pos.x+1, y=pos.y, z=pos.z }).name) then return 2 end - if string.find(verts, minetest.get_node({ x=pos.x , y=pos.y, z=pos.z-1 }).name) then return 5 end - if string.find(verts, minetest.get_node({ x=pos.x , y=pos.y, z=pos.z+1 }).name) then return 4 end - end - return nil -end - --- Function to search downward from the given position, looking for the first --- node that matches the ground table. Returns the new position, or nil if --- height limit is exceeded before finding it. -function biome_lib:search_downward(pos, heightlimit, ground) - for i = 0, heightlimit do - if string.find(dump(ground), minetest.get_node({x=pos.x, y=pos.y-i, z = pos.z}).name) then - return {x=pos.x, y=pos.y-i, z = pos.z} - end - end - return false -end +dofile(biome_lib.modpath .. "/search_functions.lua") +assert(loadfile(biome_lib.modpath .. "/growth.lua"))(time_scale) -function biome_lib:find_open_side(pos) - if minetest.get_node({ x=pos.x-1, y=pos.y, z=pos.z }).name == "air" then - return {newpos = { x=pos.x-1, y=pos.y, z=pos.z }, facedir = 2} - end - if minetest.get_node({ x=pos.x+1, y=pos.y, z=pos.z }).name == "air" then - return {newpos = { x=pos.x+1, y=pos.y, z=pos.z }, facedir = 3} - end - if minetest.get_node({ x=pos.x, y=pos.y, z=pos.z-1 }).name == "air" then - return {newpos = { x=pos.x, y=pos.y, z=pos.z-1 }, facedir = 4} - end - if minetest.get_node({ x=pos.x, y=pos.y, z=pos.z+1 }).name == "air" then - return {newpos = { x=pos.x, y=pos.y, z=pos.z+1 }, facedir = 5} - end - return nil -end - --- spawn_tree() on generate is routed through here so that other mods can hook --- into it. -function biome_lib:generate_tree(pos, nodes_or_function_or_model) - minetest.spawn_tree(pos, nodes_or_function_or_model) -end - --- and this one's for the call used in the growing code - -function biome_lib:grow_tree(pos, nodes_or_function_or_model) - minetest.spawn_tree(pos, nodes_or_function_or_model) -end -- Check for infinite stacks diff --git a/biome_lib/search_functions.lua b/biome_lib/search_functions.lua new file mode 100644 index 0000000..d665b5f --- /dev/null +++ b/biome_lib/search_functions.lua @@ -0,0 +1,60 @@ + +-- function to decide if a node has a wall that's in verticals_list{} +-- returns wall direction of valid node, or nil if invalid. + +function biome_lib:find_adjacent_wall(pos, verticals, randomflag) + local verts = dump(verticals) + if randomflag then + local walltab = {} + + if string.find(verts, minetest.get_node({ x=pos.x-1, y=pos.y, z=pos.z }).name) then walltab[#walltab + 1] = 3 end + if string.find(verts, minetest.get_node({ x=pos.x+1, y=pos.y, z=pos.z }).name) then walltab[#walltab + 1] = 2 end + if string.find(verts, minetest.get_node({ x=pos.x , y=pos.y, z=pos.z-1 }).name) then walltab[#walltab + 1] = 5 end + if string.find(verts, minetest.get_node({ x=pos.x , y=pos.y, z=pos.z+1 }).name) then walltab[#walltab + 1] = 4 end + + if #walltab > 0 then return walltab[math.random(1, #walltab)] end + + else + if string.find(verts, minetest.get_node({ x=pos.x-1, y=pos.y, z=pos.z }).name) then return 3 end + if string.find(verts, minetest.get_node({ x=pos.x+1, y=pos.y, z=pos.z }).name) then return 2 end + if string.find(verts, minetest.get_node({ x=pos.x , y=pos.y, z=pos.z-1 }).name) then return 5 end + if string.find(verts, minetest.get_node({ x=pos.x , y=pos.y, z=pos.z+1 }).name) then return 4 end + end + return nil +end + +-- Function to search downward from the given position, looking for the first +-- node that matches the ground table. Returns the new position, or nil if +-- height limit is exceeded before finding it. + +function biome_lib:search_downward(pos, heightlimit, ground) + for i = 0, heightlimit do + if string.find(dump(ground), minetest.get_node({x=pos.x, y=pos.y-i, z = pos.z}).name) then + return {x=pos.x, y=pos.y-i, z = pos.z} + end + end + return false +end + +function biome_lib:find_open_side(pos) + if minetest.get_node({ x=pos.x-1, y=pos.y, z=pos.z }).name == "air" then + return {newpos = { x=pos.x-1, y=pos.y, z=pos.z }, facedir = 2} + end + if minetest.get_node({ x=pos.x+1, y=pos.y, z=pos.z }).name == "air" then + return {newpos = { x=pos.x+1, y=pos.y, z=pos.z }, facedir = 3} + end + if minetest.get_node({ x=pos.x, y=pos.y, z=pos.z-1 }).name == "air" then + return {newpos = { x=pos.x, y=pos.y, z=pos.z-1 }, facedir = 4} + end + if minetest.get_node({ x=pos.x, y=pos.y, z=pos.z+1 }).name == "air" then + return {newpos = { x=pos.x, y=pos.y, z=pos.z+1 }, facedir = 5} + end + return nil +end + +-- "Record" the chunks being generated by the core mapgen + +minetest.register_on_generated(function(minp, maxp, blockseed) + biome_lib.blocklist_aircheck[#biome_lib.blocklist_aircheck + 1] = { minp, maxp } + biome_lib.blocklist_no_aircheck[#biome_lib.blocklist_no_aircheck + 1] = { minp, maxp } +end) diff --git a/concrete/init.lua b/concrete/init.lua index d309613..ced0471 100644 --- a/concrete/init.lua +++ b/concrete/init.lua @@ -1,4 +1,4 @@ ---Minetest 0.4.7 mod: concrete +--Minetest 0.4.7 mod: concrete --(c) 2013 by RealBadAngel local technic = rawget(_G, "technic") or {} @@ -89,15 +89,15 @@ minetest.register_node(":technic:concrete_post_platform", { groups={cracky=1, level=2}, sounds = default.node_sound_stone_defaults(), paramtype = "light", - drawtype = "nodebox", + drawtype = "nodebox", node_box = { type = "fixed", fixed = {box_platform} }, on_place = function (itemstack, placer, pointed_thing) local node = minetest.get_node(pointed_thing.under) - if node.name ~= "technic:concrete_post" then - return minetest.item_place_node(itemstack, placer, pointed_thing) + if node.name ~= "technic:concrete_post" then + return minetest.item_place_node(itemstack, placer, pointed_thing) end minetest.set_node(pointed_thing.under, {name="technic:concrete_post_with_platform"}) itemstack:take_item() diff --git a/cottages/functions.lua b/cottages/functions.lua new file mode 100644 index 0000000..81d88bc --- /dev/null +++ b/cottages/functions.lua @@ -0,0 +1,42 @@ + +local S = cottages.S + +--- if no owner is set, all players may use the node; else only the owner +cottages.player_can_use = function( meta, player ) + if( not( player) or not( meta )) then + return false; + end + local pname = player:get_player_name(); + local owner = meta:get_string('owner' ); + local public = meta:get_string('public') + if( not(owner) or owner=="" or owner==pname or public=="public") then + return true; + end + return false; +end + + +-- call this in on_receive_fields and add suitable buttons in order +-- to switch between public and private use +cottages.switch_public = function(pos, formname, fields, sender, name_of_the_thing) + -- switch between public and private + local meta = minetest.get_meta(pos) + local public = meta:get_string("public") + local owner = meta:get_string("owner") + if( sender and sender:get_player_name() == owner and fields.public) then + if( public ~= "public") then + meta:set_string("public", "public") + meta:set_string("infotext", + S("Public "..name_of_the_thing.." (owned by %s)"):format(owner)) + minetest.chat_send_player(owner, + S("Your "..name_of_the_thing.." can now be used by other players as well.")) + else + meta:set_string("public", "") + meta:set_string("infotext", + S("Private "..name_of_the_thing.." (owned by %s)"):format(owner)) + minetest.chat_send_player(owner, + S("Your "..name_of_the_thing.." can only be used by yourself.")) + end + return true + end +end diff --git a/cottages/init.lua b/cottages/init.lua index a2a4751..b6c412b 100644 --- a/cottages/init.lua +++ b/cottages/init.lua @@ -29,10 +29,30 @@ else cottages.S = function(s) return s end end +cottages.sounds = {} -- MineClone2 needs special treatment; default is only needed for -- crafting materials and sounds (less important) if( not( minetest.get_modpath("default"))) then default = {}; + cottages.sounds.wood = nil + cottages.sounds.dirt = nil + cottages.sounds.leaves = nil + cottages.sounds.stone = nil +else + cottages.sounds.wood = default.node_sound_wood_defaults() + cottages.sounds.dirt = default.node_sound_dirt_defaults() + cottages.sounds.stone = default.node_sound_stone_defaults() + cottages.sounds.leaves = default.node_sound_leaves_defaults() +end + +-- the straw from default comes with stairs as well and might replace +-- cottages:roof_connector_straw and cottages:roof_flat_straw +-- however, that does not look very good +if( false and minetest.registered_nodes["farming:straw"]) then + cottages.straw_texture = "farming_straw.png" + cottages.use_farming_straw_stairs = true +else + cottages.straw_texture = "cottages_darkage_straw.png" end --cottages.config_use_mesh_barrel = false; --cottages.config_use_mesh_handmill = true; @@ -57,18 +77,23 @@ cottages.handmill_product[ 'default:coal_lump'] = 'dye:black 6'; cottages.handmill_max_per_turn = 20; cottages.handmill_min_per_turn = 0; +dofile(minetest.get_modpath("cottages").."/functions.lua"); -- uncomment parts you do not want dofile(minetest.get_modpath("cottages").."/nodes_furniture.lua"); dofile(minetest.get_modpath("cottages").."/nodes_historic.lua"); dofile(minetest.get_modpath("cottages").."/nodes_feldweg.lua"); +-- allows to dig hay and straw fast +dofile(minetest.get_modpath("cottages").."/nodes_pitchfork.lua"); dofile(minetest.get_modpath("cottages").."/nodes_straw.lua"); +dofile(minetest.get_modpath("cottages").."/nodes_hay.lua"); dofile(minetest.get_modpath("cottages").."/nodes_anvil.lua"); dofile(minetest.get_modpath("cottages").."/nodes_doorlike.lua"); dofile(minetest.get_modpath("cottages").."/nodes_fences.lua"); dofile(minetest.get_modpath("cottages").."/nodes_roof.lua"); dofile(minetest.get_modpath("cottages").."/nodes_barrel.lua"); dofile(minetest.get_modpath("cottages").."/nodes_mining.lua"); +dofile(minetest.get_modpath("cottages").."/nodes_water.lua"); --dofile(minetest.get_modpath("cottages").."/nodes_chests.lua"); -- this is only required and useful if you run versions of the random_buildings mod where the nodes where defined inside that mod diff --git a/cottages/locale/de.txt b/cottages/locale/de.txt index 9677a3b..d8f8207 100644 --- a/cottages/locale/de.txt +++ b/cottages/locale/de.txt @@ -109,6 +109,8 @@ straw = Stroh threshing floor = Dreschboden Threshing floor = Dreschboden Threshing floor (owned by %s) = Dreschboden (gehoert %s) +Public threshing floor (owned by %s) = Öffentlicher Dreschboden (gehoert %s) +Private threshing floor (owned by %s) = Privater Dreschboden (gehoert %s) Harvested wheat: = Geernteter Weizen Straw: = Stroh Seeds: = Koerner @@ -120,6 +122,8 @@ You have threshed the last %s wheat. = Du hast die letzten %s Weizenaehren gedr mill, powered by punching = Muehle, durch Schlagen antreiben Mill, powered by punching = Muehle, durch Schlagen antreiben Mill, powered by punching (owned by %s) = Muehle, durch Schlagen antreiben (gehoert %s) +Public mill, powered by punching (owned by %s) = Öffentliche Muehle, durch Schlagen antreiben (gehoert %s) +Private mill, powered by punching (owned by %s) = Private Muehle, durch Schlagen antreiben (gehoert %s) Wheat seeds: = Weizenkoerner Flour: = Mehl Mill = Muehle @@ -128,3 +132,26 @@ Punch this hand-driven mill = Schlage auf diese handbetriebene Muehle to convert wheat seeds into flour. = um Weizenkoerner in Mehl umzuwandeln. You have grinded %s wheat seeds (%s are left). = Du hast %s Weizenkoerner gemahlen (%s bleiben uebrig). You have grinded the last %s wheat seeds. = Du hast die letzten %s Weizenkoerner gemahlen. + +Your threshing floor can now be used by other players as well. = Dein Dreschboden kann jetzt auch von anderen Spielern benutzt werden. +Your mill, powered by punching can now be used by other players as well. = Deine Mühle kann jetzt auch von anderen Spielern benutzt werden. + +Your threshing floor can only be used by yourself. = Dein Dreschboden kann jetzt nur noch von dir selbst benutzt werden. +Your mill, powered by punching can only be used by yourself. = Deine Mühle kann jetzt nur noch von dir selbst benutzt werden. + +Public? = Oeffentlich? + +Public tree trunk well = Oeffentlicher Baumstammbrunnen +Public tree trunk well (owned by %s) = Oeffentlicher Baumstammbrunnen (gehoert %s) +Private tree trunk well (owned by %s) = Privater Baumstammbrunnen (gehoert %s) +This tree trunk well is owned by %s. You can't use it. = Dieser Baumstammbrunnen gehoert %s. Du kannst ihn leider nicht benutzen. +Sorry. You have no room for the bucket. Please free some space in your inventory first! = Du hast leider keinen Platz mehr fuer den Eimer. Bitte schaffe erst ein wenig Platz! +Your tree trunk well can now be used by other players as well. = Dein Baumstammbrunnen kann jetzt auch von anderen Spielern benutzt werdn. +Your tree trunk well can only be used by yourself. = Dein Baumstammbrunnen kann jetzt nur noch von dir selbst benutzt werdn. + +pitchfork (dig dirt with grass to get hay, place with right-click) = Heugabel (grabe Erde mit Grass um Heu zu bekommen; Rechts-Klick zum Platzieren) +pitchfork (for hay and straw) = Heugabel (fuer Heu und Stroh) + +Some hay = Etwas Heu +Hay = Heu +Hay bale = Heuballen diff --git a/cottages/locale/template.txt b/cottages/locale/template.txt index cbc6990..40c24d3 100644 --- a/cottages/locale/template.txt +++ b/cottages/locale/template.txt @@ -105,9 +105,11 @@ Reet for thatching = layer of straw = straw bale = straw = -threshing floor = -Threshing floor = -Threshing floor (owned by %s) = +threshing floor = +Threshing floor = +Threshing floor (owned by %s) = +Public threshing floor (owned by %s) = +Private threshing floor (owned by %s) = Harvested wheat: = Straw: = Seeds: = @@ -117,8 +119,10 @@ to get straw and seeds from wheat. = You have threshed %s wheat (%s are left). = You have threshed the last %s wheat. = mill, powered by punching = -Mill, powered by punching = -Mill, powered by punching (owned by %s) = +Mill, powered by punching = +Mill, powered by punching (owned by %s) = +Public mill, powered by punching (owned by %s) = +Private mill, powered by punching (owned by %s) = Wheat seeds: = Flour: = Mill = @@ -127,3 +131,25 @@ Punch this hand-driven mill = to convert wheat seeds into flour. = You have grinded %s wheat seeds (%s are left). = You have grinded the last %s wheat seeds. = + +Your threshing floor can now be used by other players as well. = +Your mill, powered by punching can now be used by other players as well. = + +Your threshing floor can only be used by yourself. = +Your mill, powered by punching can only be used by yourself. = + +Public? = + +Public tree trunk well = +Public tree trunk well (owned by %s) = +This tree trunk well is owned by %s. You can't use it. = +Sorry. You have no room for the bucket. Please free some space in your inventory first! = +Your tree trunk well can now be used by other players as well. = +Your tree trunk well can only be used by yourself. = + +pitchfork (dig dirt with grass to get hay, place with right-click) = +pitchfork (for hay and straw) = + +Some hay = +Hay = +Hay bale = diff --git a/cottages/nodes_feldweg.lua b/cottages/nodes_feldweg.lua index bb21479..d81cc02 100644 --- a/cottages/nodes_feldweg.lua +++ b/cottages/nodes_feldweg.lua @@ -19,6 +19,47 @@ if( not( cottages_feldweg_mode )) then cottages_feldweg_mode = "mesh"; end +local function register_recipes(include_end) + + minetest.register_craft({ + output = "cottages:feldweg_crossing 5", + recipe = { + {"", "cottages:feldweg", "" }, + {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"}, + {"", "cottages:feldweg", "" }, + }, + }) + + minetest.register_craft({ + output = "cottages:feldweg_t_junction 5", + recipe = { + {"", "cottages:feldweg", "" }, + {"", "cottages:feldweg", "" }, + {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"} + + }, + }) + + minetest.register_craft({ + output = "cottages:feldweg_curve 5", + recipe = { + {"cottages:feldweg", "", "" }, + {"cottages:feldweg", "", ""}, + {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"} + }, + }) + + if include_end then + minetest.register_craft({ + output = "cottages:feldweg_end 5", + recipe = { + {"cottages:feldweg", "", "cottages:feldweg" }, + {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"} + }, + }) + end +end + --- a nice dirt road for small villages or paths to fields if( cottages_feldweg_mode == "simple" or cottages_feldweg_mode == "flat" ) then minetest.register_node("cottages:feldweg", { @@ -28,7 +69,7 @@ if( cottages_feldweg_mode == "simple" or cottages_feldweg_mode == "flat" ) then groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, }) end @@ -47,7 +88,7 @@ if( cottages_feldweg_mode == "flat" ) then groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, }) @@ -58,7 +99,7 @@ if( cottages_feldweg_mode == "flat" ) then groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, }) @@ -69,10 +110,11 @@ if( cottages_feldweg_mode == "flat" ) then groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, }) - + + register_recipes(false) -- -- cube-style nodebox version -- @@ -84,7 +126,7 @@ elseif( cottages_feldweg_mode == "nodebox" ) then roups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, drawtype = "nodebox", -- top, bottom, side1, side2, inner, outer @@ -116,7 +158,7 @@ elseif( cottages_feldweg_mode == "nodebox" ) then groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, drawtype = "nodebox", @@ -162,7 +204,7 @@ elseif( cottages_feldweg_mode == "nodebox" ) then groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, drawtype = "nodebox", @@ -206,7 +248,7 @@ elseif( cottages_feldweg_mode == "nodebox" ) then groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, drawtype = "nodebox", @@ -243,6 +285,8 @@ elseif( cottages_feldweg_mode == "nodebox" ) then }, }) + register_recipes(false) + -- -- the mesh version (rounded); provided and created by VanessaE @@ -256,7 +300,7 @@ elseif( cottages_feldweg_mode == "mesh" ) then groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png", @@ -274,7 +318,7 @@ elseif( cottages_feldweg_mode == "mesh" ) then groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, tiles = {"cottages_feldweg_end.png","default_dirt.png", "default_grass.png","cottages_feldweg_surface.png", @@ -284,13 +328,15 @@ elseif( cottages_feldweg_mode == "mesh" ) then mesh = "feldweg-crossing.obj", }) + + minetest.register_node("cottages:feldweg_t_junction", { description = S("dirt road t junction"), paramtype2 = "facedir", groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png","cottages_feldweg_surface.png", @@ -299,6 +345,8 @@ elseif( cottages_feldweg_mode == "mesh" ) then drawtype = "mesh", mesh = "feldweg-T-junction.obj", }) + + minetest.register_node("cottages:feldweg_curve", { description = S("dirt road curve"), @@ -306,7 +354,7 @@ elseif( cottages_feldweg_mode == "mesh" ) then groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, tiles = {"default_dirt.png^default_grass_side.png","default_grass.png", "default_dirt.png^default_grass_side.png","cottages_feldweg_surface.png", @@ -316,13 +364,15 @@ elseif( cottages_feldweg_mode == "mesh" ) then mesh = "feldweg-curve.obj", }) + + minetest.register_node("cottages:feldweg_end", { description = S("dirt road end"), paramtype2 = "facedir", groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png", @@ -332,6 +382,11 @@ elseif( cottages_feldweg_mode == "mesh" ) then drawtype = "mesh", mesh = "feldweg_end.obj", }) + + + register_recipes(true) + + end @@ -342,7 +397,7 @@ if( minetest.get_modpath("stairs") and stairs and stairs.register_stair_and_slab {"cottages_feldweg.png","default_dirt.png", "default_grass.png","default_grass.png","cottages_feldweg.png","cottages_feldweg.png"}, S("Dirt Road Stairs"), S("Dirt Road, half height"), - default.node_sound_dirt_defaults) + cottages.sounds.dirt) end if( cottages_feldweg_mode == "nodebox" or cottages_feldweg_mode == "mesh" ) then @@ -371,7 +426,7 @@ if( cottages_feldweg_mode == "nodebox" or cottages_feldweg_mode == "mesh" ) then groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png", @@ -385,13 +440,15 @@ if( cottages_feldweg_mode == "nodebox" or cottages_feldweg_mode == "mesh" ) then selection_box = box_slope, }) + + minetest.register_node("cottages:feldweg_slope_long", { description = S("dirt road slope long"), paramtype2 = "facedir", groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png", @@ -403,4 +460,21 @@ if( cottages_feldweg_mode == "nodebox" or cottages_feldweg_mode == "mesh" ) then collision_box = box_slope_long, selection_box = box_slope_long, }) + + + minetest.register_craft({ + output = "cottages:feldweg_slope 3", + recipe = { + {"cottages:feldweg", "", "" }, + {"cottages:feldweg", "cottages:feldweg", ""} + }, + }) + + minetest.register_craft({ + output = "cottages:feldweg_slope_long 4", + recipe = { + {"cottages:feldweg", "", "" }, + {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"} + }, + }) end diff --git a/cottages/nodes_furniture.lua b/cottages/nodes_furniture.lua index 056c8d7..5705c76 100644 --- a/cottages/nodes_furniture.lua +++ b/cottages/nodes_furniture.lua @@ -23,7 +23,7 @@ minetest.register_node("cottages:bed_foot", { paramtype = "light", paramtype2 = "facedir", groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, - sounds = default.node_sound_wood_defaults, + sounds = cottages.sounds.wood, node_box = { type = "fixed", fixed = { @@ -58,7 +58,7 @@ minetest.register_node("cottages:bed_head", { paramtype = "light", paramtype2 = "facedir", groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, - sounds = default.node_sound_wood_defaults, + sounds = cottages.sounds.wood, node_box = { type = "fixed", fixed = { @@ -99,7 +99,7 @@ minetest.register_node("cottages:sleeping_mat", { paramtype2 = "facedir", walkable = false, groups = { snappy = 3 }, - sounds = default.node_sound_leaves_defaults, + sounds = cottages.sounds.leaves, selection_box = { type = "wallmounted", }, @@ -133,7 +133,7 @@ minetest.register_node("cottages:sleeping_mat_head", { paramtype = 'light', paramtype2 = "facedir", groups = { snappy = 3 }, - sounds = default.node_sound_leaves_defaults, + sounds = cottages.sounds.leaves, node_box = { type = "fixed", fixed = { @@ -162,7 +162,7 @@ minetest.register_node("cottages:bench", { paramtype = "light", paramtype2 = "facedir", groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, - sounds = default.node_sound_wood_defaults, + sounds = cottages.sounds.wood, node_box = { type = "fixed", fixed = { diff --git a/cottages/nodes_hay.lua b/cottages/nodes_hay.lua new file mode 100644 index 0000000..3d1f8b0 --- /dev/null +++ b/cottages/nodes_hay.lua @@ -0,0 +1,135 @@ +-- contains hay_mat, hay and hay bale +-- (gives the pitchfork some work) +-- +local S = cottages.S + +-- If default:dirt_with_grass is digged while wielding a pitchfork, it will +-- turn into dirt and get some hay placed above it. +-- The hay will disappear (decay) after a couple of minutes. +if( minetest.registered_items["default:dirt_with_grass"] + and minetest.registered_tools["cottages:pitchfork"]) then + minetest.override_item("default:dirt_with_grass", { + after_dig_node = function(pos, oldnode, oldmetadata, digger) + if( not( pos ) or not( digger )) then + return + end + local wielded = digger:get_wielded_item() + if( not( wielded ) + or not( wielded:get_name() ) + or (wielded:get_name()~="cottages:pitchfork")) then + return + end + + local pos_above = {x=pos.x, y=pos.y+1, z=pos.z} + local node_above = minetest.get_node_or_nil( pos_above) + if( not(node_above) or not(node_above.name) or node_above.name ~= "air" ) then + return nil + end + minetest.swap_node( pos, {name="default:dirt"}) + minetest.add_node( pos_above, {name="cottages:hay_mat", param2=math.random(2,25)}) + -- start a node timer so that the hay will decay after some time + local timer = minetest.get_node_timer(pos_above) + if not timer:is_started() then + timer:start(math.random(60, 300)) + end + -- TODO: prevent dirt from beeing multiplied this way (that is: give no dirt!) + return + end, + }) +end + + + +-- more comparable to the straw mat than to a hay bale +-- (can be created by digging dirt with grass with the pitchfork) +minetest.register_node("cottages:hay_mat", { + drawtype = "nodebox", + paramtype2 = "leveled", + description = S("Some hay"), + tiles = {cottages.straw_texture.."^[multiply:#88BB88"}, + groups = {hay=3, snappy=2, oddly_breakable_by_hand=2, flammable=3}, + sounds = cottages.sounds.leaves, + -- the bale is slightly smaller than a full node + is_ground_content = false, + node_box = { + type = "leveled", --"fixed", + fixed = { + {-0.5,-0.5,-0.5, 0.5, 0.5, 0.5}, + } + }, + -- make sure a placed hay block looks halfway reasonable + after_place_node = function(pos, placer, itemstack, pointed_thing) + minetest.swap_node( pos, {name="cottages:hay_mat", param2=math.random(2,25)}) + end, + on_timer = function(pos, elapsed) + local node = minetest.get_node(pos) + if( node and node.name=="cottages:hay_mat") then + minetest.remove_node(pos) + minetest.check_for_falling(pos) + end + end, +}) + +-- hay block, similar to straw block +minetest.register_node("cottages:hay", { + description = S("Hay"), + tiles = {cottages.straw_texture.."^[multiply:#88BB88"}, + groups = {hay=3, snappy=2, oddly_breakable_by_hand=2, flammable=3}, + sounds = cottages.sounds.leaves, + is_ground_content = false, +}) + + +-- hay bales for hungry animals +minetest.register_node("cottages:hay_bale", { + drawtype = "nodebox", + description = S("Hay bale"), + tiles = {"cottages_darkage_straw_bale.png^[multiply:#88BB88"}, + paramtype = "light", + groups = {hay=3, snappy=2, oddly_breakable_by_hand=2, flammable=3}, + sounds = cottages.sounds.leaves, + -- the bale is slightly smaller than a full node + node_box = { + type = "fixed", + fixed = { + {-0.45, -0.5,-0.45, 0.45, 0.45, 0.45}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-0.45, -0.5,-0.45, 0.45, 0.45, 0.45}, + } + }, + is_ground_content = false, +}) + + +-- +-- craft recipes +-- +minetest.register_craft({ + output = "cottages:hay_mat 9", + recipe = { + {"cottages:hay"}, + }, +}) + +minetest.register_craft({ + output = "cottages:hay", + recipe = { + {"cottages:hay_mat", "cottages:hay_mat", "cottages:hay_mat"}, + {"cottages:hay_mat", "cottages:hay_mat", "cottages:hay_mat"}, + {"cottages:hay_mat", "cottages:hay_mat", "cottages:hay_mat"}, + }, +}) + +minetest.register_craft({ + output = "cottages:hay", + recipe = {{"cottages:hay_bale"}}, +}) + +minetest.register_craft({ + output = "cottages:hay_bale", + recipe = {{"cottages:hay"}}, +}) diff --git a/cottages/nodes_historic.lua b/cottages/nodes_historic.lua index 90e48c4..af8aa3a 100644 --- a/cottages/nodes_historic.lua +++ b/cottages/nodes_historic.lua @@ -27,7 +27,6 @@ minetest.register_node("cottages:wagon_wheel", { }, groups = {choppy=2,dig_immediate=2,attached_node=1}, legacy_wallmounted = true, - sounds = default.node_sound_defaults, is_ground_content = false, }) @@ -38,7 +37,7 @@ minetest.register_node("cottages:loam", { tiles = {"cottages_loam.png"}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.dirt, is_ground_content = false, }) @@ -50,7 +49,7 @@ if( minetest.get_modpath("stairs") and stairs and stairs.register_stair_and_slab {"cottages_loam.png"}, S("Loam Stairs"), S("Loam Slab"), - default.node_sound_dirt_defaults) + cottages.sounds.dirt) if( minetest.registered_nodes["default:clay"]) then stairs.register_stair_and_slab("clay", "default:clay", @@ -58,7 +57,7 @@ if( minetest.get_modpath("stairs") and stairs and stairs.register_stair_and_slab {"cottages_clay.png"}, S("Clay Stairs"), S("Clay Slab"), - default.node_sound_dirt_defaults) + cottages.sounds.dirt) end end @@ -67,10 +66,10 @@ end -- right now, this block mostly serves as a placeholder minetest.register_node("cottages:straw_ground", { description = S("straw ground for animals"), - tiles = {"cottages_darkage_straw.png","cottages_loam.png","cottages_loam.png","cottages_loam.png","cottages_loam.png","cottages_loam.png"}, + tiles = {cottages.straw_texture,"cottages_loam.png","cottages_loam.png","cottages_loam.png","cottages_loam.png","cottages_loam.png"}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults, + sounds = cottages.sounds.leaves, is_ground_content = false, }) @@ -179,12 +178,16 @@ minetest.register_node("cottages:wool_tent", { }) -- a fallback for cases in which there is no wool -minetest.register_node("cottages:wool", { +if( not( minetest.registered_nodes["wool:white"])) then + minetest.register_node("cottages:wool", { description = "Wool", tiles = {"cottages_wool.png"}, is_ground_content = false, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3,wool=1}, -}) + }) +else + minetest.register_alias("cottages:wool", "wool:white") +end --------------------------------------------------------------------------------------- diff --git a/cottages/nodes_mining.lua b/cottages/nodes_mining.lua index b33ec3d..2098afe 100644 --- a/cottages/nodes_mining.lua +++ b/cottages/nodes_mining.lua @@ -31,7 +31,7 @@ minetest.register_node("cottages:rope", { minetest.register_craft({ output = "cottages:rope", recipe = { - {"default:cotton","default:cotton","default:cotton"} + {"farming:cotton","farming:cotton","farming:cotton"} } }) @@ -54,7 +54,7 @@ minetest.register_node("cottages:ladder_with_rope_and_rail", { }, groups = {choppy=2,oddly_breakable_by_hand=3,rail=1,connect_to_raillike=1}, --connect_to_raillike=minetest.raillike_group("rail")}, legacy_wallmounted = true, - sounds = default.node_sound_wood_defaults, + sounds = cottages.sounds.wood, }) diff --git a/cottages/nodes_pitchfork.lua b/cottages/nodes_pitchfork.lua new file mode 100644 index 0000000..666393a --- /dev/null +++ b/cottages/nodes_pitchfork.lua @@ -0,0 +1,114 @@ + +local S = cottages.S + +-- fast tool for digging nodes with the group "hay"; +-- can also be placed as a node + +-- the straw node from default and similar nodes can be digged with the pitchfork as well +local add_hay_group = {"farming:straw", "dryplants:reed", "darkage:straw_bale"} +for i, v in ipairs(add_hay_group) do + if( minetest.registered_items[v]) then + new_groups = minetest.registered_items[v].groups + new_groups.hay = 3 + minetest.override_item(v, {groups = new_groups}) + end +end + +-- creates hay when digging dirt_with_grass (thanks to the override above); +-- useful for digging hay and straw +-- can be placed as a node +minetest.register_tool("cottages:pitchfork", { + description = S("pitchfork (dig dirt with grass to get hay, place with right-click)"), + groups = {}, + inventory_image = "cottages_pitchfork.png", + wield_image = "cottages_pitchfork.png^[transformFYR180", + wield_scale = {x=1.5,y=1.5,z=0.5}, + stack_max = 1, + liquids_pointable = false, + -- very useful for digging hay, straw and bales of those materials + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + fleshy={times={[2]=0.80, [3]=0.40}, maxwear=0.05, maxlevel=1, uses=40}, + snappy={times={[2]=0.80, [3]=0.40}, maxwear=0.05, maxlevel=1, uses=40}, + hay ={times={[2]=0.10, [3]=0.10}, maxwear=0.05, maxlevel=1, uses=40}, + }, + damage_groups = {fleshy=5}, -- slightly stronger than a stone sword + }, + sound = {breaks = "default_tool_breaks"}, + -- place the pitchfork somewhere + on_place = function(itemstack, placer, pointed_thing) + if( placer == nil or pointed_thing == nil or pointed_thing.type ~= "node") then + return nil + end + local pos = minetest.get_pointed_thing_position( pointed_thing, 1 ) + local node = minetest.get_node_or_nil( pos ) + if( node == nil or not(node.name) or node.name ~= "air") then + return nil + end + if minetest.is_protected(pos, placer:get_player_name()) then + return nil + end + minetest.rotate_and_place(ItemStack("cottages:pitchfork_placed"), placer, pointed_thing) + -- did the placing succeed? + local nnode = minetest.get_node(pos) + if( not(nnode) or not(nnode.name) or nnode.name ~= "cottages:pitchfork_placed") then + return nil + end + local meta = minetest.get_meta(pos) + meta:set_int( "wear", itemstack:get_wear()) + meta:set_string("infotext", S("pitchfork (for hay and straw)")) + -- the tool has been placed; consume it + return ItemStack("") + end, +}) + + +-- a ptichfork placed somewhere +minetest.register_node("cottages:pitchfork_placed", { + description = S("pitchfork (for hay and straw)"), + tiles = {"default_wood.png^[transformR90"}, --default_tree.png"}, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + groups = {snappy = 2, dig_immediate = 3, falling_node = 1, attached_node = 1}, + sounds = cottages.sounds.wood, + node_box = { + type = "fixed", + fixed = { + -- handle (goes a bit into the ground) + { -(1/32), -(11/16), -(1/32), (1/32), 16/16, (1/32)}, + -- middle connection + { -(7/32), -(4/16), -(1/32), (7/32), -(2/16), (1/32)}, + -- thongs + { -(7/32), -(11/16), -(1/32), -(5/32), -(4/16), (1/32)}, + { (5/32), -(11/16), -(1/32), (7/32), -(4/16), (1/32)}, + }, + }, + selection_box = { + type = "fixed", + fixed = { -0.3, -0.5, -0.1, 0.3, 1.0, 0.1 } + }, + drop = "cottages:pitchfork", + -- perserve wear + preserve_metadata = function(pos, oldnode, oldmeta, drops) + if(oldmeta["wear"]) then + -- the first drop is the pitchfork + drops[1]:set_wear(oldmeta["wear"]) + end + end, +}) + +-- +-- craft recipes +-- +minetest.register_craft({ + output = 'cottages:pitchfork', + recipe = { + { 'default:stick','default:stick','default:stick' }, + { '','default:stick', '' }, + { '','default:stick','' }, + } +}) diff --git a/cottages/nodes_roof.lua b/cottages/nodes_roof.lua index 9503e86..240f94f 100644 --- a/cottages/nodes_roof.lua +++ b/cottages/nodes_roof.lua @@ -36,7 +36,8 @@ cottages.register_roof = function( name, tiles, basic_material, homedecor_altern }) -- a better roof than the normal stairs; this one is for usage directly on top of walls (it has the form of a stair) - minetest.register_node("cottages:roof_connector_"..name, { + if( name~="straw" or not(minetest.registered_nodes["stairs:stair_straw"]) or not(cottages.use_farming_straw_stairs)) then + minetest.register_node("cottages:roof_connector_"..name, { description = S("Roof connector "..name), drawtype = "nodebox", -- top, bottom, side1, side2, inner, outer @@ -60,9 +61,13 @@ cottages.register_roof = function( name, tiles, basic_material, homedecor_altern }, is_ground_content = false, }) + else + minetest.register_alias("cottages:roof_connector_straw", "stairs:stair_straw") + end -- this one is the slab version of the above roof - minetest.register_node("cottages:roof_flat_"..name, { + if( name~="straw" or not(minetest.registered_nodes["stairs:slab_straw"]) or not(cottages.use_farming_straw_stairs)) then + minetest.register_node("cottages:roof_flat_"..name, { description = S("Roof (flat) "..name), drawtype = "nodebox", -- top, bottom, side1, side2, inner, outer @@ -85,6 +90,9 @@ cottages.register_roof = function( name, tiles, basic_material, homedecor_altern }, is_ground_content = false, }) + else + minetest.register_alias("cottages:roof_flat_straw", "stairs:slab_straw") + end if( not( homedecor_alternative ) @@ -147,9 +155,9 @@ end -- of cottages.register_roof( name, tiles, basic_material ) -- add the diffrent roof types --------------------------------------------------------------------------------------- cottages.register_roof( 'straw', - {"cottages_darkage_straw.png","cottages_darkage_straw.png", - "cottages_darkage_straw.png","cottages_darkage_straw.png", - "cottages_darkage_straw.png","cottages_darkage_straw.png"}, + {cottages.straw_texture, cottages.straw_texture, + cottages.straw_texture, cottages.straw_texture, + cottages.straw_texture, cottages.straw_texture}, 'cottages:straw_mat', nil ); cottages.register_roof( 'reet', {"cottages_reet.png","cottages_reet.png", @@ -191,7 +199,7 @@ minetest.register_node("cottages:slate_vertical", { tiles = {"cottages_slate.png",cottages.texture_roof_sides,"cottages_slate.png","cottages_slate.png",cottages.texture_roof_sides,"cottages_slate.png"}, paramtype2 = "facedir", groups = {cracky=2, stone=1}, - sounds = default.node_sound_stone_defaults, + sounds = cottages.sounds.stone, is_ground_content = false, }) @@ -208,8 +216,8 @@ minetest.register_craft({ minetest.register_node("cottages:reet", { description = S("Reet for thatching"), tiles = {"cottages_reet.png"}, - groups = {snappy=3,choppy=3,oddly_breakable_by_hand=3,flammable=3}, - sounds = default.node_sound_wood_defaults, + groups = {hay = 3, snappy=3,choppy=3,oddly_breakable_by_hand=3,flammable=3}, + sounds = cottages.sounds.leaves, is_ground_content = false, }) diff --git a/cottages/nodes_straw.lua b/cottages/nodes_straw.lua index c19b869..d26f6b8 100644 --- a/cottages/nodes_straw.lua +++ b/cottages/nodes_straw.lua @@ -6,33 +6,21 @@ local S = cottages.S -local cottages_can_use = function( meta, player ) - if( not( player) or not( meta )) then - return false; - end - local pname = player:get_player_name(); - local owner = meta:get_string('owner' ); - if( not(owner) or owner=="" or owner==pname ) then - return true; - end - return false; -end - -- an even simpler from of bed - usually for animals -- it is a nodebox and not wallmounted because that makes it easier to replace beds with straw mats minetest.register_node("cottages:straw_mat", { description = S("layer of straw"), drawtype = 'nodebox', - tiles = { 'cottages_darkage_straw.png' }, -- done by VanessaE - wield_image = 'cottages_darkage_straw.png', - inventory_image = 'cottages_darkage_straw.png', + tiles = { cottages.straw_texture }, -- done by VanessaE + wield_image = cottages.straw_texture, + inventory_image = cottages.straw_texture, sunlight_propagates = true, paramtype = 'light', paramtype2 = "facedir", walkable = false, - groups = { snappy = 3 }, - sounds = default.node_sound_leaves_defaults, + groups = { hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable=3 }, + sounds = cottages.sounds.leaves, node_box = { type = "fixed", fixed = { @@ -57,8 +45,8 @@ minetest.register_node("cottages:straw_bale", { description = S("straw bale"), tiles = {"cottages_darkage_straw_bale.png"}, paramtype = "light", - groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, - sounds = default.node_sound_wood_defaults, + groups = { hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable=3 }, + sounds = cottages.sounds.leaves, -- the bale is slightly smaller than a full node node_box = { type = "fixed", @@ -76,21 +64,26 @@ minetest.register_node("cottages:straw_bale", { }) -- just straw -minetest.register_node("cottages:straw", { +if( not(minetest.registered_nodes["farming:straw"])) then + minetest.register_node("cottages:straw", { drawtype = "normal", description = S("straw"), - tiles = {"cottages_darkage_straw.png"}, - groups = {snappy=3,choppy=3,oddly_breakable_by_hand=3,flammable=3}, - sounds = default.node_sound_wood_defaults, + tiles = {cottages.straw_texture}, + groups = { hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable=3 }, + sounds = cottages.sounds.leaves, -- the bale is slightly smaller than a full node is_ground_content = false, -}) + }) +else + minetest.register_alias("cottages:straw", "farming:straw") +end local cottages_formspec_treshing_floor = "size[8,8]".. "image[1.5,0;1,1;"..cottages.texture_stick.."]".. "image[0,1;1,1;farming_wheat.png]".. + "button_exit[6.8,0.0;1.5,0.5;public;"..S("Public?").."]".. "list[current_name;harvest;1,1;2,1;]".. "list[current_name;straw;5,0;2,2;]".. "list[current_name;seeds;5,2;2,2;]".. @@ -109,7 +102,8 @@ minetest.register_node("cottages:threshing_floor", { tiles = {"cottages_junglewood.png^farming_wheat.png","cottages_junglewood.png","cottages_junglewood.png^"..cottages.texture_stick}, paramtype = "light", paramtype2 = "facedir", - groups = {cracky=2}, + -- can be digged with axe and pick + groups = {cracky=2, choppy=2}, is_ground_content = false, node_box = { type = "fixed", @@ -131,23 +125,29 @@ minetest.register_node("cottages:threshing_floor", { }, on_construct = function(pos) local meta = minetest.get_meta(pos); - meta:set_string("infotext", S("Threshing floor")); + meta:set_string("infotext", S("Public threshing floor")); local inv = meta:get_inventory(); inv:set_size("harvest", 2); inv:set_size("straw", 4); inv:set_size("seeds", 4); meta:set_string("formspec", cottages_formspec_treshing_floor ); + meta:set_string("public", "public") end, after_place_node = function(pos, placer) local meta = minetest.get_meta(pos); meta:set_string("owner", placer:get_player_name() or ""); - meta:set_string("infotext", S("Threshing floor (owned by %s)"):format(meta:get_string("owner") or "")); + meta:set_string("infotext", S("Private threshing floor (owned by %s)"):format(meta:get_string("owner") or "")); meta:set_string("formspec", cottages_formspec_treshing_floor.. "label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string("owner") or "").."]" ); + meta:set_string("public", "private") end, + on_receive_fields = function(pos, formname, fields, sender) + cottages.switch_public(pos, formname, fields, sender, 'threshing floor') + end, + can_dig = function(pos,player) local meta = minetest.get_meta(pos); @@ -167,7 +167,7 @@ minetest.register_node("cottages:threshing_floor", { allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) local meta = minetest.get_meta(pos) - if( not( cottages_can_use( meta, player ))) then + if( not( cottages.player_can_use( meta, player ))) then return 0 end return count; @@ -182,7 +182,7 @@ minetest.register_node("cottages:threshing_floor", { return 0; end - if( not( cottages_can_use( meta, player ))) then + if( not( cottages.player_can_use( meta, player ))) then return 0 end return stack:get_count() @@ -190,7 +190,7 @@ minetest.register_node("cottages:threshing_floor", { allow_metadata_inventory_take = function(pos, listname, index, stack, player) local meta = minetest.get_meta(pos) - if( not( cottages_can_use( meta, player ))) then + if( not( cottages.player_can_use( meta, player ))) then return 0 end return stack:get_count() @@ -243,7 +243,7 @@ minetest.register_node("cottages:threshing_floor", { end local overlay1 = "^farming_wheat.png"; - local overlay2 = "^cottages_darkage_straw.png"; + local overlay2 = "^"..cottages.straw_texture; local overlay3 = "^"..cottages.texture_wheat_seed; -- this can be enlarged by a multiplicator if desired @@ -348,6 +348,7 @@ minetest.register_node("cottages:threshing_floor", { local cottages_handmill_formspec = "size[8,8]".. "image[0,1;1,1;"..cottages.texture_wheat_seed.."]".. + "button_exit[6.0,0.0;1.5,0.5;public;"..S("Public?").."]".. "list[current_name;seeds;1,1;1,1;]".. "list[current_name;flour;5,1;2,2;]".. "label[0,0.5;"..S("Wheat seeds:").."]".. @@ -380,22 +381,28 @@ minetest.register_node("cottages:handmill", { }, on_construct = function(pos) local meta = minetest.get_meta(pos); - meta:set_string("infotext", S("Mill, powered by punching")); + meta:set_string("infotext", S("Public mill, powered by punching")); local inv = meta:get_inventory(); inv:set_size("seeds", 1); inv:set_size("flour", 4); meta:set_string("formspec", cottages_handmill_formspec ); + meta:set_string("public", "public") end, after_place_node = function(pos, placer) local meta = minetest.get_meta(pos); meta:set_string("owner", placer:get_player_name() or ""); - meta:set_string("infotext", S("Mill, powered by punching (owned by %s)"):format(meta:get_string("owner") or "")); + meta:set_string("infotext", S("Private mill, powered by punching (owned by %s)"):format(meta:get_string("owner") or "")); meta:set_string("formspec", cottages_handmill_formspec.. "label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]" ); + meta:set_string("public", "private") end, + on_receive_fields = function(pos, formname, fields, sender) + cottages.switch_public(pos, formname, fields, sender, 'mill, powered by punching') + end, + can_dig = function(pos,player) local meta = minetest.get_meta(pos); @@ -414,7 +421,7 @@ minetest.register_node("cottages:handmill", { allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) local meta = minetest.get_meta(pos) - if( not( cottages_can_use( meta, player ))) then + if( not( cottages.player_can_use( meta, player ))) then return 0 end return count; @@ -428,7 +435,7 @@ minetest.register_node("cottages:handmill", { return 0; end - if( not( cottages_can_use( meta, player ))) then + if( not( cottages.player_can_use( meta, player ))) then return 0 end return stack:get_count() @@ -436,7 +443,7 @@ minetest.register_node("cottages:handmill", { allow_metadata_inventory_take = function(pos, listname, index, stack, player) local meta = minetest.get_meta(pos) - if( not( cottages_can_use( meta, player ))) then + if( not( cottages.player_can_use( meta, player ))) then return 0 end return stack:get_count() diff --git a/cottages/nodes_water.lua b/cottages/nodes_water.lua new file mode 100644 index 0000000..1cfe77d --- /dev/null +++ b/cottages/nodes_water.lua @@ -0,0 +1,312 @@ + +-- TODO: play sound while working +-- TODO: play sound when emptying a bucket +-- TODO: store correct bucket texture when loading the world anew +-- TODO: show particles when running? distinguish between running/idle state? (with punch?) + +-- well for getting water +-- * has some storage space for buckets (filled with water, river water or empty) +-- * only the owner can use the bucket store and the well +-- * the bucket will be added as an entity and slowly rotate; +-- once filled, the texture of the bucket is changed +-- * full (water or river water) buckets can be emptied +-- * by default public; but can also be made private + + +-- how many seconds does it take to fill a bucket? +cottages.water_fill_time = 10 + + +-- code taken from the itemframes mod in homedecor +-- (the relevant functions are sadly private there and thus cannot be reused) +local tmp = {} +minetest.register_entity("cottages:bucket_entity",{ + hp_max = 1, + visual="wielditem", + visual_size={x = 0.33, y = 0.33}, + collisionbox = {0, 0, 0, 0, 0, 0}, + physical = false, + textures = {"air"}, + on_activate = function(self, staticdata) + if tmp.nodename ~= nil and tmp.texture ~= nil then + self.nodename = tmp.nodename + tmp.nodename = nil + self.texture = tmp.texture + tmp.texture = nil + else + if staticdata ~= nil and staticdata ~= "" then + local data = staticdata:split(';') + if data and data[1] and data[2] then + self.nodename = data[1] + self.texture = data[2] + end + end + end + if self.texture ~= nil then + self.object:set_properties({textures = {self.texture}}) + end + self.object:set_properties({automatic_rotate = 1}) + if self.texture ~= nil and self.nodename ~= nil then + local entity_pos = vector.round(self.object:get_pos()) + local objs = minetest.get_objects_inside_radius(entity_pos, 0.5) + for _, obj in ipairs(objs) do + if obj ~= self.object and + obj:get_luaentity() and + obj:get_luaentity().name == "cottages:bucket_entity" and + obj:get_luaentity().nodename == self.nodename and + obj:get_properties() and + obj:get_properties().textures and + obj:get_properties().textures[1] == self.texture then + minetest.log("action","[cottages] Removing extra " .. + self.texture .. " found in " .. self.nodename .. " at " .. + minetest.pos_to_string(entity_pos)) + self.object:remove() + break + end + end + end + end, + get_staticdata = function(self) + if self.nodename ~= nil and self.texture ~= nil then + return self.nodename .. ';' .. self.texture + end + return "" + end, +}) + +cottages.water_gen_fill_bucket = function(pos) + if( not(pos)) then + return + end + local meta = minetest.get_meta(pos) + local bucket = meta:get_string("bucket") + -- nothing to do + if( not(bucket) or bucket ~= "bucket:bucket_empty") then + return + end + -- abort if the water has not been running long enough + -- (the player may have removed a bucket before it was full) + start = meta:get_string("fillstarttime") + if( (minetest.get_us_time()/1000000) - tonumber(start) < cottages.water_fill_time -2) then + return + end + + -- the bucket has been filled + meta:set_string("bucket", "bucket:bucket_river_water") + + -- change the texture of the bucket to that of one filled with river water + local objs = nil + objs = minetest.get_objects_inside_radius(pos, .5) + if objs then + for _, obj in ipairs(objs) do + if obj and obj:get_luaentity() and obj:get_luaentity().name == "cottages:bucket_entity" then + obj:set_properties( { textures = { "bucket:bucket_river_water" }}) + obj:get_luaentity().nodename = "bucket:bucket_river_water" + obj:get_luaentity().texture = "bucket:bucket_river_water" + end + end + end +end + + +minetest.register_node("cottages:water_gen", { + description = "Tree Trunk Well", + tiles = {"default_tree_top.png", "default_tree.png^[transformR90", "default_tree.png^[transformR90"}, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = cottages.sounds.wood, + node_box = { + type = "fixed", + fixed = { + -- floor of water bassin + {-0.5, -0.5+(3/16), -0.5, 0.5, -0.5+(4/16), 0.5}, + -- walls + {-0.5, -0.5+(3/16), -0.5, 0.5, (4/16), -0.5+(2/16)}, + {-0.5, -0.5+(3/16), -0.5, -0.5+(2/16), (4/16), 0.5}, + { 0.5, -0.5+(3/16), 0.5, 0.5-(2/16), (4/16), -0.5}, + { 0.5, -0.5+(3/16), 0.5, -0.5+(2/16), (4/16), 0.5-(2/16)}, + -- feet + {-0.5+(3/16), -0.5, -0.5+(3/16), -0.5+(6/16), -0.5+(3/16), 0.5-(3/16)}, + { 0.5-(3/16), -0.5, -0.5+(3/16), 0.5-(6/16), -0.5+(3/16), 0.5-(3/16)}, + -- real pump + { 0.5-(4/16), -0.5, -(2/16), 0.5, 0.5+(4/16), (2/16)}, + -- water pipe inside wooden stem + { 0.5-(8/16), 0.5+(1/16), -(1/16), 0.5, 0.5+(3/16), (1/16)}, + -- where the water comes out + { 0.5-(15/32), 0.5, -(1/32), 0.5-(12/32), 0.5+(1/16), (1/32)}, + }, + }, + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.5+(4/16), 0.5 } + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + local spos = pos.x .. "," .. pos.y .. "," .. pos.z + meta:set_string("formspec", + "size[8,9]" .. + "label[3.0,0.0;Tree trunk well]".. + "label[1.5,0.7;Punch the well while wielding an empty bucket.]".. + "label[1.5,1.0;Your bucket will slowly be filled with river water.]".. + "label[1.5,1.3;Punch again to get the bucket back when it is full.]".. + "label[1.0,2.9;Internal bucket storage (passive storage only):]".. + "item_image[0.2,0.7;1.0,1.0;bucket:bucket_empty]".. + "item_image[0.2,1.7;1.0,1.0;bucket:bucket_river_water]".. + "label[1.5,1.9;Punch well with full water bucket in order to empty bucket.]".. + "button_exit[6.0,0.0;2,0.5;public;"..S("Public?").."]".. + "list[nodemeta:" .. spos .. ";main;1,3.3;8,1;]" .. + "list[current_player;main;0,4.85;8,1;]" .. + "list[current_player;main;0,6.08;8,3;8]" .. + "listring[nodemeta:" .. spos .. ";main]" .. + "listring[current_player;main]") + local inv = meta:get_inventory() + inv:set_size('main', 6) + meta:set_string("infotext", S("Public tree trunk well")) -- (punch with empty bucket to fill bucket)") + end, + after_place_node = function(pos, placer) + local meta = minetest.get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", S("Public tree trunk well (owned by %s)"):format(meta:get_string("owner"))) + -- no bucket loaded + meta:set_string("bucket", "") + meta:set_string("public", "public") + end, + can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") and + default.can_interact_with_node(player, pos) + end, + -- no inventory move allowed + allow_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + return 0 + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + if not(stack) or not cottages.player_can_use(meta, player) then + return 0 + end + local inv = meta:get_inventory() + -- only for buckets + local sname = stack:get_name() + if( sname ~= "bucket:bucket_empty" + and sname ~= "bucket:bucket_water" + and sname ~= "bucket:bucket_river_water") then + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + if not(cottages.player_can_use(meta:get_string(pos), player)) then + return 0 + end + return stack:get_count() + end, + on_blast = function() end, + on_receive_fields = function(pos, formname, fields, sender) + cottages.switch_public(pos, formname, fields, sender, 'tree trunk well') + end, + -- punch to place and retrieve bucket + on_punch = function(pos, node, puncher) + if( not( pos ) or not( node ) or not( puncher )) then + return + end + -- only the owner can use the well + local name = puncher:get_player_name() + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + local public = meta:get_string("public") + if( name ~= owner and public~="public") then + minetest.chat_send_player( name, S("This tree trunk well is owned by %s. You can't use it."):format(name)) + return + end + + -- we will either add or take from the players inventory + local pinv = puncher:get_inventory() + + -- is the well working on something? (either empty or full bucket) + local bucket = meta:get_string("bucket") + -- there is a bucket loaded - either empty or full + if( bucket and bucket~="") then + if( not(pinv:room_for_item("main", bucket))) then + minetest.chat_send_player( puncher:get_player_name(), + S("Sorry. You have no room for the bucket. Please free some ".. + "space in your inventory first!")) + return + end + end + + -- remove the old entity (either a bucket will be placed now or a bucket taken) + local objs = nil + objs = minetest.get_objects_inside_radius(pos, .5) + if objs then + for _, obj in ipairs(objs) do + if obj and obj:get_luaentity() and obj:get_luaentity().name == "cottages:bucket_entity" then + obj:remove() + end + end + end + + -- the player gets the bucket (either empty or full) into his inventory + if( bucket and bucket ~= "") then + pinv:add_item("main", bucket ) + meta:set_string("bucket", "") + -- we are done + return + end + + -- punching with empty bucket will put that bucket into the well (as an entity) + -- and will slowly fill it + local wielded = puncher:get_wielded_item() + if( wielded + and wielded:get_name() + and wielded:get_name() == "bucket:bucket_empty") then + -- remove the bucket from the players inventory + pinv:remove_item( "main", "bucket:bucket_empty") + -- remember that we got a bucket loaded + meta:set_string("bucket", "bucket:bucket_empty") + -- create the entity + tmp.nodename = "bucket:bucket_empty" + -- TODO: add a special texture with a handle for the bucket here + tmp.texture = "bucket:bucket_empty" + local e = minetest.add_entity({x=pos.x,y=pos.y+(4/16),z=pos.z},"cottages:bucket_entity") + -- fill the bucket with water + minetest.after(cottages.water_fill_time, cottages.water_gen_fill_bucket, pos) + -- the bucket will only be filled if the water ran long enough + meta:set_string("fillstarttime", tostring(minetest.get_us_time()/1000000)) + return; + end + -- buckets can also be emptied here + if( wielded + and wielded:get_name() + and (wielded:get_name() == "bucket:bucket_water" + or wielded:get_name() == "bucket:bucket_river_water") + and (pinv:room_for_item("main", "bucket:bucket_empty"))) then + -- remove the full bucket from the players inventory + pinv:remove_item( "main", wielded:get_name()) + -- add empty bucket + pinv:add_item("main", "bucket:bucket_empty") + -- TODO: play diffrent sound when pouring a bucket + return; + end + + -- else check if there is a bucket that can be retrieved + meta:set_string("bucket","") + end, +}) + + +-- a well (will fill water buckets) crafted from wooden materials +minetest.register_craft({ + output = 'cottages:water_gen', + recipe = { + {'default:stick', '', ''}, + {'default:tree', 'bucket:bucket_empty', 'bucket:bucket_empty'}, + {'default:tree', 'default:tree', 'default:tree'}, + } +}) + diff --git a/cottages/textures/cottages_pitchfork.png b/cottages/textures/cottages_pitchfork.png new file mode 100644 index 0000000..7253a7a Binary files /dev/null and b/cottages/textures/cottages_pitchfork.png differ diff --git a/extranodes/init.lua b/extranodes/init.lua index edc7e87..b8c3093 100644 --- a/extranodes/init.lua +++ b/extranodes/init.lua @@ -87,7 +87,7 @@ if minetest.get_modpath("moreblocks") then minetest.register_alias(modname .. ":panel_" .. origname .. "_vertical", newmod..":panel_" .. newname .. "_vertical") minetest.register_alias(modname .. ":micro_" .. origname .. "_bottom", newmod..":micro_" .. newname .. "_bottom") minetest.register_alias(modname .. ":micro_" .. origname .. "_top", newmod..":micro_" .. newname .. "_top") - end + end register_technic_stairs_alias("stairsplus", "concrete", "technic", "concrete") register_technic_stairs_alias("stairsplus", "marble", "technic", "marble") diff --git a/facade/README.md b/facade/README.md index ac5fb35..ea7138d 100644 --- a/facade/README.md +++ b/facade/README.md @@ -3,3 +3,4 @@ Adds decorative clay and stone-type nodes to Minetest Game. ![Preview](https://github.com/TumeniNodes/facade/blob/master/screenshot.png) ![Preview](https://github.com/TumeniNodes/facade/blob/master/screenshot2.png) ![Preview](https://github.com/TumeniNodes/facade/blob/master/screenshot3.png) +![Preview](https://github.com/TumeniNodes/facade/blob/master/screenshot4.png) diff --git a/facade/init.lua b/facade/init.lua index 5cdde6d..0fe0da1 100644 --- a/facade/init.lua +++ b/facade/init.lua @@ -234,12 +234,12 @@ function facade.register_corbel(modname, subname, recipeitem, desc) {-0.1875, -0.3125, -0.3125, 0.1875, 0.5, 0}, }, }, - -- selection_box = { - -- type = "fixed", - -- fixed = { - -- {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, - -- } - -- }, +-- selection_box = { +-- type = "fixed", +-- fixed = { +-- {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, +-- } +-- }, }) end @@ -262,12 +262,12 @@ function facade.register_corbel_corner(modname, subname, recipeitem, desc) {0, -0.3125, -0.3125, 0.3125, 0.5, 0}, }, }, - -- selection_box = { - -- type = "fixed", - -- fixed = { - -- {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, - -- } - -- }, +-- selection_box = { +-- type = "fixed", +-- fixed = { +-- {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, +-- } +-- }, }) end @@ -291,12 +291,12 @@ function facade.register_corbel_corner_inner(modname, subname, recipeitem, desc) {-0.5, -0.5, -0.5, 0, 0.5, 0.5}, }, }, - -- selection_box = { - -- type = "fixed", - -- fixed = { - -- {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, - -- } - -- }, +-- selection_box = { +-- type = "fixed", +-- fixed = { +-- {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, +-- } +-- }, }) end @@ -310,7 +310,7 @@ function facade.register_carved_stone_a(modname, subname, recipeitem, desc) minetest.register_node("facade:" .. subname .. "_carved_stone_a", { description = desc .. " Carved Stone A", drawtype = "nodebox", - tiles = { + tiles = { "" .. modname.. "_" .. subname .. ".png", "" .. modname.. "_" .. subname .. ".png", "" .. modname.. "_" .. subname .. ".png", @@ -326,16 +326,16 @@ function facade.register_carved_stone_a(modname, subname, recipeitem, desc) type = "fixed", fixed = { {-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5}, - {-0.5, 0.4375, -0.5, 0.5, 0.5, -0.4375}, - {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, - {-0.4375, -0.375, -0.5, -0.3125, 0.375, -0.4375}, - {-0.5, -0.375, -0.5, -0.3125, -0.25, 0.5}, - {-0.4375, 0.25, -0.5, 0.4375, 0.375, 0.5}, - {0.3125, -0.125, -0.5, 0.4375, 0.25, 0.5}, - {-0.1875, -0.375, -0.5, 0.5, -0.25, 0.5}, - {-0.1875, -0.25, -0.5, -0.0625, 0.125, 0.5}, - {0.0625, -0.125, -0.5, 0.3125, 0, 0.5}, - {-0.0625, 0, -0.5, 0.1875, 0.125, 0.5}, + {-0.5, 0.4375, -0.5, 0.5, 0.5, -0.4375}, + {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, + {-0.4375, -0.375, -0.5, -0.3125, 0.375, -0.4375}, + {-0.5, -0.375, -0.5, -0.3125, -0.25, 0.5}, + {-0.4375, 0.25, -0.5, 0.4375, 0.375, 0.5}, + {0.3125, -0.125, -0.5, 0.4375, 0.25, 0.5}, + {-0.1875, -0.375, -0.5, 0.5, -0.25, 0.5}, + {-0.1875, -0.25, -0.5, -0.0625, 0.125, 0.5}, + {0.0625, -0.125, -0.5, 0.3125, 0, 0.5}, + {-0.0625, 0, -0.5, 0.1875, 0.125, 0.5}, }, }, selection_box = { @@ -352,7 +352,7 @@ function facade.register_carved_stone_a_corner(modname, subname, recipeitem, des minetest.register_node("facade:" .. subname .. "_carved_stone_a_corner", { description = desc .. " Carved Stone A Corner", drawtype = "nodebox", - tiles = { + tiles = { "" .. modname.. "_" .. subname .. ".png", "" .. modname.. "_" .. subname .. ".png", "" .. modname.. "_" .. subname .. ".png", @@ -368,24 +368,24 @@ function facade.register_carved_stone_a_corner(modname, subname, recipeitem, des type = "fixed", fixed = { {-0.4375, -0.5, -0.4375, 0.5, 0.5, 0.5}, - {-0.5, 0.4375, -0.5, 0.5, 0.5, -0.4375}, - {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, - {-0.4375, -0.375, -0.5, -0.3125, 0.375, -0.4375}, - {-0.5, -0.375, -0.5, -0.3125, -0.25, 0.1875}, - {-0.4375, 0.25, -0.5, 0.4375, 0.375, 0.5}, - {0.3125, -0.125, -0.5, 0.4375, 0.25, 0.5}, - {-0.1875, -0.375, -0.5, 0.5, -0.25, 0.5}, - {-0.1875, -0.25, -0.5, -0.0625, 0.125, 0.5}, - {0.0625, -0.125, -0.5, 0.3125, 0, 0.5}, - {-0.0625, 0, -0.5, 0.1875, 0.125, 0.5}, - {-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5}, - {-0.5, -0.125, -0.4375, 0.5, 0.375, -0.3125}, - {-0.5, 0.25, -0.3125, 0.5, 0.375, 0.4375}, - {-0.5, -0.375, 0.3125, 0.4375, 0.375, 0.4375}, - {-0.5, -0.375, 0.3125, 0.4375, -0.25, 0.5}, - {-0.5, -0.125, -0.3125, 0.4375, 0, -0.0625}, - {-0.5, 0, -0.1875, 0.4375, 0.125, 0.1875}, - {-0.5, -0.25, 0.0625, 0.4375, 0.125, 0.1875}, + {-0.5, 0.4375, -0.5, 0.5, 0.5, -0.4375}, + {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, + {-0.4375, -0.375, -0.5, -0.3125, 0.375, -0.4375}, + {-0.5, -0.375, -0.5, -0.3125, -0.25, 0.1875}, + {-0.4375, 0.25, -0.5, 0.4375, 0.375, 0.5}, + {0.3125, -0.125, -0.5, 0.4375, 0.25, 0.5}, + {-0.1875, -0.375, -0.5, 0.5, -0.25, 0.5}, + {-0.1875, -0.25, -0.5, -0.0625, 0.125, 0.5}, + {0.0625, -0.125, -0.5, 0.3125, 0, 0.5}, + {-0.0625, 0, -0.5, 0.1875, 0.125, 0.5}, + {-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5}, + {-0.5, -0.125, -0.4375, 0.5, 0.375, -0.3125}, + {-0.5, 0.25, -0.3125, 0.5, 0.375, 0.4375}, + {-0.5, -0.375, 0.3125, 0.4375, 0.375, 0.4375}, + {-0.5, -0.375, 0.3125, 0.4375, -0.25, 0.5}, + {-0.5, -0.125, -0.3125, 0.4375, 0, -0.0625}, + {-0.5, 0, -0.1875, 0.4375, 0.125, 0.1875}, + {-0.5, -0.25, 0.0625, 0.4375, 0.125, 0.1875}, }, }, selection_box = { @@ -398,6 +398,158 @@ function facade.register_carved_stone_a_corner(modname, subname, recipeitem, des end +-------------------------- +--- RGSpro Facia +-------------------------- + +--Node will be called facade:_rgspro +function facade.register_rgspro(modname, subname, recipeitem, desc) + minetest.register_node("facade:" .. subname .. "_rgspro", { + description = desc .. " RGSpro", + drawtype = "nodebox", + tiles = { + "" .. modname.. "_" .. subname .. ".png", + "" .. modname.. "_" .. subname .. ".png", + "" .. modname.. "_" .. subname .. ".png^facade_rgspro.png", + "" .. modname.. "_" .. subname .. ".png^facade_rgspro.png", + "" .. modname.. "_" .. subname .. ".png^facade_rgspro.png", + "" .. modname.. "_" .. subname .. ".png^facade_rgspro.png"}, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1}, + sounds = default.node_sound_stone_defaults(), + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.375, 0.5, -0.3125, 0.5}, + {-0.5, -0.3125, 0.25, 0.5, -0.125, 0.5}, + {-0.5, -0.125, 0.125, 0.5, 0.5, 0.5}, + }, + }, +-- selection_box = { +-- type = "fixed", +-- fixed = { +-- {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, +-- }, +-- }, + }) +end + +--Node will be called facade:_rgspro_inner_corner +function facade.register_rgspro_inner_corner(modname, subname, recipeitem, desc) + minetest.register_node("facade:" .. subname .. "_rgspro_inner_corner", { + description = desc .. " RGSpro Inner Corner", + drawtype = "nodebox", + tiles = { + "" .. modname.. "_" .. subname .. ".png", + "" .. modname.. "_" .. subname .. ".png", + "" .. modname.. "_" .. subname .. ".png^facade_rgspro.png", + "" .. modname.. "_" .. subname .. ".png^facade_rgspro.png", + "" .. modname.. "_" .. subname .. ".png^facade_rgspro.png", + "" .. modname.. "_" .. subname .. ".png^facade_rgspro.png"}, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1}, + sounds = default.node_sound_stone_defaults(), + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.375, 0.5, -0.3125, 0.5}, + {-0.5, -0.3125, 0.25, 0.5, -0.125, 0.5}, + {-0.5, -0.125, 0.125, 0.5, 0.5, 0.5}, + {0.375, -0.5, -0.5, 0.5, -0.3125, 0.375}, + {0.25, -0.3125, -0.5, 0.5, -0.0625, 0.25}, + {0.125, -0.125, -0.5, 0.5, 0.5, 0.125}, + }, + }, +-- selection_box = { +-- type = "fixed", +-- fixed = { +-- {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, +-- }, +-- }, + }) +end + + +--Node will be called facade:_rgspro_outer_corner +function facade.register_rgspro_outer_corner(modname, subname, recipeitem, desc) + minetest.register_node("facade:" .. subname .. "_rgspro_outer_corner", { + description = desc .. " RGSpro Outer Corner", + drawtype = "nodebox", + tiles = { + "" .. modname.. "_" .. subname .. ".png", + "" .. modname.. "_" .. subname .. ".png", + "" .. modname.. "_" .. subname .. ".png^facade_rgspro.png", + "" .. modname.. "_" .. subname .. ".png^facade_rgspro.png", + "" .. modname.. "_" .. subname .. ".png^facade_rgspro.png", + "" .. modname.. "_" .. subname .. ".png^facade_rgspro.png"}, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1}, + sounds = default.node_sound_stone_defaults(), + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.375, 0.5, -0.3125, 0.5}, + {-0.5, -0.3125, 0.25, 0.5, -0.0625, 0.5}, + {-0.5, -0.125, 0.125, 0.5, 0.5, 0.5}, + {-0.625, -0.5, 0.375, -0.5, -0.3125, 1.5}, + {-0.75, -0.3125, 0.25, -0.5, -0.125, 1.5}, + {-0.875, -0.125, 0.125, -0.5, 0.5, 1.5}, + }, + }, +-- selection_box = { +-- type = "fixed", +-- fixed = { +-- {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, +-- }, +-- }, + }) +end + + +-------------------------- +--- Corner Bricks +-------------------------- + +--Node will be called facade:_corner_bricks +function facade.register_corner_bricks(modname, subname, recipeitem, desc) + if not string.match(recipeitem,"clay") + then -- do not do for clay things that is ugly + minetest.register_node("facade:" .. subname .. "_corner_bricks", { + description = desc .. " Corner Bricks", + drawtype = "nodebox", + tiles = { + "" .. modname.. "_" .. subname .. "_brick.png"}, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1}, + sounds = default.node_sound_stone_defaults(), + node_box = { + type = "fixed", + fixed = { + {-0.5625, -0.5, 0.4375, -0.5, 0, 1}, + {-0.5, -0.5, 0.4375, 0, 0, 0.5}, + {-0.5625, 0, 0.5, -0.5, 0.5, 1.5}, + {-0.5625, 0, 0.4375, 0.5, 0.5, 0.5}, + }, + }, +-- selection_box = { +-- type = "fixed", +-- fixed = { +-- {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, +-- }, +-- }, + }) + end +end + + -------------------------- --Register Nodes/Materials -------------------------- @@ -412,21 +564,31 @@ function facade.register_facade_nodes(modname, subname, recipeitem, desc) facade.register_corbel_corner_inner(modname, subname, recipeitem, desc) facade.register_carved_stone_a(modname, subname, recipeitem, desc) facade.register_carved_stone_a_corner(modname, subname, recipeitem, desc) + facade.register_rgspro(modname, subname, recipeitem, desc) + facade.register_rgspro_inner_corner(modname, subname, recipeitem, desc) + facade.register_rgspro_outer_corner(modname, subname, recipeitem, desc) + facade.register_corner_bricks(modname, subname, recipeitem, desc) if wehavechisels then -- register all nodes with mychisel mod to use them without creative priv - chisel.register_node("facade",subname, recipeitem, "bannerstone") - chisel.register_node("facade",subname, recipeitem, "bannerstone_corner") - chisel.register_node("facade",subname, recipeitem, "centerstone") - chisel.register_node("facade",subname, recipeitem, "column") - chisel.register_node("facade",subname, recipeitem, "column_corner") - chisel.register_node("facade",subname, recipeitem, "corbel") - chisel.register_node("facade",subname, recipeitem, "corbel_corner") - chisel.register_node("facade",subname, recipeitem, "corbel_corner_inner") - chisel.register_node("facade",subname, recipeitem, "carved_stone_a") - chisel.register_node("facade",subname, recipeitem, "carved_stone_a_corner") + chisel.register_node("facade",subname, recipeitem, "bannerstone") + chisel.register_node("facade",subname, recipeitem, "bannerstone_corner") + chisel.register_node("facade",subname, recipeitem, "centerstone") + chisel.register_node("facade",subname, recipeitem, "column") + chisel.register_node("facade",subname, recipeitem, "column_corner") + chisel.register_node("facade",subname, recipeitem, "corbel") + chisel.register_node("facade",subname, recipeitem, "corbel_corner") + chisel.register_node("facade",subname, recipeitem, "corbel_corner_inner") + chisel.register_node("facade",subname, recipeitem, "carved_stone_a") + chisel.register_node("facade",subname, recipeitem, "carved_stone_a_corner") + chisel.register_node("facade",subname, recipeitem, "rgspro") + chisel.register_node("facade",subname, recipeitem, "rgspro_inner_corner") + chisel.register_node("facade",subname, recipeitem, "rgspro_outer_corner") + chisel.register_node("facade",subname, recipeitem, "corner_bricks") + + end end -if wehavechisels then chisel.add_mod("facade",10) end -- register the total number of different designs in this mod with mychisel +if wehavechisels then chisel.add_mod("facade",14) end -- register the total number of different designs in this mod with mychisel facade.register_facade_nodes("default", "clay", "default:clay", "Clay") facade.register_facade_nodes("default", "desert_sandstone", "default:desert_sandstone", "Desert Sandstone") diff --git a/facade/license.txt b/facade/license.txt index f273c36..dc51f2a 100644 --- a/facade/license.txt +++ b/facade/license.txt @@ -1,9 +1,10 @@ *Textures from Minetest Game mod: default +The licenses for such media can be found in the source for Minetest Game ========================================= License of source code: ----------------------- -Copyright (C) 2011-2012 celeron55, Perttu Ahola +Copyright (C) 2016-2018 TumeniNodes This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -12,215 +13,31 @@ the Free Software Foundation; either version 2.1 of the License, or http://www.gnu.org/licenses/lgpl-2.1.html -License of media (textures and sounds) --------------------------------------- -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ - -Authors of media files ------------------------ -Everything not listed in here: -Copyright (C) 2010-2012 celeron55, Perttu Ahola - -Cisoun's WTFPL texture pack: - default_jungletree.png - default_lava.png - default_leaves.png - default_sapling.png - default_stone.png - default_tree.png - default_tree_top.png - default_water.png - -Cisoun's conifers mod (WTFPL): - default_pine_needles.png - -Originating from G4JC's Almost MC Texture Pack: - default_torch.png - default_torch_on_ceiling.png - default_torch_on_floor.png - -VanessaE's animated torches (WTFPL): - default_torch_animated.png - default_torch_on_ceiling_animated.png - default_torch_on_floor_animated.png - default_torch_on_floor.png - -RealBadAngel's animated water (WTFPL): - default_water_source_animated.png - default_water_flowing_animated.png - -VanessaE (WTFPL): - default_nc_back.png - default_nc_front.png - default_nc_rb.png - default_nc_side.png - default_desert_sand.png - default_desert_stone.png - default_sand.png - -Calinou (CC BY-SA): - default_brick.png - default_papyrus.png - default_mineral_copper.png - default_glass_detail.png - -MirceaKitsune (WTFPL): - character.x - -Jordach (CC BY-SA 3.0): - character.png - -PilzAdam (WTFPL): - default_jungleleaves.png - default_junglesapling.png - default_obsidian_glass.png - default_obsidian_shard.png - default_mineral_gold.png - default_snowball.png - -jojoa1997 (WTFPL): - default_obsidian.png - -InfinityProject (WTFPL): - default_mineral_diamond.png - -Splizard (CC BY-SA 3.0): - default_snow.png - default_pine_sapling.png - -Zeg9 (CC BY-SA 3.0): - default_coal_block.png - default_steel_block.png - default_copper_block.png - default_bronze_block.png - default_gold_block.png - -paramat (CC BY-SA 3.0): - wieldhand.png -- Copied from character.png by Jordach (CC BY-SA 3.0) - default_pinetree.png - default_pinetree_top.png - default_pinewood.png - default_acacia_leaves.png - default_acacia_sapling.png - default_acacia_tree.png - default_acacia_tree_top.png - default_acacia_wood.png - default_junglewood.png - default_jungletree_top.png - default_sandstone_brick.png - default_obsidian_brick.png - default_stone_brick.png - default_desert_stone_brick.png - default_river_water.png - default_river_water_source_animated.png - default_river_water_flowing_animated.png - default_dry_grass.png - default_dry_grass_side.png - default_dry_grass_*.png - default_grass.png - default_grass_side.png - default_snow_side.png - -brunob.santos (CC BY-SA 4.0): - default_desert_cobble.png - -BlockMen (CC BY-SA 3.0): - default_wood.png - default_clay_brick.png - default_iron_ingot.png - default_gold_ingot.png - default_tool_steelsword.png - default_diamond.png - default_book.png - default_tool_*.png - default_lava_source_animated.png - default_lava_flowing_animated.png - default_stick.png - default_chest_front.png - default_chest_lock.png - default_chest_side.png - default_chest_top.png - default_mineral_mese.png - default_meselamp.png - bubble.png - gui_*.png - -sofar (CC BY-SA 3.0): - default_book_written.png, based on default_book.png - default_aspen_sapling - default_aspen_leaves - default_aspen_tree - default_aspen_tree_top, derived from default_pine_tree_top (by paramat) - default_aspen_wood, derived from default_pine_wood (by paramat) - -sofar (WTFPL): - default_gravel.png -- Derived from Gambit's PixelBOX texture pack light gravel - -Neuromancer (CC BY-SA 2.0): - default_cobble.png, based on texture by Brane praefect - default_mossycobble.png, based on texture by Brane praefect -Neuromancer (CC BY-SA 3.0): - default_dirt.png - default_furnace_*.png - -Gambit (WTFPL): - default_bronze_ingot.png - default_copper_ingot.png - default_copper_lump.png - default_iron_lump.png - default_gold_lump.png - default_clay_lump.png - default_coal.png - default_grass_*.png - default_paper.png - default_diamond_block.png - default_ladder_steel.png - default_sign_wall_wood.png - default_flint.png - -asl97 (WTFPL): - default_ice.png - -KevDoy (CC BY-SA 3.0) - heart.png - -Glass breaking sounds (CC BY 3.0): - 1: http://www.freesound.org/people/cmusounddesign/sounds/71947/ - 2: http://www.freesound.org/people/Tomlija/sounds/97669/ - 3: http://www.freesound.org/people/lsprice/sounds/88808/ - -Mito551 (sounds) (CC BY-SA): - default_dig_choppy.ogg - default_dig_cracky.ogg - default_dig_crumbly.1.ogg - default_dig_crumbly.2.ogg - default_dig_dig_immediate.ogg - default_dig_oddly_breakable_by_hand.ogg - default_dug_node.1.ogg - default_dug_node.2.ogg - default_grass_footstep.1.ogg - default_grass_footstep.2.ogg - default_grass_footstep.3.ogg - default_gravel_footstep.1.ogg - default_gravel_footstep.2.ogg - default_gravel_footstep.3.ogg - default_gravel_footstep.4.ogg - default_grass_footstep.1.ogg - default_place_node.1.ogg - default_place_node.2.ogg - default_place_node.3.ogg - default_place_node_hard.1.ogg - default_place_node_hard.2.ogg - default_snow_footstep.1.ogg - default_snow_footstep.2.ogg - default_hard_footstep.1.ogg - default_hard_footstep.2.ogg - default_hard_footstep.3.ogg - default_sand_footstep.1.ogg - default_sand_footstep.2.ogg - default_wood_footstep.1.ogg - default_wood_footstep.2.ogg - default_dirt_footstep.1.ogg - default_dirt_footstep.2.ogg - default_glass_footstep.ogg +init.lua +bannerstone.lua +bannerstone_corner.lua +carved_stone_a.lua +carved_stone_a_corner.lua +column.lua +column_corner.lua +corbel.lua +corbel_corner.lua +corbel_inner_corner.lua +rgspro.lua +rgspro_corner.lua +rgspro_inner.lua +corner_bricks.lua + +bannerstone.nbe +bannerstone_corner.nbe +carved_stone_a.nbe +carved_stone_a_corner.nbe +column.nbe +column_corner.nbe +corbel.nbe +corbel_corner.nbe +corbel_inner_corner.nbe +rgspro.nbe +rgspro_corner.nbe +rgspro_inner.nbe +corner_bricks.nbe diff --git a/facade/models/corner_bricks.obj b/facade/models/corner_bricks.obj new file mode 100644 index 0000000..b733f59 --- /dev/null +++ b/facade/models/corner_bricks.obj @@ -0,0 +1,64 @@ +mtllib corner_bricks.mtl +o converted_out +v 0.5625 -0.5 0.4375 +v 0.5625 -0.5 1 +v 0.5625 0 1 +v 0.5625 0 0.4375 +v 0.5 -0.5 0.4375 +v 0.5 -0.5 1 +v 0.5 0 1 +v 0.5 0 0.4375 +v 0.5 -0.5 0.4375 +v 0.5 -0.5 0.5 +v 0.5 0 0.5 +v 0.5 0 0.4375 +v -0 -0.5 0.4375 +v -0 -0.5 0.5 +v -0 0 0.5 +v -0 0 0.4375 +v 0.5625 0 0.5 +v 0.5625 0 1.5 +v 0.5625 0.5 1.5 +v 0.5625 0.5 0.5 +v 0.5 0 0.5 +v 0.5 0 1.5 +v 0.5 0.5 1.5 +v 0.5 0.5 0.5 +v 0.5625 0 0.4375 +v 0.5625 0 0.5 +v 0.5625 0.5 0.5 +v 0.5625 0.5 0.4375 +v -0.5 0 0.4375 +v -0.5 0 0.5 +v -0.5 0.5 0.5 +v -0.5 0.5 0.4375 +usemtl none +s off +g nodebox1 +f 1 2 3 4 +f 5 6 7 8 +f 1 4 8 5 +f 2 3 7 6 +f 1 2 6 5 +f 4 3 7 8 +g nodebox2 +f 9 10 11 12 +f 13 14 15 16 +f 9 12 16 13 +f 10 11 15 14 +f 9 10 14 13 +f 12 11 15 16 +g nodebox3 +f 17 18 19 20 +f 21 22 23 24 +f 17 20 24 21 +f 18 19 23 22 +f 17 18 22 21 +f 20 19 23 24 +g nodebox4 +f 25 26 27 28 +f 29 30 31 32 +f 25 28 32 29 +f 26 27 31 30 +f 25 26 30 29 +f 28 27 31 32 diff --git a/facade/models/files.txt b/facade/models/files.txt deleted file mode 100644 index 8b13789..0000000 --- a/facade/models/files.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/facade/models/license.txt b/facade/models/license.txt new file mode 100644 index 0000000..ecc81dc --- /dev/null +++ b/facade/models/license.txt @@ -0,0 +1,18 @@ +source files for facade +Copyright (C) 2016 - 2018 TumeniNodes +Attribution - ShareAlike 4.0 International (CC BY-SA 4.0) +https://creativecommons.org/licenses/by-sa/4.0/ +========================================================= +bannerstone.obj +bannerstone_corner.obj +carved_stone_a.obj +carved_stone_a_corner.obj +column.obj +column_corner.obj +corbel.obj +corbel_corner.obj +corbel_inner_corner.obj +rgspro.obj +rgspro_corner.obj +rgspro_inner.obj +corner_bricks.obj diff --git a/facade/models/nbe files/corner_bricks.nbe b/facade/models/nbe files/corner_bricks.nbe new file mode 100644 index 0000000..0573bba Binary files /dev/null and b/facade/models/nbe files/corner_bricks.nbe differ diff --git a/facade/models/nbe files/rgspro.nbe b/facade/models/nbe files/rgspro.nbe new file mode 100644 index 0000000..9b9e448 Binary files /dev/null and b/facade/models/nbe files/rgspro.nbe differ diff --git a/facade/models/nbe files/rgspro_corner.nbe b/facade/models/nbe files/rgspro_corner.nbe new file mode 100644 index 0000000..fef58c7 Binary files /dev/null and b/facade/models/nbe files/rgspro_corner.nbe differ diff --git a/facade/models/nbe files/rgspro_inner.nbe b/facade/models/nbe files/rgspro_inner.nbe new file mode 100644 index 0000000..ee78066 Binary files /dev/null and b/facade/models/nbe files/rgspro_inner.nbe differ diff --git a/facade/models/nbe lua files/corner_bricks.lua b/facade/models/nbe lua files/corner_bricks.lua new file mode 100644 index 0000000..9975c02 --- /dev/null +++ b/facade/models/nbe lua files/corner_bricks.lua @@ -0,0 +1,26 @@ +-- GENERATED CODE +-- Node Box Editor, version 0.9.0 +-- Namespace: test + +minetest.register_node("test:node_1", { + tiles = { + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png" + }, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + {-0.5625, -0.5, 0.4375, -0.5, 0, 1}, + {-0.5, -0.5, 0.4375, 0, 0, 0.5}, + {-0.5625, 0, 0.5, -0.5, 0.5, 1.5}, + {-0.5625, 0, 0.4375, 0.5, 0.5, 0.5}, + } + } +}) + diff --git a/facade/models/nbe lua files/rgspro.lua b/facade/models/nbe lua files/rgspro.lua new file mode 100644 index 0000000..888badb --- /dev/null +++ b/facade/models/nbe lua files/rgspro.lua @@ -0,0 +1,25 @@ +-- GENERATED CODE +-- Node Box Editor, version 0.9.0 +-- Namespace: test + +minetest.register_node("test:node_1", { + tiles = { + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png" + }, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.375, 0.5, -0.3125, 0.5}, + {-0.5, -0.3125, 0.25, 0.5, -0.125, 0.5}, + {-0.5, -0.125, 0.125, 0.5, 0.5, 0.5}, + } + } +}) + diff --git a/facade/models/nbe lua files/rgspro_corner.lua b/facade/models/nbe lua files/rgspro_corner.lua new file mode 100644 index 0000000..31e70a7 --- /dev/null +++ b/facade/models/nbe lua files/rgspro_corner.lua @@ -0,0 +1,28 @@ +-- GENERATED CODE +-- Node Box Editor, version 0.9.0 +-- Namespace: test + +minetest.register_node("test:node_1", { + tiles = { + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png" + }, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.375, 0.5, -0.3125, 0.5}, + {-0.5, -0.3125, 0.25, 0.5, -0.0625, 0.5}, + {-0.5, -0.125, 0.125, 0.5, 0.5, 0.5}, + {-0.625, -0.5, 0.375, -0.5, -0.3125, 1.5}, + {-0.75, -0.3125, 0.25, -0.5, -0.125, 1.5}, + {-0.875, -0.125, 0.125, -0.5, 0.5, 1.5}, + } + } +}) + diff --git a/facade/models/nbe lua files/rgspro_inner.lua b/facade/models/nbe lua files/rgspro_inner.lua new file mode 100644 index 0000000..dfe2142 --- /dev/null +++ b/facade/models/nbe lua files/rgspro_inner.lua @@ -0,0 +1,28 @@ +-- GENERATED CODE +-- Node Box Editor, version 0.9.0 +-- Namespace: test + +minetest.register_node("test:node_1", { + tiles = { + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png" + }, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.375, 0.5, -0.3125, 0.5}, + {-0.5, -0.3125, 0.25, 0.5, -0.125, 0.5}, + {-0.5, -0.125, 0.125, 0.5, 0.5, 0.5}, + {0.375, -0.5, -0.5, 0.5, -0.3125, 0.375}, + {0.25, -0.3125, -0.5, 0.5, -0.0625, 0.25}, + {0.125, -0.125, -0.5, 0.5, 0.5, 0.125}, + } + } +}) + diff --git a/facade/models/obj_info.txt b/facade/models/obj_info.txt index 387cde6..8b6cfad 100644 --- a/facade/models/obj_info.txt +++ b/facade/models/obj_info.txt @@ -1,3 +1,6 @@ These .obj files were created using Rubenwardy's NodeBoxEditor https://forum.minetest.net/viewtopic.php?f=14&t=2840&hilit=NBE (which is a very nice and useful tool) They do support textures but, do not support UV mapping, and they will still render as individual objects. They are provided merely as a reference for anyone who may whish to create .obj models using Blender, or other similar 3D modeling software. + +However, there is a method with Blender, in which one can delete duplicate faces, etc., which would make these closely workable to a native .obj file, and help with UV mapping. +It would be up to you to do a search on this method, as I have no interest in doing so. diff --git a/facade/models/rgspro.obj b/facade/models/rgspro.obj new file mode 100644 index 0000000..593a2a8 --- /dev/null +++ b/facade/models/rgspro.obj @@ -0,0 +1,49 @@ +mtllib rgspro.mtl +o converted_out +v 0.5 -0.5 0.375 +v 0.5 -0.5 0.5 +v 0.5 -0.3125 0.5 +v 0.5 -0.3125 0.375 +v -0.5 -0.5 0.375 +v -0.5 -0.5 0.5 +v -0.5 -0.3125 0.5 +v -0.5 -0.3125 0.375 +v 0.5 -0.3125 0.25 +v 0.5 -0.3125 0.5 +v 0.5 -0.125 0.5 +v 0.5 -0.125 0.25 +v -0.5 -0.3125 0.25 +v -0.5 -0.3125 0.5 +v -0.5 -0.125 0.5 +v -0.5 -0.125 0.25 +v 0.5 -0.125 0.125 +v 0.5 -0.125 0.5 +v 0.5 0.5 0.5 +v 0.5 0.5 0.125 +v -0.5 -0.125 0.125 +v -0.5 -0.125 0.5 +v -0.5 0.5 0.5 +v -0.5 0.5 0.125 +usemtl none +s off +g nodebox1 +f 1 2 3 4 +f 5 6 7 8 +f 1 4 8 5 +f 2 3 7 6 +f 1 2 6 5 +f 4 3 7 8 +g nodebox2 +f 9 10 11 12 +f 13 14 15 16 +f 9 12 16 13 +f 10 11 15 14 +f 9 10 14 13 +f 12 11 15 16 +g nodebox3 +f 17 18 19 20 +f 21 22 23 24 +f 17 20 24 21 +f 18 19 23 22 +f 17 18 22 21 +f 20 19 23 24 diff --git a/facade/models/rgspro_corner.obj b/facade/models/rgspro_corner.obj new file mode 100644 index 0000000..506df93 --- /dev/null +++ b/facade/models/rgspro_corner.obj @@ -0,0 +1,94 @@ +mtllib rgspro_corner.mtl +o converted_out +v 0.5 -0.5 0.375 +v 0.5 -0.5 0.5 +v 0.5 -0.3125 0.5 +v 0.5 -0.3125 0.375 +v -0.5 -0.5 0.375 +v -0.5 -0.5 0.5 +v -0.5 -0.3125 0.5 +v -0.5 -0.3125 0.375 +v 0.5 -0.3125 0.25 +v 0.5 -0.3125 0.5 +v 0.5 -0.0625 0.5 +v 0.5 -0.0625 0.25 +v -0.5 -0.3125 0.25 +v -0.5 -0.3125 0.5 +v -0.5 -0.0625 0.5 +v -0.5 -0.0625 0.25 +v 0.5 -0.125 0.125 +v 0.5 -0.125 0.5 +v 0.5 0.5 0.5 +v 0.5 0.5 0.125 +v -0.5 -0.125 0.125 +v -0.5 -0.125 0.5 +v -0.5 0.5 0.5 +v -0.5 0.5 0.125 +v 0.625 -0.5 0.375 +v 0.625 -0.5 1.5 +v 0.625 -0.3125 1.5 +v 0.625 -0.3125 0.375 +v 0.5 -0.5 0.375 +v 0.5 -0.5 1.5 +v 0.5 -0.3125 1.5 +v 0.5 -0.3125 0.375 +v 0.75 -0.3125 0.25 +v 0.75 -0.3125 1.5 +v 0.75 -0.125 1.5 +v 0.75 -0.125 0.25 +v 0.5 -0.3125 0.25 +v 0.5 -0.3125 1.5 +v 0.5 -0.125 1.5 +v 0.5 -0.125 0.25 +v 0.875 -0.125 0.125 +v 0.875 -0.125 1.5 +v 0.875 0.5 1.5 +v 0.875 0.5 0.125 +v 0.5 -0.125 0.125 +v 0.5 -0.125 1.5 +v 0.5 0.5 1.5 +v 0.5 0.5 0.125 +usemtl none +s off +g nodebox1 +f 1 2 3 4 +f 5 6 7 8 +f 1 4 8 5 +f 2 3 7 6 +f 1 2 6 5 +f 4 3 7 8 +g nodebox2 +f 9 10 11 12 +f 13 14 15 16 +f 9 12 16 13 +f 10 11 15 14 +f 9 10 14 13 +f 12 11 15 16 +g nodebox3 +f 17 18 19 20 +f 21 22 23 24 +f 17 20 24 21 +f 18 19 23 22 +f 17 18 22 21 +f 20 19 23 24 +g nodebox4 +f 25 26 27 28 +f 29 30 31 32 +f 25 28 32 29 +f 26 27 31 30 +f 25 26 30 29 +f 28 27 31 32 +g nodebox5 +f 33 34 35 36 +f 37 38 39 40 +f 33 36 40 37 +f 34 35 39 38 +f 33 34 38 37 +f 36 35 39 40 +g nodebox6 +f 41 42 43 44 +f 45 46 47 48 +f 41 44 48 45 +f 42 43 47 46 +f 41 42 46 45 +f 44 43 47 48 diff --git a/facade/models/rgspro_inner.obj b/facade/models/rgspro_inner.obj new file mode 100644 index 0000000..dba753e --- /dev/null +++ b/facade/models/rgspro_inner.obj @@ -0,0 +1,94 @@ +mtllib rgspro_inner.mtl +o converted_out +v 0.5 -0.5 0.375 +v 0.5 -0.5 0.5 +v 0.5 -0.3125 0.5 +v 0.5 -0.3125 0.375 +v -0.5 -0.5 0.375 +v -0.5 -0.5 0.5 +v -0.5 -0.3125 0.5 +v -0.5 -0.3125 0.375 +v 0.5 -0.3125 0.25 +v 0.5 -0.3125 0.5 +v 0.5 -0.125 0.5 +v 0.5 -0.125 0.25 +v -0.5 -0.3125 0.25 +v -0.5 -0.3125 0.5 +v -0.5 -0.125 0.5 +v -0.5 -0.125 0.25 +v 0.5 -0.125 0.125 +v 0.5 -0.125 0.5 +v 0.5 0.5 0.5 +v 0.5 0.5 0.125 +v -0.5 -0.125 0.125 +v -0.5 -0.125 0.5 +v -0.5 0.5 0.5 +v -0.5 0.5 0.125 +v -0.375 -0.5 -0.5 +v -0.375 -0.5 0.375 +v -0.375 -0.3125 0.375 +v -0.375 -0.3125 -0.5 +v -0.5 -0.5 -0.5 +v -0.5 -0.5 0.375 +v -0.5 -0.3125 0.375 +v -0.5 -0.3125 -0.5 +v -0.25 -0.3125 -0.5 +v -0.25 -0.3125 0.25 +v -0.25 -0.0625 0.25 +v -0.25 -0.0625 -0.5 +v -0.5 -0.3125 -0.5 +v -0.5 -0.3125 0.25 +v -0.5 -0.0625 0.25 +v -0.5 -0.0625 -0.5 +v -0.125 -0.125 -0.5 +v -0.125 -0.125 0.125 +v -0.125 0.5 0.125 +v -0.125 0.5 -0.5 +v -0.5 -0.125 -0.5 +v -0.5 -0.125 0.125 +v -0.5 0.5 0.125 +v -0.5 0.5 -0.5 +usemtl none +s off +g nodebox1 +f 1 2 3 4 +f 5 6 7 8 +f 1 4 8 5 +f 2 3 7 6 +f 1 2 6 5 +f 4 3 7 8 +g nodebox2 +f 9 10 11 12 +f 13 14 15 16 +f 9 12 16 13 +f 10 11 15 14 +f 9 10 14 13 +f 12 11 15 16 +g nodebox3 +f 17 18 19 20 +f 21 22 23 24 +f 17 20 24 21 +f 18 19 23 22 +f 17 18 22 21 +f 20 19 23 24 +g nodebox4 +f 25 26 27 28 +f 29 30 31 32 +f 25 28 32 29 +f 26 27 31 30 +f 25 26 30 29 +f 28 27 31 32 +g nodebox5 +f 33 34 35 36 +f 37 38 39 40 +f 33 36 40 37 +f 34 35 39 38 +f 33 34 38 37 +f 36 35 39 40 +g nodebox6 +f 41 42 43 44 +f 45 46 47 48 +f 41 44 48 45 +f 42 43 47 46 +f 41 42 46 45 +f 44 43 47 48 diff --git a/facade/screenshot4.png b/facade/screenshot4.png new file mode 100644 index 0000000..7cd8c86 Binary files /dev/null and b/facade/screenshot4.png differ diff --git a/facade/textures/facade_rgspro.png b/facade/textures/facade_rgspro.png new file mode 100644 index 0000000..de36926 Binary files /dev/null and b/facade/textures/facade_rgspro.png differ diff --git a/facade/textures/license.txt b/facade/textures/license.txt new file mode 100644 index 0000000..4ac1f99 --- /dev/null +++ b/facade/textures/license.txt @@ -0,0 +1,10 @@ +custom textures for facade +Copyright (C) 2016 - 2018 TumeniNodes +Attribution - ShareAlike 4.0 International (CC BY-SA 4.0) +https://creativecommons.org/licenses/by-sa/4.0/ +========================================================= +facade_bannerstone.png +facade_carved_stone_a.png +facade_cornerstone.png +facade_column.png +facade_rgspro.png diff --git a/facade/textures/texures license.txt b/facade/textures/texures license.txt deleted file mode 100644 index 9f8effb..0000000 --- a/facade/textures/texures license.txt +++ /dev/null @@ -1,4 +0,0 @@ -custom textures for facade -Copyright (C) 2017 TumeniNodes -Attribution - ShareAlike 4.0 International (CC BY-SA 4.0) -https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/farming/README.md b/farming/README.md index 55ddee0..8f3e671 100644 --- a/farming/README.md +++ b/farming/README.md @@ -13,6 +13,8 @@ This mod works by adding your new plant to the {growing=1} group and numbering t ### Changelog: +- 1.40 - Added Mithril Scythe to quick harvest and replant crops on right-click. +- 1.39 - Added Rice, Rye and Oats thanks to Ademants Grains mod. Added Jaffa Cake and multigrain bread. - 1.38 - Pumpkin grows into block, use chopping board to cut into 4x slices, same with melon block, 2x2 slices makes a block, cocoa pods are no longer walkable - 1.37 - Added custom 'growth_check(pos, nodename) function for crop nodes to use (check cocoa.lua for example) - 1.36 - Added Beetroot, Beetroot Soup (6x beetroot, 1x bowl), fix register_plant() issue, add new recipes @@ -59,4 +61,4 @@ This mod works by adding your new plant to the {growing=1} group and numbering t - 0.1 - Fixed growing bug - 0.0 - Initial release -### Lucky Blocks: 38 +### Lucky Blocks: 39 diff --git a/farming/api.txt b/farming/api.txt index 0098624..acec5a0 100644 --- a/farming/api.txt +++ b/farming/api.txt @@ -56,3 +56,9 @@ growth_check = function(pos, node_name) end return true -- condition not met, skip next growth stage until next check end, + +### Scythe items that will not drop + +This is a function to add items to a list that scythes will not drop, e.g. farming:trellis or farming:beanpole. + +farming.add_to_scythe_not_drops(item_name) diff --git a/farming/crops/barley.lua b/farming/crops/barley.lua index 6f3cb97..cc5ca0f 100644 --- a/farming/crops/barley.lua +++ b/farming/crops/barley.lua @@ -110,5 +110,13 @@ farming.registered_plants["farming:barley"] = { seed = "farming:seed_barley", minlight = 13, maxlight = 15, - steps = 8 + steps = 7 } + +-- Fuel + +minetest.register_craft({ + type = "fuel", + recipe = "farming:barley", + burntime = 1, +}) diff --git a/farming/crops/beans.lua b/farming/crops/beans.lua index a75030a..bd3b8ee 100644 --- a/farming/crops/beans.lua +++ b/farming/crops/beans.lua @@ -191,7 +191,7 @@ local crop_def = { selection_box = farming.select, groups = { snappy = 3, flammable = 3, not_in_creative_inventory = 1, - attached_node = 1, growing = 1 + attached_node = 1, growing = 1, plant = 1 }, sounds = default.node_sound_leaves_defaults() } diff --git a/farming/crops/blueberry.lua b/farming/crops/blueberry.lua index 64aee3e..6752e35 100644 --- a/farming/crops/blueberry.lua +++ b/farming/crops/blueberry.lua @@ -42,6 +42,7 @@ minetest.register_craft({ "group:food_flour", "group:food_sugar", "group:food_blueberries", "group:food_baking_tray" }, + replacements = {{"group:food_baking_tray", "farming:baking_tray"}} }) -- blueberry definition diff --git a/farming/crops/carrot.lua b/farming/crops/carrot.lua index b4baa8d..6ec1994 100644 --- a/farming/crops/carrot.lua +++ b/farming/crops/carrot.lua @@ -22,6 +22,7 @@ minetest.register_craftitem("farming:carrot_juice", { description = S("Carrot Juice"), inventory_image = "farming_carrot_juice.png", on_use = minetest.item_eat(4, "vessels:drinking_glass"), + groups = {vessel = 1}, }) minetest.register_craft({ diff --git a/farming/crops/grapes.lua b/farming/crops/grapes.lua index c341075..2b33427 100644 --- a/farming/crops/grapes.lua +++ b/farming/crops/grapes.lua @@ -186,7 +186,7 @@ local crop_def = { selection_box = farming.select, groups = { snappy = 3, flammable = 3, not_in_creative_inventory = 1, - attached_node = 1, growing = 1 + attached_node = 1, growing = 1, plant = 1 }, sounds = default.node_sound_leaves_defaults() } diff --git a/farming/crops/pineapple.lua b/farming/crops/pineapple.lua index 8a60310..f62042e 100644 --- a/farming/crops/pineapple.lua +++ b/farming/crops/pineapple.lua @@ -47,6 +47,7 @@ minetest.register_craftitem("farming:pineapple_juice", { description = S("Pineapple Juice"), inventory_image = "farming_pineapple_juice.png", on_use = minetest.item_eat(4, "vessels:drinking_glass"), + groups = {vessel = 1}, }) minetest.register_craft({ diff --git a/farming/crops/raspberry.lua b/farming/crops/raspberry.lua index 4938658..979bdfb 100644 --- a/farming/crops/raspberry.lua +++ b/farming/crops/raspberry.lua @@ -17,6 +17,7 @@ minetest.register_craftitem("farming:smoothie_raspberry", { description = S("Raspberry Smoothie"), inventory_image = "farming_raspberry_smoothie.png", on_use = minetest.item_eat(2, "vessels:drinking_glass"), + groups = {vessel = 1}, }) minetest.register_craft({ diff --git a/farming/crops/ryeoatrice.lua b/farming/crops/ryeoatrice.lua new file mode 100644 index 0000000..d064626 --- /dev/null +++ b/farming/crops/ryeoatrice.lua @@ -0,0 +1,162 @@ + +local S = farming.intllib + +--= A nice addition from Ademant's grain mod :) + +-- Rye + +farming.register_plant("farming:rye", { + description = "Rye seed", + paramtype2 = "meshoptions", + inventory_image = "farming_rye_seed.png", + steps = 8, + place_param2 = 3, +}) + +minetest.override_item("farming:rye", { + groups = {food_rye = 1, flammable = 4} +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:flour", + recipe = { + "farming:rye", "farming:rye", "farming:rye", "farming:rye", + "farming:mortar_pestle" + }, + replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}, +}) + +-- Oats + +farming.register_plant("farming:oat", { + description = "Oat seed", + paramtype2 = "meshoptions", + inventory_image = "farming_oat_seed.png", + steps = 8, + place_param2 = 3, +}) + +minetest.override_item("farming:oat", { + groups = {food_oats = 1, flammable = 4} +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:flour", + recipe = { + "farming:oat", "farming:oat", "farming:oat", "farming:oat", + "farming:mortar_pestle" + }, + replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}, +}) + +-- Rice + +farming.register_plant("farming:rice", { + description = "Rice grains", + paramtype2 = "meshoptions", + inventory_image = "farming_rice_seed.png", + steps = 8, + place_param2 = 3, +}) + +minetest.override_item("farming:rice", { + groups = {food_rice = 1, flammable = 4} +}) + +minetest.register_craftitem("farming:rice_bread", { + description = "Rice Bread", + inventory_image = "farming_rice_bread.png", + on_use = minetest.item_eat(5), + groups = {food_rice_bread = 1, flammable = 2}, +}) + +minetest.register_craftitem("farming:rice_flour", { + description = "Rice Flour", + inventory_image = "farming_rice_flour.png", + groups = {food_rice_flour = 1, flammable = 1}, +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:rice_flour", + recipe = { + "farming:rice", "farming:rice", "farming:rice", "farming:rice", + "farming:mortar_pestle" + }, + replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}, +}) + +minetest.register_craft({ + type = "cooking", + cooktime = 15, + output = "farming:rice_bread", + recipe = "farming:rice_flour" +}) + +-- Multigrain flour + +minetest.register_craftitem("farming:flour_multigrain", { + description = S("Multigrain Flour"), + inventory_image = "farming_flour_multigrain.png", + groups = {food_flour = 1, flammable = 1}, +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:flour_multigrain", + recipe = { + "farming:wheat", "farming:barley", "farming:oat", + "farming:rye", "farming:mortar_pestle" + }, + replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}, +}) + +-- Multigrain bread + +minetest.register_craftitem("farming:bread_multigrain", { + description = S("Multigrain Bread"), + inventory_image = "farming_bread_multigrain.png", + on_use = minetest.item_eat(7), + groups = {food_bread = 1, flammable = 2}, +}) + +minetest.register_craft({ + type = "cooking", + cooktime = 15, + output = "farming:bread_multigrain", + recipe = "farming:flour_multigrain" +}) + +-- Fuels + +minetest.register_craft({ + type = "fuel", + recipe = "farming:rice_bread", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:bread_multigrain", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:rye", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:oat", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:rice", + burntime = 1, +}) diff --git a/farming/farming.conf_example b/farming/farming.conf_example index f652e9c..9d1769a 100644 --- a/farming/farming.conf_example +++ b/farming/farming.conf_example @@ -29,6 +29,7 @@ farming.pepper = true farming.pineapple = true farming.peas = true farming.beetroot = true +farming.grains = true -- rarety of crops on map, default is 0.001 (higher number = more crops) farming.rarety = 0.002 diff --git a/farming/food.lua b/farming/food.lua index f099e53..1670f1f 100644 --- a/farming/food.lua +++ b/farming/food.lua @@ -185,4 +185,36 @@ minetest.after(0, function() }, replacements = {{fluid_return, "bucket:bucket_empty"}} }) + + minetest.register_craft({ + type = "shapeless", + output = "farming:porridge", + recipe = { + "group:food_oats", "group:food_oats", "group:food_oats", + "group:food_oats", "group:food_bowl", fluid + }, + replacements = {{fluid_return, "bucket:bucket_empty"}} + }) end) + +--= Jaffa Cake + +minetest.register_craftitem("farming:jaffa_cake", { + description = S("Jaffa Cake"), + inventory_image = "farming_jaffa_cake.png", + on_use = minetest.item_eat(6), +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:jaffa_cake", + recipe = { + "farming:baking_tray", "group:food_egg", "group:food_sugar", + "group:food_flour", "group:food_cocoa", "group:food_orange", + "group:food_milk" + }, + replacements = { + {"farming:baking_tray", "farming:baking_tray"}, + {"mobs:bucket_milk", "bucket:bucket_empty"} + } +}) diff --git a/farming/grass.lua b/farming/grass.lua index 9644254..53ea606 100644 --- a/farming/grass.lua +++ b/farming/grass.lua @@ -8,6 +8,7 @@ for i = 4, 5 do max_items = 1, items = { {items = {'farming:seed_wheat'}, rarity = 5}, + {items = {'farming:seed_oat'},rarity = 5}, {items = {'default:grass_1'}}, } }, @@ -21,7 +22,8 @@ for i = 4, 5 do drop = { max_items = 1, items = { - {items = {'farming:seed_barley'}, rarity = 6}, + {items = {'farming:seed_barley'}, rarity = 5}, + {items = {'farming:seed_rye'},rarity = 5}, {items = {'default:dry_grass_1'}}, } }, @@ -37,6 +39,7 @@ minetest.override_item("default:junglegrass", { max_items = 1, items = { {items = {'farming:seed_cotton'}, rarity = 8}, + {items = {'farming:seed_rice'},rarity = 8}, {items = {'default:junglegrass'}}, } }, diff --git a/farming/hoes.lua b/farming/hoes.lua index 633e6f0..6ffa98f 100644 --- a/farming/hoes.lua +++ b/farming/hoes.lua @@ -330,3 +330,143 @@ minetest.register_craftitem("farming:hoe_bomb", { end end, }) + +-- Mithril Scythe (special item) + +farming.scythe_not_drops = {"farming:trellis", "farming:beanpole"} + +farming.add_to_scythe_not_drops = function(item) + table.insert(farming.scythe_not_drops, item) +end + +minetest.register_tool("farming:scythe_mithril", { + description = S("Mithril Scythe (Right-click crop to harvest and replant)"), + inventory_image = "farming_scythe_mithril.png", + tool_capabilities = { + full_punch_interval = 0.8, + max_drop_level = 2, + groupcaps = { + fleshy = {times = {[2] = 0.65, [3] = 0.25}, uses = 150, maxlevel = 2}, + snappy = {times = {[2] = 0.70, [3] = 0.25}, uses = 150, maxlevel = 2}, + }, + damage_groups = {fleshy = 8}, + }, + sound = {breaks = "default_tool_breaks"}, + + on_place = function(itemstack, placer, pointed_thing) + + if pointed_thing.type ~= "node" then + return + end + + local pos = pointed_thing.under + local name = placer:get_player_name() + + if minetest.is_protected(pos, name) then + return + end + + local node = minetest.get_node_or_nil(pos) + + if not node then + return + end + + local def = minetest.registered_nodes[node.name] + + if not def then + return + end + + if not def.drop then + return + end + + if not def.groups + or not def.groups.plant then + return + end + + local drops = minetest.get_node_drops(node.name, "") + + if not drops + or #drops == 0 + or (#drops == 1 and drops[1] == "") then + return + end + + -- get crop name + local mname = node.name:split(":")[1] + local pname = node.name:split(":")[2] + local sname = tonumber(pname:split("_")[2]) + pname = pname:split("_")[1] + + if not sname then + return + end + + -- add dropped items + for _, dropped_item in pairs(drops) do + + -- dont drop items on this list + for _, not_item in pairs(farming.scythe_not_drops) do + + if dropped_item == not_item then + dropped_item = nil + end + end + + if dropped_item then + + local obj = minetest.add_item(pos, dropped_item) + + if obj then + + obj:set_velocity({ + x = math.random(-10, 10) / 9, + y = 3, + z = math.random(-10, 10) / 9, + }) + end + end + end + + -- Run script hook + for _, callback in pairs(core.registered_on_dignodes) do + callback(pos, node) + end + + -- play sound + minetest.sound_play("default_grass_footstep", {pos = pos, gain = 1.0}) + + local replace = mname .. ":" .. pname .. "_1" + + if minetest.registered_nodes[replace] then + + local p2 = minetest.registered_nodes[replace].place_param2 or 1 + + minetest.set_node(pos, {name = replace, param2 = p2}) + else + minetest.set_node(pos, {name = "air"}) + end + + if not farming.is_creative(name) then + + itemstack:add_wear(65535 / 150) -- 150 uses + + return itemstack + end + end, +}) + +if minetest.get_modpath("moreores") then + + minetest.register_craft({ + output = "farming:scythe_mithril", + recipe = { + {"", "moreores:mithril_ingot", "moreores:mithril_ingot"}, + {"moreores:mithril_ingot", "", "group:stick"}, + {"", "", "group:stick"} + } + }) +end diff --git a/farming/init.lua b/farming/init.lua index 04fe300..98479a3 100644 --- a/farming/init.lua +++ b/farming/init.lua @@ -7,7 +7,7 @@ farming = { mod = "redo", - version = "20180929", + version = "20190111", path = minetest.get_modpath("farming"), select = { type = "fixed", @@ -457,6 +457,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname) minetest.set_node(pt.above, {name = plantname, param2 = p2}) --minetest.get_node_timer(pt.above):start(1) +--farming.handle_growth(pt.above)--, node) minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}) @@ -591,7 +592,7 @@ farming.registered_plants[mname .. ":" .. pname] = { minlight = def.minlight, maxlight = def.maxlight } -print(dump(farming.registered_plants[mname .. ":" .. pname])) +--print(dump(farming.registered_plants[mname .. ":" .. pname])) -- Return info return {seed = mname .. ":seed_" .. pname, harvest = mname .. ":" .. pname} end @@ -621,6 +622,7 @@ farming.pepper = true farming.pineapple = true farming.peas = true farming.beetroot = true +farming.grains = true farming.rarety = 0.002 -- 0.006 @@ -629,16 +631,14 @@ local input = io.open(farming.path.."/farming.conf", "r") if input then dofile(farming.path .. "/farming.conf") input:close() - input = nil end -- load new world-specific settings if found inside world folder local worldpath = minetest.get_worldpath() -local input = io.open(worldpath.."/farming.conf", "r") +input = io.open(worldpath.."/farming.conf", "r") if input then dofile(worldpath .. "/farming.conf") input:close() - input = nil end @@ -685,6 +685,7 @@ ddoo("pineapple.lua", farming.pineapple) ddoo("peas.lua", farming.peas) ddoo("beetroot.lua", farming.beetroot) ddoo("chili.lua", farming.chili) +ddoo("ryeoatrice.lua", farming.grains) dofile(farming.path.."/food.lua") dofile(farming.path.."/mapgen.lua") diff --git a/farming/license.txt b/farming/license.txt index b7bb7a9..eba35f8 100644 --- a/farming/license.txt +++ b/farming/license.txt @@ -23,7 +23,7 @@ THE SOFTWARE. License of media (textures): ---------------------------- -Created by PilzAdam (License: WTFPL): +Created by PilzAdam (License: CC BY 3.0): farming_bread.png farming_soil.png farming_soil_wet.png @@ -41,7 +41,7 @@ Created by Calinou (License: CC BY-SA): farming_tool_mesehoe.png farming_tool_diamondhoe.png -Created by VanessaE (License: WTFPL): +Created by VanessaE (License: CC BY 3.0): farming_cotton_seed.png farming_wheat_seed.png farming_flour.png @@ -63,7 +63,7 @@ Created by VanessaE (License: WTFPL): farming_cotton_7.png farming_cotton_8.png -Created by Doc (License: WTFPL): +Created by Doc (License: CC BY 3.0): farming_cucumber.png farming_cucumber_1.png farming_cucumber_2.png @@ -80,7 +80,7 @@ Created by Doc (License: WTFPL): farming_raspberry_3.png farming_raspberry_4.png -Created by Gambit: +Created by Gambit (License: CC BY 3.0): default_junglegrass.png farming_carrot.png farming_carrot_1.png @@ -92,7 +92,7 @@ Created by Gambit: farming_carrot_7.png farming_carrot_8.png -Created by JoseTheCrafter and edited by TenPlus1: +Created by JoseTheCrafter and edited by TenPlus1 (CC BY 3.0): farming_tomato.png farming_tomato_1.png farming_tomato_2.png @@ -103,7 +103,7 @@ Created by JoseTheCrafter and edited by TenPlus1: farming_tomato_7.png farming_tomato_8.png -Created by GeMinecraft and edited by TenPlus1: +Created by GeMinecraft and edited by TenPlus1 (CC BY 3.0): farming_corn.png farming_corn_cob.png farming_corn_1.png @@ -115,7 +115,7 @@ Created by GeMinecraft and edited by TenPlus1: farming_corn_7.png farming_corn_8.png -Created by TenPlus1 +Created by TenPlus1 (CC BY 3.0) farming_cocoa_1.png farming_cocoa_2.png farming_cocoa_3.png @@ -128,3 +128,14 @@ Created by TenPlus1 farming_rhubarb.png farming_rhubarb_pie.png farming_hemp*.png + +Created by ademant (CC-BY-3.0) + farming_rye*.png + farming_oat*.png + farming_rice*.png + +Created by PilzAdam and edited by SpaghettiToastBook (CC0): + farming_bread_multigrain.png + +Created by VanessaE and edited by SpaghettiToastBook (CC0): + farming_flour_multigrain.png diff --git a/farming/lucky_block.lua b/farming/lucky_block.lua index 6f656ff..5a69a68 100644 --- a/farming/lucky_block.lua +++ b/farming/lucky_block.lua @@ -34,6 +34,7 @@ if minetest.get_modpath("lucky_block") then {"dro", {"farming:hoe_bomb"}, 10}, {"dro", {"farming:turkish_delight"}, 5}, {"lig"}, + {"dro", {"farming:scythe_mithril"}, 1}, {"sch", "instafarm", 0, true, { {"farming:wheat_8", "farming:carrot_8"}, {"farming:cotton_8", "farming:rhubarb_3"}, @@ -67,6 +68,9 @@ if minetest.get_modpath("lucky_block") then {name = "farming:seed_barley", max = 15}, {name = "farming:seed_barley", max = 15}, {name = "farming:seed_hemp", max = 15}, + {name = "farming:seed_rye", max = 15}, + {name = "farming:seed_rice", max = 15}, + {name = "farming:seed_oat", max = 15}, {name = "farming:soil_wet", max = 10}, }}, }) diff --git a/farming/textures/farming_bread_multigrain.png b/farming/textures/farming_bread_multigrain.png new file mode 100644 index 0000000..66dda07 Binary files /dev/null and b/farming/textures/farming_bread_multigrain.png differ diff --git a/farming/textures/farming_flour_multigrain.png b/farming/textures/farming_flour_multigrain.png new file mode 100644 index 0000000..5367bc5 Binary files /dev/null and b/farming/textures/farming_flour_multigrain.png differ diff --git a/farming/textures/farming_jaffa_cake.png b/farming/textures/farming_jaffa_cake.png new file mode 100644 index 0000000..87cc003 Binary files /dev/null and b/farming/textures/farming_jaffa_cake.png differ diff --git a/farming/textures/farming_oat.png b/farming/textures/farming_oat.png new file mode 100644 index 0000000..e8d5c23 Binary files /dev/null and b/farming/textures/farming_oat.png differ diff --git a/farming/textures/farming_oat_1.png b/farming/textures/farming_oat_1.png new file mode 100644 index 0000000..177fbdf Binary files /dev/null and b/farming/textures/farming_oat_1.png differ diff --git a/farming/textures/farming_oat_2.png b/farming/textures/farming_oat_2.png new file mode 100644 index 0000000..fe051ea Binary files /dev/null and b/farming/textures/farming_oat_2.png differ diff --git a/farming/textures/farming_oat_3.png b/farming/textures/farming_oat_3.png new file mode 100644 index 0000000..5aba108 Binary files /dev/null and b/farming/textures/farming_oat_3.png differ diff --git a/farming/textures/farming_oat_4.png b/farming/textures/farming_oat_4.png new file mode 100644 index 0000000..833b134 Binary files /dev/null and b/farming/textures/farming_oat_4.png differ diff --git a/farming/textures/farming_oat_5.png b/farming/textures/farming_oat_5.png new file mode 100644 index 0000000..ec0803b Binary files /dev/null and b/farming/textures/farming_oat_5.png differ diff --git a/farming/textures/farming_oat_6.png b/farming/textures/farming_oat_6.png new file mode 100644 index 0000000..847adc5 Binary files /dev/null and b/farming/textures/farming_oat_6.png differ diff --git a/farming/textures/farming_oat_7.png b/farming/textures/farming_oat_7.png new file mode 100644 index 0000000..3552811 Binary files /dev/null and b/farming/textures/farming_oat_7.png differ diff --git a/farming/textures/farming_oat_8.png b/farming/textures/farming_oat_8.png new file mode 100644 index 0000000..c7a5540 Binary files /dev/null and b/farming/textures/farming_oat_8.png differ diff --git a/farming/textures/farming_oat_seed.png b/farming/textures/farming_oat_seed.png new file mode 100644 index 0000000..893c93c Binary files /dev/null and b/farming/textures/farming_oat_seed.png differ diff --git a/farming/textures/farming_rice.png b/farming/textures/farming_rice.png new file mode 100644 index 0000000..3d64c7e Binary files /dev/null and b/farming/textures/farming_rice.png differ diff --git a/farming/textures/farming_rice_1.png b/farming/textures/farming_rice_1.png new file mode 100644 index 0000000..715bb2e Binary files /dev/null and b/farming/textures/farming_rice_1.png differ diff --git a/farming/textures/farming_rice_2.png b/farming/textures/farming_rice_2.png new file mode 100644 index 0000000..2662d42 Binary files /dev/null and b/farming/textures/farming_rice_2.png differ diff --git a/farming/textures/farming_rice_3.png b/farming/textures/farming_rice_3.png new file mode 100644 index 0000000..fee87b2 Binary files /dev/null and b/farming/textures/farming_rice_3.png differ diff --git a/farming/textures/farming_rice_4.png b/farming/textures/farming_rice_4.png new file mode 100644 index 0000000..97b026f Binary files /dev/null and b/farming/textures/farming_rice_4.png differ diff --git a/farming/textures/farming_rice_5.png b/farming/textures/farming_rice_5.png new file mode 100644 index 0000000..c249851 Binary files /dev/null and b/farming/textures/farming_rice_5.png differ diff --git a/farming/textures/farming_rice_6.png b/farming/textures/farming_rice_6.png new file mode 100644 index 0000000..c0e7233 Binary files /dev/null and b/farming/textures/farming_rice_6.png differ diff --git a/farming/textures/farming_rice_7.png b/farming/textures/farming_rice_7.png new file mode 100644 index 0000000..9d251ee Binary files /dev/null and b/farming/textures/farming_rice_7.png differ diff --git a/farming/textures/farming_rice_8.png b/farming/textures/farming_rice_8.png new file mode 100644 index 0000000..41b37e0 Binary files /dev/null and b/farming/textures/farming_rice_8.png differ diff --git a/farming/textures/farming_rice_bread.png b/farming/textures/farming_rice_bread.png new file mode 100644 index 0000000..f14f741 Binary files /dev/null and b/farming/textures/farming_rice_bread.png differ diff --git a/farming/textures/farming_rice_flour.png b/farming/textures/farming_rice_flour.png new file mode 100644 index 0000000..2722151 Binary files /dev/null and b/farming/textures/farming_rice_flour.png differ diff --git a/farming/textures/farming_rice_seed.png b/farming/textures/farming_rice_seed.png new file mode 100644 index 0000000..854cd05 Binary files /dev/null and b/farming/textures/farming_rice_seed.png differ diff --git a/farming/textures/farming_rye.png b/farming/textures/farming_rye.png new file mode 100644 index 0000000..ebc5b37 Binary files /dev/null and b/farming/textures/farming_rye.png differ diff --git a/farming/textures/farming_rye_1.png b/farming/textures/farming_rye_1.png new file mode 100644 index 0000000..932b621 Binary files /dev/null and b/farming/textures/farming_rye_1.png differ diff --git a/farming/textures/farming_rye_2.png b/farming/textures/farming_rye_2.png new file mode 100644 index 0000000..b6a69b7 Binary files /dev/null and b/farming/textures/farming_rye_2.png differ diff --git a/farming/textures/farming_rye_3.png b/farming/textures/farming_rye_3.png new file mode 100644 index 0000000..aaa71c2 Binary files /dev/null and b/farming/textures/farming_rye_3.png differ diff --git a/farming/textures/farming_rye_4.png b/farming/textures/farming_rye_4.png new file mode 100644 index 0000000..ea1246e Binary files /dev/null and b/farming/textures/farming_rye_4.png differ diff --git a/farming/textures/farming_rye_5.png b/farming/textures/farming_rye_5.png new file mode 100644 index 0000000..b359673 Binary files /dev/null and b/farming/textures/farming_rye_5.png differ diff --git a/farming/textures/farming_rye_6.png b/farming/textures/farming_rye_6.png new file mode 100644 index 0000000..749a2ef Binary files /dev/null and b/farming/textures/farming_rye_6.png differ diff --git a/farming/textures/farming_rye_7.png b/farming/textures/farming_rye_7.png new file mode 100644 index 0000000..fc78198 Binary files /dev/null and b/farming/textures/farming_rye_7.png differ diff --git a/farming/textures/farming_rye_8.png b/farming/textures/farming_rye_8.png new file mode 100644 index 0000000..0b7c33e Binary files /dev/null and b/farming/textures/farming_rye_8.png differ diff --git a/farming/textures/farming_rye_seed.png b/farming/textures/farming_rye_seed.png new file mode 100644 index 0000000..e65ba9b Binary files /dev/null and b/farming/textures/farming_rye_seed.png differ diff --git a/farming/textures/farming_scythe_mithril.png b/farming/textures/farming_scythe_mithril.png new file mode 100644 index 0000000..17c89c5 Binary files /dev/null and b/farming/textures/farming_scythe_mithril.png differ diff --git a/homedecor/wardrobe.lua b/homedecor/wardrobe.lua index 8515555..6ce13f8 100644 --- a/homedecor/wardrobe.lua +++ b/homedecor/wardrobe.lua @@ -45,17 +45,16 @@ function homedecor.get_player_skin(player) end function homedecor.set_player_skin(player, skin, save) - skin = skin or default_skin if skinsdb_mod_path then - skins.set_player_skin(player, skin) + skins.set_player_skin(player, skin or skins.default) elseif armor_mod_path then -- if 3D_armor's installed, let it set the skin - armor.textures[player:get_player_name()].skin = skin + armor.textures[player:get_player_name()].skin = skin or default_skin armor:update_player_visuals(player) else - set_player_textures(player, { skin }) + set_player_textures(player, { skin or default_skin}) end - if save then + if save and not skinsdb_mod_path then if skin == default_skin then skin = "default" player:set_attribute("homedecor:player_skin", "") @@ -133,13 +132,15 @@ homedecor.register("wardrobe", { minetest.register_alias("homedecor:wardrobe_bottom", "homedecor:wardrobe") minetest.register_alias("homedecor:wardrobe_top", "air") -minetest.register_on_joinplayer(function(player) - local skin = player:get_attribute("homedecor:player_skin") +if not skinsdb_mod_path then -- If not managed by skinsdb + minetest.register_on_joinplayer(function(player) + local skin = player:get_attribute("homedecor:player_skin") - if skin and skin ~= "" then - -- setting player skin on connect has no effect, so delay skin change - minetest.after(1, function(player, skin) - homedecor.set_player_skin(player, skin) - end, player, skin) - end -end) + if skin and skin ~= "" then + -- setting player skin on connect has no effect, so delay skin change + minetest.after(1, function(player, skin) + homedecor.set_player_skin(player, skin) + end, player, skin) + end + end) +end diff --git a/maptools/.editorconfig b/maptools/.editorconfig new file mode 100644 index 0000000..a41c697 --- /dev/null +++ b/maptools/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{lua,luacheckrc}] +indent_style = tab +indent_size = 4 diff --git a/maptools/.luacheckrc b/maptools/.luacheckrc new file mode 100644 index 0000000..4bfca2a --- /dev/null +++ b/maptools/.luacheckrc @@ -0,0 +1,29 @@ +std = "lua51+minetest" +unused_args = false +allow_defined_top = true +max_line_length = 90 + +stds.minetest = { + read_globals = { + "DIR_DELIM", + "minetest", + "core", + "dump", + "vector", + "nodeupdate", + "VoxelManip", + "VoxelArea", + "PseudoRandom", + "ItemStack", + "default", + table = { + fields = { + "copy", + }, + }, + } +} + +read_globals = { + "intllib", +} diff --git a/maptools/.pre-commit-config.yaml b/maptools/.pre-commit-config.yaml new file mode 100644 index 0000000..9c72498 --- /dev/null +++ b/maptools/.pre-commit-config.yaml @@ -0,0 +1,9 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.1.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace + + - id: mixed-line-ending + args: [--fix=lf] diff --git a/maptools/LICENSE.md b/maptools/LICENSE.md index 2188fe4..a5a3df9 100644 --- a/maptools/LICENSE.md +++ b/maptools/LICENSE.md @@ -1,6 +1,6 @@ # zlib license -Copyright (c) 2012-2017 Hugo Locurcio and contributors +Copyright © 2012-2019 Hugo Locurcio and contributors **This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.** diff --git a/maptools/aliases.lua b/maptools/aliases.lua index 5a0e0bb..13ec59f 100644 --- a/maptools/aliases.lua +++ b/maptools/aliases.lua @@ -1,7 +1,7 @@ --[[ Map Tools: alias definitions -Copyright (c) 2012-2017 Hugo Locurcio and contributors. +Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/maptools/config.lua b/maptools/config.lua index f59be03..56d0e2d 100644 --- a/maptools/config.lua +++ b/maptools/config.lua @@ -1,7 +1,7 @@ --[[ Map Tools: configuration handling -Copyright (c) 2012-2017 Hugo Locurcio and contributors. +Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/maptools/craftitems.lua b/maptools/craftitems.lua index fca7e13..aa2330b 100644 --- a/maptools/craftitems.lua +++ b/maptools/craftitems.lua @@ -1,7 +1,7 @@ --[[ Map Tools: item definitions -Copyright (c) 2012-2017 Hugo Locurcio and contributors. +Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/maptools/default_nodes.lua b/maptools/default_nodes.lua index eb74b4c..89409f0 100644 --- a/maptools/default_nodes.lua +++ b/maptools/default_nodes.lua @@ -1,7 +1,7 @@ --[[ Map Tools: unbreakable default nodes -Copyright (c) 2012-2017 Hugo Locurcio and contributors. +Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] @@ -47,7 +47,11 @@ minetest.register_node("maptools:jungletree", { description = S("Unbreakable Jungle Tree"), range = 12, stack_max = 10000, - tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"}, + tiles = { + "default_jungletree_top.png", + "default_jungletree_top.png", + "default_jungletree.png", + }, drop = "", groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_wood_defaults(), @@ -254,7 +258,11 @@ minetest.register_node("maptools:grass", { description = S("Unbreakable Dirt with Grass"), range = 12, stack_max = 10000, - tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, + tiles = { + "default_grass.png", + "default_dirt.png", + "default_dirt.png^default_grass_side.png", + }, paramtype2 = "facedir", drop = "", groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, @@ -282,7 +290,11 @@ for slab_num = 1,3,1 do description = S("Grass Slab"), range = 12, stack_max = 10000, - tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^maptools_grass_side_" .. slab_num * 4 .. ".png"}, + tiles = { + "default_grass.png", + "default_dirt.png", + "default_dirt.png^maptools_grass_side_" .. slab_num * 4 .. ".png", + }, drawtype = "nodebox", node_box = { type = "fixed", @@ -293,7 +305,9 @@ for slab_num = 1,3,1 do paramtype2 = "facedir", drop = "", groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, - sounds = default.node_sound_dirt_defaults({footstep = {name="default_grass_footstep", gain = 0.4}}), + sounds = default.node_sound_dirt_defaults( + {footstep = {name="default_grass_footstep", gain = 0.4}} + ), on_drop = maptools.drop_msg }) end @@ -404,9 +418,18 @@ minetest.register_node("maptools:soil_wet", { description = "Wet Soil", range = 12, stack_max = 10000, - tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_wet_side.png"}, + tiles = { + "default_dirt.png^farming_soil_wet.png", + "default_dirt.png^farming_soil_wet_side.png", + }, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, soil = 3, wet = 1, grassland = 1}, + groups = { + unbreakable = 1, + not_in_creative_inventory = maptools.creative, + soil = 3, + wet = 1, + grassland = 1, + }, sounds = default.node_sound_dirt_defaults(), on_drop = maptools.drop_msg }) @@ -417,7 +440,13 @@ minetest.register_node("maptools:desert_sand_soil_wet", { stack_max = 10000, drop = "", tiles = {"farming_desert_sand_soil_wet.png", "farming_desert_sand_soil_wet_side.png"}, - groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, soil = 3, wet = 1, desert = 1}, + groups = { + unbreakable = 1, + not_in_creative_inventory = maptools.creative, + soil = 3, + wet = 1, + desert = 1, + }, sounds = default.node_sound_sand_defaults(), on_drop = maptools.drop_msg }) diff --git a/maptools/init.lua b/maptools/init.lua index 17d5e37..a329f62 100644 --- a/maptools/init.lua +++ b/maptools/init.lua @@ -1,37 +1,37 @@ ---[[ -===================================================================== -** Map Tools ** -By Calinou. - -Copyright (c) 2012-2017 Hugo Locurcio and contributors. -Licensed under the zlib license. See LICENSE.md for more information. -===================================================================== ---]] - -maptools = {} - -local S -if minetest.get_modpath("intllib") then - S = intllib.Getter() -else - S = function(s) return s end -end -maptools.intllib = S - -local modpath = minetest.get_modpath("maptools") - -maptools.drop_msg = function(itemstack, player) - local name = player:get_player_name() - minetest.chat_send_player(name, S("[maptools] tools/nodes do not drop!")) -end - -dofile(modpath .. "/config.lua") -dofile(modpath .. "/aliases.lua") -dofile(modpath .. "/craftitems.lua") -dofile(modpath .. "/default_nodes.lua") -dofile(modpath .. "/nodes.lua") -dofile(modpath .. "/tools.lua") - -if minetest.setting_getbool("log_mods") then - minetest.log("action", S("[maptools] loaded.")) -end +--[[ +===================================================================== +** Map Tools ** +By Calinou. + +Copyright © 2012-2019 Hugo Locurcio and contributors. +Licensed under the zlib license. See LICENSE.md for more information. +===================================================================== +--]] + +maptools = {} + +local S +if minetest.get_modpath("intllib") then + S = intllib.Getter() +else + S = function(s) return s end +end +maptools.intllib = S + +local modpath = minetest.get_modpath("maptools") + +maptools.drop_msg = function(itemstack, player) + local name = player:get_player_name() + minetest.chat_send_player(name, S("[maptools] tools/nodes do not drop!")) +end + +dofile(modpath .. "/config.lua") +dofile(modpath .. "/aliases.lua") +dofile(modpath .. "/craftitems.lua") +dofile(modpath .. "/default_nodes.lua") +dofile(modpath .. "/nodes.lua") +dofile(modpath .. "/tools.lua") + +if minetest.setting_getbool("log_mods") then + minetest.log("action", S("[maptools] loaded.")) +end diff --git a/maptools/nodes.lua b/maptools/nodes.lua index d8e4212..3a2ebf5 100644 --- a/maptools/nodes.lua +++ b/maptools/nodes.lua @@ -1,7 +1,7 @@ --[[ Map Tools: node definitions -Copyright (c) 2012-2017 Hugo Locurcio and contributors. +Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] @@ -62,7 +62,6 @@ minetest.register_node("maptools:playerclip", { minetest.register_node("maptools:fake_walkable", { description = S("Player Clip"), - drawtype = "nodebox", range = 12, stack_max = 10000, inventory_image = "default_steel_block.png^dye_green.png", @@ -96,7 +95,6 @@ minetest.register_node("maptools:fullclip", { minetest.register_node("maptools:fake_walkable_pointable", { description = S("Player Clip"), - drawtype = "nodebox", range = 12, stack_max = 10000, inventory_image = "default_steel_block.png^dye_green.png", @@ -186,7 +184,11 @@ minetest.register_node("maptools:fullclip_face", { fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5}, }, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, fall_damage_add_percent=-100}, + groups = { + unbreakable = 1, + not_in_creative_inventory = maptools.creative, + fall_damage_add_percent = -100, + }, on_drop = maptools.drop_msg }) @@ -205,7 +207,11 @@ minetest.register_node("maptools:playerclip_bottom", { fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5}, }, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, fall_damage_add_percent=-100}, + groups = { + unbreakable = 1, + not_in_creative_inventory = maptools.creative, + fall_damage_add_percent = -100, + }, on_drop = maptools.drop_msg }) @@ -224,7 +230,11 @@ minetest.register_node("maptools:playerclip_top", { fixed = {-0.5, 0.4999, -0.5, 0.5, 0.5, 0.5}, }, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, fall_damage_add_percent=-100}, + groups = { + unbreakable = 1, + not_in_creative_inventory = maptools.creative, + fall_damage_add_percent = -100, + }, on_drop = maptools.drop_msg }) @@ -244,7 +254,12 @@ minetest.register_node("maptools:pusher_" .. pusher_num, { fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5}, }, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, fall_damage_add_percent=-100, bouncy=pusher_num*100}, + groups = { + unbreakable = 1, + not_in_creative_inventory = maptools.creative, + fall_damage_add_percent = -100, + bouncy = pusher_num * 100, + }, on_drop = maptools.drop_msg }) end @@ -422,7 +437,6 @@ minetest.register_node("maptools:igniter", { drawtype = "airlike", range = 12, stack_max = 10000, - inventory_image = "default_steel_block.png^crosshair.png", description = S("Igniter"), paramtype = "light", inventory_image = "fire_basic_flame.png", diff --git a/maptools/textures/fire_basic_flame_animated.png b/maptools/textures/fire_basic_flame_animated.png index 6f5f8ac..17b4ceb 100644 Binary files a/maptools/textures/fire_basic_flame_animated.png and b/maptools/textures/fire_basic_flame_animated.png differ diff --git a/maptools/textures/maptools_adminpick.png b/maptools/textures/maptools_adminpick.png index 04824eb..1714378 100644 Binary files a/maptools/textures/maptools_adminpick.png and b/maptools/textures/maptools_adminpick.png differ diff --git a/maptools/textures/maptools_copper_coin.png b/maptools/textures/maptools_copper_coin.png index 26d22a8..bac8870 100644 Binary files a/maptools/textures/maptools_copper_coin.png and b/maptools/textures/maptools_copper_coin.png differ diff --git a/maptools/textures/maptools_gold_coin.png b/maptools/textures/maptools_gold_coin.png index 40f14a9..1866881 100644 Binary files a/maptools/textures/maptools_gold_coin.png and b/maptools/textures/maptools_gold_coin.png differ diff --git a/maptools/textures/maptools_infinitefuel.png b/maptools/textures/maptools_infinitefuel.png index 163f171..de4b43e 100644 Binary files a/maptools/textures/maptools_infinitefuel.png and b/maptools/textures/maptools_infinitefuel.png differ diff --git a/maptools/textures/maptools_silver_coin.png b/maptools/textures/maptools_silver_coin.png index 284c671..7e909d6 100644 Binary files a/maptools/textures/maptools_silver_coin.png and b/maptools/textures/maptools_silver_coin.png differ diff --git a/maptools/textures/maptools_smoke.png b/maptools/textures/maptools_smoke.png index c50b7e3..192a7ce 100644 Binary files a/maptools/textures/maptools_smoke.png and b/maptools/textures/maptools_smoke.png differ diff --git a/maptools/textures/maptools_superapple.png b/maptools/textures/maptools_superapple.png index 6833827..060ee80 100644 Binary files a/maptools/textures/maptools_superapple.png and b/maptools/textures/maptools_superapple.png differ diff --git a/maptools/tools.lua b/maptools/tools.lua index a5c5933..9e784ae 100644 --- a/maptools/tools.lua +++ b/maptools/tools.lua @@ -1,7 +1,7 @@ --[[ Map Tools: tool definitions -Copyright (c) 2012-2017 Hugo Locurcio and contributors. +Copyright © 2012-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] @@ -56,8 +56,19 @@ minetest.register_tool("maptools:pick_admin_with_drops", { minetest.register_on_punchnode(function(pos, node, puncher) if puncher:get_wielded_item():get_name() == "maptools:pick_admin" and minetest.get_node(pos).name ~= "air" then - minetest.log("action", puncher:get_player_name() .. " digs " .. minetest.get_node(pos).name .. " at " .. minetest.pos_to_string(pos) .. " using an Admin Pickaxe.") - minetest.remove_node(pos) -- The node is removed directly, which means it even works on non-empty containers and group-less nodes. - minetest.check_for_falling(pos) -- Run node update actions like falling nodes. + minetest.log( + "action", + puncher:get_player_name() .. + " digs " .. + minetest.get_node(pos).name .. + " at " .. + minetest.pos_to_string(pos) .. + " using an Admin Pickaxe." + ) + -- The node is removed directly, which means it even works + -- on non-empty containers and group-less nodes. + minetest.remove_node(pos) + -- Run node update actions like falling nodes. + minetest.check_for_falling(pos) end end) diff --git a/mesecons_blinkyplant/doc/blinkyplant/description.html b/mesecons_blinkyplant/doc/blinkyplant/description.html index 2a7db48..0d987a5 100644 --- a/mesecons_blinkyplant/doc/blinkyplant/description.html +++ b/mesecons_blinkyplant/doc/blinkyplant/description.html @@ -1 +1,2 @@ The blinky plants toggles between on and off state every three seconds. Can be used to make clocks. Also works after having restarted the game. +It stops blinking in an inactive block, then starts again when the block becomes active. diff --git a/mesecons_commandblock/doc/commandblock/description.html b/mesecons_commandblock/doc/commandblock/description.html index 405b7e55..9ba7ce5 100644 --- a/mesecons_commandblock/doc/commandblock/description.html +++ b/mesecons_commandblock/doc/commandblock/description.html @@ -1 +1,2 @@ There is no crafting recipe as this should only be available for server admins. Quite similar to the Minecraft counterpart. Executes server commands. +It works in inactive blocks. diff --git a/mesecons_delayer/doc/delayer/description.html b/mesecons_delayer/doc/delayer/description.html index f3a5280..966d729 100644 --- a/mesecons_delayer/doc/delayer/description.html +++ b/mesecons_delayer/doc/delayer/description.html @@ -1 +1 @@ -The delayer delays the signal from the input for a determined time. The time can be set by punching the delayer. Possible delays are: 0.1 seconds, 0.3 seconds, 0.5 seconds and 1 second. You may try to use it for creating songs with the noteblock. +The delayer delays the signal from the input for a determined time. The time can be set by punching the delayer. Possible delays are: 0.1 seconds, 0.3 seconds, 0.5 seconds and 1 second. You may try to use it for creating songs with the noteblock. It works in unloaded blocks. diff --git a/mesecons_detector/doc/nodedetector/description.html b/mesecons_detector/doc/nodedetector/description.html index be1582e..ee8c09d 100644 --- a/mesecons_detector/doc/nodedetector/description.html +++ b/mesecons_detector/doc/nodedetector/description.html @@ -5,3 +5,4 @@ respond with the detected nodename or you can send any other string and it will set this string as the node to scan for. Nodenames must include the mod they reside in, so for instance default:dirt, not just dirt. The distance parameter specifies how many blocks are between the node detector and the node to detect. +Automatic scanning with Mesecons output only works when the detector is in an active block, but Digilines queries always work. diff --git a/mesecons_detector/doc/objectdetector/description.html b/mesecons_detector/doc/objectdetector/description.html index bb88856..a928434 100644 --- a/mesecons_detector/doc/objectdetector/description.html +++ b/mesecons_detector/doc/objectdetector/description.html @@ -2,3 +2,4 @@ The object detector is a receptor. It changes its state when a player approaches Right-click it to set a name to scan for. You can also search for comma-separated lists of players where the detector gets activated if any of the names in the list are found. It can also receive digiline signals which are the name to scan for on the specified channel in the right-click menu. +Automatic scanning with Mesecons output only works when the detector is in an active block, but Digilines queries always work. diff --git a/mesecons_extrawires/doc/corner/description.html b/mesecons_extrawires/doc/corner/description.html index 92de8b0..fc420d1 100644 --- a/mesecons_extrawires/doc/corner/description.html +++ b/mesecons_extrawires/doc/corner/description.html @@ -1 +1 @@ -Insulated corners are conductors that only conduct between the inputs (also not up or down). When placing they always point to the left in direction of your vision. +Insulated corners are conductors that only conduct between the inputs (also not up or down). When placing they always point to the left in direction of your vision. Like uninsulated wires, they work through unloaded blocks. diff --git a/mesecons_extrawires/doc/crossing/description.html b/mesecons_extrawires/doc/crossing/description.html index aa4cf25..5f02382 100644 --- a/mesecons_extrawires/doc/crossing/description.html +++ b/mesecons_extrawires/doc/crossing/description.html @@ -1 +1 @@ -Insulated crossing are conductors that conduct two signals between the opposing sides, the signals are insulated to each other. +Insulated crossing are conductors that conduct two signals between the opposing sides, the signals are insulated to each other. Like uninsulated wires, they work through unloaded blocks. diff --git a/mesecons_extrawires/doc/mese/description.html b/mesecons_extrawires/doc/mese/description.html index 1a14864..b29e92c 100644 --- a/mesecons_extrawires/doc/mese/description.html +++ b/mesecons_extrawires/doc/mese/description.html @@ -1 +1 @@ -The basic prerequesite for mesecons, can be crafted into wires and other stuff. Have a look at the Minetest Wiki for more information. Mese is a conductor. It conducts in all six directions: Up/Down/Left/Right/Forward/Backward +The basic prerequesite for mesecons, can be crafted into wires and other stuff. Have a look at the Minetest Wiki for more information. Mese is a conductor. It conducts in all six directions: Up/Down/Left/Right/Forward/Backward. Like horizontal wires, Mese conduction works through unloaded blocks. diff --git a/mesecons_extrawires/doc/tjunction/description.html b/mesecons_extrawires/doc/tjunction/description.html index f655a5d..647bba6 100644 --- a/mesecons_extrawires/doc/tjunction/description.html +++ b/mesecons_extrawires/doc/tjunction/description.html @@ -1 +1 @@ -Insulated T-Junctions are conductors that only conduct between the inputs (also not up or down). +Insulated T-Junctions are conductors that only conduct between the inputs (also not up or down). Like uninsulated wires, they work through unloaded blocks. diff --git a/mesecons_extrawires/doc/vertical/description.html b/mesecons_extrawires/doc/vertical/description.html index df09b94..8508542 100644 --- a/mesecons_extrawires/doc/vertical/description.html +++ b/mesecons_extrawires/doc/vertical/description.html @@ -1 +1 @@ -Vertical Mesecons only conduct up and down. Plates appear at the ends, at that place they also conduct to the side. +Vertical Mesecons only conduct up and down. Plates appear at the ends, at that place they also conduct to the side. Like horizontal wires, they work through unloaded blocks. diff --git a/mesecons_fpga/doc/fpga/description.html b/mesecons_fpga/doc/fpga/description.html index 95177b2..a4cbeed 100644 --- a/mesecons_fpga/doc/fpga/description.html +++ b/mesecons_fpga/doc/fpga/description.html @@ -1,5 +1,6 @@ FPGAs can be used to chain multiple logic gates together in a compact manner. They come with 4 I/O ports and 10 internal registers, -which can then be connected with each other to form logic circuits.
+which can then be connected with each other to form logic circuits. +They work fine in unloaded blocks.
Supported gate types: AND, OR, NOT, XOR, NAND, XNOR, Buffer (=)
I/O ports: A B C D; Registers: numbered 0 to 9 diff --git a/mesecons_gates/doc/and/description.html b/mesecons_gates/doc/and/description.html index 528839c..e8aff91 100644 --- a/mesecons_gates/doc/and/description.html +++ b/mesecons_gates/doc/and/description.html @@ -1 +1,2 @@ AND gates power their output if both inputs (from left and right) are powered. +They work in unloaded blocks. diff --git a/mesecons_gates/doc/diode/description.html b/mesecons_gates/doc/diode/description.html index 5f82706..b96aced 100644 --- a/mesecons_gates/doc/diode/description.html +++ b/mesecons_gates/doc/diode/description.html @@ -1 +1,2 @@ Diodes conduct signals in one direction only. +They work in unloaded blocks. diff --git a/mesecons_gates/doc/nand/description.html b/mesecons_gates/doc/nand/description.html index 69c1d4f..c46a7e1 100644 --- a/mesecons_gates/doc/nand/description.html +++ b/mesecons_gates/doc/nand/description.html @@ -1 +1,2 @@ NAND gates do not power their output if both inputs (from left and right) are powered, but power it in every other case. +They work in unloaded blocks. diff --git a/mesecons_gates/doc/nor/description.html b/mesecons_gates/doc/nor/description.html index 28d66a4..7d53953 100644 --- a/mesecons_gates/doc/nor/description.html +++ b/mesecons_gates/doc/nor/description.html @@ -1 +1,2 @@ NOR gates only power their output if none of their two inputs is powered. They are basically OR gates with a NOT gate at their output. +They work in unloaded blocks. diff --git a/mesecons_gates/doc/not/description.html b/mesecons_gates/doc/not/description.html index 7538dc9..5a08423 100644 --- a/mesecons_gates/doc/not/description.html +++ b/mesecons_gates/doc/not/description.html @@ -1 +1,2 @@ NOT gates invert signals, just like a mesecon torch does, but faster. The input is at the opposite side of the output. +They work in unloaded blocks. diff --git a/mesecons_gates/doc/or/description.html b/mesecons_gates/doc/or/description.html index f7f5539..15d598f 100644 --- a/mesecons_gates/doc/or/description.html +++ b/mesecons_gates/doc/or/description.html @@ -1 +1,2 @@ OR gates power their output if either of their inputs (or both) are powered. You could basically get the same behaviour with two diodes, but OR gates save some space. +They work in unloaded blocks. diff --git a/mesecons_gates/doc/xor/description.html b/mesecons_gates/doc/xor/description.html index f52f3fc..74f8b5f 100644 --- a/mesecons_gates/doc/xor/description.html +++ b/mesecons_gates/doc/xor/description.html @@ -1 +1,2 @@ XOR gates power their output if only one input is powered, they're off if either both or none of the inputs is powered. +They work in unloaded blocks. diff --git a/mesecons_hydroturbine/doc/waterturbine/description.html b/mesecons_hydroturbine/doc/waterturbine/description.html index 4b4e5a0..6153d51 100644 --- a/mesecons_hydroturbine/doc/waterturbine/description.html +++ b/mesecons_hydroturbine/doc/waterturbine/description.html @@ -1 +1,2 @@ Water turbines are receptors that turn on if flowing water is above them. +They only work in active blocks; in inactive blocks they keep their old state. diff --git a/mesecons_insulated/doc/insulated/description.html b/mesecons_insulated/doc/insulated/description.html index df2a6df..deb344d 100644 --- a/mesecons_insulated/doc/insulated/description.html +++ b/mesecons_insulated/doc/insulated/description.html @@ -1 +1 @@ - Insulated mesecons are conductors that only conduct in one direction (and also not up or down). + Insulated mesecons are conductors that only conduct in one direction (and also not up or down). Like uninsulated wires, they work through unloaded blocks. diff --git a/mesecons_lightstone/doc/lightstone_blue/description.html b/mesecons_lightstone/doc/lightstone_blue/description.html index 813e6ea..5397a96 100644 --- a/mesecons_lightstone/doc/lightstone_blue/description.html +++ b/mesecons_lightstone/doc/lightstone_blue/description.html @@ -1 +1,2 @@ Effector, glows blue when powered. +It works in an inactive block. diff --git a/mesecons_lightstone/doc/lightstone_darkgrey/description.html b/mesecons_lightstone/doc/lightstone_darkgrey/description.html index 826ca0f..aad59ea 100644 --- a/mesecons_lightstone/doc/lightstone_darkgrey/description.html +++ b/mesecons_lightstone/doc/lightstone_darkgrey/description.html @@ -1 +1,2 @@ Effector, glows dark grey when powered. +It works in an inactive block. diff --git a/mesecons_lightstone/doc/lightstone_green/description.html b/mesecons_lightstone/doc/lightstone_green/description.html index cb5b515..1191334 100644 --- a/mesecons_lightstone/doc/lightstone_green/description.html +++ b/mesecons_lightstone/doc/lightstone_green/description.html @@ -1 +1,2 @@ Effector, glows green when powered. +It works in an inactive block. diff --git a/mesecons_lightstone/doc/lightstone_lightgrey/description.html b/mesecons_lightstone/doc/lightstone_lightgrey/description.html index 990b501..b3003d2 100644 --- a/mesecons_lightstone/doc/lightstone_lightgrey/description.html +++ b/mesecons_lightstone/doc/lightstone_lightgrey/description.html @@ -1 +1,2 @@ Effector, glows light grey when powered. +It works in an inactive block. diff --git a/mesecons_lightstone/doc/lightstone_red/description.html b/mesecons_lightstone/doc/lightstone_red/description.html index 699b1ee..f49aeac 100644 --- a/mesecons_lightstone/doc/lightstone_red/description.html +++ b/mesecons_lightstone/doc/lightstone_red/description.html @@ -1 +1,2 @@ Effector, glows red when powered. +It works in an inactive block. diff --git a/mesecons_lightstone/doc/lightstone_yellow/description.html b/mesecons_lightstone/doc/lightstone_yellow/description.html index 2bed7f2..a97839b 100644 --- a/mesecons_lightstone/doc/lightstone_yellow/description.html +++ b/mesecons_lightstone/doc/lightstone_yellow/description.html @@ -1 +1,2 @@ Effector, glows yellow when powered. +It works in an inactive block. diff --git a/mesecons_luacontroller/doc/luacontroller/description.html b/mesecons_luacontroller/doc/luacontroller/description.html index e549ffe..8c5d023 100644 --- a/mesecons_luacontroller/doc/luacontroller/description.html +++ b/mesecons_luacontroller/doc/luacontroller/description.html @@ -1,5 +1,7 @@ The Luacontroller is an advanced programmable component. You can simply code it in the language Mesecons uses itself: Lua! All the code runs in a sandbox, so it's completely safe (but I won't guarantee that for absolute certainty!). +It works fine in an unloaded block, loading the block when the program needs to run. +Events are properly delivered after a server restart. Documentation is available here! diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua index 19b6479..1c93e48 100644 --- a/mesecons_luacontroller/init.lua +++ b/mesecons_luacontroller/init.lua @@ -266,32 +266,45 @@ local function remove_functions(x) return x end --- itbl: Flat table of functions to run after sandbox cleanup, used to prevent various security hazards -local function get_interrupt(pos, itbl, send_warning) - -- iid = interrupt id - local function interrupt(time, iid) - -- NOTE: This runs within string metatable sandbox, so don't *rely* on anything of the form (""):y - -- Hence the values get moved out. Should take less time than original, so totally compatible - if type(time) ~= "number" then return end - table.insert(itbl, function () - -- Outside string metatable sandbox, can safely run this now - local luac_id = minetest.get_meta(pos):get_int("luac_id") - -- Check if IID is dodgy, so you can't use interrupts to store an infinite amount of data. - -- Note that this is safe from alter-after-free because this code gets run after the sandbox has ended. - -- This runs outside of the timer and *shouldn't* harm perf. unless dodgy data is being sent in the first place - iid = remove_functions(iid) - local msg_ser = minetest.serialize(iid) - if #msg_ser <= mesecon.setting("luacontroller_interruptid_maxlen", 256) then - mesecon.queue:add_action(pos, "lc_interrupt", {luac_id, iid}, time, iid, 1) - else - send_warning("An interrupt ID was too large!") - end +-- The setting affects API so is not intended to be changeable at runtime +local get_interrupt +if mesecon.setting("luacontroller_lightweight_interrupts", false) then + -- use node timer + get_interrupt = function(pos, itbl, send_warning) + return (function(time, iid) + if type(time) ~= "number" then error("Delay must be a number") end + if iid ~= nil then send_warning("Interrupt IDs are disabled on this server") end + table.insert(itbl, function() minetest.get_node_timer(pos):start(time) end) end) end - return interrupt +else + -- use global action queue + -- itbl: Flat table of functions to run after sandbox cleanup, used to prevent various security hazards + get_interrupt = function(pos, itbl, send_warning) + -- iid = interrupt id + local function interrupt(time, iid) + -- NOTE: This runs within string metatable sandbox, so don't *rely* on anything of the form (""):y + -- Hence the values get moved out. Should take less time than original, so totally compatible + if type(time) ~= "number" then error("Delay must be a number") end + table.insert(itbl, function () + -- Outside string metatable sandbox, can safely run this now + local luac_id = minetest.get_meta(pos):get_int("luac_id") + -- Check if IID is dodgy, so you can't use interrupts to store an infinite amount of data. + -- Note that this is safe from alter-after-free because this code gets run after the sandbox has ended. + -- This runs outside of the timer and *shouldn't* harm perf. unless dodgy data is being sent in the first place + iid = remove_functions(iid) + local msg_ser = minetest.serialize(iid) + if #msg_ser <= mesecon.setting("luacontroller_interruptid_maxlen", 256) then + mesecon.queue:add_action(pos, "lc_interrupt", {luac_id, iid}, time, iid, 1) + else + send_warning("An interrupt ID was too large!") + end + end) + end + return interrupt + end end - -- Given a message object passed to digiline_send, clean it up into a form -- which is safe to transmit over the network and compute its "cost" (a very -- rough estimate of its memory usage). @@ -414,7 +427,6 @@ local function get_digiline_send(pos, itbl, send_warning) end end - local safe_globals = { -- Don't add pcall/xpcall unless willing to deal with the consequences (unless very careful, incredibly likely to allow killing server indirectly) "assert", "error", "ipairs", "next", "pairs", "select", @@ -651,6 +663,14 @@ local function reset(pos) set_port_states(pos, {a=false, b=false, c=false, d=false}) end +local function node_timer(pos) + if minetest.registered_nodes[minetest.get_node(pos).name].is_burnt then + return false + end + run(pos, {type="interrupt"}) + return false +end + ----------------------- -- A.Queue callbacks -- ----------------------- @@ -823,6 +843,7 @@ for d = 0, 1 do mesecon.receptor_off(pos, output_rules) end, is_luacontroller = true, + on_timer = node_timer, on_blast = mesecon.on_blastnode, }) end diff --git a/mesecons_movestones/doc/movestone/description.html b/mesecons_movestones/doc/movestone/description.html index 8555a9e..b7138a0 100644 --- a/mesecons_movestones/doc/movestone/description.html +++ b/mesecons_movestones/doc/movestone/description.html @@ -1 +1,2 @@ Movestones are effectors that push the blocks in front of them. They move along on the right side of a mesecon wire track. +A movestone trying to move into, or push other nodes into, an unloaded block doesn't move. diff --git a/mesecons_movestones/doc/movestone_sticky/description.html b/mesecons_movestones/doc/movestone_sticky/description.html index 460c277..f19d6a5 100644 --- a/mesecons_movestones/doc/movestone_sticky/description.html +++ b/mesecons_movestones/doc/movestone_sticky/description.html @@ -1 +1,3 @@ Movestones are effectors that push the blocks in front of them. They move along on the right side of a mesecon wire track. Sticky ones also pull blocks. +A sticky movestone trying to move into, or push other nodes into, an unloaded block doesn't move. +A sticky movestone trying to pull nodes from an unloaded block moves but leaves them behind. diff --git a/mesecons_pistons/doc/piston/description.html b/mesecons_pistons/doc/piston/description.html index d95dfb9..b9dffaa 100644 --- a/mesecons_pistons/doc/piston/description.html +++ b/mesecons_pistons/doc/piston/description.html @@ -1 +1,3 @@ Pistons are effectors, they push up to 20 blocks in front of them. The push direction can be set by placing them from different angles. +A piston pointing into an unloaded block won't extend. +A piston retracting from an unloaded block works, but gravity-sensitive nodes above the empty space may not fall. diff --git a/mesecons_pistons/doc/piston_sticky/description.html b/mesecons_pistons/doc/piston_sticky/description.html index 3974097..580b76f 100644 --- a/mesecons_pistons/doc/piston_sticky/description.html +++ b/mesecons_pistons/doc/piston_sticky/description.html @@ -1 +1,4 @@ Sticky pistons are effectors, they push up to 20 blocks in front of them. The push direction can be set by placing them from different angles. Sticky ones also pull 1 block. +A sticky piston pointing into an unloaded block won't extend. +A sticky piston retracting from within an unloaded block works and pulls a node, but if it doesn't pull anything, then gravity-sensitive nodes above the empty space may not fall. +An extended sticky piston that touches the surface of an unloaded block and loses signal retracts but doesn't pull anything. diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua index 386cffa..56a3f73 100644 --- a/mesecons_pistons/init.lua +++ b/mesecons_pistons/init.lua @@ -55,7 +55,7 @@ local function piston_get_rules(node) return rules end -local function piston_remove_pusher(pos, node) +local function piston_remove_pusher(pos, node, check_falling) local pistonspec = get_pistonspec(node.name, "onname") local dir = vector.multiply(minetest.facedir_to_dir(node.param2), -1) local pusherpos = vector.add(pos, dir) @@ -72,7 +72,14 @@ local function piston_remove_pusher(pos, node) max_hear_distance = 20, gain = 0.3, }) - minetest.check_for_falling(pusherpos) + + if check_falling then + minetest.check_for_falling(pusherpos) + end +end + +local function piston_after_dig(pos, node) + piston_remove_pusher(pos, node, true) end local piston_on = function(pos, node) @@ -97,7 +104,7 @@ end local function piston_off(pos, node) local pistonspec = get_pistonspec(node.name, "onname") minetest.set_node(pos, {param2 = node.param2, name = pistonspec.offname}) - piston_remove_pusher(pos, node) + piston_remove_pusher(pos, node, not pistonspec.sticky) if not pistonspec.sticky then return @@ -293,7 +300,7 @@ minetest.register_node("mesecons_pistons:piston_normal_on", { paramtype2 = "facedir", is_ground_content = false, drop = "mesecons_pistons:piston_normal_off", - after_dig_node = piston_remove_pusher, + after_dig_node = piston_after_dig, node_box = piston_on_box, selection_box = piston_on_box, sounds = default.node_sound_wood_defaults(), @@ -371,7 +378,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", { paramtype2 = "facedir", is_ground_content = false, drop = "mesecons_pistons:piston_sticky_off", - after_dig_node = piston_remove_pusher, + after_dig_node = piston_after_dig, node_box = piston_on_box, selection_box = piston_on_box, sounds = default.node_sound_wood_defaults(), diff --git a/mesecons_powerplant/doc/powerplant/description.html b/mesecons_powerplant/doc/powerplant/description.html index 4ed8f33..22be496 100644 --- a/mesecons_powerplant/doc/powerplant/description.html +++ b/mesecons_powerplant/doc/powerplant/description.html @@ -1 +1,2 @@ A power plant is a receptor that is always turned on: it provides energy. +It continues to work in an unloaded block. diff --git a/mesecons_random/doc/ghoststone/description.html b/mesecons_random/doc/ghoststone/description.html index 395430e..d54ef63 100644 --- a/mesecons_random/doc/ghoststone/description.html +++ b/mesecons_random/doc/ghoststone/description.html @@ -1 +1,2 @@ Ghoststones disappear when powered, just like Removestones. But in contrast to Removestones, they reappear again when not powered anymore and they are also conductive. +They work in inactive blocks. diff --git a/mesecons_random/doc/removestone/description.html b/mesecons_random/doc/removestone/description.html index 6947441..ccd3c14 100644 --- a/mesecons_random/doc/removestone/description.html +++ b/mesecons_random/doc/removestone/description.html @@ -1 +1,2 @@ Removestones are probably the simplest effectors possible. They simply disappear when powered. +They work in inactive blocks. diff --git a/mesecons_solarpanel/doc/solarpanel/description.html b/mesecons_solarpanel/doc/solarpanel/description.html index add6213..53570ca 100644 --- a/mesecons_solarpanel/doc/solarpanel/description.html +++ b/mesecons_solarpanel/doc/solarpanel/description.html @@ -1 +1,2 @@ Solar panels are light receptors: they turn on if there is enough light. +They only work in active blocks; in inactive blocks they keep their old state. diff --git a/mesecons_torch/doc/torch/description.html b/mesecons_torch/doc/torch/description.html index da7f19c..60a6713 100644 --- a/mesecons_torch/doc/torch/description.html +++ b/mesecons_torch/doc/torch/description.html @@ -1 +1,2 @@ The torch is an inverter, it may take up to 1 second until the signal has passed through. The input is 2 blocks away in the direction of the stick, outputs are around the mesecon glow. +It doesn't work in an inactive block; it just retains its state until the block becomes active. diff --git a/mesecons_wires/doc/mesecon/description.html b/mesecons_wires/doc/mesecon/description.html index f217be9..b20606b 100644 --- a/mesecons_wires/doc/mesecon/description.html +++ b/mesecons_wires/doc/mesecon/description.html @@ -1 +1 @@ -Mesecons are the wires, use them to connect effectors with receptors. +Mesecons are the wires, use them to connect effectors with receptors. Wiring works through unloaded blocks; they’re loaded when the signal level changes. diff --git a/moreblocks/.editorconfig b/moreblocks/.editorconfig new file mode 100644 index 0000000..a41c697 --- /dev/null +++ b/moreblocks/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{lua,luacheckrc}] +indent_style = tab +indent_size = 4 diff --git a/moreblocks/.luacheckrc b/moreblocks/.luacheckrc index fbf3483..7089a5d 100644 --- a/moreblocks/.luacheckrc +++ b/moreblocks/.luacheckrc @@ -1,14 +1,35 @@ +std = "lua51+minetest" unused_args = false allow_defined_top = true +max_line_length = 999 + +stds.minetest = { + read_globals = { + "DIR_DELIM", + "minetest", + "core", + "dump", + "vector", + "nodeupdate", + "VoxelManip", + "VoxelArea", + "PseudoRandom", + "ItemStack", + "default", + table = { + fields = { + "copy", + }, + }, + } +} read_globals = { - "DIR_DELIM", - "minetest", "core", - "dump", - "vector", "nodeupdate", - "VoxelManip", "VoxelArea", - "PseudoRandom", "ItemStack", "intllib", - "default", + "protector", + "isprotect", + "IsPlayerNodeOwner", + "HasOwner", + "getLastOwner", + "GetNodeOwnerName", } - diff --git a/moreblocks/.pre-commit-config.yaml b/moreblocks/.pre-commit-config.yaml new file mode 100644 index 0000000..9c72498 --- /dev/null +++ b/moreblocks/.pre-commit-config.yaml @@ -0,0 +1,9 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.1.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace + + - id: mixed-line-ending + args: [--fix=lf] diff --git a/moreblocks/CHANGELOG.md b/moreblocks/CHANGELOG.md index 53c4458..0d949aa 100644 --- a/moreblocks/CHANGELOG.md +++ b/moreblocks/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed + +- Node rotation now works correctly when placing Stairs+ nodes. +- Stairs+ glasslike nodes' textures are now easier to see. + ## [1.2.0] - 2018-11-24 ### Added diff --git a/moreblocks/LICENSE.md b/moreblocks/LICENSE.md index f68debf..d7470b4 100644 --- a/moreblocks/LICENSE.md +++ b/moreblocks/LICENSE.md @@ -1,6 +1,6 @@ # zlib license -Copyright (c) 2011-2018 Hugo Locurcio and contributors +Copyright © 2011-2019 Hugo Locurcio and contributors **This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.** diff --git a/moreblocks/README.md b/moreblocks/README.md index 33b9d6b..739164b 100644 --- a/moreblocks/README.md +++ b/moreblocks/README.md @@ -65,7 +65,7 @@ versions than 0.4.16 will generally not be fixed. ## License -Copyright © 2011-2018 Hugo Locurcio and contributors +Copyright © 2011-2019 Hugo Locurcio and contributors - More Blocks code is licensed under the zlib license, see [`LICENSE.md`](LICENSE.md) for details. diff --git a/moreblocks/aliases.lua b/moreblocks/aliases.lua index 59f5d5c..524876c 100644 --- a/moreblocks/aliases.lua +++ b/moreblocks/aliases.lua @@ -1,7 +1,7 @@ --[[ More Blocks: alias definitions -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/circular_saw.lua b/moreblocks/circular_saw.lua index 94e680e..4d1a3d9 100644 --- a/moreblocks/circular_saw.lua +++ b/moreblocks/circular_saw.lua @@ -1,7 +1,7 @@ --[[ More Blocks: circular saw -Copyright (c) 2011-2018 Hugo Locurcio, Sokomine and contributors. +Copyright © 2011-2019 Hugo Locurcio, Sokomine and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/config.lua b/moreblocks/config.lua index 84dcaf2..a855d5c 100644 --- a/moreblocks/config.lua +++ b/moreblocks/config.lua @@ -1,7 +1,7 @@ --[[ More Blocks: configuration handling -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/crafting.lua b/moreblocks/crafting.lua index 5fdd82f..468667d 100644 --- a/moreblocks/crafting.lua +++ b/moreblocks/crafting.lua @@ -1,7 +1,7 @@ --[[ More Blocks: crafting recipes -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/init.lua b/moreblocks/init.lua index 168768a..ad5ad25 100644 --- a/moreblocks/init.lua +++ b/moreblocks/init.lua @@ -3,7 +3,7 @@ ** More Blocks ** By Calinou, with the help of ShadowNinja and VanessaE. -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. ===================================================================== --]] diff --git a/moreblocks/locale/de.txt b/moreblocks/locale/de.txt index 542f977..03b71f6 100644 --- a/moreblocks/locale/de.txt +++ b/moreblocks/locale/de.txt @@ -15,15 +15,15 @@ Up Wooden Tile = Holzfliese oben Down Wooden Tile = Holzfliese unten Left Wooden Tile = Holzfliese links Right Wooden Tile = Holzfliese rechts -Circle Stone Bricks = Kreissteinziegel +Circle Stone Bricks = Kreissteinziegel Stone Tile = Steinfliese Split Stone Tile = Geteilte Steinfliese Glow Glass = Leuchtglas Super Glow Glass = Superleuchtglas Coal Glass = Kohleglas Iron Glass = Eisenglas -Coal Checker = Karierte Kohle -Iron Checker = Kariertes Eisen +Coal Checker = Karierte Kohle +Iron Checker = Kariertes Eisen Trap Stone = Steinfalle Trap Glass = Glasfalle Trap Glow Glass = Leuchtglasfalle @@ -64,4 +64,3 @@ Recycle\noutput = Wiederver-\nwerten ###ownership.lua### someone = jemand Sorry, %s owns that spot. = Tut mir leid, %s gehoert diese Stelle. - diff --git a/moreblocks/locale/es.txt b/moreblocks/locale/es.txt index d11ba49..e3b1eab 100644 --- a/moreblocks/locale/es.txt +++ b/moreblocks/locale/es.txt @@ -1,52 +1,65 @@ -# Translation by kaeza - +###init.lua### [moreblocks] loaded. = [moreblocks] cargado. -Jungle Wooden Planks = Tablones de madera de jungla -Empty Bookshelf = Estante para libros vacío -Clean Glass = Cristal Limpio -Plankstone = Tablones de piedra -Wooden Tile = Parquet -Full Wooden Tile = Parquet Completo -Centered Wooden Tile = Parquet Centrado -Up Wooden Tile = Parquet Superior -Down Wooden Tile = Parquet Inferior -Left Wooden Tile = Parquet Izquierdo -Right Wooden Tile = Parquet Derecho -Circle Stone Bricks = Bloques de Piedra Circulares -Stone Tile = Baldosa de Piedra -Split Stone Tile = Baldosas de Piedra Partida -Glow Glass = Cristal Brillante -Super Glow Glass = Cristal Súper Brillante -Coal Glass = Cristal con Carbón -Iron Glass = Cristal con Hierro -Coal Checker = Cuadros de Carbón -Iron Checker = Cuadros de Hierro -Trap Stone = Piedra Trampa -Trap Glass = Cristal Trampa -Coal Stone = Carbón y Piedra -Iron Stone = Hierro y Piedra -Cactus Checker = Cuadros de Cactus -Cactus Brick = Ladrillos de Cactus +###nodes.lua### +Jungle Wood Fence = Valla de madera tropical +Empty Bookshelf = Librería vacía +Clean Glass = Cristal límpido +Plankstone = Piedra en planchas +Wooden Tile = Caldosa de madera +Full Wooden Tile = Parquet completo +Centered Wooden Tile = Parquet centrado +Up Wooden Tile = Parquet superior +Down Wooden Tile = Parquet inferior +Left Wooden Tile = Parquet izquierdo +Right Wooden Tile = Parquet derecho +Circle Stone Bricks = Ladrillo de piedra circulares +Stone Tile = Baldosa de piedra +Split Stone Tile = Baldosa de piedra partida +Glow Glass = Cristal brillante +Super Glow Glass = Cristal súper brillante +Coal Glass = Cristal armado de carbón +Iron Glass = Cristal armado de hierro +Coal Checker = Mosaico de carbón +Iron Checker = Mosaico de hierro +Trap Stone = Trampa de piedra +Trap Glass = Trampa de cristal +Trap Glow Glass = Trampa de cristal brillante +Trap Super Glow Glass = Trampa de cristal súper brillante +Coal Stone = Piedra con carbón +Iron Stone = Piedra con hierro +Coal Stone Bricks = Ladrillos de piedra con carbón +Iron Stone Bricks = Ladrillos de piedra con hierro +Cactus Checker = Mosaico de cactus +Cactus Brick = Ladrillo de cactus Sweeper = Limpiador -Jungle Stick = Varita de Madera de Jungla -Horizontal Tree = Tronco de árbol horizontal -Horizontal Jungle Tree = Tronco de árbol de la jungla horizontal -Rope = Soga -All-faces Tree = Tronco de Árbol +Jungle Stick = Palo de madera tropical +Rope = Cuerda +All-faces Tree = madera + +###circular_saw.lua### +Circular Saw = Sierra circular +Circular saw, empty (owned by %s) = Sierra circular, vacía (propiedad de %s) +Circular saw, working with %s (owned by %s) = Sierra circular, trabajando con %s (propiedad de %s) +Circular saw, empty = Sierra circular, vacía +Circular saw is empty (owned by %s) = La sierra circular está vacía (propiedad de %s) + +Input\nmaterial = Entrada de\nmaterial: +Left-over = Remanente: +Max = Máx. +Set = Guardar +Recycle\noutput = Salida de\nreciclaje: -%s Stairs = Escalera de %s +###ownership.lua### +someone = alguien +Sorry, %s owns that spot. = Lo siento, esto pertenece a %s. + +###./stairsplus/*### +%s Stairs = Escaleras de %s %s Slab = Losa de %s %s Panel = Panel de %s %s Microblock = Microbloque de %s - -Wooden = Madera -Papyrus = Papiro -Dry Shrub = Arbusto Desértico -Sapling = Brote de Árbol -Wooden Planks = Tablones de Madera -Ladder = Escalera de Mano -Glass = Cristal +%s Slope = Biselado de %s %s Pane = Panel de %s %s Fence = Valla de %s diff --git a/moreblocks/locale/fr.txt b/moreblocks/locale/fr.txt index 6bd7f98..72c09f5 100644 --- a/moreblocks/locale/fr.txt +++ b/moreblocks/locale/fr.txt @@ -56,7 +56,7 @@ Circular saw, working with %s (owned by %s) = Scie circulaire, manipule %s (prop Circular saw, empty = Scie circulaire, vide Circular saw is empty (owned by %s) = Scie circulaire est vide (proprit de %s) -Input material = Entre du matriel +Input material = Entre du matriel Rest/microblocks = Reste/microbloc Max: = Max: Set = Fixer @@ -69,4 +69,4 @@ Recycle output = Recyclage %s Microblock = Microbloc en %s %s Pane = Panneau en %s -%s Fence = Barrire en %s \ No newline at end of file +%s Fence = Barrire en %s diff --git a/moreblocks/locale/it.txt b/moreblocks/locale/it.txt index 589e104..821ff36 100644 --- a/moreblocks/locale/it.txt +++ b/moreblocks/locale/it.txt @@ -33,7 +33,7 @@ Trap Glass = Vetro trappola Trap Glow Glass = Vetro luminoso trappola Trap Super Glow Glass = Super vetro luminoso trappola Coal Stone = Pietra in carbone -Iron Stone = Pietra in ferro +Iron Stone = Pietra in ferro Coal Stone Bricks = Mattoni di pietra in carbone Iron Stone Bricks = Mattoni di pietra in ferro Cactus Checker = Scacchiera in cactus diff --git a/moreblocks/locale/template.txt b/moreblocks/locale/template.txt index 2b88227..ea6f8ac 100644 --- a/moreblocks/locale/template.txt +++ b/moreblocks/locale/template.txt @@ -1,64 +1,64 @@ ###init.lua### -[moreblocks] loaded. = +[moreblocks] loaded. = ###nodes.lua### -Jungle Wood Fence = -Empty Bookshelf = -Clean Glass = -Plankstone = -Wooden Tile = -Full Wooden Tile = -Centered Wooden Tile = -Up Wooden Tile = -Down Wooden Tile = -Left Wooden Tile = -Right Wooden Tile = -Circle Stone Bricks = -Stone Tile = -Split Stone Tile = -Glow Glass = -Super Glow Glass = -Coal Glass = -Iron Glass = -Coal Checker = -Iron Checker = -Trap Stone = -Trap Glass = -Trap Glow Glass = -Trap Super Glow Glass = -Coal Stone = -Iron Stone = -Coal Stone Bricks = -Iron Stone Bricks = -Cactus Checker = -Cactus Brick = -Sweeper = -Jungle Stick = -Rope = -All-faces Tree = +Jungle Wood Fence = +Empty Bookshelf = +Clean Glass = +Plankstone = +Wooden Tile = +Full Wooden Tile = +Centered Wooden Tile = +Up Wooden Tile = +Down Wooden Tile = +Left Wooden Tile = +Right Wooden Tile = +Circle Stone Bricks = +Stone Tile = +Split Stone Tile = +Glow Glass = +Super Glow Glass = +Coal Glass = +Iron Glass = +Coal Checker = +Iron Checker = +Trap Stone = +Trap Glass = +Trap Glow Glass = +Trap Super Glow Glass = +Coal Stone = +Iron Stone = +Coal Stone Bricks = +Iron Stone Bricks = +Cactus Checker = +Cactus Brick = +Sweeper = +Jungle Stick = +Rope = +All-faces Tree = ###circular_saw.lua### -Circular Saw = -Circular saw, empty (owned by %s) = -Circular saw, working with %s (owned by %s) = -Circular saw, empty = -Circular saw is empty (owned by %s) = +Circular Saw = +Circular saw, empty (owned by %s) = +Circular saw, working with %s (owned by %s) = +Circular saw, empty = +Circular saw is empty (owned by %s) = -Input\nmaterial = -Left-over = -Max = -Set = -Recycle\noutput = +Input\nmaterial = +Left-over = +Max = +Set = +Recycle\noutput = ###ownership.lua### -someone = -Sorry, %s owns that spot. = +someone = +Sorry, %s owns that spot. = ###./stairsplus/*### -%s Stairs = -%s Slab = -%s Panel = -%s Microblock = +%s Stairs = +%s Slab = +%s Panel = +%s Microblock = -%s Pane = -%s Fence = +%s Pane = +%s Fence = diff --git a/moreblocks/nodes.lua b/moreblocks/nodes.lua index f898068..5bcab6c 100644 --- a/moreblocks/nodes.lua +++ b/moreblocks/nodes.lua @@ -1,7 +1,7 @@ --[[ More Blocks: node definitions -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] @@ -459,6 +459,21 @@ for name, def in pairs(nodes) do def.tiles = def.tiles or {"moreblocks_" ..name.. ".png"} minetest.register_node("moreblocks:" ..name, def) minetest.register_alias(name, "moreblocks:" ..name) + + def_copy = table.copy(def) + + -- Use the primary tile for all sides of cut glasslike nodes. + -- This makes them easier to see + if + #def_copy.tiles > 1 and + def_copy.drawtype and + def_copy.drawtype == "glasslike_framed" or + def_copy.drawtype == "glasslike_framed_optional" + then + def.tiles = {def_copy.tiles[1]} + end + + if not def.no_stairs then local groups = {} for k, v in pairs(def.groups) do groups[k] = v end diff --git a/moreblocks/ownership.lua b/moreblocks/ownership.lua index eb1ae0e..34bcffa 100644 --- a/moreblocks/ownership.lua +++ b/moreblocks/ownership.lua @@ -1,7 +1,7 @@ --[[ More Blocks: ownership handling -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/redefinitions.lua b/moreblocks/redefinitions.lua index fd24c80..b05c2c0 100644 --- a/moreblocks/redefinitions.lua +++ b/moreblocks/redefinitions.lua @@ -1,7 +1,7 @@ --[[ More Blocks: redefinitions of default stuff -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/API.md b/moreblocks/stairsplus/API.md index cd8d1a7..b5cb0c1 100644 --- a/moreblocks/stairsplus/API.md +++ b/moreblocks/stairsplus/API.md @@ -79,4 +79,4 @@ The subset table should have the following format: { "stair", "_alt_4" }, } ``` -You can remove entries as needed. \ No newline at end of file +You can remove entries as needed. diff --git a/moreblocks/stairsplus/aliases.lua b/moreblocks/stairsplus/aliases.lua index 224dce7..b005a06 100644 --- a/moreblocks/stairsplus/aliases.lua +++ b/moreblocks/stairsplus/aliases.lua @@ -1,7 +1,7 @@ --[[ More Blocks: alias definitions -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/common.lua b/moreblocks/stairsplus/common.lua index a7134b2..6ec5101 100644 --- a/moreblocks/stairsplus/common.lua +++ b/moreblocks/stairsplus/common.lua @@ -1,7 +1,7 @@ --[[ More Blocks: registrations -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] @@ -10,11 +10,11 @@ local S = moreblocks.intllib stairsplus.register_single = function(category, alternate, info, modname, subname, recipeitem, fields) local descriptions = { - ["micro"] = "Microblock", - ["slab"] = "Slab", - ["slope"] = "Slope", - ["panel"] = "Panel", - ["stair"] = "Stairs", + ["micro"] = S("Microblock"), + ["slab"] = S("Slab"), + ["slope"] = S("Slope"), + ["panel"] = S("Panel"), + ["stair"] = S("Stairs"), } local def = {} if category ~= "slab" then @@ -30,6 +30,10 @@ stairsplus.register_single = function(category, alternate, info, modname, subnam end def.paramtype = "light" def.paramtype2 = def.paramtype2 or "facedir" + + -- This makes node rotation work on placement + def.place_param2 = nil + def.on_place = minetest.rotate_node if category ~= "slab" then def.description = S("%s " .. descriptions[category]):format(fields.description) @@ -58,4 +62,4 @@ stairsplus.register_single = function(category, alternate, info, modname, subnam end minetest.register_node(":" ..modname.. ":" .. category .. "_" .. subname .. alternate, def) stairsplus.register_recipes(category, alternate, modname, subname, recipeitem) -end \ No newline at end of file +end diff --git a/moreblocks/stairsplus/conversion.lua b/moreblocks/stairsplus/conversion.lua index bc8e77e..e73dfb0 100644 --- a/moreblocks/stairsplus/conversion.lua +++ b/moreblocks/stairsplus/conversion.lua @@ -1,7 +1,7 @@ --[[ More Blocks: conversion -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/custom.lua b/moreblocks/stairsplus/custom.lua index e456f7c..ad67009 100644 --- a/moreblocks/stairsplus/custom.lua +++ b/moreblocks/stairsplus/custom.lua @@ -1,12 +1,10 @@ --[[ More Blocks: microblock definitions -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib - --[[ Subset table should have the following format: (You can remove entries as needed.) @@ -75,22 +73,22 @@ function register_custom_subset(subset, modname, subname, recipeitem, groups, im end function stairsplus:register_custom_subset_alias(subset, modname_old, subname_old, modname_new, subname_new) - local subset = table.copy(subset) - for k, v in pairs(subset) do + local subset_copy = table.copy(subset) + for k, v in pairs(subset_copy) do minetest.register_alias(modname_old .. ":" .. v[1] .. "_" .. subname_old .. v[2], modname_new .. ":" .. v[1] .. "_" .. subname_new .. v[2]) end end function stairsplus:register_custom_subset_alias_force(subset, modname_old, subname_old, modname_new, subname_new) - local subset = table.copy(subset) - for k, v in pairs(subset) do + local subset_copy = table.copy(subset) + for k, v in pairs(subset_copy) do minetest.register_alias_force(modname_old .. ":" .. v[1] .. "_" .. subname_old .. v[2], modname_new .. ":" .. v[1] .. "_" .. subname_new .. v[2]) end end function stairsplus:register_custom_subset(subset, modname, subname, recipeitem, fields) - local subset = table.copy(subset) - for k, v in pairs(subset) do + local subset_copy = table.copy(subset) + for k, v in pairs(subset_copy) do stairsplus.register_single(v[1], v[2], stairsplus.defs[v[1]][v[2]], modname, subname, recipeitem, fields) end diff --git a/moreblocks/stairsplus/defs.lua b/moreblocks/stairsplus/defs.lua index 560b1f2..a3d2cb1 100644 --- a/moreblocks/stairsplus/defs.lua +++ b/moreblocks/stairsplus/defs.lua @@ -1,7 +1,7 @@ --[[ More Blocks: registrations -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] @@ -406,4 +406,4 @@ for type,a in pairs(stairsplus.defs) do for name,b in pairs(stairsplus.defs[type]) do table.insert(stairsplus.shapes_list, { type .. "_", name }) end -end \ No newline at end of file +end diff --git a/moreblocks/stairsplus/init.lua b/moreblocks/stairsplus/init.lua index 624b7c8..0d99a14 100644 --- a/moreblocks/stairsplus/init.lua +++ b/moreblocks/stairsplus/init.lua @@ -1,7 +1,7 @@ --[[ More Blocks: Stairs+ -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/microblocks.lua b/moreblocks/stairsplus/microblocks.lua index dc8ddfd..a08ec7c 100644 --- a/moreblocks/stairsplus/microblocks.lua +++ b/moreblocks/stairsplus/microblocks.lua @@ -1,12 +1,10 @@ --[[ More Blocks: microblock definitions -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib - -- Node will be called :micro_ function register_micro(modname, subname, recipeitem, groups, images, description, drop, light) diff --git a/moreblocks/stairsplus/panels.lua b/moreblocks/stairsplus/panels.lua index 5e2bf7b..c017af6 100644 --- a/moreblocks/stairsplus/panels.lua +++ b/moreblocks/stairsplus/panels.lua @@ -1,12 +1,10 @@ --[[ More Blocks: panel definitions -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib - -- Node will be called :panel_ function register_panel(modname, subname, recipeitem, groups, images, description, drop, light) diff --git a/moreblocks/stairsplus/recipes.lua b/moreblocks/stairsplus/recipes.lua index ec908bd..f4d259c 100644 --- a/moreblocks/stairsplus/recipes.lua +++ b/moreblocks/stairsplus/recipes.lua @@ -1,7 +1,7 @@ --[[ More Blocks: Stairs+ -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/registrations.lua b/moreblocks/stairsplus/registrations.lua index 6262a6d..189ca84 100644 --- a/moreblocks/stairsplus/registrations.lua +++ b/moreblocks/stairsplus/registrations.lua @@ -1,7 +1,7 @@ --[[ More Blocks: registrations -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/slabs.lua b/moreblocks/stairsplus/slabs.lua index 11618a2..c41b2e3 100644 --- a/moreblocks/stairsplus/slabs.lua +++ b/moreblocks/stairsplus/slabs.lua @@ -1,7 +1,7 @@ --[[ More Blocks: slab definitions -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/slopes.lua b/moreblocks/stairsplus/slopes.lua index 63635eb..0652a51 100644 --- a/moreblocks/stairsplus/slopes.lua +++ b/moreblocks/stairsplus/slopes.lua @@ -1,12 +1,10 @@ --[[ More Blocks: slope definitions -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib - -- Node will be called :slope_ function register_slope(modname, subname, recipeitem, groups, images, description, drop, light) diff --git a/moreblocks/stairsplus/stairs.lua b/moreblocks/stairsplus/stairs.lua index 0ccf081..c72b268 100644 --- a/moreblocks/stairsplus/stairs.lua +++ b/moreblocks/stairsplus/stairs.lua @@ -1,12 +1,10 @@ --[[ More Blocks: stair definitions -Copyright (c) 2011-2018 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -local S = moreblocks.intllib - -- Node will be called :stair_ function register_stair(modname, subname, recipeitem, groups, images, description, drop, light) diff --git a/moreblocks/textures/moreblocks_cactus_brick.png b/moreblocks/textures/moreblocks_cactus_brick.png index 0e8c2c9..43d2479 100644 Binary files a/moreblocks/textures/moreblocks_cactus_brick.png and b/moreblocks/textures/moreblocks_cactus_brick.png differ diff --git a/moreblocks/textures/moreblocks_cactus_checker.png b/moreblocks/textures/moreblocks_cactus_checker.png index 99c2677..79f2e32 100644 Binary files a/moreblocks/textures/moreblocks_cactus_checker.png and b/moreblocks/textures/moreblocks_cactus_checker.png differ diff --git a/moreblocks/textures/moreblocks_checker_stone_tile.png b/moreblocks/textures/moreblocks_checker_stone_tile.png index 9d11b4f..7261586 100644 Binary files a/moreblocks/textures/moreblocks_checker_stone_tile.png and b/moreblocks/textures/moreblocks_checker_stone_tile.png differ diff --git a/moreblocks/textures/moreblocks_circle_stone_bricks.png b/moreblocks/textures/moreblocks_circle_stone_bricks.png index 4ca0134..d14057a 100644 Binary files a/moreblocks/textures/moreblocks_circle_stone_bricks.png and b/moreblocks/textures/moreblocks_circle_stone_bricks.png differ diff --git a/moreblocks/textures/moreblocks_circular_saw_bottom.png b/moreblocks/textures/moreblocks_circular_saw_bottom.png index 1522829..1a67636 100644 Binary files a/moreblocks/textures/moreblocks_circular_saw_bottom.png and b/moreblocks/textures/moreblocks_circular_saw_bottom.png differ diff --git a/moreblocks/textures/moreblocks_circular_saw_side.png b/moreblocks/textures/moreblocks_circular_saw_side.png index ce9e16f..567082b 100644 Binary files a/moreblocks/textures/moreblocks_circular_saw_side.png and b/moreblocks/textures/moreblocks_circular_saw_side.png differ diff --git a/moreblocks/textures/moreblocks_circular_saw_top.png b/moreblocks/textures/moreblocks_circular_saw_top.png index 96f3350..1b491da 100644 Binary files a/moreblocks/textures/moreblocks_circular_saw_top.png and b/moreblocks/textures/moreblocks_circular_saw_top.png differ diff --git a/moreblocks/textures/moreblocks_clean_glass.png b/moreblocks/textures/moreblocks_clean_glass.png index 140ee2b..73febdb 100644 Binary files a/moreblocks/textures/moreblocks_clean_glass.png and b/moreblocks/textures/moreblocks_clean_glass.png differ diff --git a/moreblocks/textures/moreblocks_coal_checker.png b/moreblocks/textures/moreblocks_coal_checker.png index 3df90c3..181cb97 100644 Binary files a/moreblocks/textures/moreblocks_coal_checker.png and b/moreblocks/textures/moreblocks_coal_checker.png differ diff --git a/moreblocks/textures/moreblocks_coal_glass_stairsplus.png b/moreblocks/textures/moreblocks_coal_glass_stairsplus.png index 8086a28..7aee70a 100644 Binary files a/moreblocks/textures/moreblocks_coal_glass_stairsplus.png and b/moreblocks/textures/moreblocks_coal_glass_stairsplus.png differ diff --git a/moreblocks/textures/moreblocks_coal_stone_bricks.png b/moreblocks/textures/moreblocks_coal_stone_bricks.png index 366e445..08e87a7 100644 Binary files a/moreblocks/textures/moreblocks_coal_stone_bricks.png and b/moreblocks/textures/moreblocks_coal_stone_bricks.png differ diff --git a/moreblocks/textures/moreblocks_copperpatina.png b/moreblocks/textures/moreblocks_copperpatina.png index 1b971dc..1216d8d 100644 Binary files a/moreblocks/textures/moreblocks_copperpatina.png and b/moreblocks/textures/moreblocks_copperpatina.png differ diff --git a/moreblocks/textures/moreblocks_dirt_compressed.png b/moreblocks/textures/moreblocks_dirt_compressed.png index 0a98272..a307202 100644 Binary files a/moreblocks/textures/moreblocks_dirt_compressed.png and b/moreblocks/textures/moreblocks_dirt_compressed.png differ diff --git a/moreblocks/textures/moreblocks_glass_stairsplus.png b/moreblocks/textures/moreblocks_glass_stairsplus.png index b879ec3..30aadfb 100644 Binary files a/moreblocks/textures/moreblocks_glass_stairsplus.png and b/moreblocks/textures/moreblocks_glass_stairsplus.png differ diff --git a/moreblocks/textures/moreblocks_iron_stone.png b/moreblocks/textures/moreblocks_iron_stone.png index 20c42f3..5a6e457 100644 Binary files a/moreblocks/textures/moreblocks_iron_stone.png and b/moreblocks/textures/moreblocks_iron_stone.png differ diff --git a/moreblocks/textures/moreblocks_iron_stone_bricks.png b/moreblocks/textures/moreblocks_iron_stone_bricks.png index 1f817f8..bc2ef2e 100644 Binary files a/moreblocks/textures/moreblocks_iron_stone_bricks.png and b/moreblocks/textures/moreblocks_iron_stone_bricks.png differ diff --git a/moreblocks/textures/moreblocks_junglestick.png b/moreblocks/textures/moreblocks_junglestick.png index 7c6c462..23644fd 100644 Binary files a/moreblocks/textures/moreblocks_junglestick.png and b/moreblocks/textures/moreblocks_junglestick.png differ diff --git a/moreblocks/textures/moreblocks_split_stone_tile.png b/moreblocks/textures/moreblocks_split_stone_tile.png index d7d69af..7af4fdd 100644 Binary files a/moreblocks/textures/moreblocks_split_stone_tile.png and b/moreblocks/textures/moreblocks_split_stone_tile.png differ diff --git a/moreblocks/textures/moreblocks_split_stone_tile_top.png b/moreblocks/textures/moreblocks_split_stone_tile_top.png index 3c8eb6d..f3184a8 100644 Binary files a/moreblocks/textures/moreblocks_split_stone_tile_top.png and b/moreblocks/textures/moreblocks_split_stone_tile_top.png differ diff --git a/moreblocks/textures/moreblocks_super_glow_glass_stairsplus.png b/moreblocks/textures/moreblocks_super_glow_glass_stairsplus.png index 9118c78..ae3f01f 100644 Binary files a/moreblocks/textures/moreblocks_super_glow_glass_stairsplus.png and b/moreblocks/textures/moreblocks_super_glow_glass_stairsplus.png differ diff --git a/moreblocks/textures/moreblocks_sweeper.png b/moreblocks/textures/moreblocks_sweeper.png index 34f1cde..770b988 100644 Binary files a/moreblocks/textures/moreblocks_sweeper.png and b/moreblocks/textures/moreblocks_sweeper.png differ diff --git a/moreblocks/textures/moreblocks_tar.png b/moreblocks/textures/moreblocks_tar.png index e1eb427..846d068 100644 Binary files a/moreblocks/textures/moreblocks_tar.png and b/moreblocks/textures/moreblocks_tar.png differ diff --git a/moreblocks/textures/moreblocks_trap_box_glass.png b/moreblocks/textures/moreblocks_trap_box_glass.png index fbb25ca..b0c0993 100644 Binary files a/moreblocks/textures/moreblocks_trap_box_glass.png and b/moreblocks/textures/moreblocks_trap_box_glass.png differ diff --git a/moreblocks/textures/moreblocks_tree_stairsplus.png b/moreblocks/textures/moreblocks_tree_stairsplus.png index 60100c9..bed0969 100644 Binary files a/moreblocks/textures/moreblocks_tree_stairsplus.png and b/moreblocks/textures/moreblocks_tree_stairsplus.png differ diff --git a/moreblocks/textures/moreblocks_wood_tile.png b/moreblocks/textures/moreblocks_wood_tile.png index d0faa3d..6e34453 100644 Binary files a/moreblocks/textures/moreblocks_wood_tile.png and b/moreblocks/textures/moreblocks_wood_tile.png differ diff --git a/moreblocks/textures/moreblocks_wood_tile_center.png b/moreblocks/textures/moreblocks_wood_tile_center.png index 02b0f84..a7d399a 100644 Binary files a/moreblocks/textures/moreblocks_wood_tile_center.png and b/moreblocks/textures/moreblocks_wood_tile_center.png differ diff --git a/moreblocks/textures/moreblocks_wood_tile_full.png b/moreblocks/textures/moreblocks_wood_tile_full.png index 7ec7f05..edfd5d2 100644 Binary files a/moreblocks/textures/moreblocks_wood_tile_full.png and b/moreblocks/textures/moreblocks_wood_tile_full.png differ diff --git a/moreblocks/textures/moreblocks_wood_tile_offset.png b/moreblocks/textures/moreblocks_wood_tile_offset.png index 3f6a2f2..fde40a2 100644 Binary files a/moreblocks/textures/moreblocks_wood_tile_offset.png and b/moreblocks/textures/moreblocks_wood_tile_offset.png differ diff --git a/moreores/.editorconfig b/moreores/.editorconfig new file mode 100644 index 0000000..a41c697 --- /dev/null +++ b/moreores/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{lua,luacheckrc}] +indent_style = tab +indent_size = 4 diff --git a/moreores/.luacheckrc b/moreores/.luacheckrc new file mode 100644 index 0000000..b1eb1c9 --- /dev/null +++ b/moreores/.luacheckrc @@ -0,0 +1,31 @@ +std = "lua51+minetest" +unused_args = false +allow_defined_top = true +max_line_length = 90 + +stds.minetest = { + read_globals = { + "DIR_DELIM", + "minetest", + "core", + "dump", + "vector", + "nodeupdate", + "VoxelManip", + "VoxelArea", + "PseudoRandom", + "ItemStack", + "default", + table = { + fields = { + "copy", + }, + }, + } +} + +read_globals = { + "farming", + "intllib", + "mg", +} diff --git a/moreores/.pre-commit-config.yaml b/moreores/.pre-commit-config.yaml new file mode 100644 index 0000000..9c72498 --- /dev/null +++ b/moreores/.pre-commit-config.yaml @@ -0,0 +1,9 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.1.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace + + - id: mixed-line-ending + args: [--fix=lf] diff --git a/moreores/CHANGELOG.md b/moreores/CHANGELOG.md index 612b615..6ec2e51 100644 --- a/moreores/CHANGELOG.md +++ b/moreores/CHANGELOG.md @@ -9,10 +9,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added -- Brazilian translation. +- Brazilian and Dutch translations. + +### Changed + +- Ores are now slower to mine and cannot be mined using wooden tools anymore. + +### Deprecated + +- Deprecated hoes to follow Minetest Game's deprecation of hoes + made of "rare" materials. + - Hoes are still available in existing worlds, but they + cannot be crafted anymore. ### Fixed +- Hoes now use the `farming` mod's handling function and can no longer + turn desert sand into dirt. - Handle tin which is now included in [Minetest Game](https://github.com/minetest/minetest_game). If it is detected, then the tin nodes and items from More Ores won't be registered. diff --git a/moreores/LICENSE.md b/moreores/LICENSE.md index a3511ad..d7470b4 100644 --- a/moreores/LICENSE.md +++ b/moreores/LICENSE.md @@ -1,6 +1,6 @@ # zlib license -Copyright (c) 2011-2017 Hugo Locurcio and contributors +Copyright © 2011-2019 Hugo Locurcio and contributors **This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.** diff --git a/moreores/depends.txt b/moreores/depends.txt index 0219052..0dc152f 100644 --- a/moreores/depends.txt +++ b/moreores/depends.txt @@ -1,2 +1,3 @@ default mg? +farming? diff --git a/moreores/init.lua b/moreores/init.lua index 0a85392..08bc0a6 100644 --- a/moreores/init.lua +++ b/moreores/init.lua @@ -3,18 +3,13 @@ ** More Ores ** By Calinou, with the help of Nore. -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. ===================================================================== --]] moreores = {} -local default_tin = false -if minetest.registered_items["default:tin_ingot"] then - default_tin = true -end - local S if minetest.get_modpath("intllib") then S = intllib.Getter() @@ -26,69 +21,57 @@ local modpath = minetest.get_modpath("moreores") dofile(modpath .. "/_config.txt") --- `mg` support: +-- `mg` mapgen support if minetest.get_modpath("mg") then dofile(modpath .. "/mg.lua") end --- Utility functions --- ================= - local default_stone_sounds = default.node_sound_stone_defaults() local default_metal_sounds = default.node_sound_metal_defaults() -local function hoe_on_use(itemstack, user, pointed_thing, uses) - local pt = pointed_thing - -- Check if pointing at a node: - if not pt then - return - end - if pt.type ~= "node" then - return - end - - local under = minetest.get_node(pt.under) - local pos = {x = pt.under.x, y = pt.under.y + 1, z = pt.under.z} - local above = minetest.get_node(pos) - - -- Return if any of the nodes is not registered: - if not minetest.registered_nodes[under.name] then return end - if not minetest.registered_nodes[above.name] then return end - - -- Check if the node above the pointed thing is air: - if above.name ~= "air" then return end - - -- Check if pointing at dirt: - if minetest.get_item_group(under.name, "soil") ~= 1 then return end - - -- Turn the node into soil, wear out item and play sound: - minetest.set_node(pt.under, {name ="farming:soil"}) - minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5}) - itemstack:add_wear(65535 / (uses - 1)) - return itemstack -end - -local function get_recipe(c, name) - if name == "sword" then - return {{c}, {c}, {"group:stick"}} - end - if name == "shovel" then - return {{c}, {"group:stick"}, {"group:stick"}} +-- Returns the crafting recipe table for a given material and item. +local function get_recipe(material, item) + if item == "sword" then + return { + {material}, + {material}, + {"group:stick"}, + } end - if name == "axe" then - return {{c, c}, {c, "group:stick"}, {"", "group:stick"}} + if item == "shovel" then + return { + {material}, + {"group:stick"}, + {"group:stick"}, + } end - if name == "pick" then - return {{c, c, c}, {"", "group:stick", ""}, {"", "group:stick", ""}} + if item == "axe" then + return { + {material, material}, + {material, "group:stick"}, + {"", "group:stick"}, + } end - if name == "hoe" then - return {{c, c}, {"", "group:stick"}, {"", "group:stick"}} + if item == "pick" then + return { + {material, material, material}, + {"", "group:stick", ""}, + {"", "group:stick", ""}, + } end - if name == "block" then - return {{c, c, c}, {c, c, c}, {c, c, c}} + if item == "block" then + return { + {material, material, material}, + {material, material, material}, + {material, material, material}, + } end - if name == "lockedchest" then - return {{"group:wood", "group:wood", "group:wood"}, {"group:wood", c, "group:wood"}, {"group:wood", "group:wood", "group:wood"}} + if item == "lockedchest" then + return { + {"group:wood", "group:wood", "group:wood"}, + {"group:wood", material, "group:wood"}, + {"group:wood", "group:wood", "group:wood"}, + } end end @@ -100,15 +83,14 @@ local function add_ore(modname, description, mineral_name, oredef) local item_base = tool_base .. mineral_name local ingot = item_base .. "_ingot" local lump_item = item_base .. "_lump" - local ingotcraft = ingot if oredef.makes.ore then minetest.register_node(modname .. ":mineral_" .. mineral_name, { description = S("%s Ore"):format(S(description)), tiles = {"default_stone.png^" .. modname .. "_mineral_" .. mineral_name .. ".png"}, - groups = {cracky = 3}, + groups = {cracky = 2}, sounds = default_stone_sounds, - drop = lump_item + drop = lump_item, }) end @@ -116,8 +98,8 @@ local function add_ore(modname, description, mineral_name, oredef) local block_item = item_base .. "_block" minetest.register_node(block_item, { description = S("%s Block"):format(S(description)), - tiles = { img_base .. "_block.png" }, - groups = {snappy = 1, bendy = 2, cracky = 1, melty = 2, level= 2}, + tiles = {img_base .. "_block.png"}, + groups = {snappy = 1, bendy = 2, cracky = 1, melty = 2, level = 2}, sounds = default_metal_sounds, }) minetest.register_alias(mineral_name.."_block", block_item) @@ -129,7 +111,7 @@ local function add_ore(modname, description, mineral_name, oredef) minetest.register_craft( { output = ingot .. " 9", recipe = { - { block_item } + {block_item}, } }) end @@ -145,7 +127,7 @@ local function add_ore(modname, description, mineral_name, oredef) minetest.register_craft({ type = "cooking", output = ingot, - recipe = lump_item + recipe = lump_item, }) end end @@ -163,7 +145,7 @@ local function add_ore(modname, description, mineral_name, oredef) output = "default:chest_locked", recipe = { {ingot}, - {"default:chest"} + {"default:chest"}, } }) minetest.register_craft( { @@ -184,9 +166,9 @@ local function add_ore(modname, description, mineral_name, oredef) inventory_image = toolimg_base .. tool_name .. ".png", tool_capabilities = { max_drop_level = 3, - groupcaps = tooldef + groupcaps = tooldef, }, - sound = {breaks = "default_tool_breaks"}, + sound = {breaks = "default_tool_breaks"}, } if tool_name == "sword" then @@ -211,61 +193,65 @@ local function add_ore(modname, description, mineral_name, oredef) tdef.full_punch_interval = oredef.full_punch_interval tdef.tool_capabilities.damage_groups = oredef.damage_groups tdef.description = S("%s Shovel"):format(S(description)) - tdef.wield_image = toolimg_base .. tool_name .. ".png^[transformR90" + tdef.wield_image = toolimg_base .. tool_name .. ".png^[transformR90" end - if tool_name == "hoe" then + local fulltool_name = tool_base .. tool_name .. tool_post + + if tool_name == "hoe" and minetest.get_modpath("farming") then + tdef.max_uses = tooldef.uses tdef.description = S("%s Hoe"):format(S(description)) - local uses = tooldef.uses - tooldef.uses = nil - tdef.on_use = function(itemstack, user, pointed_thing) - return hoe_on_use(itemstack, user, pointed_thing, uses) + farming.register_hoe(fulltool_name, tdef) + end + + -- Hoe registration is handled above. + -- There are no crafting recipes for hoes, as they have been + -- deprecated from Minetest Game: + -- https://github.com/minetest/minetest_game/commit/9c459e77a + if tool_name ~= "hoe" then + minetest.register_tool(fulltool_name, tdef) + + if oredef.makes.ingot then + minetest.register_craft({ + output = fulltool_name, + recipe = get_recipe(ingot, tool_name) + }) end end - local fulltool_name = tool_base .. tool_name .. tool_post - minetest.register_tool(fulltool_name, tdef) minetest.register_alias(tool_name .. tool_post, fulltool_name) - if oredef.makes.ingot then - minetest.register_craft({ - output = fulltool_name, - recipe = get_recipe(ingot, tool_name) - }) - end end end --- Add everything: -local modname = "moreores" - local oredefs = { silver = { description = "Silver", makes = {ore = true, block = true, lump = true, ingot = true, chest = true}, - oredef = {clust_scarcity = moreores.silver_chunk_size * moreores.silver_chunk_size * moreores.silver_chunk_size, + oredef = { + clust_scarcity = moreores.silver_chunk_size ^ 3, clust_num_ores = moreores.silver_ore_per_chunk, - clust_size = moreores.silver_chunk_size, - y_min = moreores.silver_min_depth, - y_max = moreores.silver_max_depth - }, + clust_size = moreores.silver_chunk_size, + y_min = moreores.silver_min_depth, + y_max = moreores.silver_max_depth, + }, tools = { pick = { - cracky = {times = {[1] = 2.60, [2] = 1.00, [3] = 0.60}, uses = 100, maxlevel= 1} + cracky = {times = {[1] = 2.60, [2] = 1.00, [3] = 0.60}, uses = 100, maxlevel = 1}, }, hoe = { - uses = 300 + uses = 300, }, shovel = { - crumbly = {times = {[1] = 1.10, [2] = 0.40, [3] = 0.25}, uses = 100, maxlevel= 1} + crumbly = {times = {[1] = 1.10, [2] = 0.40, [3] = 0.25}, uses = 100, maxlevel = 1}, }, axe = { - choppy = {times = {[1] = 2.50, [2] = 0.80, [3] = 0.50}, uses = 100, maxlevel= 1}, - fleshy = {times = {[2] = 1.10, [3] = 0.60}, uses = 100, maxlevel= 1} + choppy = {times = {[1] = 2.50, [2] = 0.80, [3] = 0.50}, uses = 100, maxlevel = 1}, + fleshy = {times = {[2] = 1.10, [3] = 0.60}, uses = 100, maxlevel = 1} }, sword = { - fleshy = {times = {[2] = 0.70, [3] = 0.30}, uses = 100, maxlevel= 1}, - snappy = {times = {[2] = 0.70, [3] = 0.30}, uses = 100, maxlevel= 1}, - choppy = {times = {[3] = 0.80}, uses = 100, maxlevel= 0} + fleshy = {times = {[2] = 0.70, [3] = 0.30}, uses = 100, maxlevel = 1}, + snappy = {times = {[2] = 0.70, [3] = 0.30}, uses = 100, maxlevel = 1}, + choppy = {times = {[3] = 0.80}, uses = 100, maxlevel = 0}, }, }, full_punch_interval = 1.0, @@ -274,88 +260,87 @@ local oredefs = { mithril = { description = "Mithril", makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, - oredef = {clust_scarcity = moreores.mithril_chunk_size * moreores.mithril_chunk_size * moreores.mithril_chunk_size, + oredef = { + clust_scarcity = moreores.mithril_chunk_size ^ 3, clust_num_ores = moreores.mithril_ore_per_chunk, - clust_size = moreores.mithril_chunk_size, - y_min = moreores.mithril_min_depth, - y_max = moreores.mithril_max_depth - }, + clust_size = moreores.mithril_chunk_size, + y_min = moreores.mithril_min_depth, + y_max = moreores.mithril_max_depth, + }, tools = { pick = { - cracky = {times = {[1] = 2.25, [2] = 0.55, [3] = 0.35}, uses = 200, maxlevel= 2} + cracky = {times = {[1] = 2.25, [2] = 0.55, [3] = 0.35}, uses = 200, maxlevel = 2} }, hoe = { - uses = 1000 + uses = 1000, }, shovel = { - crumbly = {times = {[1] = 0.70, [2] = 0.35, [3] = 0.20}, uses = 200, maxlevel= 2} + crumbly = {times = {[1] = 0.70, [2] = 0.35, [3] = 0.20}, uses = 200, maxlevel = 2}, }, axe = { - choppy = {times = {[1] = 1.75, [2] = 0.45, [3] = 0.45}, uses = 200, maxlevel= 2}, - fleshy = {times = {[2] = 0.95, [3] = 0.30}, uses = 200, maxlevel= 1} + choppy = {times = {[1] = 1.75, [2] = 0.45, [3] = 0.45}, uses = 200, maxlevel = 2}, + fleshy = {times = {[2] = 0.95, [3] = 0.30}, uses = 200, maxlevel = 1} }, sword = { - fleshy = {times = {[2] = 0.65, [3] = 0.25}, uses = 200, maxlevel= 2}, - snappy = {times = {[2] = 0.70, [3] = 0.25}, uses = 200, maxlevel= 2}, - choppy = {times = {[3] = 0.65}, uses = 200, maxlevel= 0} - } + fleshy = {times = {[2] = 0.65, [3] = 0.25}, uses = 200, maxlevel = 2}, + snappy = {times = {[2] = 0.70, [3] = 0.25}, uses = 200, maxlevel = 2}, + choppy = {times = {[3] = 0.65}, uses = 200, maxlevel = 0}, + }, }, full_punch_interval = 0.45, damage_groups = {fleshy = 9}, } } -if not default_tin then - oredefs.tin = { - description = "Tin", - makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, - oredef = {clust_scarcity = moreores.tin_chunk_size * moreores.tin_chunk_size * moreores.tin_chunk_size, - clust_num_ores = moreores.tin_ore_per_chunk, - clust_size = moreores.tin_chunk_size, - y_min = moreores.tin_min_depth, - y_max = moreores.tin_max_depth - }, - tools = {}, - } -end - -for orename,def in pairs(oredefs) do - add_ore(modname, def.description, orename, def) +-- If tin is available in the `default` mod, don't register More Ores' variant of tin +local default_tin +if minetest.registered_items["default:tin_ingot"] then + default_tin = true +else + default_tin = false end --- Copper rail (special node): -minetest.register_craft({ - output = "moreores:copper_rail 24", - recipe = { - {"default:copper_ingot", "", "default:copper_ingot"}, - {"default:copper_ingot", "group:stick", "default:copper_ingot"}, - {"default:copper_ingot", "", "default:copper_ingot"} - } -}) - if default_tin then minetest.register_alias("moreores:mineral_tin", "default:stone_with_tin") minetest.register_alias("moreores:tin_lump", "default:tin_lump") minetest.register_alias("moreores:tin_ingot", "default:tin_ingot") minetest.register_alias("moreores:tin_block", "default:tinblock") else - -- Bronze has some special cases, because it is made from copper and tin: - minetest.register_craft( { + oredefs.tin = { + description = "Tin", + makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, + oredef = { + clust_scarcity = moreores.tin_chunk_size ^ 3, + clust_num_ores = moreores.tin_ore_per_chunk, + clust_size = moreores.tin_chunk_size, + y_min = moreores.tin_min_depth, + y_max = moreores.tin_max_depth, + }, + tools = {}, + } + + -- Bronze has some special cases, because it is made from copper and tin + minetest.register_craft({ type = "shapeless", output = "default:bronze_ingot 3", recipe = { "moreores:tin_ingot", "default:copper_ingot", "default:copper_ingot", - } + }, }) end --- Unique node: +-- Copper rail (unique node) minetest.register_node("moreores:copper_rail", { description = S("Copper Rail"), drawtype = "raillike", - tiles = {"moreores_copper_rail.png", "moreores_copper_rail_curved.png", "moreores_copper_rail_t_junction.png", "moreores_copper_rail_crossing.png"}, + tiles = { + "moreores_copper_rail.png", + "moreores_copper_rail_curved.png", + "moreores_copper_rail_t_junction.png", + "moreores_copper_rail_crossing.png", + }, inventory_image = "moreores_copper_rail.png", wield_image = "moreores_copper_rail.png", paramtype = "light", @@ -363,10 +348,17 @@ minetest.register_node("moreores:copper_rail", { walkable = false, selection_box = { type = "fixed", - fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + fixed = { + -1/2, + -1/2, + -1/2, + 1/2, + -1/2 + 1/16, + 1/2, + }, }, sounds = default_metal_sounds, - groups = {bendy = 2,snappy = 1,dig_immediate = 2,rail= 1, connect_to_raillike = 1}, + groups = {bendy = 2, snappy = 1, dig_immediate = 2, rail = 1, connect_to_raillike = 1}, mesecons = { effector = { action_on = function(pos, node) @@ -380,6 +372,19 @@ minetest.register_node("moreores:copper_rail", { }, }) +minetest.register_craft({ + output = "moreores:copper_rail 24", + recipe = { + {"default:copper_ingot", "", "default:copper_ingot"}, + {"default:copper_ingot", "group:stick", "default:copper_ingot"}, + {"default:copper_ingot", "", "default:copper_ingot"}, + }, +}) + +for orename, def in pairs(oredefs) do + -- Register everything + add_ore("moreores", def.description, orename, def) +end if minetest.settings:get_bool("log_mods") then minetest.log("action", S("[moreores] loaded.")) diff --git a/moreores/locale/de.txt b/moreores/locale/de.txt index 2eb6075..070faf9 100644 --- a/moreores/locale/de.txt +++ b/moreores/locale/de.txt @@ -10,7 +10,6 @@ %s Shovel = %sschaufel %s Axe = %saxt %s Sword = %sschwert -%s Hoe = %shacke Copper = Kupfer Tin = Zinn diff --git a/moreores/locale/it.txt b/moreores/locale/it.txt index dcd8c52..db1644c 100644 --- a/moreores/locale/it.txt +++ b/moreores/locale/it.txt @@ -18,4 +18,4 @@ Silver = Argento Gold = Oro Mithril = Mithril -Copper Rail = Binario di rame \ No newline at end of file +Copper Rail = Binario di rame diff --git a/moreores/locale/nl.txt b/moreores/locale/nl.txt index c90eb60..954045f 100644 --- a/moreores/locale/nl.txt +++ b/moreores/locale/nl.txt @@ -8,7 +8,6 @@ %s Shovel = %s Schep %s Axe = %s Bijl %s Sword = %s Zwaard -%s Hoe = %s Schoffel Copper = Koper Tin = Tin diff --git a/moreores/mg.lua b/moreores/mg.lua index 6551ae5..988c092 100644 --- a/moreores/mg.lua +++ b/moreores/mg.lua @@ -1,7 +1,7 @@ --[[ More Ores: `mg` mod support -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright © 2011-2019 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreores/textures/moreores_copper_rail_crossing.png b/moreores/textures/moreores_copper_rail_crossing.png index bc78b47..cf80320 100644 Binary files a/moreores/textures/moreores_copper_rail_crossing.png and b/moreores/textures/moreores_copper_rail_crossing.png differ diff --git a/moreores/textures/moreores_copper_rail_t_junction.png b/moreores/textures/moreores_copper_rail_t_junction.png index dd23aa7..60f7aaa 100644 Binary files a/moreores/textures/moreores_copper_rail_t_junction.png and b/moreores/textures/moreores_copper_rail_t_junction.png differ diff --git a/moreores/textures/moreores_silver_block.png b/moreores/textures/moreores_silver_block.png index 6806b5c..3cd846d 100644 Binary files a/moreores/textures/moreores_silver_block.png and b/moreores/textures/moreores_silver_block.png differ diff --git a/moreores/textures/moreores_tool_silvershovel.png b/moreores/textures/moreores_tool_silvershovel.png index 9f9cfbe..775019f 100644 Binary files a/moreores/textures/moreores_tool_silvershovel.png and b/moreores/textures/moreores_tool_silvershovel.png differ diff --git a/pipeworks/lua_tube.lua b/pipeworks/lua_tube.lua index 941ef92..689f74e 100644 --- a/pipeworks/lua_tube.lua +++ b/pipeworks/lua_tube.lua @@ -333,8 +333,11 @@ local safe_globals = { } local function create_environment(pos, mem, event) - -- Gather variables for the environment + -- Make sure the tube hasn't broken. local vports = minetest.registered_nodes[minetest.get_node(pos).name].virtual_portstates + if not vports then return {} end + + -- Gather variables for the environment local vports_copy = {} for k, v in pairs(vports) do vports_copy[k] = v end local rports = get_real_port_states(pos) diff --git a/playeranim/LICENSE.md b/playeranim/LICENSE.md deleted file mode 100644 index 5957b8c..0000000 --- a/playeranim/LICENSE.md +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2013-2014, Diego Martínez -Copyright (c) 2016-2018, Rui -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/playeranim/README.md b/playeranim/README.md deleted file mode 100644 index 9938d60..0000000 --- a/playeranim/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# playeranim - -Makes the head, and the right arm when you're mining, face the way you're facing, similar to Minecraft. Compatible with [3d_armor](https://github.com/stujones11/minetest-3d_armor). This is an ugly hack. Forked from [Kaeza's animplus mod](https://github.com/kaeza/minetest-animplus). - -The head only turns up and down relative to the body, except it turns slightly to the right/left when you strafe right/left. When you turn the body turns with the head. -Works in both singleplayer and multiplayer. - -Created by [Rui](https://github.com/Rui-Minetest), this document was written by [sloantothebone](https://github.com/sloantothebone). - -## Configuration - -### Version of player model - -Player models supported by this mod: -- `MTG_4_Jun_2017` (minetest_game after 4 Jun 2017, 0.4.16) -- `MTG_4_Nov_2017` (minetest_game after 4 Nov 2017, 0.5.0) - -As there is no automatic way to determine which version is used, this must be configured with advanced settings menu, or by manually editing `playeranim.model_version` entry in minetest.conf. -The default value is `MTG_4_Jun_2017`. - -Symptoms of having configured the incorrect player model: -- In rest, arms are raised up, and are either detached from the body, or are too close to the body -- Cape (if visible) points upward - -### The delay of sideways body rotation - -Configure `playeranim.body_rotation_delay`. -It's the number of frame delay of sideways body rotation. -The default value is `7`. - -### Lengthways body rotation in sneaking - -Configure `playeranim.body_x_rotation_sneak`. -It's the degrees of the body's X-axis rotation in sneaking. -The default value is `6.0`. - -### The speed of an animation - -Configure `playeranim.animation_speed`. -It's the number of stepping per seconds. -The default value is `2.4`. - -### The speed of an animation in sneaking - -Configure `playeranim.animation_speed_sneak`. -It's the number of stepping per seconds in sneaking. -The default value is `0.8`. diff --git a/playeranim/depends.txt b/playeranim/depends.txt deleted file mode 100644 index 9bcff68..0000000 --- a/playeranim/depends.txt +++ /dev/null @@ -1,2 +0,0 @@ -default? -player_api? diff --git a/playeranim/description.txt b/playeranim/description.txt deleted file mode 100644 index 0c1198d..0000000 --- a/playeranim/description.txt +++ /dev/null @@ -1 +0,0 @@ -Adds animations to the players' head and right arm. \ No newline at end of file diff --git a/playeranim/init.lua b/playeranim/init.lua deleted file mode 100644 index e6730e2..0000000 --- a/playeranim/init.lua +++ /dev/null @@ -1,301 +0,0 @@ -local ANIMATION_SPEED = tonumber(minetest.settings:get("playeranim.animation_speed")) or 2.4 -local ANIMATION_SPEED_SNEAK = tonumber(minetest.settings:get("playeranim.animation_speed_sneak")) or 0.8 -local BODY_ROTATION_DELAY = math.max(math.floor(tonumber(minetest.settings:get("playeranim.body_rotation_delay")) or 7), 1) -local BODY_X_ROTATION_SNEAK = tonumber(minetest.settings:get("playeranim.body_x_rotation_sneak")) or 6.0 - -local BONE_POSITION, BONE_ROTATION = (function() - local modname = minetest.get_current_modname() - local modpath = minetest.get_modpath(modname) - return dofile(modpath .. "/model.lua") -end)() - -local get_animation = player_api and player_api.get_animation or default.player_get_animation -if not get_animation then - error("player_api.get_animation or default.player_get_animation is not found") -end - -local function get_animation_speed(player) - if player:get_player_control().sneak then - return ANIMATION_SPEED_SNEAK - end - return ANIMATION_SPEED -end - -local math_deg = math.deg -local function get_pitch_deg(player) - return math_deg(player:get_look_vertical()) -end - -local players_animation_data = setmetatable({}, { - __index = { - init_player = function(self, player) - self[player] = { - time = 0, - yaw_history = {}, - bone_rotations = {}, - bone_positions = {}, - previous_animation = 0, - } - end, - - -- time - get_time = function(self, player) - return self[player].time - end, - - increment_time = function(self, player, dtime) - self[player].time = self:get_time(player) + dtime - end, - - reset_time = function(self, player) - self[player].time = 0 - end, - - -- yaw_history - get_yaw_history = function(self, player) - return self[player].yaw_history -- Return mutable reference - end, - - add_yaw_to_history = function(self, player) - local yaw = player:get_look_horizontal() - local history = self:get_yaw_history(player) - history[#history + 1] = yaw - end, - - clear_yaw_history = function(self, player) - if #self[player].yaw_history > 0 then - self[player].yaw_history = {} - end - end, - - -- bone_rotations - get_bone_rotation = function(self, player, bone) - return self[player].bone_rotations[bone] - end, - - set_bone_rotation = function(self, player, bone, rotation) - self[player].bone_rotations[bone] = rotation - end, - - -- bone_positions - get_bone_position = function(self, player, bone) - return self[player].bone_positions[bone] - end, - - set_bone_position = function(self, player, bone, position) - self[player].bone_positions[bone] = position - end, - - -- previous_animation - get_previous_animation = function(self, player) - return self[player].previous_animation - end, - - set_previous_animation = function(self, player, animation) - self[player].previous_animation = animation - end, - } -}) - -minetest.register_on_joinplayer(function(player) - players_animation_data:init_player(player) -end) - -local vector_add, vector_equals = vector.add, vector.equals -local function rotate_bone(player, bone, rotation, position_optional) - local previous_rotation = players_animation_data:get_bone_rotation(player, bone) - local rotation = vector_add(rotation, BONE_ROTATION[bone]) - - local previous_position = players_animation_data:get_bone_position(player, bone) - local position = BONE_POSITION[bone] - if position_optional then - position = vector_add(position, position_optional) - end - - if not previous_rotation - or not previous_position - or not vector_equals(rotation, previous_rotation) - or not vector_equals(position, previous_position) then - player:set_bone_position(bone, position, rotation) - players_animation_data:set_bone_rotation(player, bone, rotation) - players_animation_data:set_bone_position(player, bone, position) - end -end - --- Animation alias -local STAND = 1 -local WALK = 2 -local MINE = 3 -local WALK_MINE = 4 -local SIT = 5 -local LAY = 6 - --- Bone alias -local BODY = "Body" -local HEAD = "Head" -local CAPE = "Cape" -local LARM = "Arm_Left" -local RARM = "Arm_Right" -local LLEG = "Leg_Left" -local RLEG = "Leg_Right" - -local math_sin, math_cos, math_pi = math.sin, math.cos, math.pi -local ANIMATIONS = { - [STAND] = function(player, _time) - rotate_bone(player, BODY, {x = 0, y = 0, z = 0}) - rotate_bone(player, CAPE, {x = 0, y = 0, z = 0}) - rotate_bone(player, LARM, {x = 0, y = 0, z = 0}) - rotate_bone(player, RARM, {x = 0, y = 0, z = 0}) - rotate_bone(player, LLEG, {x = 0, y = 0, z = 0}) - rotate_bone(player, RLEG, {x = 0, y = 0, z = 0}) - end, - - [LAY] = function(player, _time) - rotate_bone(player, HEAD, {x = 0, y = 0, z = 0}) - rotate_bone(player, CAPE, {x = 0, y = 0, z = 0}) - rotate_bone(player, LARM, {x = 0, y = 0, z = 0}) - rotate_bone(player, RARM, {x = 0, y = 0, z = 0}) - rotate_bone(player, LLEG, {x = 0, y = 0, z = 0}) - rotate_bone(player, RLEG, {x = 0, y = 0, z = 0}) - rotate_bone(player, BODY, BONE_ROTATION.body_lay, BONE_POSITION.body_lay) - end, - - [SIT] = function(player, _time) - rotate_bone(player, LARM, {x = 0, y = 0, z = 0}) - rotate_bone(player, RARM, {x = 0, y = 0, z = 0}) - rotate_bone(player, LLEG, {x = 90, y = 0, z = 0}) - rotate_bone(player, RLEG, {x = 90, y = 0, z = 0}) - rotate_bone(player, BODY, BONE_ROTATION.body_sit, BONE_POSITION.body_sit) - end, - - [WALK] = function(player, time) - local speed = get_animation_speed(player) - local sin = math_sin(time * speed * math_pi) - - rotate_bone(player, CAPE, {x = -35 * sin - 35, y = 0, z = 0}) - rotate_bone(player, LARM, {x = -55 * sin, y = 0, z = 0}) - rotate_bone(player, RARM, {x = 55 * sin, y = 0, z = 0}) - rotate_bone(player, LLEG, {x = 55 * sin, y = 0, z = 0}) - rotate_bone(player, RLEG, {x = -55 * sin, y = 0, z = 0}) - end, - - [MINE] = function(player, time) - local speed = get_animation_speed(player) - - local cape_sin = math_sin(time * speed * math_pi) - local rarm_sin = math_sin(2 * time * speed * math_pi) - local rarm_cos = -math_cos(2 * time * speed * math_pi) - local pitch = 90 - get_pitch_deg(player) - - rotate_bone(player, CAPE, {x = -5 * cape_sin - 5, y = 0, z = 0}) - rotate_bone(player, LARM, {x = 0, y = 0, z = 0}) - rotate_bone(player, RARM, {x = 10 * rarm_sin + pitch, y = 10 * rarm_cos, z = 0}) - rotate_bone(player, LLEG, {x = 0, y = 0, z = 0}) - rotate_bone(player, RLEG, {x = 0, y = 0, z = 0}) - end, - - [WALK_MINE] = function(player, time) - local speed = get_animation_speed(player) - - local sin = math_sin(time * speed * math_pi) - local rarm_sin = math_sin(2 * time * speed * math_pi) - local rarm_cos = -math_cos(2 * time * speed * math_pi) - local pitch = 90 - get_pitch_deg(player) - - rotate_bone(player, CAPE, {x = -35 * sin - 35, y = 0, z = 0}) - rotate_bone(player, LARM, {x = -55 * sin, y = 0, z = 0}) - rotate_bone(player, RARM, {x = 10 * rarm_sin + pitch, y = 10 * rarm_cos, z = 0}) - rotate_bone(player, LLEG, {x = 55 * sin, y = 0, z = 0}) - rotate_bone(player, RLEG, {x = -55 * sin, y = 0, z = 0}) - end, -} - -local function set_animation(player, animation, force_animate) - local animation_changed - = (players_animation_data:get_previous_animation(player) ~= animation) - - if force_animate or animation_changed then - players_animation_data:set_previous_animation(player, animation) - ANIMATIONS[animation](player, players_animation_data:get_time(player)) - end -end - -local function rotate_head(player) - local head_x_rotation = -get_pitch_deg(player) - rotate_bone(player, HEAD, {x = head_x_rotation, y = 0, z = 0}) -end - -local table_remove, math_deg = table.remove, math.deg -local function rotate_body_and_head(player) - local body_x_rotation = (function() - local sneak = player:get_player_control().sneak - return sneak and BODY_X_ROTATION_SNEAK or 0 - end)() - - local body_y_rotation = (function() - local yaw_history = players_animation_data:get_yaw_history(player) - if #yaw_history > BODY_ROTATION_DELAY then - local body_yaw = table_remove(yaw_history, 1) - local player_yaw = player:get_look_horizontal() - return math_deg(player_yaw - body_yaw) - end - return 0 - end)() - - rotate_bone(player, BODY, {x = body_x_rotation, y = body_y_rotation, z = 0}) - - local head_x_rotation = -get_pitch_deg(player) - rotate_bone(player, HEAD, {x = head_x_rotation, y = -body_y_rotation, z = 0}) -end - - -local function animate_player(player, dtime) - local animation = get_animation(player).animation - - -- Yaw history - if animation == "lay" or animation == "sit" then - players_animation_data:clear_yaw_history(player) - else - players_animation_data:add_yaw_to_history(player) - end - - -- Increment animation time - if animation == "walk" - or animation == "mine" - or animation == "walk_mine" then - players_animation_data:increment_time(player, dtime) - else - players_animation_data:reset_time(player) - end - - -- Set animation - if animation == "stand" then - set_animation(player, STAND) - elseif animation == "lay" then - set_animation(player, LAY) - elseif animation == "sit" then - set_animation(player, SIT) - elseif animation == "walk" then - set_animation(player, WALK, true) - elseif animation == "mine" then - set_animation(player, MINE, true) - elseif animation == "walk_mine" then - set_animation(player, WALK_MINE, true) - end - - -- Rotate body and head - if animation == "lay" then - -- Do nothing - elseif animation == "sit" then - rotate_head(player) - else - rotate_body_and_head(player) - end -end - -local minetest_get_connected_players = minetest.get_connected_players -minetest.register_globalstep(function(dtime) - for _, player in ipairs(minetest_get_connected_players()) do - animate_player(player, dtime) - end -end) diff --git a/playeranim/mod.conf b/playeranim/mod.conf deleted file mode 100644 index 3e162f0..0000000 --- a/playeranim/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = playeranim -description = Adds animations to the players' head and right arm. -optional_depends = player_api, default diff --git a/playeranim/model.lua b/playeranim/model.lua deleted file mode 100644 index 717382c..0000000 --- a/playeranim/model.lua +++ /dev/null @@ -1,99 +0,0 @@ --- Bone alias -local BODY = "Body" -local HEAD = "Head" -local CAPE = "Cape" -local LARM = "Arm_Left" -local RARM = "Arm_Right" -local LLEG = "Leg_Left" -local RLEG = "Leg_Right" - --- Version of player model -local DEFAULT_PLAYER_MODEL_VERSION = "MTG_4_Jun_2017" - -local VALID_PLAYER_MODEL_VERSIONS = { - MTG_4_Jun_2017 = true, - MTG_4_Nov_2017 = true, -} - -local LEGACY_PLAYER_MODEL_VERSIONS = { - default_character_v1 = true, - default_character_v2 = true, - default_character_v3 = true, -} - -local BONE_POSITIONS = { - MTG_4_Jun_2017 = { - [BODY] = {x = 0, y = -3.5, z = 0}, - [HEAD] = {x = 0, y = 6.5, z = 0}, - [CAPE] = {x = 0, y = 6.5, z = 1.2}, - [LARM] = {x = 3, y = 5.5, z = 0}, - [RARM] = {x = -3, y = 5.5, z = 0}, - [LLEG] = {x = 1, y = 0, z = 0}, - [RLEG] = {x = -1, y = 0, z = 0}, - - body_sit = {x = 0, y = -5.5, z = 0}, - body_lay = {x = 0, y = -5.5, z = 0}, - }, - MTG_4_Nov_2017 = { - [BODY] = {x = 0, y = 6.25, z = 0}, - [HEAD] = {x = 0, y = 6.5, z = 0}, - [CAPE] = {x = 0, y = 6.5, z = 1.2}, - [LARM] = {x = 3, y = 5.5, z = 0}, - [RARM] = {x = -3, y = 5.5, z = 0}, - [LLEG] = {x = 1, y = 0, z = 0}, - [RLEG] = {x = -1, y = 0, z = 0}, - - body_sit = {x = 0, y = -5, z = 0}, - body_lay = {x = 0, y = -5, z = 0}, - }, -} - -local BONE_ROTATIONS = { - MTG_4_Jun_2017 = { - [BODY] = {x = 0, y = 0, z = 0}, - [HEAD] = {x = 0, y = 0, z = 0}, - [CAPE] = {x = 0, y = 0, z = 0}, - [LARM] = {x = 0, y = 0, z = 0}, - [RARM] = {x = 0, y = 0, z = 0}, - [LLEG] = {x = 0, y = 0, z = 0}, - [RLEG] = {x = 0, y = 0, z = 0}, - - body_sit = {x = 0, y = 0, z = 0}, - body_lay = {x = 270, y = 0, z = 0}, - }, - MTG_4_Nov_2017 = { - [BODY] = {x = 0, y = 0, z = 0}, - [HEAD] = {x = 0, y = 0, z = 0}, - [CAPE] = {x = 0, y = 0, z = 0}, - [LARM] = {x = 0, y = 0, z = 0}, - [RARM] = {x = 0, y = 0, z = 0}, - [LLEG] = {x = 0, y = 0, z = 0}, - [RLEG] = {x = 0, y = 0, z = 0}, - - body_sit = {x = 0, y = 0, z = 0}, - body_lay = {x = 270, y = 0, z = 0}, - }, -} - -local PLAYER_MODEL_VERSION = (function() - local version = minetest.settings:get("playeranim.model_version") - if version == nil or version == "" then - version = DEFAULT_PLAYER_MODEL_VERSION - end - - if LEGACY_PLAYER_MODEL_VERSIONS[version] then - error("The model version '" .. version .. "' is no longer suppported") - elseif not VALID_PLAYER_MODEL_VERSIONS[version] then - error("Invalid value for playeranim.model_version in minetest.conf: " .. version) - end - - return version -end)() - -local BONE_POSITION = BONE_POSITIONS[PLAYER_MODEL_VERSION] -local BONE_ROTATION = BONE_ROTATIONS[PLAYER_MODEL_VERSION] -if not BONE_POSITION or not BONE_ROTATION then - error("Internal error: invalid player_model_version: " .. PLAYER_MODEL_VERSION) -end - -return BONE_POSITION, BONE_ROTATION diff --git a/playeranim/screenshot.png b/playeranim/screenshot.png deleted file mode 100644 index 57aeefe..0000000 Binary files a/playeranim/screenshot.png and /dev/null differ diff --git a/playeranim/settingtypes.txt b/playeranim/settingtypes.txt deleted file mode 100644 index a36322f..0000000 --- a/playeranim/settingtypes.txt +++ /dev/null @@ -1,18 +0,0 @@ -# Version of player model. -# -# Player models supported by this mod: -# . -- `MTG_4_Jun_2017` (minetest_game after 4 Jun 2017, 0.4.16) -# . -- `MTG_4_Nov_2017` (minetest_game after 4 Nov 2017, 0.5.0) -playeranim.model_version (Version of player model) enum MTG_4_Jun_2017 MTG_4_Jun_2017,MTG_4_Nov_2017 - -# The number of frame delay of sideways body rotation. (between 1 and 20). -playeranim.body_rotation_delay (The delay of sideways body rotation) int 7 1 20 - -# The degrees of the body's X-axis rotation in sneaking. -playeranim.body_x_rotation_sneak (Lengthways body rotation in sneaking) float 6.0 - -# The number of stepping per seconds. -playeranim.animation_speed (The speed of an animation) float 2.4 - -# The number of stepping per seconds in sneaking. -playeranim.animation_speed_sneak (The speed of an animation in sneaking) float 0.8 diff --git a/quartz/README.txt b/quartz/README.txt index 0db0cf8..383bcad 100644 --- a/quartz/README.txt +++ b/quartz/README.txt @@ -12,9 +12,10 @@ License: MIT (see LICENSE.txt) Dependencies: default (found in minetest_game) stairs (found in minetest_game) -moreblocks (optional, for stairsplus support) +intllib (optional, for translations) +moreblocks or stairsplus (optional, for stairsplus support) -Please report bugs at the github issue tracker: +Please report bugs at the GitHub issue tracker: https://github.com/minetest-mods/quartz/issues/ Crafting: @@ -80,3 +81,6 @@ x|x|x x|c|x ----- x|x|x + +If you have stairsplus (or moreblocks) installed, you will be able to use +circular saws to cut quartz blocks. diff --git a/quartz/depends.txt b/quartz/depends.txt index c2a3e1b..7f004f6 100644 --- a/quartz/depends.txt +++ b/quartz/depends.txt @@ -1,4 +1,5 @@ default stairs +intllib? moreblocks? -intllib? \ No newline at end of file +stairsplus? diff --git a/quartz/description.txt b/quartz/description.txt index adc7fc2..f2afef2 100644 --- a/quartz/description.txt +++ b/quartz/description.txt @@ -1 +1 @@ -Adds quartz ore and some decorative quartz blocks +Adds quartz ore and some decorative quartz blocks. diff --git a/quartz/init.lua b/quartz/init.lua index c2870a7..4189d58 100644 --- a/quartz/init.lua +++ b/quartz/init.lua @@ -62,7 +62,8 @@ minetest.register_node("quartz:chiseled", { minetest.register_node("quartz:pillar", { description = S("Quartz Pillar"), paramtype2 = "facedir", - tiles = {"quartz_pillar_top.png", "quartz_pillar_top.png", "quartz_pillar_side.png"}, + tiles = {"quartz_pillar_top.png", "quartz_pillar_top.png", + "quartz_pillar_side.png"}, groups = {cracky=3, oddly_breakable_by_hand=1}, sounds = default.node_sound_glass_defaults(), on_place = minetest.rotate_node @@ -78,7 +79,8 @@ stairs.register_stair_and_slab("quartzblock", "quartz:block", stairs.register_stair_and_slab("quartzstair", "quartz:pillar", {cracky=3, oddly_breakable_by_hand=1}, - {"quartz_pillar_top.png", "quartz_pillar_top.png", "quartz_pillar_side.png"}, + {"quartz_pillar_top.png", "quartz_pillar_top.png", + "quartz_pillar_side.png"}, S("Quartz Pillar stair"), S("Quartz Pillar slab"), default.node_sound_glass_defaults()) @@ -157,34 +159,28 @@ minetest.register_abm({ -- Compatibility with stairsplus -- -if minetest.get_modpath("moreblocks") and settings:get_bool("ENABLE_STAIRSPLUS") then - register_stair_slab_panel_micro("quartz", "block", "quartz:block", - {cracky=3}, - {"quartz_block.png"}, - "Quartz Block", - "block", - 0 - ) - - register_stair_slab_panel_micro("quartz", "chiseled", "quartz:chiseled", - {cracky=3}, - {"quartz_chiseled.png"}, - "Chiseled Quartz", - "chiseled", - 0 - ) - - register_stair_slab_panel_micro("quartz", "pillar", "quartz:pillar", - {cracky=3}, - {"quartz_pillar_top.png", "quartz_pillar_top.png", "quartz_pillar_side.png"}, - "Quartz Pillar", - "pillar", - 0 - ) - - table.insert(circular_saw.known_stairs, "quartz:block") - table.insert(circular_saw.known_stairs, "quartz:chiseled") - table.insert(circular_saw.known_stairs, "quartz:pillar") +if minetest.global_exists("stairsplus") then + stairsplus:register_all("quartz", "block", "quartz:block", { + description = "Quartz Block", + tiles = {"quartz_block.png"}, + groups = {cracky=3}, + sounds = default.node_sound_glass_defaults() + }) + + stairsplus:register_all("quartz", "chiseled", "quartz:chiseled", { + description = "Chiseled Quartz", + tiles = {"quartz_chiseled.png"}, + groups = {cracky=3}, + sounds = default.node_sound_glass_defaults() + }) + + stairsplus:register_all("quartz", "pillar", "quartz:pillar", { + description = "Quartz Pillar", + tiles = {"quartz_pillar_top.png", "quartz_pillar_top.png", + "quartz_pillar_side.png"}, + groups = {cracky=3}, + sounds = default.node_sound_glass_defaults() + }) end -- @@ -195,11 +191,14 @@ if settings:get_bool("ENABLE_HORIZONTAL_PILLAR") then -- Quartz Pillar (horizontal) minetest.register_node("quartz:pillar_horizontal", { description = "Quartz Pillar Horizontal", - tiles = {"quartz_pillar_side.png", "quartz_pillar_side.png", "quartz_pillar_side.png^[transformR90", - "quartz_pillar_side.png^[transformR90", "quartz_pillar_top.png", "quartz_pillar_top.png"}, + tiles = {"quartz_pillar_side.png", "quartz_pillar_side.png", + "quartz_pillar_side.png^[transformR90", + "quartz_pillar_side.png^[transformR90", "quartz_pillar_top.png", + "quartz_pillar_top.png"}, paramtype2 = "facedir", drop = 'quartz:pillar', - groups = {cracky=3, oddly_breakable_by_hand=1, not_in_creative_inventory=1}, + groups = {cracky=3, oddly_breakable_by_hand=1, + not_in_creative_inventory=1}, sounds = default.node_sound_glass_defaults(), }) end diff --git a/quartz/mod.conf b/quartz/mod.conf index a5f15f3..40a9866 100644 --- a/quartz/mod.conf +++ b/quartz/mod.conf @@ -1 +1,4 @@ -name = quartz +name = quartz +description = Adds quartz ore and some decorative quartz blocks. +depends = default,stairs +optional_depends = intllib,moreblocks,stairsplus diff --git a/technic/init.lua b/technic/init.lua index 0d97319..370c71b 100644 --- a/technic/init.lua +++ b/technic/init.lua @@ -26,10 +26,10 @@ dofile(modpath.."/config.lua") -- Helper functions dofile(modpath.."/helpers.lua") --- Items +-- Items dofile(modpath.."/items.lua") --- Craft recipes for items +-- Craft recipes for items dofile(modpath.."/crafts.lua") -- Register functions diff --git a/technic/items.lua b/technic/items.lua index d89ed46..cf57229 100644 --- a/technic/items.lua +++ b/technic/items.lua @@ -35,7 +35,7 @@ minetest.register_tool("technic:blue_energy_crystal", { fleshy = {times={}, uses=10000, maxlevel=0} } } -}) +}) minetest.register_tool("technic:green_energy_crystal", { description = S("Green Energy Crystal"), @@ -51,7 +51,7 @@ minetest.register_tool("technic:green_energy_crystal", { fleshy = {times={}, uses=10000, maxlevel=0} } } -}) +}) minetest.register_tool("technic:red_energy_crystal", { description = S("Red Energy Crystal"), @@ -67,7 +67,7 @@ minetest.register_tool("technic:red_energy_crystal", { fleshy = {times={}, uses=10000, maxlevel=0} } } -}) +}) minetest.register_craftitem("technic:copper_coil", { description = S("Copper Coil"), diff --git a/technic/locale/de.txt b/technic/locale/de.txt index 69bcb3d..45ff387 100644 --- a/technic/locale/de.txt +++ b/technic/locale/de.txt @@ -25,7 +25,7 @@ Mixed Metal Ingot = Mischmetallbarren Composite Plate = Verbundplatte Copper Plate = Kupferplatte Carbon Plate = Kohlefaserplatte -Graphite = Graphit +Graphite = Graphit Carbon Cloth = Kohlefasergewebe Raw Latex = Rohlatex Rubber Fiber = Gummifaser @@ -42,7 +42,7 @@ Inventory move disallowed due to protection = Das Inventar ist geschuetzt, Zugri %s Enabled = %s Idle = %s ist bereit %s Improperly Placed = %s ist falsch plaziert -%s Unpowered = %s hat keine Stromversorgung +%s Unpowered = %s hat keine Stromversorgung %s Out Of Fuel = %s hat keinen Brennstoff %s Has Bad Cabling = %s ist falsch verkabelt %s Has No Network = %s hat kein Netzwerk @@ -69,7 +69,7 @@ Disabled = %s Cable = %s Kabel %s Compressor = %s Kompressor %s Extractor = %s Extraktor -%s Forcefield Emitter = %s Kraftfeld-Emitter +%s Forcefield Emitter = %s Kraftfeld-Emitter %s Furnace = %s Ofen %s Grinder = %s Schleifmaschine %s Music Player = %s Musikspieler @@ -105,7 +105,7 @@ Administrative World Anchor = Charge = Aufladen Discharge = Entladen Power level = Energiestufe -# $1: Tier $2: current_charge $3: max_charge +# $1: Tier $2: current_charge $3: max_charge @1 Battery Box: @2/@3 = @1 Batteriebox: @2/@3 # $1: Machine name $2: Supply $3: Demand @1. Supply: @2 Demand: @3 = @1. Versorgung: @2 Bedarf: @3 diff --git a/technic/locale/es.txt b/technic/locale/es.txt index 2c1cdca..fa66988 100644 --- a/technic/locale/es.txt +++ b/technic/locale/es.txt @@ -101,7 +101,7 @@ Administrative World Anchor = Charge = Cargar Discharge = Descargar Power level = Nivel de Poder -# $1: Tier $2: current_charge $3: max_charge +# $1: Tier $2: current_charge $3: max_charge @1 Battery Box: @2/@3 = Caja de Bateria @1: @2/@3 # $1: Machine name $2: Supply $3: Demand @1. Supply: @2 Demand: @3 = @1. Alimentacion: @2 Demanda: @3 diff --git a/technic/locale/template.txt b/technic/locale/template.txt index f94ccda..12dbc65 100644 --- a/technic/locale/template.txt +++ b/technic/locale/template.txt @@ -110,7 +110,7 @@ Administrative World Anchor = Charge = Discharge = Power level = -# $1: Tier $2: current_charge $3: max_charge +# $1: Tier $2: current_charge $3: max_charge @1 Battery Box: @2/@3 = # $1: Machine name $2: Supply $3: Demand @1. Supply: @2 Demand: @3 = diff --git a/technic/machines/HV/cables.lua b/technic/machines/HV/cables.lua index 0b86a23..e084cf0 100644 --- a/technic/machines/HV/cables.lua +++ b/technic/machines/HV/cables.lua @@ -6,7 +6,7 @@ minetest.register_craft({ {'technic:mv_cable', 'technic:mv_cable', 'technic:mv_cable'}, {'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting'}, } -}) +}) technic.register_cable("HV", 3/16) diff --git a/technic/machines/LV/cables.lua b/technic/machines/LV/cables.lua index d4ed880..69c0a24 100644 --- a/technic/machines/LV/cables.lua +++ b/technic/machines/LV/cables.lua @@ -8,7 +8,7 @@ minetest.register_craft({ {'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, {'default:paper', 'default:paper', 'default:paper'}, } -}) +}) technic.register_cable("LV", 2/16) diff --git a/technic/machines/LV/geothermal.lua b/technic/machines/LV/geothermal.lua index d828f6d..c66547e 100644 --- a/technic/machines/LV/geothermal.lua +++ b/technic/machines/LV/geothermal.lua @@ -22,7 +22,7 @@ minetest.register_craft({ minetest.register_craftitem("technic:geothermal", { description = S("Geothermal %s Generator"):format("LV"), -}) +}) local check_node_around = function(pos) local node = minetest.get_node(pos) diff --git a/technic/machines/LV/water_mill.lua b/technic/machines/LV/water_mill.lua index 33834ec..ed3c1e1 100644 --- a/technic/machines/LV/water_mill.lua +++ b/technic/machines/LV/water_mill.lua @@ -1,5 +1,5 @@ -- A water mill produces LV EUs by exploiting flowing water across it --- It is a LV EU supplyer and fairly low yield (max 180EUs) +-- It is a LV EU supplier and fairly low yield (max 180EUs) -- It is a little over half as good as the thermal generator. local S = technic.getter diff --git a/technic/machines/MV/cables.lua b/technic/machines/MV/cables.lua index 0c1f457..7d63dfd 100644 --- a/technic/machines/MV/cables.lua +++ b/technic/machines/MV/cables.lua @@ -8,7 +8,7 @@ minetest.register_craft({ {'technic:lv_cable', 'technic:lv_cable', 'technic:lv_cable'}, {'technic:rubber', 'technic:rubber', 'technic:rubber'}, } -}) +}) technic.register_cable("MV", 2.5/16) diff --git a/technic/machines/MV/hydro_turbine.lua b/technic/machines/MV/hydro_turbine.lua index e5df5e6..19dfebb 100644 --- a/technic/machines/MV/hydro_turbine.lua +++ b/technic/machines/MV/hydro_turbine.lua @@ -1,5 +1,5 @@ -- A Hydro Turbine produces MV EUs by exploiting flowing water across it --- It is a MV EU supplyer and fairly high yield (max 1800EUs) +-- It is a MV EU supplier and fairly high yield (max 1800EUs) local S = technic.getter @@ -25,7 +25,7 @@ local function get_water_flow(pos) end --- --- 10 times better than LV hydro because of 2 extra water mills and 4 stainless steel, a transformer and whatnot ;P. +-- 10 times better than LV hydro because of 2 extra water mills and 4 stainless steel, a transformer and whatnot ;P. -- Man hydro turbines are tough and long lasting. So, give it some value :) local run = function(pos, node) local meta = minetest.get_meta(pos) diff --git a/technic/machines/MV/lighting.lua b/technic/machines/MV/lighting.lua index 76fcb20..8ff2702 100644 --- a/technic/machines/MV/lighting.lua +++ b/technic/machines/MV/lighting.lua @@ -49,7 +49,7 @@ local dirs1 = {20, 23, 22, 21} local dirs2 = {9, 18, 7, 12} local technic_homedecor_rotate_and_place = function(itemstack, placer, pointed_thing) - if not technic_homedecor_node_is_owned(pointed_thing.under, placer) + if not technic_homedecor_node_is_owned(pointed_thing.under, placer) and not technic_homedecor_node_is_owned(pointed_thing.above, placer) then local node = minetest.get_node(pointed_thing.under) if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then @@ -76,7 +76,7 @@ local technic_homedecor_rotate_and_place = function(itemstack, placer, pointed_t if not minetest.registered_nodes[minetest.get_node(pos1).name]["buildable_to"] then return end - if iswall then + if iswall then minetest.add_node(pos1, {name = wield_name, param2 = dirs2[fdir+1] }) -- place wall variant elseif isceiling then minetest.add_node(pos1, {name = wield_name, param2 = 20 }) -- place upside down variant diff --git a/technic/machines/other/injector.lua b/technic/machines/other/injector.lua index 4fe78b2..c98be59 100644 --- a/technic/machines/other/injector.lua +++ b/technic/machines/other/injector.lua @@ -6,7 +6,7 @@ local fs_helpers = pipeworks.fs_helpers local tube_entry = "^pipeworks_tube_connection_metallic.png" local function inject_items (pos) - local meta=minetest.get_meta(pos) + local meta=minetest.get_meta(pos) local inv = meta:get_inventory() local mode=meta:get_string("mode") if mode=="single items" then @@ -15,7 +15,7 @@ local function inject_items (pos) i=i+1 if stack then local item0=stack:to_table() - if item0 then + if item0 then item0["count"] = "1" technic.tube_inject_item(pos, pos, vector.new(0, -1, 0), item0) stack:take_item(1) @@ -31,7 +31,7 @@ local function inject_items (pos) i=i+1 if stack then local item0=stack:to_table() - if item0 then + if item0 then technic.tube_inject_item(pos, pos, vector.new(0, -1, 0), item0) stack:clear() inv:set_stack("main", i, stack) @@ -142,7 +142,7 @@ minetest.register_abm({ chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) local pos1 = vector.add(pos, vector.new(0, -1, 0)) - local node1 = minetest.get_node(pos1) + local node1 = minetest.get_node(pos1) if minetest.get_item_group(node1.name, "tubedevice") > 0 then inject_items(pos) end diff --git a/technic/machines/register/alloy_recipes.lua b/technic/machines/register/alloy_recipes.lua index 8731b8e..d5a4a4e 100644 --- a/technic/machines/register/alloy_recipes.lua +++ b/technic/machines/register/alloy_recipes.lua @@ -26,7 +26,7 @@ local recipes = { {"technic:silicon_wafer", "technic:gold_dust", "technic:doped_silicon_wafer"}, -- from https://en.wikipedia.org/wiki/Carbon_black -- The highest volume use of carbon black is as a reinforcing filler in rubber products, especially tires. - -- "[Compounding a] pure gum vulcanizate … with 50% of its weight of carbon black improves its tensile strength and wear resistance …" + -- "[Compounding a] pure gum vulcanizate … with 50% of its weight of carbon black improves its tensile strength and wear resistance …" {"technic:raw_latex 4", "technic:coal_dust 2", "technic:rubber 6", 2}, } diff --git a/technic/machines/register/battery_box.lua b/technic/machines/register/battery_box.lua index d10b705..4f1f76e 100644 --- a/technic/machines/register/battery_box.lua +++ b/technic/machines/register/battery_box.lua @@ -129,11 +129,11 @@ local tube = { } local function add_on_off_buttons(meta, ltier, charge_percent) - local formspec = "" - if ltier == "mv" or ltier == "hv" then - formspec = "image[1,1;1,2;technic_power_meter_bg.png" + local formspec = "image[1,1;1,2;technic_power_meter_bg.png" .."^[lowpart:"..charge_percent - ..":technic_power_meter_fg.png]".. + ..":technic_power_meter_fg.png]" + if ltier == "mv" or ltier == "hv" then + formspec = formspec.. fs_helpers.cycling_button( meta, "image_button[3,2.0;1,0.6", diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua index 924128e..63ee851 100644 --- a/technic/machines/register/cables.lua +++ b/technic/machines/register/cables.lua @@ -122,7 +122,7 @@ local function item_place_override_node(itemstack, placer, pointed, node) local temp_itemstack = ItemStack(itemstack) temp_itemstack:set_name(node.name) local original_count = temp_itemstack:get_count() - temp_itemstack = + temp_itemstack = minetest.item_place(temp_itemstack, placer, pointed, node.param2) or temp_itemstack -- Remove the same number of items from the real itemstack diff --git a/technic/machines/register/common.lua b/technic/machines/register/common.lua index dfa2948..38354f9 100644 --- a/technic/machines/register/common.lua +++ b/technic/machines/register/common.lua @@ -66,14 +66,14 @@ function technic.send_items(pos, x_velocity, z_velocity, output_name) output_name = "dst" end - local meta = minetest.get_meta(pos) + local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local i = 0 for _, stack in ipairs(inv:get_list(output_name)) do i = i + 1 if stack then local item0 = stack:to_table() - if item0 then + if item0 then item0["count"] = "1" technic.tube_inject_item(pos, pos, vector.new(x_velocity, 0, z_velocity), item0) stack:take_item(1) @@ -124,7 +124,7 @@ function technic.handle_machine_pipeworks(pos, tube_upgrade, send_function) if node.param2 == 0 then pos1.x = pos1.x + 1 x_velocity = 1 end local output_tube_connected = false - local node1 = minetest.get_node(pos1) + local node1 = minetest.get_node(pos1) if minetest.get_item_group(node1.name, "tubedevice") > 0 then output_tube_connected = true end diff --git a/technic/machines/register/generator.lua b/technic/machines/register/generator.lua index 87ef6e7..f8d7e6a 100644 --- a/technic/machines/register/generator.lua +++ b/technic/machines/register/generator.lua @@ -57,7 +57,7 @@ function technic.register_generator(data) -- Burn another piece of fuel if burn_time == 0 then local inv = meta:get_inventory() - if not inv:is_empty("src") then + if not inv:is_empty("src") then local fuellist = inv:get_list("src") local fuel local afterfuel @@ -96,7 +96,7 @@ function technic.register_generator(data) } )..pipeworks.button_label end - meta:set_string("formspec", + meta:set_string("formspec", "size[8, 9]".. "label[0, 0;"..minetest.formspec_escape(desc).."]".. "list[current_name;src;3, 1;1, 1;]".. @@ -120,7 +120,7 @@ function technic.register_generator(data) "technic_"..ltier.."_generator_side.png"..tentry, "technic_"..ltier.."_generator_side.png"..tentry, "technic_"..ltier.."_generator_front.png" - }, + }, paramtype2 = "facedir", groups = groups, connect_sides = {"bottom", "back", "left", "right"}, @@ -240,7 +240,7 @@ function technic.register_generator(data) } )..pipeworks.button_label end - meta:set_string("formspec", + meta:set_string("formspec", "size[8, 9]".. "label[0, 0;"..minetest.formspec_escape(desc).."]".. "list[current_name;src;3, 1;1, 1;]".. @@ -274,7 +274,7 @@ function technic.register_generator(data) local burn_time = meta:get_int("burn_time") local percent = math.floor(burn_time / burn_totaltime * 100) - meta:set_string("formspec", + meta:set_string("formspec", "size[8, 9]".. "label[0, 0;"..minetest.formspec_escape(desc).."]".. "list[current_name;src;3, 1;1, 1;]".. diff --git a/technic/machines/register/machine_base.lua b/technic/machines/register/machine_base.lua index 14cf998..15fb8ea 100644 --- a/technic/machines/register/machine_base.lua +++ b/technic/machines/register/machine_base.lua @@ -147,7 +147,7 @@ function technic.register_base_machine(data) minetest.register_node("technic:"..ltier.."_"..machine_name, { description = machine_desc:format(tier), tiles = { - "technic_"..ltier.."_"..machine_name.."_top.png"..tentry, + "technic_"..ltier.."_"..machine_name.."_top.png"..tentry, "technic_"..ltier.."_"..machine_name.."_bottom.png"..tentry, "technic_"..ltier.."_"..machine_name.."_side.png"..tentry, "technic_"..ltier.."_"..machine_name.."_side.png"..tentry, diff --git a/technic/tools/flashlight.lua b/technic/tools/flashlight.lua index 252dc8c..30f2480 100644 --- a/technic/tools/flashlight.lua +++ b/technic/tools/flashlight.lua @@ -8,7 +8,7 @@ local S = technic.getter technic.register_power_tool("technic:flashlight", flashlight_max_charge) minetest.register_alias("technic:light_off", "air") - + minetest.register_tool("technic:flashlight", { description = S("Flashlight"), inventory_image = "technic_flashlight.png", diff --git a/technic/tools/mining_drill.lua b/technic/tools/mining_drill.lua index 250c461..cb16914 100644 --- a/technic/tools/mining_drill.lua +++ b/technic/tools/mining_drill.lua @@ -62,7 +62,7 @@ end local function drill_dig_it1 (player) local dir=player:get_look_dir() - if math.abs(dir.x)>math.abs(dir.z) then + if math.abs(dir.x)>math.abs(dir.z) then if dir.x>0 then return 0 end return 1 end diff --git a/technic/tools/prospector.lua b/technic/tools/prospector.lua index 9a918a2..12437a7 100644 --- a/technic/tools/prospector.lua +++ b/technic/tools/prospector.lua @@ -93,7 +93,7 @@ minetest.register_tool("technic:prospector", { "label[0,7.5;Accuracy:]".. "label[0,8;98%]") return - end, + end, }) minetest.register_on_player_receive_fields(function(user, formname, fields) @@ -117,7 +117,7 @@ minetest.register_on_player_receive_fields(function(user, formname, fields) user:set_wielded_item(toolstack) return true end) - + minetest.register_craft({ output = "technic:prospector", recipe = { diff --git a/technic/tools/sonic_screwdriver.lua b/technic/tools/sonic_screwdriver.lua index 300d363..536f47c 100644 --- a/technic/tools/sonic_screwdriver.lua +++ b/technic/tools/sonic_screwdriver.lua @@ -86,7 +86,7 @@ minetest.register_tool("technic:sonic_screwdriver", { return itemstack end, }) - + minetest.register_craft({ output = "technic:sonic_screwdriver", recipe = { diff --git a/technic_chests/README.md b/technic_chests/README.md index a570346..c4f3eac 100644 --- a/technic_chests/README.md +++ b/technic_chests/README.md @@ -18,7 +18,7 @@ VanessaE: (WTFPL) sdzen (Elise Staudter) modified by VanessaE (CC BY-SA 3.0): * copper, iron, silver, gold, mithril chest textures 16x16 - + RealBadAngel: (WTFPL) * Everything else. diff --git a/technic_chests/locale/tr.txt b/technic_chests/locale/tr.txt index 6bef5be..1f07ce6 100644 --- a/technic_chests/locale/tr.txt +++ b/technic_chests/locale/tr.txt @@ -1,5 +1,5 @@ # Turkish translation -# mahmutelmas06@hotmail.com +# mahmutelmas06@hotmail.com # Türkçe çeviri %s Chest = %s Sandık diff --git a/technic_worldgen/locale/template.txt b/technic_worldgen/locale/template.txt index 594e0ce..40d0029 100644 --- a/technic_worldgen/locale/template.txt +++ b/technic_worldgen/locale/template.txt @@ -2,36 +2,36 @@ # technic_worldgen translation template ###crafts.lua -Uranium Lump = -Uranium Ingot = -Chromium Lump = -Chromium Ingot = -Zinc Lump = -Zinc Ingot = -Brass Ingot = +Uranium Lump = +Uranium Ingot = +Chromium Lump = +Chromium Ingot = +Zinc Lump = +Zinc Ingot = +Brass Ingot = Wrought Iron Ingot = Cast Iron Ingot = Carbon Steel Ingot = -Stainless Steel Ingot = +Stainless Steel Ingot = Iron = ###nodes.lua -Uranium Ore = -Chromium Ore = -Zinc Ore = -Granite = -Marble = -Marble Bricks = -Uranium Block = -Chromium Block = -Zinc Block = +Uranium Ore = +Chromium Ore = +Zinc Ore = +Granite = +Marble = +Marble Bricks = +Uranium Block = +Chromium Block = +Zinc Block = Wrought Iron Block = Cast Iron Block = Carbon Steel Block = -Stainless Steel Block = -Brass Block = +Stainless Steel Block = +Brass Block = Wrought Iron = ###rubber.lua -Rubber Tree Sapling = -Rubber Tree = +Rubber Tree Sapling = +Rubber Tree = diff --git a/technic_worldgen/locale/tr.txt b/technic_worldgen/locale/tr.txt index a04597f..1c0fc44 100644 --- a/technic_worldgen/locale/tr.txt +++ b/technic_worldgen/locale/tr.txt @@ -1,38 +1,38 @@ # Turkish translation -# mahmutelmas06@hotmail.com +# mahmutelmas06@hotmail.com # Türkçe çeviri ###crafts.lua -Uranium Lump = Uranyum yığını +Uranium Lump = Uranyum yığını Uranium Ingot = Uranyum külçesi Chromium Lump = Krom yığını Chromium Ingot = Krom külçesi Zinc Lump = Çinko yığını Zinc Ingot = Çünko külçesi -Brass Ingot = Pirinç yığını +Brass Ingot = Pirinç yığını Wrought Iron Ingot = İşlenmiş demir yığını Cast Iron Ingot = Döküm demir yığını -Carbon Steel Ingot = Karbon çelik külçe -Stainless Steel Ingot =Paslanmaz çelik külçe +Carbon Steel Ingot = Karbon çelik külçe +Stainless Steel Ingot =Paslanmaz çelik külçe Iron = Demir ###nodes.lua -Uranium Ore = Uranyum madeni -Chromium Ore = Krom madeni -Zinc Ore = Çinko madeni +Uranium Ore = Uranyum madeni +Chromium Ore = Krom madeni +Zinc Ore = Çinko madeni Granite = Granit Marble = Mermer -Marble Bricks = Mermer tuğla -Uranium Block = Uranyum blok -Chromium Block = Karbon blok -Zinc Block = Çinko blok +Marble Bricks = Mermer tuğla +Uranium Block = Uranyum blok +Chromium Block = Karbon blok +Zinc Block = Çinko blok Wrought Iron Block = İşlenmiş demir blok Cast Iron Block = Döküm demir blok Carbon Steel Block = Karbon çelik blok -Stainless Steel Block = Paslanmaz çelik blok +Stainless Steel Block = Paslanmaz çelik blok Brass Block = Pirinç blok Wrought Iron = İşlenmiş demir ###rubber.lua Rubber Tree Sapling = Kauçuk ağacı fidanı -Rubber Tree = Kauçuk ağacı +Rubber Tree = Kauçuk ağacı diff --git a/technic_worldgen/nodes.lua b/technic_worldgen/nodes.lua index 14b4eba..d4d3e4c 100644 --- a/technic_worldgen/nodes.lua +++ b/technic_worldgen/nodes.lua @@ -8,7 +8,7 @@ minetest.register_node( ":technic:mineral_uranium", { groups = {cracky=3, radioactive=1}, sounds = default.node_sound_stone_defaults(), drop = "technic:uranium_lump", -}) +}) minetest.register_node( ":technic:mineral_chromium", { description = S("Chromium Ore"), @@ -17,7 +17,7 @@ minetest.register_node( ":technic:mineral_chromium", { groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), drop = "technic:chromium_lump", -}) +}) minetest.register_node( ":technic:mineral_zinc", { description = S("Zinc Ore"), @@ -52,7 +52,7 @@ minetest.register_node( ":technic:granite", { is_ground_content = true, groups = {cracky=1}, sounds = default.node_sound_stone_defaults(), -}) +}) minetest.register_node( ":technic:marble", { description = S("Marble"), @@ -60,7 +60,7 @@ minetest.register_node( ":technic:marble", { is_ground_content = true, groups = {cracky=3, marble=1}, sounds = default.node_sound_stone_defaults(), -}) +}) minetest.register_node( ":technic:marble_bricks", { description = S("Marble Bricks"), @@ -68,7 +68,7 @@ minetest.register_node( ":technic:marble_bricks", { is_ground_content = true, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), -}) +}) minetest.register_node(":technic:uranium_block", { description = S("Uranium Block"), diff --git a/travelnet/config.lua b/travelnet/config.lua index 7673833..519e66d 100644 --- a/travelnet/config.lua +++ b/travelnet/config.lua @@ -29,6 +29,59 @@ travelnet.elevator_recipe = { {"default:steel_ingot", "", "default:steel_ingot", }, {"default:steel_ingot", "default:glass", "default:steel_ingot", } } +travelnet.tiles_travelnet = { + "travelnet_travelnet_front.png", -- backward view + "travelnet_travelnet_back.png", -- front view + "travelnet_travelnet_side.png", -- sides :) + "default_steel_block.png", -- view from top + "default_clay.png", -- view from bottom + } +travelnet.tiles_elevator = { + "travelnet_elevator_front.png", + "travelnet_elevator_inside_controls.png", + "travelnet_elevator_sides_outside.png", + "travelnet_elevator_inside_ceiling.png", + "travelnet_elevator_inside_floor.png", + "default_steel_block.png" + } +travelnet.travelnet_inventory_image = "travelnet_inv.png" +travelnet.elevator_inventory_image = "travelnet_elevator_inv.png" + +if( minetest.registered_nodes["mcl_core:wood"]) then + travelnet.travelnet_recipe = { + {"mcl_stairs:slab_wood", "mcl_stairs:slab_wood", "mcl_stairs:slab_wood",}, + {"mesecons_torch:mesecon_torch_on", "mcl_chests:chest", "mesecons_torch:mesecon_torch_on"}, + {"mesecons_torch:mesecon_torch_on", "mcl_chests:chest", "mesecons_torch:mesecon_torch_on"}, +-- {"core:glass", "mcl_core:iron_ingot", "mcl_core:glass", }, +-- {"mcl_core:glass", "mesecons_torch:redstoneblock", "mcl_core:glass", }, +-- {"mcl_core:glass", "mcl_core:iron_ingot", "mcl_core:glass", } + } + travelnet.elevator_recipe = { + {"mcl_stairs:slab_wood", "mcl_stairs:slab_wood", "mcl_stairs:slab_wood",}, + {"mesecons_torch:mesecon_torch_on", "", "mesecons_torch:mesecon_torch_on"}, + {"mesecons_torch:mesecon_torch_on", "", "mesecons_torch:mesecon_torch_on"}, +-- {"mcl_core:iron_ingot", "mcl_core:glass", "mcl_core:iron_ingot", }, +-- {"mcl_core:iron_ingot", "", "mcl_core:iron_ingot", }, +-- {"mcl_core:iron_ingot", "mcl_core:glass", "mcl_core:iron_ingot", } + } + travelnet.tiles_travelnet = { + "default_wood.png^[transformR90", -- backward view + "default_wood.png^[transformR90", -- front view + "default_wood.png^[transformR90", -- sides :) + "default_wood.png^[transformR90", -- view from top + "default_wood.png^[transformR90", -- view from bottom + } + travelnet.tiles_elevator = { + "mcl_core_planks_big_oak.png^[transformR90", -- front + "mcl_core_planks_big_oak.png^[transformR90", -- inside + "mcl_core_planks_big_oak.png^[transformR90", -- sides outside + "mcl_core_planks_big_oak.png^[transformR90", -- inside ceiling + "mcl_core_planks_big_oak.png^[transformR90", -- inside floor + "mcl_core_planks_big_oak.png^[transformR90", -- top + } + travelnet.travelnet_inventory_image = nil + travelnet.elevator_inventory_image = nil +end -- if this function returns true, the player with the name player_name is -- allowed to add a box to the network named network_name, which is owned diff --git a/travelnet/doors.lua b/travelnet/doors.lua index 1ca64c1..c7a3122 100644 --- a/travelnet/doors.lua +++ b/travelnet/doors.lua @@ -92,6 +92,9 @@ travelnet.register_door = function( node_base_name, def_tiles, material ) end -- actually register the doors -travelnet.register_door( "travelnet:elevator_door_steel", {"default_stone.png"}, "default:steel_ingot"); -travelnet.register_door( "travelnet:elevator_door_glass", {"travelnet_elevator_door_glass.png"}, "default:glass"); -travelnet.register_door( "travelnet:elevator_door_tin", {"default_clay.png"}, "default:tin_ingot"); +-- (but only if the materials for them exist) +if( minetest.registered_nodes["default:glass"]) then + travelnet.register_door( "travelnet:elevator_door_steel", {"default_stone.png"}, "default:steel_ingot"); + travelnet.register_door( "travelnet:elevator_door_glass", {"travelnet_elevator_door_glass.png"}, "default:glass"); + travelnet.register_door( "travelnet:elevator_door_tin", {"default_clay.png"}, "default:tin_ingot"); +end diff --git a/travelnet/elevator.lua b/travelnet/elevator.lua index 722a73a..a428845 100644 --- a/travelnet/elevator.lua +++ b/travelnet/elevator.lua @@ -114,16 +114,10 @@ minetest.register_node("travelnet:elevator", { }, }, - tiles = { - "travelnet_elevator_front.png", - "travelnet_elevator_inside_controls.png", - "travelnet_elevator_sides_outside.png", - "travelnet_elevator_inside_ceiling.png", - "travelnet_elevator_inside_floor.png", - "default_steel_block.png" - }, - inventory_image = "travelnet_elevator_inv.png", - groups = {cracky=1,choppy=1,snappy=1}, + tiles = travelnet.tiles_elevator, + + inventory_image = travelnet.elevator_inventory_image, + groups = {}, --cracky=1,choppy=1,snappy=1, light_source = 10, @@ -149,9 +143,7 @@ minetest.register_node("travelnet:elevator", { on_receive_fields = travelnet.on_receive_fields, on_punch = function(pos, node, puncher) - if( not( travelnet.check_if_trying_to_dig( puncher, node ))) then travelnet.update_formspec(pos, puncher:get_player_name()) - end end, can_dig = function( pos, player ) diff --git a/travelnet/init.lua b/travelnet/init.lua index a7aab85..7827a70 100644 --- a/travelnet/init.lua +++ b/travelnet/init.lua @@ -224,6 +224,7 @@ travelnet.reset_formspec = function( meta ) meta:set_string("formspec", "size[10,6.0]".. "label[2.0,0.0;--> "..S("Configure this travelnet station").." <--]".. + "button_exit[8.0,0.0;2.2,0.7;station_dig;"..S("Remove station").."]".. "field[0.3,1.2;9,0.9;station_name;"..S("Name of this station")..":;".. minetest.formspec_escape(station_name or "").."]".. "label[0.3,1.5;"..S("How do you call this place here? Example: \"my first house\", \"mine\", \"shop\"...").."]".. @@ -461,6 +462,7 @@ travelnet.update_formspec = function( pos, puncher_name, fields ) formspec = formspec.. "label[8.0,1.6;"..S("Position in list:").."]".. "button_exit[11.3,0.0;1.0,0.5;station_exit;"..S("Exit").."]".. + "button_exit[10.0,0.5;2.2,0.7;station_dig;"..S("Remove station").."]".. "button[9.6,1.6;1.4,0.5;move_up;"..S("move up").."]".. "button[10.9,1.6;1.4,0.5;move_down;"..S("move down").."]"; @@ -655,6 +657,50 @@ travelnet.on_receive_fields = function(pos, formname, fields, player) return; end + -- the player wants to remove the station + if( fields.station_dig ) then + local owner = meta:get_string( "owner" ); + + local node = minetest.get_node(pos) + local description = "station" + if( node and node.name and node.name == "travelnet:travelnet") then + description = "travelnet box" + elseif( node and node.name and node.name == "travelnet:elevator") then + description = "elevator" + else + minetest.chat_send_player(name, "Error: Unkown node."); + return + end + -- players with travelnet_remove priv can dig the station + if( not(minetest.check_player_privs(name, {travelnet_remove=true})) + -- the function travelnet.allow_dig(..) may allow additional digging + and not(travelnet.allow_dig( name, owner, network_name )) + -- the owner can remove the station + and owner ~= name + -- stations without owner can be removed by anybody + and owner ~= "") then + minetest.chat_send_player(name, S("This %s belongs to %s. You can't remove it."):format(description, tostring( meta:get_string('owner')))); + return + end + + local pinv = player:get_inventory() + if(not(pinv:room_for_item("main", node.name))) then + minetest.chat_send_player(name, S("You do not have enough room in your inventory.")); + return + end + + -- give the player the box + pinv:add_item("main", node.name) + -- remove the box from the data structure + travelnet.remove_box( pos, nil, meta:to_table(), player ); + -- remove the node as such + minetest.remove_node(pos) + return; + end + + + + -- if the box has not been configured yet if( meta:get_string("station_network")=="" ) then @@ -847,7 +893,12 @@ end travelnet.can_dig = function( pos, player, description ) + -- forbid digging of the travelnet + return false; +end +-- obsolete function +travelnet.can_dig_old = function( pos, player, description ) if( not( player )) then return false; end diff --git a/travelnet/locale/de.txt b/travelnet/locale/de.txt index 2675c13..e5f7642 100644 --- a/travelnet/locale/de.txt +++ b/travelnet/locale/de.txt @@ -24,6 +24,8 @@ Owned by: = Besitzer: Unless you know what you are doing, leave this empty. = Wenn du nicht weißt, wozu dieses Feld dient, laß es leer. Help = Hilfe Save = Speichern +Remove station = Station entfernen +You do not have enough room in your inventory. = Du hast nicht genug Platz in deinem Inventar. Update failed! Resetting this box on the travelnet. = Aktualisierung gescheitert. Konfiguration der Reisenetz-Box wird zurückgesetzt. Station '%s' = Station '%s' has been reattached to the network '%s'. = wurde dem Netzwerk '%s' wieder hinzugefügt. diff --git a/travelnet/locale/template.txt b/travelnet/locale/template.txt index 661dbdd..f247861 100644 --- a/travelnet/locale/template.txt +++ b/travelnet/locale/template.txt @@ -24,6 +24,8 @@ Owned by: = Unless you know what you are doing, leave this empty. = Help = Save = +Remove station = +You do not have enough room in your inventory. = Update failed! Resetting this box on the travelnet. = Station '%s' = has been reattached to the network '%s'. = diff --git a/travelnet/travelnet.lua b/travelnet/travelnet.lua index aee7f64..56cbf35 100644 --- a/travelnet/travelnet.lua +++ b/travelnet/travelnet.lua @@ -39,16 +39,11 @@ minetest.register_node("travelnet:travelnet", { }, }, - tiles = { - "travelnet_travelnet_front.png", -- backward view - "travelnet_travelnet_back.png", -- front view - "travelnet_travelnet_side.png", -- sides :) - "default_steel_block.png", -- view from top - "default_clay.png", -- view from bottom - }, - inventory_image = "travelnet_inv.png", + tiles = travelnet.tiles_travelnet, + + inventory_image = travelnet.travelnet_inventory_image, - groups = {cracky=1,choppy=1,snappy=1}, + groups = {}, --cracky=1,choppy=1,snappy=1}, light_source = 10, @@ -60,9 +55,7 @@ minetest.register_node("travelnet:travelnet", { on_receive_fields = travelnet.on_receive_fields, on_punch = function(pos, node, puncher) - if( not( travelnet.check_if_trying_to_dig( puncher, node ))) then travelnet.update_formspec(pos, puncher:get_player_name(), nil) - end end, can_dig = function( pos, player ) diff --git a/unified_inventory/register.lua b/unified_inventory/register.lua index dd2b3cc..d065e82 100644 --- a/unified_inventory/register.lua +++ b/unified_inventory/register.lua @@ -290,8 +290,7 @@ unified_inventory.register_page("craftguide", { alternates = #crafts craft = crafts[alternate] end - local has_creative = player_privs.give or player_privs.creative or - minetest.settings:get_bool("creative_mode") + local has_give = player_privs.give or unified_inventory.is_creative(player_name) formspec = formspec.."background[0.5,"..(formspecy + 0.2)..";8,3;ui_craftguide_form.png]" formspec = formspec.."textarea["..craftresultx..","..craftresulty @@ -307,7 +306,7 @@ unified_inventory.register_page("craftguide", { formspec = formspec.."image["..no_pos..","..formspecy..";1.1,1.1;ui_no.png]" formspec = formspec..stack_image_button(item_pos, formspecy, 1.1, 1.1, "item_button_" ..other_dir[dir].."_", ItemStack(item_name)) - if has_creative then + if has_give then formspec = formspec.."label[0,"..(formspecy + 2.10)..";" .. F(S("Give me:")) .. "]" .."button[0, "..(formspecy + 2.7)..";0.6,0.5;craftguide_giveme_1;1]" .."button[0.6,"..(formspecy + 2.7)..";0.7,0.5;craftguide_giveme_10;10]" @@ -384,7 +383,7 @@ unified_inventory.register_page("craftguide", { .."button[0.6,"..(formspecy + 1.5)..";0.7,0.5;craftguide_craft_10;10]" .."button[1.3,"..(formspecy + 1.5)..";0.8,0.5;craftguide_craft_max;" .. F(S("All")) .. "]" end - if has_creative then + if has_give then formspec = formspec.."label[0,"..(formspecy + 2.1)..";" .. F(S("Give me:")) .. "]" .."button[0, "..(formspecy + 2.7)..";0.6,0.5;craftguide_giveme_1;1]" .."button[0.6,"..(formspecy + 2.7)..";0.7,0.5;craftguide_giveme_10;10]" @@ -404,18 +403,24 @@ unified_inventory.register_page("craftguide", { }) local function craftguide_giveme(player, formname, fields) + local player_name = player:get_player_name() + local player_privs = minetest.get_player_privs(player_name) + if not player_privs.give and + not unified_inventory.is_creative(player_name) then + minetest.log("action", "[unified_inventory] Denied give action to player " .. + player_name) + return + end + local amount for k, v in pairs(fields) do amount = k:match("craftguide_giveme_(.*)") if amount then break end end - if not amount then return end - amount = tonumber(amount) + amount = tonumber(amount) or 0 if amount == 0 then return end - local player_name = player:get_player_name() - local output = unified_inventory.current_item[player_name] if (not output) or (output == "") then return end @@ -562,6 +567,10 @@ local function craftguide_craft(player, formname, fields) end minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "" then + return + end + for k, v in pairs(fields) do if k:match("craftguide_craft_") then craftguide_craft(player, formname, fields) diff --git a/unifieddyes/init.lua b/unifieddyes/init.lua index 673eef1..b692810 100644 --- a/unifieddyes/init.lua +++ b/unifieddyes/init.lua @@ -1431,7 +1431,7 @@ for _,i in ipairs(unifieddyes.base_color_crafts) do minetest.register_craft( { type = "shapeless", - output = "dye:"..j[1]..color..j[2].." "..yield, + output = "dye:"..j[1]..color..j[2].." "..j[6], recipe = { "dye:"..color, firstdye, diff --git a/xban2/gui.lua b/xban2/gui.lua index d3306e2..66fc89a 100644 --- a/xban2/gui.lua +++ b/xban2/gui.lua @@ -9,7 +9,7 @@ local ESC = minetest.formspec_escape local function make_list(filter) filter = filter or "" local list, n, dropped = { }, 0, false - for k in pairs(minetest.auth_table) do + for k in minetest.get_auth_handler().iterate() do if strfind(k, filter, 1, true) then if n >= MAXLISTSIZE then dropped = true -- cgit v1.2.3