diff --git a/minetestforfun_game/game_api.txt b/minetestforfun_game/game_api.txt index 8123c010..4ff5859c 100755 --- a/minetestforfun_game/game_api.txt +++ b/minetestforfun_game/game_api.txt @@ -275,3 +275,16 @@ dye.basecolors dye.excolors ^ Array containing the names of the available extended colors + +Leafdecay +--------- +To enable leaf decay for a node, add it to the "leafdecay" group. + +The rating of the group determines how far from a node in the group "tree" +the node can be without decaying. + +If param2 of the node is ~= 0, the node will always be preserved. Thus, if +the player places a node of that kind, you will want to set param2=1 or so. + +If the node is in the leafdecay_drop group then it will always be dropped as an +item. diff --git a/minetestforfun_game/mods/bucket/init.lua b/minetestforfun_game/mods/bucket/init.lua index 4d2d9b90..927e9543 100644 --- a/minetestforfun_game/mods/bucket/init.lua +++ b/minetestforfun_game/mods/bucket/init.lua @@ -1,8 +1,6 @@ -- Minetest 0.4 mod: bucket -- See README.txt for licensing and other information. -local LIQUID_MAX = 8 --The number of water levels when liquid_finite is enabled - minetest.register_alias("bucket", "bucket:bucket_empty") minetest.register_alias("bucket_water", "bucket:bucket_water") minetest.register_alias("bucket_acid", "bucket:bucket_acid") @@ -73,40 +71,20 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name itemstack) or itemstack end - local place_liquid = function(pos, node, source, flowing, fullness) + local place_liquid = function(pos, node, source, flowing) if check_protection(pos, user and user:get_player_name() or "", "place "..source) then return end - if math.floor(fullness/128) == 1 or - not minetest.setting_getbool("liquid_finite") then - minetest.add_node(pos, {name=source, - param2=fullness}) - return - elseif node.name == flowing then - fullness = fullness + node.param2 - elseif node.name == source then - fullness = LIQUID_MAX - end - - if fullness >= LIQUID_MAX then - minetest.add_node(pos, {name=source, - param2=LIQUID_MAX}) - else - minetest.add_node(pos, {name=flowing, - param2=fullness}) - end + minetest.add_node(pos,{name=source}) end -- Check if pointing to a buildable node - local fullness = tonumber(itemstack:get_metadata()) - if not fullness then fullness = LIQUID_MAX end - if ndef and ndef.buildable_to then -- buildable; replace the node place_liquid(pointed_thing.under, node, - source, flowing, fullness) + flowing) else -- not buildable to; place the liquid above -- check if the node above can be replaced @@ -114,7 +92,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name if node and minetest.registered_nodes[node.name].buildable_to then place_liquid(pointed_thing.above, node, source, - flowing, fullness) + flowing) else -- do not remove the bucket with the liquid return @@ -141,9 +119,7 @@ minetest.register_craftitem(":bucket:bucket_empty", { node = minetest.get_node(pointed_thing.under) liquiddef = bucket.liquids[node.name] if liquiddef ~= nil and liquiddef.itemname ~= nil and - (node.name == liquiddef.source or - (node.name == liquiddef.flowing and - minetest.setting_getbool("liquid_finite"))) then + node.name == liquiddef.source then if check_protection(pointed_thing.under, user:get_player_name(), "take ".. node.name) then @@ -162,13 +138,9 @@ minetest.register_craftitem(":bucket:bucket_empty", { minetest.add_node(pointed_thing.under, {name="air"}) count = count - 1 itemstack:set_count(count) - if node.name == liquiddef.source then - node.param2 = LIQUID_MAX - end - bucket_liquid = ItemStack({name = liquiddef.itemname, - metadata = tostring(node.param2)}) inv:add_item("main", bucket_liquid) - return itemstack + return ItemStack(liquiddef.itemname) + --return itemstack else minetest.chat_send_player(user:get_player_name(), "Your inventory is full.") end diff --git a/minetestforfun_game/mods/default/README.txt b/minetestforfun_game/mods/default/README.txt index 695d3b1f..c53e149e 100644 --- a/minetestforfun_game/mods/default/README.txt +++ b/minetestforfun_game/mods/default/README.txt @@ -23,6 +23,13 @@ Everything not listed in here: Copyright (C) 2010-2012 celeron55, Perttu Ahola Cisoun's WTFPL texture pack: + default_chest_front.png + default_chest_lock.png + default_chest_side.png + default_chest_top.png + default_dirt.png + default_grass.png + default_grass_side.png default_jungletree.png default_jungletree_top.png default_lava.png @@ -34,7 +41,7 @@ Cisoun's WTFPL texture pack: default_tree_top.png default_water.png -Cisoun's conifers mod (WTFPL): +Cisoun's conifere mod (WTFPL): default_pine_needles.png Originating from G4JC's Almost MC Texture Pack: @@ -64,12 +71,12 @@ VanessaE (WTFPL): default_sand.png default_sandstone_brick.png -Calinou (CC BY-SA): +Calinou (CC BY-SA 3.0): + crack_anylength.png default_brick.png default_papyrus.png default_copper_lump.png default_mineral_copper.png - default_glass_detail.png MirceaKitsune (WTFPL): character.x @@ -83,6 +90,7 @@ PilzAdam (WTFPL): default_junglewood.png default_obsidian_glass.png default_obsidian_shard.png + default_mossycobble.png default_gold_lump.png default_mineral_gold.png default_snowball.png @@ -97,7 +105,6 @@ Splizard (CC BY-SA 3.0): default_snow.png default_snow_side.png default_ice.png - default_pine_sapling.png Zeg9 (CC BY-SA 3.0): default_coal_block.png @@ -118,6 +125,7 @@ brunob.santos (CC BY-SA 4.0): BlockMen (CC BY-SA 3.0): default_stone_brick.png default_wood.png + default_cobble.png default_clay_brick.png default_tool_steelsword.png default_bronze_ingot.png @@ -131,25 +139,10 @@ BlockMen (CC BY-SA 3.0): default_book.png default_paper.png default_stick.png - default_chest_front.png - default_chest_lock.png - default_chest_side.png - default_chest_top.png bubble.png heart.png gui_*.png -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 - -Philipbenr (CC BY-SA 3.0): - default_grass.png - default_grass_side.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/ diff --git a/minetestforfun_game/mods/default/crafting.lua b/minetestforfun_game/mods/default/crafting.lua index d8f233af..4d075d1b 100644 --- a/minetestforfun_game/mods/default/crafting.lua +++ b/minetestforfun_game/mods/default/crafting.lua @@ -5,6 +5,19 @@ minetest.register_craft({ recipe = {{"default:tree"},} }) +minetest.register_craft({ + output = 'default:pinewood 4', + recipe = { + {'default:pinetree'}, + } +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_sapling", + burntime = 10, +}) + minetest.register_craft({ output = "default:junglewood 4", recipe = {{"default:jungletree"},} diff --git a/minetestforfun_game/mods/default/craftitems.lua b/minetestforfun_game/mods/default/craftitems.lua index fcd76240..70ad25b8 100644 --- a/minetestforfun_game/mods/default/craftitems.lua +++ b/minetestforfun_game/mods/default/craftitems.lua @@ -17,14 +17,13 @@ minetest.register_craftitem("default:paper", { minetest.register_craftitem("default:book", { description = "Book", inventory_image = "default_book.png", - groups = {book=1}, + groups = {book = 1}, }) minetest.register_craftitem("default:coal_lump", { description = "Coal Lump", wield_scale = {x = 1, y = 1, z = 2}, inventory_image = "default_coal_lump.png", - groups = {coal = 1} }) minetest.register_craftitem("default:iron_lump", { diff --git a/minetestforfun_game/mods/default/functions.lua b/minetestforfun_game/mods/default/functions.lua index 806e8969..5b921e0d 100644 --- a/minetestforfun_game/mods/default/functions.lua +++ b/minetestforfun_game/mods/default/functions.lua @@ -7,20 +7,40 @@ function default.node_sound_defaults(table) table = table or {} table.footstep = table.footstep or - {name="", gain=1.0} + {name = "default_hard_footstep", gain = 0.6} + table.dig = table.dig or + {name = "default_hard_footstep", gain = 0.7} table.dug = table.dug or - {name="default_dug_node", gain=0.25} + {name = "default_hard_footstep", gain = 0.8} table.place = table.place or - {name="default_place_node_hard", gain=1.0} + {name = "default_hard_footstep", gain = 0.8} return table end function default.node_sound_stone_defaults(table) table = table or {} table.footstep = table.footstep or - {name="default_hard_footstep", gain=0.5} + {name = "default_hard_footstep", gain = 0.6} + table.dig = table.dig or + {name = "default_hard_footstep", gain = 0.7} table.dug = table.dug or - {name="default_hard_footstep", gain=1.0} + {name = "default_hard_footstep", gain = 0.8} + table.place = table.place or + {name = "default_hard_footstep", gain = 0.8} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_metal_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_metal_footstep", gain = 0.575} + table.dig = table.dig or + {name = "default_metal_footstep", gain = 0.65} + table.dug = table.dug or + {name = "default_metal_footstep", gain = 0.8} + table.place = table.place or + {name = "default_metal_footstep", gain = 0.8} default.node_sound_defaults(table) return table end @@ -28,11 +48,27 @@ end function default.node_sound_dirt_defaults(table) table = table or {} table.footstep = table.footstep or - {name="default_dirt_footstep", gain=1.0} + {name = "default_dirt_footstep", gain = 0.8} + table.dig = table.dig or + {name = "default_dirt_footstep", gain = 0.9} table.dug = table.dug or - {name="default_dirt_footstep", gain=1.5} + {name = "default_dirt_footstep", gain = 1.0} table.place = table.place or - {name="default_place_node", gain=1.0} + {name = "default_dirt_footstep", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_gravel_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_dirt_footstep", gain = 0.8} + table.dig = table.dig or + {name = "default_dirt_footstep", gain = 0.9} + table.dug = table.dug or + {name = "default_dirt_footstep", gain = 1.0} + table.place = table.place or + {name = "default_dirt_footstep", gain = 1.0} default.node_sound_defaults(table) return table end @@ -40,11 +76,13 @@ end function default.node_sound_sand_defaults(table) table = table or {} table.footstep = table.footstep or - {name="default_sand_footstep", gain=0.2} + {name = "default_sand_footstep", gain = 0.6} + table.dig = table.dig or + {name = "default_sand_footstep", gain = 0.7} table.dug = table.dug or - {name="default_sand_footstep", gain=0.4} + {name = "default_sand_footstep", gain = 0.8} table.place = table.place or - {name="default_place_node", gain=1.0} + {name = "default_sand_footstep", gain = 0.8} default.node_sound_defaults(table) return table end @@ -52,9 +90,13 @@ end function default.node_sound_wood_defaults(table) table = table or {} table.footstep = table.footstep or - {name="default_wood_footstep", gain=0.5} + {name = "default_wood_footstep", gain = 0.625} + table.dig = table.dig or + {name = "default_wood_footstep", gain = 0.7} table.dug = table.dug or - {name="default_wood_footstep", gain=1.0} + {name = "default_wood_footstep", gain = 0.8} + table.place = table.place or + {name = "default_wood_footstep", gain = 0.8} default.node_sound_defaults(table) return table end @@ -62,13 +104,13 @@ end function default.node_sound_leaves_defaults(table) table = table or {} table.footstep = table.footstep or - {name="default_grass_footstep", gain=0.35} - table.dug = table.dug or - {name="default_grass_footstep", gain=0.7} + {name = "default_grass_footstep", gain = 0.6} table.dig = table.dig or - {name="default_dig_crumbly", gain=0.4} + {name = "default_grass_footstep", gain = 0.7} + table.dug = table.dug or + {name = "default_snow_footstep", gain = 0.8} table.place = table.place or - {name="default_place_node", gain=1.0} + {name = "default_snow_footstep", gain = 0.8} default.node_sound_defaults(table) return table end @@ -76,27 +118,28 @@ end function default.node_sound_glass_defaults(table) table = table or {} table.footstep = table.footstep or - {name="default_glass_footstep", gain=0.5} + {name = "default_hard_footstep", gain = 0.55} + table.dig = table.dig or + {name = "default_hard_footstep", gain = 0.65} table.dug = table.dug or - {name="default_break_glass", gain=1.0} + {name = "default_break_glass", gain = 0.8} + table.place = table.place or + {name = "default_hard_footstep", gain = 0.75} default.node_sound_defaults(table) return table end --- --- Legacy --- - +-- Legacy: function default.spawn_falling_node(p, nodename) spawn_falling_node(p, nodename) end --- Horrible crap to support old code --- Don't use this and never do what this does, it's completely wrong! --- (More specifically, the client and the C++ code doesn't get the group) +-- Horrible crap to support old code, +-- don't use this and never do what this does, it's completely wrong! +-- (more specifically, the client and the C++ code doesn't get the group). function default.register_falling_node(nodename, texture) minetest.log("error", debug.traceback()) - minetest.log('error', "WARNING: default.register_falling_node is deprecated") + minetest.log("error", "WARNING: default.register_falling_node is deprecated.") if minetest.registered_nodes[nodename] then minetest.registered_nodes[nodename].groups.falling_node = 1 end @@ -108,37 +151,89 @@ end -- Global environment step function function on_step(dtime) - -- print("on_step") + -- print("on_step, " .. p .. ", " .. node) end minetest.register_globalstep(on_step) function on_placenode(p, node) - --print("on_placenode") + -- print("on_placenode, " .. p .. ", " .. node) end minetest.register_on_placenode(on_placenode) function on_dignode(p, node) - --print("on_dignode") + -- print("on_dignode, " .. p .. ", " .. node) end minetest.register_on_dignode(on_dignode) function on_punchnode(p, node) + -- print("on_punchnode, " .. p .. ", " .. node) end minetest.register_on_punchnode(on_punchnode) +-- +-- Lava cooling +-- --- --- Lavacooling --- +local function cool_wf_vm(pos, node1, node2) + local t1 = os.clock() + local minp = vector.subtract(pos, 10) + local maxp = vector.add(pos, 10) + local manip = minetest.get_voxel_manip() + local emerged_pos1, emerged_pos2 = manip:read_from_map(minp, maxp) + local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2}) + local nodes = manip:get_data() + + local stone = minetest.get_content_id(node2) + local lava = minetest.get_content_id(node1) + + for i in area:iterp(minp, maxp) do + local p = area:position(i) + if nodes[i] == lava and minetest.find_node_near(p, 1, {"group:water"}) then + nodes[i] = stone + end + end + + manip:set_data(nodes) + manip:write_to_map() + -- minetest.log("action", "Lava cooling happened at (" .. pos.x .. "," .. pos.y .. "," .. pos.z .. ").") + local t1 = os.clock() + manip:update_map() + -- minetest.log("action", string.format("Lava cooling updated the map after ca. %.2fs.", os.clock() - t1)) +end + +local del1 = 0 +local count = 0 default.cool_lava_source = function(pos) - minetest.set_node(pos, {name="default:obsidian"}) - minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25}) + local del2 = tonumber(os.clock()) + if del2-del1 < 0.1 + and count > 1 then + cool_wf_vm(pos, "default:lava_source", "default:obsidian_cooled") + count = 0 + else + minetest.set_node(pos, {name = "default:obsidian_cooled"}) + minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.2}) + if del2-del1 < 0.1 then + count = count + 1 + end + end + del1 = del2 end default.cool_lava_flowing = function(pos) - minetest.set_node(pos, {name="default:stone"}) - minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25}) + local del2 = tonumber(os.clock()) + if del2-del1 < 0.1 + and count > 1 then + cool_wf_vm(pos, "default:lava_flowing", "default:cobble_cooled") + count = 0 + else + minetest.set_node(pos, {name = "default:cobble_cooled"}) + minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.2}) + if del2-del1 < 0.1 then + count = count + 1 + end + end + del1 = del2 end minetest.register_abm({ @@ -151,6 +246,12 @@ minetest.register_abm({ end, }) +default.after_place_leaves = function(pos, placer, itemstack, pointed_thing) + local node = minetest.get_node(pos) + node.param2 = 1 + minetest.set_node(pos, node) +end + minetest.register_abm({ nodenames = {"default:lava_source"}, neighbors = {"group:water"}, @@ -169,20 +270,20 @@ minetest.register_abm({ nodenames = {"default:cactus"}, neighbors = {"group:sand"}, interval = 30, - chance = 25, + chance = 50, action = function(pos, node) - pos.y = pos.y-1 + pos.y = pos.y - 1 local name = minetest.get_node(pos).name if minetest.get_item_group(name, "sand") ~= 0 then - pos.y = pos.y+1 + pos.y = pos.y + 1 local height = 0 while minetest.get_node(pos).name == "default:cactus" and height < 4 do - height = height+1 - pos.y = pos.y+1 + height = height + 1 + pos.y = pos.y + 1 end if height < 4 then if minetest.get_node(pos).name == "air" then - minetest.set_node(pos, {name="default:cactus"}) + minetest.set_node(pos, {name = "default:cactus"}) end end end @@ -191,35 +292,35 @@ minetest.register_abm({ minetest.register_abm({ nodenames = {"default:papyrus"}, - neighbors = {"default:dirt", "default:dirt_with_grass"}, + neighbors = {"default:dirt", "default:dirt_with_grass", "default:dirt_with_snow", "default:sand", "default:desert_sand"}, interval = 30, - chance = 25, + chance = 30, action = function(pos, node) - pos.y = pos.y-1 + pos.y = pos.y - 1 local name = minetest.get_node(pos).name - if name == "default:dirt" or name == "default:dirt_with_grass" then + if name == "default:dirt" + or name == "default:dirt_with_grass" + or name == "default:dirt_with_snow" + or name == "default:sand" + or name == "default:desert_sand" then if minetest.find_node_near(pos, 3, {"group:water"}) == nil then return end - pos.y = pos.y+1 + pos.y = pos.y + 1 local height = 0 while minetest.get_node(pos).name == "default:papyrus" and height < 4 do - height = height+1 - pos.y = pos.y+1 + height = height + 1 + pos.y = pos.y + 1 end if height < 4 then if minetest.get_node(pos).name == "air" then - minetest.set_node(pos, {name="default:papyrus"}) + minetest.set_node(pos, {name = "default:papyrus"}) end end end end, }) --- --- dig upwards --- - function default.dig_up(pos, node, digger) if digger == nil then return end local np = {x = pos.x, y = pos.y + 1, z = pos.z} @@ -229,9 +330,7 @@ function default.dig_up(pos, node, digger) end end --- --- Leafdecay --- +if minetest.setting_getbool("leaf_decay") ~= false then -- “If not defined or set to true then” default.leafdecay_trunk_cache = {} default.leafdecay_enable_cache = true @@ -244,30 +343,23 @@ minetest.register_globalstep(function(dtime) math.floor(dtime * finds_per_second) end) -default.after_place_leaves = function(pos, placer, itemstack, pointed_thing) - local node = minetest.get_node(pos) - node.param2 = 1 - minetest.set_node(pos, node) -end - minetest.register_abm({ nodenames = {"group:leafdecay"}, neighbors = {"air", "group:liquid"}, - -- A low interval and a high inverse chance spreads the load - interval = 1, + interval = 1, -- A low interval and a high inverse chance spreads the load. chance = 2, action = function(p0, node, _, _) - --print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")") + -- print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")") local do_preserve = false local d = minetest.registered_nodes[node.name].groups.leafdecay if not d or d == 0 then - --print("not groups.leafdecay") + -- print("not groups.leafdecay") return end local n0 = minetest.get_node(p0) if n0.param2 ~= 0 then - --print("param2 ~= 0") + -- print("param2 ~= 0") return end local p0_hash = nil @@ -277,13 +369,13 @@ minetest.register_abm({ if trunkp then local n = minetest.get_node(trunkp) local reg = minetest.registered_nodes[n.name] - -- Assume ignore is a trunk, to make the thing work at the border of the active area + -- Assume ignore is a trunk, to make the thing work at the border of the active area: if n.name == "ignore" or (reg and reg.groups.tree and reg.groups.tree ~= 0) then - --print("cached trunk still exists") + -- print("Cached trunk still exists.") return end - --print("cached trunk is invalid") - -- Cache is invalid + -- print("Cached trunk is invalid.") + -- Cache is invalid: table.remove(default.leafdecay_trunk_cache, p0_hash) end end @@ -292,34 +384,30 @@ minetest.register_abm({ end default.leafdecay_trunk_find_allow_accumulator = default.leafdecay_trunk_find_allow_accumulator - 1 - -- Assume ignore is a trunk, to make the thing work at the border of the active area + -- Assume ignore is a trunk, to make the thing work at the border of the active area: local p1 = minetest.find_node_near(p0, d, {"ignore", "group:tree"}) if p1 then do_preserve = true if default.leafdecay_enable_cache then - --print("caching trunk") - -- Cache the trunk + -- print("Caching trunk.") + -- Cache the trunk: default.leafdecay_trunk_cache[p0_hash] = p1 end end if not do_preserve then - -- Drop stuff other than the node itself - local itemstacks = minetest.get_node_drops(n0.name) + -- Drop stuff other than the node itself: + itemstacks = minetest.get_node_drops(n0.name) for _, itemname in ipairs(itemstacks) do - if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 or - itemname ~= n0.name then - local p_drop = { - x = p0.x - 0.5 + math.random(), - y = p0.y - 0.5 + math.random(), - z = p0.z - 0.5 + math.random(), - } - minetest.add_item(p_drop, itemname) + if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 + or itemname ~= n0.name then + minetest.add_item(p0, itemname) end end - -- Remove node minetest.remove_node(p0) + -- minetest.log("action", n0.name .. " decayed at " .. minetest.pos_to_string(p0) .. ".") nodeupdate(p0) end end }) +end -- Ends: if minetest.setting_getbool("leaf_decay") ~= false diff --git a/minetestforfun_game/mods/default/furnace.lua b/minetestforfun_game/mods/default/furnace.lua index d49d8efe..1bb61b33 100644 --- a/minetestforfun_game/mods/default/furnace.lua +++ b/minetestforfun_game/mods/default/furnace.lua @@ -1,14 +1,15 @@ --- --- Formspecs --- + -- + -- Formspecs + -- local function active_formspec(fuel_percent, item_percent) - local formspec = + local formspec = "size[8,8.5]".. default.gui_bg.. default.gui_bg_img.. default.gui_slots.. + --gui_slots.. "list[current_name;src;2.75,0.5;1,1;]".. "list[current_name;fuel;2.75,2.5;1,1;]".. "image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:".. @@ -98,9 +99,9 @@ minetest.register_node("default:furnace", { legacy_facedir_simple = true, is_ground_content = false, sounds = default.node_sound_stone_defaults(), - + can_dig = can_dig, - + allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_move = allow_metadata_inventory_move, allow_metadata_inventory_take = allow_metadata_inventory_take, @@ -133,7 +134,7 @@ minetest.register_node("default:furnace_active", { can_dig = can_dig, - aallow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_move = allow_metadata_inventory_move, allow_metadata_inventory_take = allow_metadata_inventory_take, }) @@ -163,15 +164,15 @@ minetest.register_abm({ local fuel_time = meta:get_float("fuel_time") or 0 local src_time = meta:get_float("src_time") or 0 local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 - + -- -- Inizialize inventory -- local inv = meta:get_inventory() for listname, size in pairs({ - src = 1, - fuel = 1, - dst = 4, + src = 1, + fuel = 1, + dst = 4, }) do if inv:get_size(listname) ~= size then inv:set_size(listname, size) @@ -188,16 +189,16 @@ minetest.register_abm({ -- Check if we have cookable content local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) local cookable = true - + if cooked.time == 0 then cookable = false end - + -- Check if we have enough fuel to burn if fuel_time < fuel_totaltime then -- The furnace is currently active and has enough fuel fuel_time = fuel_time + 1 - + -- If there is a cookable item then check if it is ready yet if cookable then src_time = src_time + 1 @@ -215,7 +216,7 @@ minetest.register_abm({ if cookable then -- We need to get new fuel local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) - + if fuel.time == 0 then -- No valid fuel in fuel list fuel_totaltime = 0 @@ -224,10 +225,10 @@ minetest.register_abm({ else -- Take fuel from fuel list inv:set_stack("fuel", 1, afterfuel.items[1]) - + fuel_totaltime = fuel.time fuel_time = 0 - + end else -- We don't need to get new fuel since there is no cookable item @@ -236,7 +237,7 @@ minetest.register_abm({ src_time = 0 end end - + -- -- Update formspec, infotext and node -- @@ -244,7 +245,7 @@ minetest.register_abm({ local item_state = "" local item_percent = 0 if cookable then - item_percent = math.floor(src_time / cooked.time * 100) + item_percent = math.floor(src_time / cooked.time * 100) item_state = item_percent .. "%" else if srclist[1]:is_empty() then @@ -253,7 +254,7 @@ minetest.register_abm({ item_state = "Not cookable" end end - + local fuel_state = "Empty" local active = "inactive " if fuel_time <= fuel_totaltime and fuel_totaltime ~= 0 then @@ -268,9 +269,9 @@ minetest.register_abm({ end swap_node(pos, "default:furnace") end - - local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")" - + + local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")" + -- -- Set meta values -- diff --git a/minetestforfun_game/mods/default/init.lua b/minetestforfun_game/mods/default/init.lua index 792b367f..2f7218de 100644 --- a/minetestforfun_game/mods/default/init.lua +++ b/minetestforfun_game/mods/default/init.lua @@ -1,45 +1,42 @@ -- Minetest 0.4 mod: default -- See README.txt for licensing and other information. --- The API documentation in here was moved into doc/lua_api.txt +default = {} -- Definitions made by this mod are usable by all mods. + +-- The API documentation in here was moved into doc/lua_api.txt. WATER_ALPHA = 160 WATER_VISC = 1 LAVA_VISC = 3 -- Slower movement in lava. LIGHT_MAX = 14 -- 15 is reserved for sunlight. --- Definitions made by this mod that other mods can use too -default = {} - --- GUI related stuff +-- GUI related stuff: default.gui_bg = "bgcolor[#080808BB;true]" default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]" default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" function default.get_hotbar_bg(x,y) local out = "" - for i=0,7,1 do - out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]" + for i= 0, 7, 1 do + out = out .."image[" .. x + i .. "," .. y .. ";1,1;gui_hb_bg.png]" end return out end -default.gui_suvival_form = "size[8,8.5]".. - default.gui_bg.. - default.gui_bg_img.. - default.gui_slots.. - "list[current_player;main;0,4.25;8,1;]".. - "list[current_player;main;0,5.5;8,3;8]".. - "list[current_player;craft;1.75,0.5;3,3;]".. - "list[current_player;craftpreview;5.75,1.5;1,1;]".. - "image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]".. - default.get_hotbar_bg(0,4.25) +gui_suvival_form = "size[8,8.5]".. + default.gui_slots .. + "list[current_player;main; 0, 4.25; 8, 4; ]" .. + "list[current_player;craft; 1.75, 0.5; 3, 3; ]" .. + "list[current_player;craftpreview; 5.75, 1.5; 1, 1; ]" .. + default.get_hotbar_bg(0, 4.25) .. + default.get_hotbar_bg(0, 5.25) --- Load files +-- Load files: dofile(minetest.get_modpath("default").."/functions.lua") +dofile(minetest.get_modpath("default").."/commands.lua") dofile(minetest.get_modpath("default").."/nodes.lua") -dofile(minetest.get_modpath("default").."/furnace.lua") dofile(minetest.get_modpath("default").."/tools.lua") +dofile(minetest.get_modpath("default").."/furnace.lua") dofile(minetest.get_modpath("default").."/craftitems.lua") dofile(minetest.get_modpath("default").."/crafting.lua") dofile(minetest.get_modpath("default").."/mapgen.lua") diff --git a/minetestforfun_game/mods/default/models/character.png b/minetestforfun_game/mods/default/models/character.png index 05021781..321f9fb2 100644 Binary files a/minetestforfun_game/mods/default/models/character.png and b/minetestforfun_game/mods/default/models/character.png differ diff --git a/minetestforfun_game/mods/default/nodes.lua b/minetestforfun_game/mods/default/nodes.lua index 434f684d..29ebe97d 100644 --- a/minetestforfun_game/mods/default/nodes.lua +++ b/minetestforfun_game/mods/default/nodes.lua @@ -476,6 +476,7 @@ minetest.register_node("default:jungleleaves", { } } }, + after_place_node = default.after_place_leaves, sounds = default.node_sound_leaves_defaults(), }) @@ -538,6 +539,7 @@ minetest.register_node("default:leaves", { } } }, + after_place_node = default.after_place_leaves, sounds = default.node_sound_leaves_defaults(), }) @@ -608,7 +610,8 @@ minetest.register_node("default:bookshelf", { local meta = minetest.get_meta(pos) local inv = meta:get_inventory() if listname == "books" then - if stack:get_name() == "default:book" then + if minetest.get_item_group(stack:get_name(), "book") ~= 0 + and to_stack:is_empty() then return 1 else return 0 @@ -811,9 +814,8 @@ minetest.register_node("default:water_flowing", { liquid_alternative_flowing = "default:water_flowing", liquid_alternative_source = "default:water_source", liquid_viscosity = WATER_VISC, - freezemelt = "default:snow", post_effect_color = {a = 120, r = 20, g = 60, b = 80}, - groups = {water= 3, liquid = 3, puts_out_fire = 1, not_in_creative_inventory = 1, freezes = 1, melt_around = 1}, + groups = {water= 3, liquid = 3, puts_out_fire = 1, not_in_creative_inventory = 1}, }) minetest.register_node("default:water_source", { @@ -843,9 +845,8 @@ minetest.register_node("default:water_source", { liquid_alternative_flowing = "default:water_flowing", liquid_alternative_source = "default:water_source", liquid_viscosity = WATER_VISC, - freezemelt = "default:ice", post_effect_color = {a = 120, r = 20, g = 60, b = 80}, - groups = {water= 3, liquid = 3, puts_out_fire = 1, freezes = 1}, + groups = {water= 3, liquid = 3, puts_out_fire = 1}, }) --[[ @@ -1105,7 +1106,6 @@ minetest.register_node("default:acid_source", { liquid_alternative_flowing = "default:acid_flowing", liquid_alternative_source = "default:acid_source", liquid_viscosity = WATER_VISC, - liquid_renewable = false, damage_per_second = 3, post_effect_color = {a = 120, r = 50, g = 90, b = 30}, groups = {water = 3, liquid = 3, puts_out_fire = 1}, @@ -1140,7 +1140,7 @@ minetest.register_node("default:torch", { wall_bottom = {-0.25, -0.5 , -0.25, 0.25, 0.0625, 0.25}, wall_side = {-0.25, -0.5 , -0.25, -0.5, 0.0625, 0.25}, }, - groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1, hot = 2}, + groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1}, sounds = default.node_sound_wood_defaults(), }) @@ -1322,226 +1322,67 @@ minetest.register_node("default:chest_locked", { end, }) -function default.furnace_active(pos, percent, item_percent) - local formspec = - "size[8,8.5]".. - gui_slots.. - "list[current_name;src;2.75, 0.5;1,1;]" .. - "list[current_name;fuel;2.75,2.5;1,1;]" .. - "image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:" .. - (100-percent)..":default_furnace_fire_fg.png]" .. - "image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:" .. - (item_percent * 100)..":gui_furnace_arrow_fg.png^[transformR270]" .. - "list[current_name;dst;4.75,0.96;2,2;]" .. - "list[current_player;main;0,4.25;8,4;]" .. - default.get_hotbar_bg(0, 4.25) .. - default.get_hotbar_bg(0, 5.25) - return formspec - end - -function default.get_furnace_active_formspec(pos, percent) - local meta = minetest.get_meta(pos)local inv = meta:get_inventory() - local srclist = inv:get_list("src") - local cooked = nil - local aftercooked = nil - if srclist then - cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) - end - local item_percent = 0 - if cooked then - item_percent = meta:get_float("src_time")/cooked.time - end - - return default.furnace_active(pos, percent, item_percent) -end - -default.furnace_inactive_formspec = - "size[8,8.5]".. - gui_slots.. - "list[current_name;src;2.75, 0.5;1,1;]" .. - "list[current_name;fuel;2.75,2.5;1,1;]" .. - "image[2.75,1.5;1,1;default_furnace_fire_bg.png]" .. - "image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]" .. - "list[current_name;dst;4.75, 0.96;2,2;]" .. - "list[current_player;main;0,4.25;8,4;]" .. - default.get_hotbar_bg(0, 4.25) .. - default.get_hotbar_bg(0, 5.25) - -minetest.register_node("default:furnace", { - description = "Furnace", - tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png", - "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"}, - paramtype2 = "facedir", - groups = {cracky = 2}, +minetest.register_node("default:pine_needles",{ + description = "Pine Needles", + drawtype = "allfaces_optional", + visual_scale = 1.3, + tiles = {"default_pine_needles.png"}, + waving = 1, + paramtype = "light", is_ground_content = false, - sounds = default.node_sound_stone_defaults(), - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", default.furnace_inactive_formspec) - meta:set_string("infotext", "Furnace") - local inv = meta:get_inventory() - inv:set_size("fuel", 1) - inv:set_size("src", 1) - inv:set_size("dst", 4) - end, - can_dig = function(pos,player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("fuel") then - return false - elseif not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, - allow_metadata_inventory_put = function(pos, listname, index, stack, player) - if minetest.is_protected(pos, player:get_player_name()) then - return 0 - end - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - if listname == "fuel" then - if minetest.get_craft_result({method = "fuel",width = 1, items ={stack}}).time ~= 0 then - if inv:is_empty("src") then - meta:set_string("infotext","Furnace is empty") - end - return stack:get_count() - else - return 0 - end - elseif listname == "src" then - return stack:get_count() - elseif listname == "dst" then - return 0 - end - end, - allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - if minetest.is_protected(pos, player:get_player_name()) then - return 0 - end - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - local stack = inv:get_stack(from_list, from_index) - if to_list == "fuel" then - if minetest.get_craft_result({method = "fuel",width = 1, items ={stack}}).time ~= 0 then - if inv:is_empty("src") then - meta:set_string("infotext","Furnace is empty") - end - return count - else - return 0 - end - elseif to_list == "src" then - return count - elseif to_list == "dst" then - return 0 - end - end, - allow_metadata_inventory_take = function(pos, listname, index, stack, player) - if minetest.is_protected(pos, player:get_player_name()) then - return 0 - end - return stack:get_count() - end, -}) - -minetest.register_node("default:furnace_active", { - description = "Furnace (active)", - tiles = { - "default_furnace_top.png", - "default_furnace_bottom.png", - "default_furnace_side.png", - "default_furnace_side.png", - "default_furnace_side.png", - { - image = "default_furnace_front_active.png", - backface_culling = false, - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 1 + groups = {snappy=3, leafdecay=3, flammable=2, leaves=1}, + drop = { + max_items = 1, + items = { + { + -- player will get sapling with 1/20 chance + items = {"default:pine_sapling"}, + rarity = 20, }, + { + -- player will get leaves only if he get no saplings, + -- this is because max_items is 1 + items = {"default:pine_needles"}, + } } }, + sounds = default.node_sound_leaves_defaults(), + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:pine_sapling", { + description = "Pine Sapling", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_pine_sapling.png"}, + inventory_image = "default_pine_sapling.png", + wield_image = "default_pine_sapling.png", + paramtype = "light", + walkable = false, + is_ground_content = true, + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + }, + groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("default:pinetree", { + description = "Pine Tree", + tiles = {"default_pinetree_top.png", "default_pinetree_top.png", "default_pinetree.png"}, paramtype2 = "facedir", - light_source = 9, - drop = "default:furnace", - groups = {cracky = 2, not_in_creative_inventory = 1,hot= 1}, is_ground_content = false, - sounds = default.node_sound_stone_defaults(), - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", default.furnace_inactive_formspec) - meta:set_string("infotext", "Furnace"); - local inv = meta:get_inventory() - inv:set_size("fuel", 1) - inv:set_size("src", 1) - inv:set_size("dst", 4) - end, - can_dig = function(pos,player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("fuel") then - return false - elseif not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, - allow_metadata_inventory_put = function(pos, listname, index, stack, player) - if minetest.is_protected(pos, player:get_player_name()) then - return 0 - end - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - if listname == "fuel" then - if minetest.get_craft_result({method = "fuel",width = 1, items ={stack}}).time ~= 0 then - if inv:is_empty("src") then - meta:set_string("infotext","Furnace is empty") - end - return stack:get_count() - else - return 0 - end - elseif listname == "src" then - return stack:get_count() - elseif listname == "dst" then - return 0 - end - end, - allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - if minetest.is_protected(pos, player:get_player_name()) then - return 0 - end - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - local stack = inv:get_stack(from_list, from_index) - if to_list == "fuel" then - if minetest.get_craft_result({method = "fuel",width = 1, items ={stack}}).time ~= 0 then - if inv:is_empty("src") then - meta:set_string("infotext","Furnace is empty") - end - return count - else - return 0 - end - elseif to_list == "src" then - return count - elseif to_list == "dst" then - return 0 - end - end, - allow_metadata_inventory_take = function(pos, listname, index, stack, player) - if minetest.is_protected(pos, player:get_player_name()) then - return 0 - end - return stack:get_count() - end, + groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2}, + sounds = default.node_sound_wood_defaults(), + on_place = minetest.rotate_node +}) + +minetest.register_node("default:pinewood", { + description = "Pinewood Planks", + tiles = {"default_pinewood.png"}, + groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1}, + sounds = default.node_sound_wood_defaults(), }) -- Locked Furnace thanks to kotolegokot: @@ -2310,16 +2151,14 @@ minetest.register_node("default:snow", { sunlight_propagates = true, walkable = false, buildable_to = true, - leveled = 7, drawtype = "nodebox", - freezemelt = "default:water_flowing", node_box = { - type = "leveled", + type = "fixed", fixed = { {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, }, }, - groups = {crumbly = 3, falling_node = 1, melts = 1, float = 1}, + groups = {crumbly = 3, falling_node = 1}, sounds = default.node_sound_dirt_defaults({footstep = {name = "default_snow_footstep", gain = 0.7}}), on_construct = function(pos) pos.y = pos.y - 1 @@ -2336,8 +2175,7 @@ minetest.register_node("default:snowblock", { description = "Snow Block", tiles = {"default_snow.png"}, is_ground_content = true, - freezemelt = "default:water_source", - groups = {crumbly = 3, melts = 1}, + groups = {crumbly = 3}, sounds = default.node_sound_dirt_defaults({footstep = {name = "default_snow_footstep", gain = 0.625}}), }) diff --git a/minetestforfun_game/mods/default/player.lua b/minetestforfun_game/mods/default/player.lua index 017a6172..73e4e1e0 100644 --- a/minetestforfun_game/mods/default/player.lua +++ b/minetestforfun_game/mods/default/player.lua @@ -1,6 +1,55 @@ -- Minetest 0.4 mod: player -- See README.txt for licensing and other information. +--[[ + +API +--- + +default.player_register_model(name, def) +^ Register a new model to be used by players. +^ is the model filename such as "character.x", "foo.b3d", etc. +^ See Model Definition below for format of . + +default.registered_player_models[name] +^ See Model Definition below for format. + +default.player_set_model(player, model_name) +^ is a PlayerRef. +^ is a model registered with player_register_model. + +default.player_set_animation(player, anim_name [, speed]) +^ is a PlayerRef. +^ is the name of the animation. +^ is in frames per second. If nil, default from the model is used + +default.player_set_textures(player, textures) +^ is a PlayerRef. +^ is an array of textures +^ If is nil, the default textures from the model def are used + +default.player_get_animation(player) +^ is a PlayerRef. +^ Returns a table containing fields "model", "textures" and "animation". +^ Any of the fields of the returned table may be nil. + +Model Definition +---------------- + +model_def = { + animation_speed = 30, -- Default animation speed, in FPS. + textures = {"character.png", }, -- Default array of textures. + visual_size = {x = 1, y = 1,}, -- Used to scale the model. + animations = { + -- = { x =, y =, }, + foo = { x = 0, y = 19, }, + bar = { x = 20, y =39, }, + -- ... + }, +} + +]] + -- Player animation blending -- Note: This is currently broken due to a bug in Irrlicht, leave at 0 local animation_blend = 0 @@ -19,14 +68,12 @@ default.player_register_model("character.x", { animation_speed = 35, textures = {"character.png", }, animations = { - -- Standard animations. - stand = { x= 0, y= 79, }, - lay = { x=162, y=166, }, - walk = { x=168, y=187, }, - mine = { x=189, y=198, }, - walk_mine = { x=200, y=219, }, - -- Extra animations (not currently used by the game). - sit = { x= 81, y=160, }, + stand = {x = 0, y = 40}, + lay = {x = 162, y = 166}, + walk = {x = 168, y = 187}, + mine = {x = 189, y = 198}, + walk_mine = {x = 200, y = 219}, + sit = {x = 81, y = 160}, }, }) @@ -46,7 +93,7 @@ function default.player_get_animation(player) } end --- Called when a player's appearance needs to be updated +-- Called when a player"s appearance needs to be updated function default.player_set_model(player, model_name) local name = player:get_player_name() local model = models[model_name] @@ -58,7 +105,7 @@ function default.player_set_model(player, model_name) mesh = model_name, textures = player_textures[name] or model.textures, visual = "mesh", - visual_size = model.visual_size or {x=1, y=1}, + visual_size = model.visual_size or {x = 1, y = 1}, }) default.player_set_animation(player, "stand") else @@ -94,10 +141,10 @@ end minetest.register_on_joinplayer(function(player) default.player_attached[player:get_player_name()] = false default.player_set_model(player, "character.x") - player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 35) + player:set_local_animation({x = 0, y = 40}, {x = 168, y = 187}, {x = 189, y = 198}, {x = 200, y = 219}, 35) -- set GUI - if minetest.setting_getbool("creative_mode") then + if minetest.setting_getbool("creative_mode") then -- creative.set_creative_formspec(player, 0, 1) else player:set_inventory_formspec(gui_suvival_form) @@ -106,6 +153,7 @@ minetest.register_on_joinplayer(function(player) player:hud_set_hotbar_image("gui_hotbar.png") player:hud_set_hotbar_selected_image("gui_hotbar_selected.png") end) +end) minetest.register_on_leaveplayer(function(player) local name = player:get_player_name() @@ -116,7 +164,6 @@ end) -- Localize for better performance. local player_set_animation = default.player_set_animation -local player_attached = default.player_attached -- Check each player and apply animations minetest.register_globalstep(function(dtime) @@ -124,7 +171,7 @@ minetest.register_globalstep(function(dtime) local name = player:get_player_name() local model_name = player_model[name] local model = model_name and models[model_name] - if model and not player_attached[name] then + if model and not default.player_attached[name] then local controls = player:get_player_control() local walking = false local animation_speed_mod = model.animation_speed or 35 @@ -136,13 +183,13 @@ minetest.register_globalstep(function(dtime) -- Determine if the player is sneaking, and reduce animation speed if so if controls.sneak then - animation_speed_mod = animation_speed_mod / 2 + animation_speed_mod = animation_speed_mod * 0.5 end -- Apply animations based on what the player is doing if player:get_hp() == 0 then player_set_animation(player, "lay", animation_speed_mod) - player:set_eye_offset({x = 0, y = -10, z = 0}, {x = 0 + player:set_eye_offset({x = 0, y = -10, z = 0}, {x = 0, y = -10, z = 0}) elseif walking then if player_sneak[name] ~= controls.sneak then player_anim[name] = nil @@ -154,7 +201,7 @@ minetest.register_globalstep(function(dtime) player_set_animation(player, "walk", animation_speed_mod) end elseif controls.LMB or controls.RMB then - player_set_animation(player, "mine", animation_spee + player_set_animation(player, "mine", animation_speed_mod) else player_set_animation(player, "stand", animation_speed_mod * 0.4) end diff --git a/minetestforfun_game/mods/default/textures/default_grass.png b/minetestforfun_game/mods/default/textures/default_grass.png index 8cd9e1fe..3a82a0eb 100644 Binary files a/minetestforfun_game/mods/default/textures/default_grass.png and b/minetestforfun_game/mods/default/textures/default_grass.png differ diff --git a/minetestforfun_game/mods/default/textures/default_grass_side.png b/minetestforfun_game/mods/default/textures/default_grass_side.png index a8a2bb3c..5f4aee59 100644 Binary files a/minetestforfun_game/mods/default/textures/default_grass_side.png and b/minetestforfun_game/mods/default/textures/default_grass_side.png differ diff --git a/minetestforfun_game/mods/default/textures/default_jungleleaves.png b/minetestforfun_game/mods/default/textures/default_jungleleaves.png index 65ad8484..f1b55e88 100644 Binary files a/minetestforfun_game/mods/default/textures/default_jungleleaves.png and b/minetestforfun_game/mods/default/textures/default_jungleleaves.png differ diff --git a/minetestforfun_game/mods/default/trees.lua b/minetestforfun_game/mods/default/trees.lua index 5752fe0d..b994cc1f 100644 --- a/minetestforfun_game/mods/default/trees.lua +++ b/minetestforfun_game/mods/default/trees.lua @@ -180,4 +180,3 @@ function default.grow_jungletree(pos, bad) vm:write_to_map() vm:update_map() end - diff --git a/minetestforfun_game/mods/fire/init.lua b/minetestforfun_game/mods/fire/init.lua index ef9c891c..271bb530 100644 --- a/minetestforfun_game/mods/fire/init.lua +++ b/minetestforfun_game/mods/fire/init.lua @@ -11,7 +11,7 @@ minetest.register_node("fire:basic_flame", { }}, inventory_image = "fire_basic_flame.png", light_source = 14, - groups = {igniter=2,dig_immediate=3,hot=3}, + groups = {igniter=2,dig_immediate=3}, drop = '', walkable = false, buildable_to = true, diff --git a/minetestforfun_game/mods/flowers/init.lua b/minetestforfun_game/mods/flowers/init.lua index 86d3ade6..6baae4c8 100644 --- a/minetestforfun_game/mods/flowers/init.lua +++ b/minetestforfun_game/mods/flowers/init.lua @@ -1,6 +1,9 @@ -- Minetest 0.4 mod: default -- See README.txt for licensing and other information. +-- Namespace for functions +flowers = {} + -- Map Generation dofile(minetest.get_modpath("flowers").."/mapgen.lua") @@ -18,16 +21,15 @@ minetest.register_node("flowers:dandelion_white", { tiles = { "flowers_dandelion_white.png" }, inventory_image = "flowers_dandelion_white.png", wield_image = "flowers_dandelion_white.png", - is_ground_content = true, sunlight_propagates = true, paramtype = "light", walkable = false, buildable_to = true, - groups = {snappy = 3, flammable = 2, flower = 1, flora = 1, attached_node = 1, color_white = 1}, + groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_white=1}, sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, + fixed = { -0.5, -0.5, -0.5, 0.5, -0.2, 0.5 }, }, }) @@ -37,16 +39,15 @@ minetest.register_node("flowers:dandelion_yellow", { tiles = { "flowers_dandelion_yellow.png" }, inventory_image = "flowers_dandelion_yellow.png", wield_image = "flowers_dandelion_yellow.png", - is_ground_content = true, sunlight_propagates = true, paramtype = "light", walkable = false, buildable_to = true, - groups = {snappy = 3, flammable = 2, flower = 1, flora = 1, attached_node = 1, color_yellow = 1}, + groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_yellow=1}, sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, + fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 }, }, }) @@ -56,16 +57,15 @@ minetest.register_node("flowers:geranium", { tiles = { "flowers_geranium.png" }, inventory_image = "flowers_geranium.png", wield_image = "flowers_geranium.png", - is_ground_content = true, sunlight_propagates = true, paramtype = "light", walkable = false, buildable_to = true, - groups = {snappy = 3, flammable = 2, flower = 1, flora = 1, attached_node = 1, color_blue = 1}, + groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_blue=1}, sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, + fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 }, }, }) @@ -75,16 +75,15 @@ minetest.register_node("flowers:rose", { tiles = { "flowers_rose.png" }, inventory_image = "flowers_rose.png", wield_image = "flowers_rose.png", - is_ground_content = true, sunlight_propagates = true, paramtype = "light", walkable = false, buildable_to = true, - groups = {snappy = 3, flammable = 2, flower = 1, flora = 1, attached_node = 1, color_red = 1}, + groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_red=1}, sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, + fixed = { -0.15, -0.5, -0.15, 0.15, 0.3, 0.15 }, }, }) @@ -94,16 +93,15 @@ minetest.register_node("flowers:tulip", { tiles = { "flowers_tulip.png" }, inventory_image = "flowers_tulip.png", wield_image = "flowers_tulip.png", - is_ground_content = true, sunlight_propagates = true, paramtype = "light", walkable = false, buildable_to = true, - groups = {snappy = 3, flammable = 2, flower = 1, flora = 1, attached_node = 1, color_orange = 1}, + groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_orange=1}, sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, + fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 }, }, }) @@ -113,65 +111,48 @@ minetest.register_node("flowers:viola", { tiles = { "flowers_viola.png" }, inventory_image = "flowers_viola.png", wield_image = "flowers_viola.png", - is_ground_content = true, sunlight_propagates = true, paramtype = "light", walkable = false, buildable_to = true, - groups = {snappy = 3, flammable = 2, flower = 1, flora = 1, attached_node = 1, color_violet = 1}, + groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_violet=1}, sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, - }, -}) - -minetest.register_node("flowers:lily_pad", { - description = "Lily Pad", - drawtype = "nodebox", - tiles = { "flowers_lily_pad.png" }, - inventory_image = "flowers_lily_pad.png", - wield_image = "flowers_lily_pad.png", - wield_scale = {x = 1, y = 1, z = 0.001}, - is_ground_content = true, - sunlight_propagates = true, - paramtype = "light", - walkable = false, - buildable_to = true, - groups = {snappy = 3, flammable = 2, flower = 1, flora = 1}, - sounds = default.node_sound_leaves_defaults(), - node_box = { - type = "fixed", - fixed = {-0.5, -0.45, -0.5, 0.5, -0.4375, 0.5}, - }, - selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, + fixed = { -0.5, -0.5, -0.5, 0.5, -0.2, 0.5 }, }, }) minetest.register_abm({ nodenames = {"group:flora"}, neighbors = {"default:dirt_with_grass", "default:desert_sand"}, - interval = 2, - chance = 500, + interval = 50, + chance = 25, action = function(pos, node) pos.y = pos.y - 1 local under = minetest.get_node(pos) pos.y = pos.y + 1 if under.name == "default:desert_sand" then minetest.set_node(pos, {name="default:dry_shrub"}) - elseif under.name ~= "default:dirt_with_grass" then return end + elseif under.name ~= "default:dirt_with_grass" then + return + end local light = minetest.get_node_light(pos) - if not light or light < 13 then return end + if not light or light < 13 then + return + end - local pos0 = {x = pos.x - 4, y = pos.y - 4, z = pos.z - 4} - local pos1 = {x = pos.x + 4, y = pos.y + 4, z = pos.z + 4} - if #minetest.find_nodes_in_area(pos0, pos1, "group:flora_block") > 0 then return end + local pos0 = {x=pos.x-4,y=pos.y-4,z=pos.z-4} + local pos1 = {x=pos.x+4,y=pos.y+4,z=pos.z+4} + if #minetest.find_nodes_in_area(pos0, pos1, "group:flora_block") > 0 then + return + end local flowers = minetest.find_nodes_in_area(pos0, pos1, "group:flora") - if #flowers > 3 then return end + if #flowers > 3 then + return + end local seedling = minetest.find_nodes_in_area(pos0, pos1, "default:dirt_with_grass") if #seedling > 0 then @@ -187,7 +168,3 @@ minetest.register_abm({ end end, }) - -if minetest.setting_getbool("log_mods") then - minetest.log("action", "Carbone: [flowers] loaded.") -end diff --git a/minetestforfun_game/mods/flowers/mapgen.lua b/minetestforfun_game/mods/flowers/mapgen.lua index 20086993..55e0edcc 100644 --- a/minetestforfun_game/mods/flowers/mapgen.lua +++ b/minetestforfun_game/mods/flowers/mapgen.lua @@ -1,4 +1,4 @@ -minetest.register_on_generated(function(minp, maxp, seed) +function flowers.mgv6ongen(minp, maxp, seed) if maxp.y >= 2 and minp.y <= 0 then -- Generate flowers local perlin1 = minetest.get_perlin(436, 3, 0.6, 100) @@ -21,19 +21,19 @@ minetest.register_on_generated(function(minp, maxp, seed) -- Find ground level (0...15) local ground_y = nil for y=30,0,-1 do - if minetest.get_node({x = x, y = y, z = z}).name ~= "air" then + if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then ground_y = y break end end - + if ground_y then - local p = {x = x, y = ground_y + 1, z = z} + local p = {x=x,y=ground_y+1,z=z} local nn = minetest.get_node(p).name -- Check if the node can be replaced if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].buildable_to then - nn = minetest.get_node({x = x, y = ground_y, z = z}).name + nn = minetest.get_node({x=x,y=ground_y,z=z}).name if nn == "default:dirt_with_grass" then local flower_choice = pr:next(1, 6) local flower @@ -50,19 +50,21 @@ minetest.register_on_generated(function(minp, maxp, seed) elseif flower_choice == 6 then flower = "flowers:viola" end - minetest.set_node(p, {name = flower}) - elseif nn == "default:water_source" then - minetest.set_node(p, {name = "flowers:lily_pad"}) - elseif nn == "default:sand" then - minetest.set_node(p, {name = "default:dry_shrub"}) - elseif nn == "default:dirt_with_snow" then - minetest.set_node(p, {name = "default:snow"}) + minetest.set_node(p, {name=flower}) end end end - + end end end end +end + +-- Enable in mapgen v6 only + +minetest.register_on_mapgen_init(function(mg_params) + if mg_params.mgname == "v6" then + minetest.register_on_generated(flowers.mgv6ongen) + end end) diff --git a/minetestforfun_game/mods/flowers/textures/flowers_dandelion_white.png b/minetestforfun_game/mods/flowers/textures/flowers_dandelion_white.png index f3b80d36..8c0e9fe8 100644 Binary files a/minetestforfun_game/mods/flowers/textures/flowers_dandelion_white.png and b/minetestforfun_game/mods/flowers/textures/flowers_dandelion_white.png differ diff --git a/minetestforfun_game/mods/flowers/textures/flowers_dandelion_yellow.png b/minetestforfun_game/mods/flowers/textures/flowers_dandelion_yellow.png index 7fd7a412..ae14554e 100644 Binary files a/minetestforfun_game/mods/flowers/textures/flowers_dandelion_yellow.png and b/minetestforfun_game/mods/flowers/textures/flowers_dandelion_yellow.png differ diff --git a/minetestforfun_game/mods/flowers/textures/flowers_geranium.png b/minetestforfun_game/mods/flowers/textures/flowers_geranium.png index eebe3720..ed499507 100644 Binary files a/minetestforfun_game/mods/flowers/textures/flowers_geranium.png and b/minetestforfun_game/mods/flowers/textures/flowers_geranium.png differ diff --git a/minetestforfun_game/mods/flowers/textures/flowers_rose.png b/minetestforfun_game/mods/flowers/textures/flowers_rose.png index 733fbe31..3e72bd6c 100644 Binary files a/minetestforfun_game/mods/flowers/textures/flowers_rose.png and b/minetestforfun_game/mods/flowers/textures/flowers_rose.png differ diff --git a/minetestforfun_game/mods/flowers/textures/flowers_tulip.png b/minetestforfun_game/mods/flowers/textures/flowers_tulip.png index 0b5cd7f8..293b041a 100644 Binary files a/minetestforfun_game/mods/flowers/textures/flowers_tulip.png and b/minetestforfun_game/mods/flowers/textures/flowers_tulip.png differ diff --git a/minetestforfun_game/mods/flowers/textures/flowers_viola.png b/minetestforfun_game/mods/flowers/textures/flowers_viola.png index 143044a4..e1767659 100644 Binary files a/minetestforfun_game/mods/flowers/textures/flowers_viola.png and b/minetestforfun_game/mods/flowers/textures/flowers_viola.png differ diff --git a/minetestforfun_game/mods/stairs/init.lua b/minetestforfun_game/mods/stairs/init.lua index c7df28c5..f36e7343 100644 --- a/minetestforfun_game/mods/stairs/init.lua +++ b/minetestforfun_game/mods/stairs/init.lua @@ -288,11 +288,9 @@ stairs.register_stair_and_slab("stonebrick", "default:stonebrick", "Stone Brick Stair", "Stone Brick Slab", default.node_sound_stone_defaults()) - stairs.register_stair_and_slab("pinewood", "default:pinewood", - {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}, - {"default_pinewood.png"}, - "Pinewood Stair", - "Pinewood Slab", - default.node_sound_wood_defaults()) - + {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + {"default_pinewood.png"}, + "Pinewood Stair", + "Pinewood Slab", + default.node_sound_wood_defaults()) \ No newline at end of file diff --git a/mods/farming/textures/farming_bread.png b/mods/farming/textures/farming_bread.png index bd00e3e1..00e53719 100644 Binary files a/mods/farming/textures/farming_bread.png and b/mods/farming/textures/farming_bread.png differ diff --git a/mods/farming/textures/farming_cotton.png b/mods/farming/textures/farming_cotton.png index ee0c2909..e2bbfd7a 100644 Binary files a/mods/farming/textures/farming_cotton.png and b/mods/farming/textures/farming_cotton.png differ diff --git a/mods/farming/textures/farming_cotton_1.png b/mods/farming/textures/farming_cotton_1.png index 8750adfa..2581db59 100644 Binary files a/mods/farming/textures/farming_cotton_1.png and b/mods/farming/textures/farming_cotton_1.png differ diff --git a/mods/farming/textures/farming_cotton_2.png b/mods/farming/textures/farming_cotton_2.png index dc1025ba..af9ed340 100644 Binary files a/mods/farming/textures/farming_cotton_2.png and b/mods/farming/textures/farming_cotton_2.png differ diff --git a/mods/farming/textures/farming_cotton_3.png b/mods/farming/textures/farming_cotton_3.png index a1fe3b64..ba46f3d6 100644 Binary files a/mods/farming/textures/farming_cotton_3.png and b/mods/farming/textures/farming_cotton_3.png differ diff --git a/mods/farming/textures/farming_cotton_4.png b/mods/farming/textures/farming_cotton_4.png index d0096da3..e6708b55 100644 Binary files a/mods/farming/textures/farming_cotton_4.png and b/mods/farming/textures/farming_cotton_4.png differ diff --git a/mods/farming/textures/farming_cotton_5.png b/mods/farming/textures/farming_cotton_5.png index 11f67fc6..0ad6a8f5 100644 Binary files a/mods/farming/textures/farming_cotton_5.png and b/mods/farming/textures/farming_cotton_5.png differ diff --git a/mods/farming/textures/farming_cotton_6.png b/mods/farming/textures/farming_cotton_6.png index 13343046..838fa930 100644 Binary files a/mods/farming/textures/farming_cotton_6.png and b/mods/farming/textures/farming_cotton_6.png differ diff --git a/mods/farming/textures/farming_cotton_7.png b/mods/farming/textures/farming_cotton_7.png index fb98f1e7..f2623c25 100644 Binary files a/mods/farming/textures/farming_cotton_7.png and b/mods/farming/textures/farming_cotton_7.png differ diff --git a/mods/farming/textures/farming_cotton_8.png b/mods/farming/textures/farming_cotton_8.png index ae9ed374..d4bf6bd5 100644 Binary files a/mods/farming/textures/farming_cotton_8.png and b/mods/farming/textures/farming_cotton_8.png differ diff --git a/mods/farming/textures/farming_cotton_seed.png b/mods/farming/textures/farming_cotton_seed.png index 70d2ac28..cff769b2 100644 Binary files a/mods/farming/textures/farming_cotton_seed.png and b/mods/farming/textures/farming_cotton_seed.png differ diff --git a/mods/farming/textures/farming_flour.png b/mods/farming/textures/farming_flour.png index a526b202..bd33f937 100644 Binary files a/mods/farming/textures/farming_flour.png and b/mods/farming/textures/farming_flour.png differ diff --git a/mods/farming/textures/farming_soil.png b/mods/farming/textures/farming_soil.png index 0be94e3c..6a59fca5 100644 Binary files a/mods/farming/textures/farming_soil.png and b/mods/farming/textures/farming_soil.png differ diff --git a/mods/farming/textures/farming_soil_wet.png b/mods/farming/textures/farming_soil_wet.png index d5e335ef..7e24c704 100644 Binary files a/mods/farming/textures/farming_soil_wet.png and b/mods/farming/textures/farming_soil_wet.png differ diff --git a/mods/farming/textures/farming_soil_wet_side.png b/mods/farming/textures/farming_soil_wet_side.png index 6bd3a56c..58bc4fb6 100644 Binary files a/mods/farming/textures/farming_soil_wet_side.png and b/mods/farming/textures/farming_soil_wet_side.png differ diff --git a/mods/farming/textures/farming_wheat.png b/mods/farming/textures/farming_wheat.png index 8ecd7350..cba51374 100644 Binary files a/mods/farming/textures/farming_wheat.png and b/mods/farming/textures/farming_wheat.png differ diff --git a/mods/farming/textures/farming_wheat_1.png b/mods/farming/textures/farming_wheat_1.png index 49430003..2ca23ee7 100644 Binary files a/mods/farming/textures/farming_wheat_1.png and b/mods/farming/textures/farming_wheat_1.png differ diff --git a/mods/farming/textures/farming_wheat_2.png b/mods/farming/textures/farming_wheat_2.png index 63550d12..6ae90d60 100644 Binary files a/mods/farming/textures/farming_wheat_2.png and b/mods/farming/textures/farming_wheat_2.png differ diff --git a/mods/farming/textures/farming_wheat_3.png b/mods/farming/textures/farming_wheat_3.png index 00a8c661..29950fe5 100644 Binary files a/mods/farming/textures/farming_wheat_3.png and b/mods/farming/textures/farming_wheat_3.png differ diff --git a/mods/farming/textures/farming_wheat_4.png b/mods/farming/textures/farming_wheat_4.png index 80b98aa2..cdc2003d 100644 Binary files a/mods/farming/textures/farming_wheat_4.png and b/mods/farming/textures/farming_wheat_4.png differ diff --git a/mods/farming/textures/farming_wheat_5.png b/mods/farming/textures/farming_wheat_5.png index 1023f0cc..2ddff037 100644 Binary files a/mods/farming/textures/farming_wheat_5.png and b/mods/farming/textures/farming_wheat_5.png differ diff --git a/mods/farming/textures/farming_wheat_6.png b/mods/farming/textures/farming_wheat_6.png index 591c1383..f7d8145e 100644 Binary files a/mods/farming/textures/farming_wheat_6.png and b/mods/farming/textures/farming_wheat_6.png differ diff --git a/mods/farming/textures/farming_wheat_7.png b/mods/farming/textures/farming_wheat_7.png index 98bc60aa..89a95912 100644 Binary files a/mods/farming/textures/farming_wheat_7.png and b/mods/farming/textures/farming_wheat_7.png differ diff --git a/mods/farming/textures/farming_wheat_8.png b/mods/farming/textures/farming_wheat_8.png index 44bc5321..78181fff 100644 Binary files a/mods/farming/textures/farming_wheat_8.png and b/mods/farming/textures/farming_wheat_8.png differ diff --git a/mods/farming/textures/farming_wheat_seed.png b/mods/farming/textures/farming_wheat_seed.png index 9afcd4dd..81fc3b22 100644 Binary files a/mods/farming/textures/farming_wheat_seed.png and b/mods/farming/textures/farming_wheat_seed.png differ