From 19b44a99108c9304b2b717efea7e558ee786c8c5 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 16 Feb 2017 20:45:28 +0100 Subject: [PATCH] Move sponges to mcl_sponges mod --- mods/CORE/mcl_core/crafting.lua | 7 -- mods/CORE/mcl_core/nodes.lua | 99 ----------------- mods/ITEMS/mcl_sponges/depends.txt | 1 + mods/ITEMS/mcl_sponges/description.txt | 1 + mods/ITEMS/mcl_sponges/init.lua | 103 ++++++++++++++++++ mods/ITEMS/mcl_sponges/mod.conf | 1 + .../textures/mcl_sponges_sponge.png} | Bin .../textures/mcl_sponges_sponge_wet.png} | Bin mods/MISC/mcl_temp_helper_recipes/init.lua | 2 +- 9 files changed, 107 insertions(+), 107 deletions(-) create mode 100644 mods/ITEMS/mcl_sponges/depends.txt create mode 100644 mods/ITEMS/mcl_sponges/description.txt create mode 100644 mods/ITEMS/mcl_sponges/init.lua create mode 100644 mods/ITEMS/mcl_sponges/mod.conf rename mods/{CORE/mcl_core/textures/default_sponge.png => ITEMS/mcl_sponges/textures/mcl_sponges_sponge.png} (100%) rename mods/{CORE/mcl_core/textures/default_sponge_wet.png => ITEMS/mcl_sponges/textures/mcl_sponges_sponge_wet.png} (100%) diff --git a/mods/CORE/mcl_core/crafting.lua b/mods/CORE/mcl_core/crafting.lua index 49c464ccd..a24c583ae 100644 --- a/mods/CORE/mcl_core/crafting.lua +++ b/mods/CORE/mcl_core/crafting.lua @@ -705,13 +705,6 @@ minetest.register_craft({ cooktime = 10, }) -minetest.register_craft({ - type = "cooking", - output = "mcl_core:sponge", - recipe = "mcl_core:sponge_wet", - cooktime = 10, -}) - minetest.register_craft({ type = "cooking", output = "mcl_core:coal_lump", diff --git a/mods/CORE/mcl_core/nodes.lua b/mods/CORE/mcl_core/nodes.lua index c2d6bf6c7..8bd7fa3b6 100644 --- a/mods/CORE/mcl_core/nodes.lua +++ b/mods/CORE/mcl_core/nodes.lua @@ -1315,105 +1315,6 @@ minetest.register_node("mcl_core:tallgrass", { end }) --- TODO: Move to own mod -minetest.register_node("mcl_core:sponge", { - description = "Sponge", - drawtype = "normal", - is_ground_content = false, - tiles = {"default_sponge.png"}, - paramtype = 'light', - walkable = true, - pointable = true, - diggable = true, - buildable_to = false, - stack_max = 64, - sounds = mcl_sounds.node_sound_dirt_defaults(), - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,building_block=1}, - on_place = function(itemstack, placer, pointed_thing) - local pn = placer:get_player_name() - if pointed_thing.type ~= "node" then - return itemstack - end - if minetest.is_protected(pointed_thing.above, pn) then - return itemstack - end - local change = false - local on_water = false - local pos = pointed_thing.above - -- verifier si il est dans l'eau ou a cotée - if string.find(minetest.get_node(pointed_thing.above).name, "water_source") - or string.find(minetest.get_node(pointed_thing.above).name, "water_flowing") then - on_water = true - end - for i=-1,1 do - local p = {x=pos.x+i, y=pos.y, z=pos.z} - local n = minetest.get_node(p) - -- On verifie si il y a de l'eau - if (n.name=="mcl_core:water_flowing") or (n.name == "mcl_core:water_source") then - on_water = true - end - end - for i=-1,1 do - local p = {x=pos.x, y=pos.y+i, z=pos.z} - local n = minetest.get_node(p) - -- On verifie si il y a de l'eau - if (n.name=="mcl_core:water_flowing") or (n.name == "mcl_core:water_source") then - on_water = true - end - end - for i=-1,1 do - local p = {x=pos.x, y=pos.y, z=pos.z+i} - local n = minetest.get_node(p) - -- On verifie si il y a de l'eau - if (n.name=="mcl_core:water_flowing") or (n.name == "mcl_core:water_source") then - on_water = true - end - end - local p, n - if on_water == true then - for i=-3,3 do - for j=-3,3 do - for k=-3,3 do - p = {x=pos.x+i, y=pos.y+j, z=pos.z+k} - n = minetest.get_node(p) - -- On Supprime l'eau - if (n.name=="mcl_core:water_flowing") or (n.name == "mcl_core:water_source")then - minetest.add_node(p, {name="air"}) - change = true - end - end - end - end - end - p = {x=pos.x, y=pos.y, z=pos.z} - n = minetest.get_node(p) - if change == true then - minetest.add_node(pointed_thing.above, {name = "mcl_core:sponge_wet"}) - else - minetest.add_node(pointed_thing.above, {name = "mcl_core:sponge"}) - end - return itemstack - - end -}) - --- TODO: Move to own mod -minetest.register_node("mcl_core:sponge_wet", { - description = "Wet Sponge", - drawtype = "normal", - is_ground_content = false, - tiles = {"default_sponge_wet.png"}, - paramtype = 'light', - walkable = true, - pointable = true, - diggable = true, - buildable_to = false, - stack_max = 64, - sounds = mcl_sounds.node_sound_dirt_defaults(), - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,building_block=1}, -}) - - minetest.register_node("mcl_core:ice", { description = "Ice", drawtype = "glasslike", diff --git a/mods/ITEMS/mcl_sponges/depends.txt b/mods/ITEMS/mcl_sponges/depends.txt new file mode 100644 index 000000000..3d96266de --- /dev/null +++ b/mods/ITEMS/mcl_sponges/depends.txt @@ -0,0 +1 @@ +mcl_sounds diff --git a/mods/ITEMS/mcl_sponges/description.txt b/mods/ITEMS/mcl_sponges/description.txt new file mode 100644 index 000000000..80f47c25f --- /dev/null +++ b/mods/ITEMS/mcl_sponges/description.txt @@ -0,0 +1 @@ +A sponge which sucks in water (WIP). diff --git a/mods/ITEMS/mcl_sponges/init.lua b/mods/ITEMS/mcl_sponges/init.lua new file mode 100644 index 000000000..b88a407ae --- /dev/null +++ b/mods/ITEMS/mcl_sponges/init.lua @@ -0,0 +1,103 @@ +minetest.register_node("mcl_sponges:sponge", { + description = "Sponge", + drawtype = "normal", + is_ground_content = false, + tiles = {"mcl_sponges_sponge.png"}, + paramtype = 'light', + walkable = true, + pointable = true, + diggable = true, + buildable_to = false, + stack_max = 64, + sounds = mcl_sounds.node_sound_dirt_defaults(), + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,building_block=1}, + on_place = function(itemstack, placer, pointed_thing) + local pn = placer:get_player_name() + if pointed_thing.type ~= "node" then + return itemstack + end + if minetest.is_protected(pointed_thing.above, pn) then + return itemstack + end + local change = false + local on_water = false + local pos = pointed_thing.above + -- verifier si il est dans l'eau ou a cotée + if string.find(minetest.get_node(pointed_thing.above).name, "water_source") + or string.find(minetest.get_node(pointed_thing.above).name, "water_flowing") then + on_water = true + end + for i=-1,1 do + local p = {x=pos.x+i, y=pos.y, z=pos.z} + local n = minetest.get_node(p) + -- On verifie si il y a de l'eau + if (n.name=="mcl_core:water_flowing") or (n.name == "mcl_core:water_source") then + on_water = true + end + end + for i=-1,1 do + local p = {x=pos.x, y=pos.y+i, z=pos.z} + local n = minetest.get_node(p) + -- On verifie si il y a de l'eau + if (n.name=="mcl_core:water_flowing") or (n.name == "mcl_core:water_source") then + on_water = true + end + end + for i=-1,1 do + local p = {x=pos.x, y=pos.y, z=pos.z+i} + local n = minetest.get_node(p) + -- On verifie si il y a de l'eau + if (n.name=="mcl_core:water_flowing") or (n.name == "mcl_core:water_source") then + on_water = true + end + end + local p, n + if on_water == true then + for i=-3,3 do + for j=-3,3 do + for k=-3,3 do + p = {x=pos.x+i, y=pos.y+j, z=pos.z+k} + n = minetest.get_node(p) + -- On Supprime l'eau + if (n.name=="mcl_core:water_flowing") or (n.name == "mcl_core:water_source")then + minetest.add_node(p, {name="air"}) + change = true + end + end + end + end + end + p = {x=pos.x, y=pos.y, z=pos.z} + n = minetest.get_node(p) + if change == true then + minetest.add_node(pointed_thing.above, {name = "mcl_sponges:sponge_wet"}) + else + minetest.add_node(pointed_thing.above, {name = "mcl_sponges:sponge"}) + end + return itemstack + + end +}) + +minetest.register_node("mcl_sponges:sponge_wet", { + description = "Wet Sponge", + drawtype = "normal", + is_ground_content = false, + tiles = {"mcl_sponges_sponge_wet.png"}, + paramtype = 'light', + walkable = true, + pointable = true, + diggable = true, + buildable_to = false, + stack_max = 64, + sounds = mcl_sounds.node_sound_dirt_defaults(), + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,building_block=1}, +}) + +minetest.register_craft({ + type = "cooking", + output = "mcl_sponges:sponge", + recipe = "mcl_sponges:sponge_wet", + cooktime = 10, +}) + diff --git a/mods/ITEMS/mcl_sponges/mod.conf b/mods/ITEMS/mcl_sponges/mod.conf new file mode 100644 index 000000000..71a459c10 --- /dev/null +++ b/mods/ITEMS/mcl_sponges/mod.conf @@ -0,0 +1 @@ +name = mcl_sponges diff --git a/mods/CORE/mcl_core/textures/default_sponge.png b/mods/ITEMS/mcl_sponges/textures/mcl_sponges_sponge.png similarity index 100% rename from mods/CORE/mcl_core/textures/default_sponge.png rename to mods/ITEMS/mcl_sponges/textures/mcl_sponges_sponge.png diff --git a/mods/CORE/mcl_core/textures/default_sponge_wet.png b/mods/ITEMS/mcl_sponges/textures/mcl_sponges_sponge_wet.png similarity index 100% rename from mods/CORE/mcl_core/textures/default_sponge_wet.png rename to mods/ITEMS/mcl_sponges/textures/mcl_sponges_sponge_wet.png diff --git a/mods/MISC/mcl_temp_helper_recipes/init.lua b/mods/MISC/mcl_temp_helper_recipes/init.lua index 407b21978..6b3f8631b 100644 --- a/mods/MISC/mcl_temp_helper_recipes/init.lua +++ b/mods/MISC/mcl_temp_helper_recipes/init.lua @@ -12,7 +12,7 @@ minetest.register_craft({ }) minetest.register_craft({ - output = "mcl_core:sponge", + output = "mcl_sponges:sponge", recipe = { { "mcl_core:haybale", "mcl_core:haybale", "mcl_core:haybale" }, { "mcl_core:haybale", "mcl_core:emerald", "mcl_core:haybale" },