From f4d718c53843c5e18243d0851b9c7790b0853334 Mon Sep 17 00:00:00 2001 From: Rogier Date: Wed, 14 Dec 2016 16:23:25 +0100 Subject: Minimal game: Use field 'tiles' instead of 'tile_images' --- games/minimal/mods/experimental/init.lua | 6 +++--- games/minimal/mods/stairs/init.lua | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'games/minimal') diff --git a/games/minimal/mods/experimental/init.lua b/games/minimal/mods/experimental/init.lua index 729191bce..142734cda 100644 --- a/games/minimal/mods/experimental/init.lua +++ b/games/minimal/mods/experimental/init.lua @@ -28,7 +28,7 @@ minetest.after(1.0, switch_player_visual) ]] minetest.register_node("experimental:soundblock", { - tile_images = {"unknown_node.png", "default_tnt_bottom.png", + tiles = {"unknown_node.png", "default_tnt_bottom.png", "default_tnt_side.png", "default_tnt_side.png", "default_tnt_side.png", "default_tnt_side.png"}, inventory_image = minetest.inventorycube("unknown_node.png", @@ -120,7 +120,7 @@ minetest.register_craft({ }) minetest.register_node("experimental:tnt", { - tile_images = {"default_tnt_top.png", "default_tnt_bottom.png", + tiles = {"default_tnt_top.png", "default_tnt_bottom.png", "default_tnt_side.png", "default_tnt_side.png", "default_tnt_side.png", "default_tnt_side.png"}, inventory_image = minetest.inventorycube("default_tnt_top.png", @@ -453,7 +453,7 @@ minetest.register_abm({ minetest.register_node("experimental:tester_node_1", { description = "Tester Node 1 (construct/destruct/timer)", - tile_images = {"wieldhand.png"}, + tiles = {"wieldhand.png"}, groups = {oddly_breakable_by_hand=2}, sounds = default.node_sound_wood_defaults(), -- This was known to cause a bug in minetest.item_place_node() when used diff --git a/games/minimal/mods/stairs/init.lua b/games/minimal/mods/stairs/init.lua index 4929d1370..c3bbc561e 100644 --- a/games/minimal/mods/stairs/init.lua +++ b/games/minimal/mods/stairs/init.lua @@ -5,7 +5,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description) minetest.register_node("stairs:stair_" .. subname, { description = description, drawtype = "nodebox", - tile_images = images, + tiles = images, paramtype = "light", paramtype2 = "facedir", is_ground_content = true, @@ -34,7 +34,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description) minetest.register_node("stairs:slab_" .. subname, { description = description, drawtype = "nodebox", - tile_images = images, + tiles = images, paramtype = "light", is_ground_content = true, groups = groups, -- cgit v1.2.3 From 7057c196c442ff3484b53f48d940f4c9e0ffe23a Mon Sep 17 00:00:00 2001 From: Luke Puchner-Hardman Date: Tue, 23 Sep 2014 14:39:34 +0200 Subject: Added "[sheet" to the texture special commands. "[sheet:WxH:X,Y" assumes the base image is a tilesheet with W*H tiles on it and crops to the tile at position X,Y. Basically it works like "[verticalframe" but in 2D. For testing, I combined the four default_chest images into one. --- games/minimal/mods/default/init.lua | 10 ++++++---- games/minimal/mods/default/textures/default_chest.png | Bin 0 -> 263 bytes .../minimal/mods/default/textures/default_chest_front.png | Bin 114 -> 0 bytes .../minimal/mods/default/textures/default_chest_lock.png | Bin 145 -> 0 bytes .../minimal/mods/default/textures/default_chest_side.png | Bin 98 -> 0 bytes games/minimal/mods/default/textures/default_chest_top.png | Bin 93 -> 0 bytes 6 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 games/minimal/mods/default/textures/default_chest.png delete mode 100644 games/minimal/mods/default/textures/default_chest_front.png delete mode 100644 games/minimal/mods/default/textures/default_chest_lock.png delete mode 100644 games/minimal/mods/default/textures/default_chest_side.png delete mode 100644 games/minimal/mods/default/textures/default_chest_top.png (limited to 'games/minimal') diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua index bff7860e3..f532e7193 100644 --- a/games/minimal/mods/default/init.lua +++ b/games/minimal/mods/default/init.lua @@ -1130,8 +1130,9 @@ minetest.register_node("default:sign_wall", { minetest.register_node("default:chest", { description = "Chest", - tiles ={"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", - "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"}, + tiles ={"default_chest.png^[sheet:2x2:0,0", "default_chest.png^[sheet:2x2:0,0", + "default_chest.png^[sheet:2x2:1,0", "default_chest.png^[sheet:2x2:1,0", + "default_chest.png^[sheet:2x2:1,0", "default_chest.png^[sheet:2x2:0,1"}, paramtype2 = "facedir", groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, @@ -1164,8 +1165,9 @@ end minetest.register_node("default:chest_locked", { description = "Locked Chest", - tiles ={"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", - "default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"}, + tiles ={"default_chest.png^[sheet:2x2:0,0", "default_chest.png^[sheet:2x2:0,0", + "default_chest.png^[sheet:2x2:1,0", "default_chest.png^[sheet:2x2:1,0", + "default_chest.png^[sheet:2x2:1,0", "default_chest.png^[sheet:2x2:1,1"}, paramtype2 = "facedir", groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, legacy_facedir_simple = true, diff --git a/games/minimal/mods/default/textures/default_chest.png b/games/minimal/mods/default/textures/default_chest.png new file mode 100644 index 000000000..9746a3fd9 Binary files /dev/null and b/games/minimal/mods/default/textures/default_chest.png differ diff --git a/games/minimal/mods/default/textures/default_chest_front.png b/games/minimal/mods/default/textures/default_chest_front.png deleted file mode 100644 index 55b076c35..000000000 Binary files a/games/minimal/mods/default/textures/default_chest_front.png and /dev/null differ diff --git a/games/minimal/mods/default/textures/default_chest_lock.png b/games/minimal/mods/default/textures/default_chest_lock.png deleted file mode 100644 index 4b2d1af6c..000000000 Binary files a/games/minimal/mods/default/textures/default_chest_lock.png and /dev/null differ diff --git a/games/minimal/mods/default/textures/default_chest_side.png b/games/minimal/mods/default/textures/default_chest_side.png deleted file mode 100644 index ae4847cb6..000000000 Binary files a/games/minimal/mods/default/textures/default_chest_side.png and /dev/null differ diff --git a/games/minimal/mods/default/textures/default_chest_top.png b/games/minimal/mods/default/textures/default_chest_top.png deleted file mode 100644 index ac41551b0..000000000 Binary files a/games/minimal/mods/default/textures/default_chest_top.png and /dev/null differ -- cgit v1.2.3 From a07b032245bef76a7695e139a9daca7cb646a73d Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 23 Dec 2016 14:43:56 +0100 Subject: Add 2D sheet animation for nodes --- games/minimal/mods/default/init.lua | 7 +++++-- .../default/textures/default_lava_source_animated.png | Bin 2902 -> 3145 bytes 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'games/minimal') diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua index f532e7193..2f73b53ef 100644 --- a/games/minimal/mods/default/init.lua +++ b/games/minimal/mods/default/init.lua @@ -1044,8 +1044,11 @@ minetest.register_node("default:lava_source", { inventory_image = minetest.inventorycube("default_lava.png"), drawtype = "liquid", --tiles ={"default_lava.png"}, - tiles ={ - {name="default_lava_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}} + tiles = { + { + name = "default_lava_source_animated.png", + animation = {type="sheet_2d", frames_w=3, frames_h=2, frame_length=0.5} + } }, special_tiles = { -- New-style lava source material (mostly unused) diff --git a/games/minimal/mods/default/textures/default_lava_source_animated.png b/games/minimal/mods/default/textures/default_lava_source_animated.png index aa9d57cf1..54f4c0ddd 100644 Binary files a/games/minimal/mods/default/textures/default_lava_source_animated.png and b/games/minimal/mods/default/textures/default_lava_source_animated.png differ -- cgit v1.2.3 From 7279f0b37335396c85f6bdd7dc67ff56e53df0f9 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 14 Jan 2017 16:48:49 +0100 Subject: Add particle animation, glow This is implemented by reusing and extending the TileAnimation code for the methods used by particles. --- games/minimal/mods/experimental/init.lua | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'games/minimal') diff --git a/games/minimal/mods/experimental/init.lua b/games/minimal/mods/experimental/init.lua index 142734cda..5e98e1a80 100644 --- a/games/minimal/mods/experimental/init.lua +++ b/games/minimal/mods/experimental/init.lua @@ -523,6 +523,43 @@ minetest.register_craft({ } }) +minetest.register_craftitem("experimental:tester_tool_2", { + description = "Tester Tool 2", + inventory_image = "experimental_tester_tool_1.png^[invert:g", + on_use = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing, true) + if pos == nil then return end + pos = vector.add(pos, {x=0, y=0.5, z=0}) + local tex, anim + if math.random(0, 1) == 0 then + tex = "default_lava_source_animated.png" + anim = {type="sheet_2d", frames_w=3, frames_h=2, frame_length=0.5} + else + tex = "default_lava_flowing_animated.png" + anim = {type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3} + end + + minetest.add_particle({ + pos = pos, + velocity = {x=0, y=0, z=0}, + acceleration = {x=0, y=0.04, z=0}, + expirationtime = 6, + collisiondetection = true, + texture = tex, + animation = anim, + size = 4, + glow = math.random(0, 5), + }) + end, +}) + +minetest.register_craft({ + output = 'experimental:tester_tool_2', + recipe = { + {'group:crumbly','group:crumbly'}, + } +}) + --[[minetest.register_on_joinplayer(function(player) minetest.after(3, function() player:set_inventory_formspec("size[8,7.5]".. -- cgit v1.2.3 From 5db41d4d213333fc39845e7b752d7976a24da6af Mon Sep 17 00:00:00 2001 From: red-001 Date: Sat, 18 Feb 2017 14:36:29 +0000 Subject: Fix not being able to damage players in minimal (#5266) --- games/minimal/mods/default/init.lua | 61 ++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 14 deletions(-) (limited to 'games/minimal') diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua index 2f73b53ef..d36e225a3 100644 --- a/games/minimal/mods/default/init.lua +++ b/games/minimal/mods/default/init.lua @@ -39,10 +39,15 @@ minetest.register_item(":", { crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1}, snappy = {times={[3]=0.40}, uses=0, maxlevel=1}, oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=1.40}, uses=0, maxlevel=3}, - } + }, + damage_groups = {fleshy=1}, } }) +-- +-- Picks +-- + minetest.register_tool("default:pick_wood", { description = "Wooden Pickaxe", inventory_image = "default_tool_woodpick.png", @@ -50,7 +55,8 @@ minetest.register_tool("default:pick_wood", { max_drop_level=0, groupcaps={ cracky={times={[2]=2.00, [3]=1.20}, uses=10, maxlevel=1} - } + }, + damage_groups = {fleshy=2}, }, }) minetest.register_tool("default:pick_stone", { @@ -60,7 +66,8 @@ minetest.register_tool("default:pick_stone", { max_drop_level=0, groupcaps={ cracky={times={[1]=2.00, [2]=1.20, [3]=0.80}, uses=20, maxlevel=1} - } + }, + damage_groups = {fleshy=3}, }, }) minetest.register_tool("default:pick_steel", { @@ -70,7 +77,8 @@ minetest.register_tool("default:pick_steel", { max_drop_level=1, groupcaps={ cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=10, maxlevel=2} - } + }, + damage_groups = {fleshy=4}, }, }) minetest.register_tool("default:pick_mese", { @@ -83,9 +91,15 @@ minetest.register_tool("default:pick_mese", { cracky={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3}, crumbly={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3}, snappy={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3} - } + }, + damage_groups = {fleshy=4}, }, }) + +-- +-- Shovels +-- + minetest.register_tool("default:shovel_wood", { description = "Wooden Shovel", inventory_image = "default_tool_woodshovel.png", @@ -93,7 +107,8 @@ minetest.register_tool("default:shovel_wood", { max_drop_level=0, groupcaps={ crumbly={times={[1]=2.00, [2]=0.80, [3]=0.50}, uses=10, maxlevel=1} - } + }, + damage_groups = {fleshy=2}, }, }) minetest.register_tool("default:shovel_stone", { @@ -103,7 +118,8 @@ minetest.register_tool("default:shovel_stone", { max_drop_level=0, groupcaps={ crumbly={times={[1]=1.20, [2]=0.50, [3]=0.30}, uses=20, maxlevel=1} - } + }, + damage_groups = {fleshy=3}, }, }) minetest.register_tool("default:shovel_steel", { @@ -113,9 +129,15 @@ minetest.register_tool("default:shovel_steel", { max_drop_level=1, groupcaps={ crumbly={times={[1]=1.00, [2]=0.70, [3]=0.60}, uses=10, maxlevel=2} - } + }, + damage_groups = {fleshy=4}, }, }) + +-- +-- Axes +-- + minetest.register_tool("default:axe_wood", { description = "Wooden Axe", inventory_image = "default_tool_woodaxe.png", @@ -124,7 +146,8 @@ minetest.register_tool("default:axe_wood", { groupcaps={ choppy={times={[2]=1.40, [3]=0.80}, uses=10, maxlevel=1}, fleshy={times={[2]=1.50, [3]=0.80}, uses=10, maxlevel=1} - } + }, + damage_groups = {fleshy=2}, }, }) minetest.register_tool("default:axe_stone", { @@ -135,7 +158,8 @@ minetest.register_tool("default:axe_stone", { groupcaps={ choppy={times={[1]=1.50, [2]=1.00, [3]=0.60}, uses=20, maxlevel=1}, fleshy={times={[2]=1.30, [3]=0.70}, uses=20, maxlevel=1} - } + }, + damage_groups = {fleshy=3}, }, }) minetest.register_tool("default:axe_steel", { @@ -146,9 +170,15 @@ minetest.register_tool("default:axe_steel", { groupcaps={ choppy={times={[1]=2.00, [2]=1.60, [3]=1.00}, uses=10, maxlevel=2}, fleshy={times={[2]=1.10, [3]=0.60}, uses=40, maxlevel=1} - } + }, + damage_groups = {fleshy=3}, }, }) + +-- +-- Swords +-- + minetest.register_tool("default:sword_wood", { description = "Wooden Sword", inventory_image = "default_tool_woodsword.png", @@ -159,7 +189,8 @@ minetest.register_tool("default:sword_wood", { fleshy={times={[2]=1.10, [3]=0.60}, uses=10, maxlevel=1}, snappy={times={[2]=1.00, [3]=0.50}, uses=10, maxlevel=1}, choppy={times={[3]=1.00}, uses=20, maxlevel=0} - } + }, + damage_groups = {fleshy=2}, } }) minetest.register_tool("default:sword_stone", { @@ -172,7 +203,8 @@ minetest.register_tool("default:sword_stone", { fleshy={times={[2]=0.80, [3]=0.40}, uses=20, maxlevel=1}, snappy={times={[2]=0.80, [3]=0.40}, uses=20, maxlevel=1}, choppy={times={[3]=0.90}, uses=20, maxlevel=0} - } + }, + damage_groups = {fleshy=4}, } }) minetest.register_tool("default:sword_steel", { @@ -185,7 +217,8 @@ minetest.register_tool("default:sword_steel", { fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2}, snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1}, choppy={times={[3]=0.70}, uses=40, maxlevel=0} - } + }, + damage_groups = {fleshy=6}, } }) -- cgit v1.2.3 From 113c85a66a5b23c8c47f1bdb435dd4b27884ed54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sat, 22 Apr 2017 00:34:00 +0200 Subject: lua: remove core.cause_error call (#5637) it was used in minimal to trigger core crash, not very useful --- games/minimal/mods/errorhandler_test/init.lua | 106 -------------------------- 1 file changed, 106 deletions(-) delete mode 100644 games/minimal/mods/errorhandler_test/init.lua (limited to 'games/minimal') diff --git a/games/minimal/mods/errorhandler_test/init.lua b/games/minimal/mods/errorhandler_test/init.lua deleted file mode 100644 index 9d1535c1d..000000000 --- a/games/minimal/mods/errorhandler_test/init.lua +++ /dev/null @@ -1,106 +0,0 @@ --- --- exception handler test module --- --- --- To avoid this from crashing the module will startup in inactive mode. --- to make specific errors happen you need to cause them by following --- chat command: --- --- exceptiontest --- --- location has to be one of: --- * mapgen: cause in next on_generate call --- * entity_step: spawn a entity and make it do error in on_step --- * globalstep: do error in next globalstep --- * immediate: cause right in chat handler --- --- errortypes defined are: --- * segv: make sigsegv happen --- * zerodivision: cause a division by zero to happen --- * exception: throw an exception - -if core.cause_error == nil or - type(core.cause_error) ~= "function" then - return -end - - -core.log("action", "WARNING: loading exception handler test module!") - -local exceptiondata = { - tocause = "none", - mapgen = false, - entity_step = false, - globalstep = false, -} - -local exception_entity = -{ - on_step = function(self, dtime) - if exceptiondata.entity_step then - core.cause_error(exceptiondata.tocause) - end - end, -} -local exception_entity_name = "errorhandler_test:error_entity" - -local function exception_chat_handler(playername, param) - local parameters = param:split(" ") - - if #parameters ~= 2 then - core.chat_send_player(playername, "Invalid argument count for exceptiontest") - end - - core.log("error", "Causing error at:" .. parameters[1]) - - if parameters[1] == "mapgen" then - exceptiondata.tocause = parameters[2] - exceptiondata.mapgen = true - elseif parameters[1] == "entity_step" then - --spawn entity at player location - local player = core.get_player_by_name(playername) - - if player:is_player() then - local pos = player:getpos() - - core.add_entity(pos, exception_entity_name) - end - - exceptiondata.tocause = parameters[2] - exceptiondata.entity_step = true - - elseif parameters[1] == "globalstep" then - exceptiondata.tocause = parameters[2] - exceptiondata.globalstep = true - - elseif parameters[1] == "immediate" then - core.cause_error(parameters[2]) - - else - core.chat_send_player(playername, "Invalid error location: " .. dump(parameters[1])) - end -end - -core.register_chatcommand("exceptiontest", - { - params = " ", - description = "cause a given error to happen.\n" .. - " location=(mapgen,entity_step,globalstep,immediate)\n" .. - " errortype=(segv,zerodivision,exception)", - func = exception_chat_handler, - privs = { server=true } - }) - -core.register_globalstep(function(dtime) - if exceptiondata.globalstep then - core.cause_error(exceptiondata.tocause) - end -end) - -core.register_on_generated(function(minp, maxp, blockseed) - if exceptiondata.mapgen then - core.cause_error(exceptiondata.tocause) - end -end) - -core.register_entity(exception_entity_name, exception_entity) -- cgit v1.2.3 From c1b3ed4180dea16e2fa77663a7d2bf155595dd60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sun, 7 May 2017 12:13:15 +0200 Subject: Player attrs: permits to remove an attribute by setting value to nil (#5716) * Player attrs: permits to remove an attribute by setting value to nil When doing player:set_attribute("attr", nil) remove attribute Also remove a useless check on C++ API part (already done by checkplayer) Fix #5709 --- games/minimal/mods/default/init.lua | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'games/minimal') diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua index d36e225a3..64970f922 100644 --- a/games/minimal/mods/default/init.lua +++ b/games/minimal/mods/default/init.lua @@ -18,6 +18,8 @@ dofile(minetest.get_modpath("default").."/mapgen.lua") minetest.register_on_joinplayer(function(player) local cb = function(player) minetest.chat_send_player(player:get_player_name(), "This is the [minimal] \"Minimal Development Test\" game. Use [minetest_game] for the real thing.") + player:set_attribute("test_attribute", "test_me") + player:set_attribute("remove_this", nil) end minetest.after(2.0, cb, player) end) @@ -1387,13 +1389,13 @@ minetest.register_abm({ local srclist = inv:get_list("src") local cooked = nil - + if srclist then cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) end - + local was_active = false - + if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then was_active = true meta:set_float("fuel_time", meta:get_float("fuel_time") + 1) @@ -1413,7 +1415,7 @@ minetest.register_abm({ meta:set_string("src_time", 0) end end - + if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then local percent = math.floor(meta:get_float("fuel_time") / meta:get_float("fuel_totaltime") * 100) @@ -1438,7 +1440,7 @@ minetest.register_abm({ local cooked = nil local fuellist = inv:get_list("fuel") local srclist = inv:get_list("src") - + if srclist then cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) end @@ -1464,7 +1466,7 @@ minetest.register_abm({ meta:set_string("fuel_totaltime", fuel.time) meta:set_string("fuel_time", 0) - + local stack = inv:get_stack("fuel", 1) stack:take_item() inv:set_stack("fuel", 1, stack) @@ -1571,7 +1573,7 @@ function default.grow_tree(data, a, pos, is_apple_tree, seed) y = y+th-1 -- (x, y, z) is now last piece of trunk local leaves_a = VoxelArea:new{MinEdge={x=-2, y=-1, z=-2}, MaxEdge={x=2, y=2, z=2}} local leaves_buffer = {} - + -- Force leaves near the trunk local d = 1 for xi = -d, d do @@ -1581,14 +1583,14 @@ function default.grow_tree(data, a, pos, is_apple_tree, seed) end end end - + -- Add leaves randomly for iii = 1, 8 do local d = 1 local xx = pr:next(leaves_a.MinEdge.x, leaves_a.MaxEdge.x - d) local yy = pr:next(leaves_a.MinEdge.y, leaves_a.MaxEdge.y - d) local zz = pr:next(leaves_a.MinEdge.z, leaves_a.MaxEdge.z - d) - + for xi = 0, d do for yi = 0, d do for zi = 0, d do @@ -1597,7 +1599,7 @@ function default.grow_tree(data, a, pos, is_apple_tree, seed) end end end - + -- Add the leaves for xi = leaves_a.MinEdge.x, leaves_a.MaxEdge.x do for yi = leaves_a.MinEdge.y, leaves_a.MaxEdge.y do -- cgit v1.2.3 From 071e114ffa945522a7a9acc3259427166992d5ee Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 10 May 2017 15:29:21 +0200 Subject: Private nodemeta (#5702) * Private node metadata that isn't sent to the client --- games/minimal/mods/default/init.lua | 2 ++ games/minimal/mods/experimental/init.lua | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'games/minimal') diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua index 64970f922..7d26f38a0 100644 --- a/games/minimal/mods/default/init.lua +++ b/games/minimal/mods/default/init.lua @@ -1228,6 +1228,8 @@ minetest.register_node("default:chest_locked", { meta:set_string("owner", "") local inv = meta:get_inventory() inv:set_size("main", 8*4) + -- this is not really the intended usage but works for testing purposes: + meta:mark_as_private("owner") end, can_dig = function(pos,player) local meta = minetest.get_meta(pos); diff --git a/games/minimal/mods/experimental/init.lua b/games/minimal/mods/experimental/init.lua index 5e98e1a80..6e0fb1738 100644 --- a/games/minimal/mods/experimental/init.lua +++ b/games/minimal/mods/experimental/init.lua @@ -502,10 +502,16 @@ minetest.register_craftitem("experimental:tester_tool_1", { on_use = function(itemstack, user, pointed_thing) --print(dump(pointed_thing)) if pointed_thing.type == "node" then - if minetest.get_node(pointed_thing.under).name == "experimental:tester_node_1" then + local node = minetest.get_node(pointed_thing.under) + if node.name == "experimental:tester_node_1" or node.name == "default:chest" then local p = pointed_thing.under minetest.log("action", "Tester tool used at "..minetest.pos_to_string(p)) - minetest.dig_node(p) + if node.name == "experimental:tester_node_1" then + minetest.dig_node(p) + else + minetest.get_meta(p):mark_as_private({"infotext", "formspec"}) + minetest.chat_send_player(user:get_player_name(), "Verify that chest is unusable now.") + end else local p = pointed_thing.above minetest.log("action", "Tester tool used at "..minetest.pos_to_string(p)) -- cgit v1.2.3 From 649f641f28dcb5054131d98f76584e5579d9f6d5 Mon Sep 17 00:00:00 2001 From: Paramat Date: Wed, 24 May 2017 06:43:17 +0100 Subject: Minimal: Add river water nodes (#5809) Is a base terrain node needed by any core mapgen with sloping rivers. --- games/minimal/mods/default/init.lua | 79 ++++++++++++++++++--- games/minimal/mods/default/mapgen.lua | 1 + .../mods/default/textures/default_river_water.png | Bin 0 -> 716 bytes 3 files changed, 69 insertions(+), 11 deletions(-) create mode 100644 games/minimal/mods/default/textures/default_river_water.png (limited to 'games/minimal') diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua index 7d26f38a0..fcdf93547 100644 --- a/games/minimal/mods/default/init.lua +++ b/games/minimal/mods/default/init.lua @@ -992,37 +992,37 @@ minetest.register_node("default:cloud", { minetest.register_node("default:water_flowing", { description = "Water (flowing)", - inventory_image = minetest.inventorycube("default_water.png"), drawtype = "flowingliquid", - tiles ={"default_water.png"}, + tiles = {"default_water.png"}, special_tiles = { - {name="default_water.png", backface_culling=false}, - {name="default_water.png", backface_culling=true}, + {name = "default_water.png", backface_culling = false}, + {name = "default_water.png", backface_culling = true}, }, alpha = WATER_ALPHA, paramtype = "light", + paramtype2 = "flowingliquid", walkable = false, pointable = false, diggable = false, buildable_to = true, is_ground_content = false, + drop = "", drowning = 1, liquidtype = "flowing", liquid_alternative_flowing = "default:water_flowing", liquid_alternative_source = "default:water_source", liquid_viscosity = WATER_VISC, - post_effect_color = {a=64, r=100, g=100, b=200}, - groups = {water=3, liquid=3}, + post_effect_color = {a = 64, r = 100, g = 100, b = 200}, + groups = {water = 3, liquid = 3}, }) minetest.register_node("default:water_source", { description = "Water", - inventory_image = minetest.inventorycube("default_water.png"), drawtype = "liquid", - tiles ={"default_water.png"}, + tiles = {"default_water.png"}, special_tiles = { -- New-style water source material (mostly unused) - {name="default_water.png", backface_culling=false}, + {name = "default_water.png", backface_culling = false}, }, alpha = WATER_ALPHA, paramtype = "light", @@ -1031,13 +1031,70 @@ minetest.register_node("default:water_source", { diggable = false, buildable_to = true, is_ground_content = false, + drop = "", drowning = 1, liquidtype = "source", liquid_alternative_flowing = "default:water_flowing", liquid_alternative_source = "default:water_source", liquid_viscosity = WATER_VISC, - post_effect_color = {a=64, r=100, g=100, b=200}, - groups = {water=3, liquid=3}, + post_effect_color = {a = 64, r = 100, g = 100, b = 200}, + groups = {water = 3, liquid = 3}, +}) + +minetest.register_node("default:river_water_source", { + description = "River Water Source", + drawtype = "liquid", + tiles = {"default_river_water.png"}, + special_tiles = { + -- New-style water source material (mostly unused) + {name = "default_river_water.png", backface_culling = false}, + }, + alpha = 160, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "default:river_water_flowing", + liquid_alternative_source = "default:river_water_source", + liquid_viscosity = 1, + liquid_renewable = false, + liquid_range = 2, + post_effect_color = {a = 103, r = 30, g = 76, b = 90}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1}, +}) + +minetest.register_node("default:river_water_flowing", { + description = "Flowing River Water", + drawtype = "flowingliquid", + tiles = {"default_river_water.png"}, + special_tiles = { + {name = "default_river_water.png", backface_culling = false}, + {name = "default_river_water.png", backface_culling = true}, + }, + alpha = 160, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "default:river_water_flowing", + liquid_alternative_source = "default:river_water_source", + liquid_viscosity = 1, + liquid_renewable = false, + liquid_range = 2, + post_effect_color = {a = 103, r = 30, g = 76, b = 90}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, + not_in_creative_inventory = 1, cools_lava = 1}, }) minetest.register_node("default:lava_flowing", { diff --git a/games/minimal/mods/default/mapgen.lua b/games/minimal/mods/default/mapgen.lua index 65b67dae5..30a865366 100644 --- a/games/minimal/mods/default/mapgen.lua +++ b/games/minimal/mods/default/mapgen.lua @@ -8,6 +8,7 @@ minetest.register_alias("mapgen_dirt", "default:dirt") minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass") minetest.register_alias("mapgen_sand", "default:sand") minetest.register_alias("mapgen_water_source", "default:water_source") +minetest.register_alias("mapgen_river_water_source", "default:river_water_source") minetest.register_alias("mapgen_lava_source", "default:lava_source") minetest.register_alias("mapgen_gravel", "default:gravel") diff --git a/games/minimal/mods/default/textures/default_river_water.png b/games/minimal/mods/default/textures/default_river_water.png new file mode 100644 index 000000000..3b55c5f66 Binary files /dev/null and b/games/minimal/mods/default/textures/default_river_water.png differ -- cgit v1.2.3