forked from VoxeLibre/VoxeLibre
working sponges
This commit is contained in:
parent
717da6dd7c
commit
58f989ca74
|
@ -100,7 +100,7 @@ S("• When water is directly below lava, the water turns into stone."),
|
|||
liquid_range = 7,
|
||||
post_effect_color = {a=209, r=0x03, g=0x3C, b=0x5C},
|
||||
stack_max = 64,
|
||||
groups = { water=3, liquid=3, puts_out_fire=1, freezes=1, not_in_creative_inventory=1, dig_by_piston=1},
|
||||
groups = { water=3, legacity_water=1, liquid=3, puts_out_fire=1, freezes=1, not_in_creative_inventory=1, dig_by_piston=1},
|
||||
_mcl_blast_resistance = 100,
|
||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
||||
_mcl_hardness = -1,
|
||||
|
|
|
@ -9,7 +9,9 @@ function mcl_sponges.register_sponge(name, def)
|
|||
if def.furnace_drying == nil then def.furnace_drying = true end
|
||||
if not def.tiles then def.tiles = {"mcl_sponges_sponge_wet.png"} end
|
||||
if not def.description then def.description = S("Logged Sponge") end
|
||||
|
||||
def.itemname = "mcl_sponges:sponge_"..name.."_logged"
|
||||
|
||||
mcl_sponges.registered_sponges[name] = def
|
||||
|
||||
minetest.register_node(def.itemname, {
|
||||
|
@ -20,7 +22,30 @@ function mcl_sponges.register_sponge(name, def)
|
|||
tiles = {"mcl_sponges_sponge_wet.png"},
|
||||
sounds = mcl_sounds.node_sound_dirt_defaults(),
|
||||
groups = {handy=1, hoey=1, building_block=1, sponge_logged=1},
|
||||
on_place = place_wet_sponge,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
local new_stack = mcl_util.call_on_rightclick(itemstack, player, pointed_thing)
|
||||
if new_stack then
|
||||
return new_stack
|
||||
end
|
||||
|
||||
local name = placer:get_player_name()
|
||||
|
||||
if minetest.is_protected(pointed_thing.above, name) then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if def.on_place then
|
||||
local new_item = def.on_place(itemstack, placer, pointed_thing)
|
||||
if new_item then return new_item end
|
||||
end
|
||||
|
||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
end,
|
||||
_mcl_blast_resistance = 0.6,
|
||||
_mcl_hardness = 0.6,
|
||||
})
|
||||
|
@ -36,7 +61,7 @@ function mcl_sponges.register_sponge(name, def)
|
|||
end
|
||||
end
|
||||
|
||||
local absorb = function(pos)
|
||||
function mcl_sponges.absorb(pos)
|
||||
local change = false
|
||||
-- Count number of absorbed river water vs other nodes
|
||||
-- to determine the wet sponge type.
|
||||
|
@ -71,20 +96,15 @@ local absorb = function(pos)
|
|||
return change, sponge_type
|
||||
end
|
||||
|
||||
|
||||
minetest.register_node("mcl_sponges:sponge", {
|
||||
description = S("Sponge"),
|
||||
_tt_help = S("Removes water on contact"),
|
||||
_doc_items_longdesc = S("Sponges are blocks which remove water around them when they are placed or come in contact with water, turning it into a wet sponge."),
|
||||
drawtype = "normal",
|
||||
_doc_items_longdesc = S("Sponges are blocks which remove certain liquid nodes around them when they are placed or come in contact with liquid, turning it into a wet sponge."),
|
||||
is_ground_content = false,
|
||||
tiles = {"mcl_sponges_sponge.png"},
|
||||
walkable = true,
|
||||
pointable = true,
|
||||
diggable = true,
|
||||
buildable_to = false,
|
||||
stack_max = 64,
|
||||
sounds = mcl_sounds.node_sound_dirt_defaults(),
|
||||
groups = {handy=1, hoey=1, building_block=1},
|
||||
groups = {handy=1, hoey=1, building_block=1, sponge_dry=1},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pn = placer:get_player_name()
|
||||
|
||||
|
@ -114,7 +134,7 @@ minetest.register_node("mcl_sponges:sponge", {
|
|||
if on_water then
|
||||
-- Absorb water
|
||||
-- FIXME: pos is not always the right placement position because of pointed_thing
|
||||
local absorbed, wet_sponge = absorb(pos)
|
||||
local absorbed, wet_sponge = mcl_sponges.absorb(pos)
|
||||
if absorbed then
|
||||
minetest.item_place_node(ItemStack(wet_sponge), placer, pointed_thing)
|
||||
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||
|
@ -170,25 +190,6 @@ function place_wet_sponge(itemstack, placer, pointed_thing)
|
|||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
end
|
||||
|
||||
minetest.register_node("mcl_sponges:sponge_wet", {
|
||||
description = S("Waterlogged Sponge"),
|
||||
_tt_help = S("Can be dried in furnace"),
|
||||
_doc_items_longdesc = S("A waterlogged sponge can be dried in the furnace to turn it into (dry) sponge. When there's an empty bucket in the fuel slot of a furnace, the water will pour into the bucket."),
|
||||
drawtype = "normal",
|
||||
is_ground_content = false,
|
||||
tiles = {"mcl_sponges_sponge_wet.png"},
|
||||
walkable = true,
|
||||
pointable = true,
|
||||
diggable = true,
|
||||
buildable_to = false,
|
||||
stack_max = 64,
|
||||
sounds = mcl_sounds.node_sound_dirt_defaults(),
|
||||
groups = {handy=1, hoey=1, building_block=1},
|
||||
on_place = place_wet_sponge,
|
||||
_mcl_blast_resistance = 0.6,
|
||||
_mcl_hardness = 0.6,
|
||||
})
|
||||
|
||||
--[[if minetest.get_modpath("mclx_core") then
|
||||
minetest.register_node("mcl_sponges:sponge_wet_river_water", {
|
||||
description = S("Riverwaterlogged Sponge"),
|
||||
|
@ -217,16 +218,43 @@ minetest.register_node("mcl_sponges:sponge_wet", {
|
|||
})
|
||||
end]]
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_sponges:sponge",
|
||||
recipe = "mcl_sponges:sponge_wet",
|
||||
cooktime = 10,
|
||||
})
|
||||
|
||||
mcl_sponges.register_sponge("water", {
|
||||
description = S("Waterlogged Sponge"),
|
||||
help = S("Can be dried in furnace"),
|
||||
longdesc = S("A waterlogged sponge can be dried in the furnace to turn it into (dry) sponge. When there's an empty bucket in the fuel slot of a furnace, the water will pour into the bucket."),
|
||||
tiles = {"mcl_sponges_sponge_wet.png"},
|
||||
liquidgroup = "legacity_water",
|
||||
furnace_drying = true,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if mcl_worlds.pos_to_dimension(pointed_thing.above) == "nether" then
|
||||
minetest.item_place_node(ItemStack("mcl_sponges:sponge"), placer, pointed_thing)
|
||||
local pos = pointed_thing.above
|
||||
for n = 0, 25 do
|
||||
minetest.add_particle({
|
||||
pos = {x = pos.x + math.random(-1, 1)*math.random()/2, y = pos.y + 0.6, z = pos.z + math.random(-1, 1)*math.random()/2},
|
||||
velocity = {x = 0, y = math.random(), z = 0},
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = math.random(),
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
size = math.random(2, 5),
|
||||
texture = "mcl_particles_sponge"..math.random(1, 5)..".png",
|
||||
})
|
||||
end
|
||||
if not minetest.is_creative_enabled(name) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
mcl_sponges.register_sponge("riverwater", {
|
||||
description = S("Riverwaterlogged Sponge"),
|
||||
help = S("Can be dried in furnace"),
|
||||
longdesc = S("This is a sponge soaking wet with river water. It can be dried in the furnace to turn it into (dry) sponge. When there's an empty bucket in the fuel slot of the furnace, the river water will pour into the bucket.") .. "\n" .. S("A sponge becomes riverwaterlogged (instead of waterlogged) if it sucks up more river water than (normal) water."),
|
||||
tiles = {"mcl_sponges_sponge_wet.png"},
|
||||
liquidgroup = "extra_water",
|
||||
furnace_drying = true,
|
||||
})
|
||||
|
||||
|
@ -243,4 +271,5 @@ minetest.register_abm({
|
|||
end
|
||||
end,
|
||||
})
|
||||
minetest.register_alias("mcl_sponges:sponge_wet", "mcl_sponges:sponge_water_logged")
|
||||
minetest.register_alias("mcl_sponges:sponge_wet", "mcl_sponges:sponge_water_logged")
|
||||
minetest.register_alias("mcl_sponges:sponge_wet_river_water", "mcl_sponges:sponge_riverwater_logged")
|
|
@ -13,6 +13,8 @@ source._doc_items_entry_name = S("River Water")
|
|||
-- Auto-expose entry only in valleys mapgen
|
||||
source._doc_items_hidden = minetest.get_mapgen_setting("mg_name") ~= "valleys"
|
||||
source.post_effect_color = {a=192, r=0x2c, g=0x88, b=0x8c}
|
||||
source.groups["legacity_water"] = nil
|
||||
source.groups["extra_water"] = 1
|
||||
source.tiles = {
|
||||
{name="default_river_water_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=5.0}}
|
||||
}
|
||||
|
@ -33,6 +35,8 @@ flowing.liquid_alternative_source = "mclx_core:river_water_source"
|
|||
flowing.liquid_renewable = false
|
||||
flowing.tiles = {"default_river_water_flowing_animated.png^[verticalframe:64:0"}
|
||||
flowing.post_effect_color = {a=192, r=0x2c, g=0x88, b=0x8c}
|
||||
flowing.groups["legacity_water"] = nil
|
||||
flowing.groups["extra_water"] = 1
|
||||
flowing.special_tiles = {
|
||||
{
|
||||
image="default_river_water_flowing_animated.png",
|
||||
|
|
Loading…
Reference in New Issue