forked from MineClone5/MineClone5
Update mcl_bubble_column mod by j45
This commit is contained in:
parent
6797466a81
commit
512042d8d6
|
@ -1,3 +1,9 @@
|
||||||
# mcl_bubble_column
|
# mcl_bubble_column by j45
|
||||||
bubble_column mod for mineclone2
|
|
||||||
put in /mtdir/games/mineclone2/mods/CORE/
|
https://github.com/Minetest-j45/mcl_bubble_column/
|
||||||
|
|
||||||
|
Adds whirlpools and upwards bubble columns to Mineclone2/5
|
||||||
|
|
||||||
|
A bubble column is a block generated by placing magma blocks or soul sand in water (source).
|
||||||
|
|
||||||
|
Bubble columns push or pull entities and items in certain directions.
|
||||||
|
|
|
@ -1,369 +1,195 @@
|
||||||
local S = minetest.get_translator("mcl_bubble_column")
|
mcl_bubble_column = {}
|
||||||
|
|
||||||
local WATER_ALPHA = 179
|
minetest.register_abm{
|
||||||
local WATER_VISC = 1
|
label = "bubbleColumnUpStop",
|
||||||
local LAVA_VISC = 7
|
nodenames = {"group:water"},
|
||||||
local LIGHT_LAVA = minetest.LIGHT_MAX
|
interval = 0.05,
|
||||||
local USE_TEXTURE_ALPHA
|
chance = 1,
|
||||||
if minetest.features.use_texture_alpha_string_modes then
|
action = function(pos)
|
||||||
USE_TEXTURE_ALPHA = "blend"
|
local meta = minetest.get_meta(pos)
|
||||||
WATER_ALPHA = nil
|
if meta:get_int("bubbly") == 1 then--bubble column
|
||||||
|
--check down if current needs to be deleted
|
||||||
|
local downpos = vector.add(pos, {x = 0, y = -1, z = 0})
|
||||||
|
local downposnode = minetest.get_node(downpos)
|
||||||
|
local downmeta = minetest.get_meta(downpos)
|
||||||
|
if (downmeta:get_int("bubbly") ~= 1 and downposnode.name ~= "mcl_nether:soul_sand") then
|
||||||
|
meta:set_int("bubbly", 0)
|
||||||
|
end
|
||||||
|
--check up to see if needs to go up
|
||||||
|
local uppos = vector.add(pos, {x = 0, y = 1, z = 0})
|
||||||
|
local upposnode = minetest.get_node(uppos)
|
||||||
|
local upmeta = minetest.get_meta(uppos)
|
||||||
|
if (minetest.get_item_group(upposnode.name, "water") == 3 and upmeta:get_int("bubbly") ~= 1) then
|
||||||
|
upmeta:set_int("bubbly", 1)
|
||||||
|
end
|
||||||
|
elseif meta:get_int("whirly") == 1 then--whirlpool
|
||||||
|
--check down if current needs to be deleted
|
||||||
|
local downpos = vector.add(pos, {x = 0, y = -1, z = 0})
|
||||||
|
local downposnode = minetest.get_node(downpos)
|
||||||
|
local downmeta = minetest.get_meta(downpos)
|
||||||
|
if (downmeta:get_int("whirly") ~= 1 and downposnode.name ~= "mcl_nether:magma") then
|
||||||
|
meta:set_int("whirly", 0)
|
||||||
|
end
|
||||||
|
--check up to see if needs to go up
|
||||||
|
local uppos = vector.add(pos, {x = 0, y = 1, z = 0})
|
||||||
|
local upposnode = minetest.get_node(uppos)
|
||||||
|
local upmeta = minetest.get_meta(uppos)
|
||||||
|
if (minetest.get_item_group(upposnode.name, "water") == 3 and upmeta:get_int("whirly") ~= 1) then
|
||||||
|
upmeta:set_int("whirly", 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
minetest.register_abm{
|
||||||
|
label = "startBubbleColumn",
|
||||||
|
nodenames = {"mcl_nether:soul_sand"},
|
||||||
|
interval = 0.05,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos)
|
||||||
|
local uppos = vector.add(pos, {x = 0, y = 1, z = 0})
|
||||||
|
local upposnode = minetest.get_node(uppos)
|
||||||
|
local upmeta = minetest.get_meta(uppos)
|
||||||
|
if (minetest.get_item_group(upposnode.name, "water") == 3 and upmeta:get_int("bubbly") ~= 1) then
|
||||||
|
upmeta:set_int("bubbly", 1)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
minetest.register_abm{
|
||||||
|
label = "startWhirlpool",
|
||||||
|
nodenames = {"mcl_nether:magma"},
|
||||||
|
interval = 0.05,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos)
|
||||||
|
local uppos = vector.add(pos, {x = 0, y = 1, z = 0})
|
||||||
|
local upposnode = minetest.get_node(uppos)
|
||||||
|
local upmeta = minetest.get_meta(uppos)
|
||||||
|
if (minetest.get_item_group(upposnode.name, "water") == 3 and upmeta:get_int("whirly") ~= 1) then
|
||||||
|
upmeta:set_int("whirly", 1)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mcl_bubble_column.on_enter_bubble_column = function(self)
|
||||||
|
local velocity = self:get_velocity()
|
||||||
|
--[[if down.name == "mcl_nether:soul_sand" then
|
||||||
|
self:add_velocity({x = 0, y = math.min(10, math.abs(velocity.y)+9.4), z = 0})
|
||||||
|
else]]
|
||||||
|
self:add_velocity({x = 0, y = math.min(3.6, math.abs(velocity.y)+3), z = 0})
|
||||||
|
--end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("mcl_bubble_column:water_flowing_up", {
|
mcl_bubble_column.on_enter_whirlpool = function(self)
|
||||||
description = S("Bubble Column Flowing Water (up)"),
|
local velocity = self:get_velocity()
|
||||||
_doc_items_create_entry = false,
|
--self:add_velocity({x = 0, y = math.max(-3, (-math.abs(velocity.y))-2), z = 0})
|
||||||
wield_image = "default_water_flowing_animated.png^[verticalframe:64:0",
|
self:add_velocity({x = 0, y = math.max(-0.3, (-math.abs(velocity.y))-0.03), z = 0})
|
||||||
drawtype = "flowingliquid",
|
end
|
||||||
tiles = {"default_water_flowing_animated.png^[verticalframe:64:0"},
|
|
||||||
special_tiles = {
|
|
||||||
{
|
|
||||||
image="default_water_flowing_animated.png",
|
|
||||||
backface_culling=false,
|
|
||||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=4.0}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
image="default_water_flowing_animated.png",
|
|
||||||
backface_culling=false,
|
|
||||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=4.0}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sounds = mcl_sounds.node_sound_water_defaults(),
|
|
||||||
is_ground_content = false,
|
|
||||||
alpha = WATER_ALPHA,
|
|
||||||
use_texture_alpha = USE_TEXTURE_ALPHA,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "flowingliquid",
|
|
||||||
walkable = false,
|
|
||||||
pointable = false,
|
|
||||||
diggable = false,
|
|
||||||
buildable_to = true,
|
|
||||||
drop = "",
|
|
||||||
drowning = 4,
|
|
||||||
liquidtype = "flowing",
|
|
||||||
liquid_alternative_flowing = "mcl_bubble_column:water_flowing_up",
|
|
||||||
liquid_alternative_source = "mcl_bubble_column:water_source_up",
|
|
||||||
liquid_viscosity = WATER_VISC,
|
|
||||||
liquid_range = 7,
|
|
||||||
post_effect_color = {a=209, r=0x03, g=0x3C, b=0x5C},
|
|
||||||
groups = { water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=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,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("mcl_bubble_column:water_source_up", {
|
mcl_bubble_column.on_enter_bubble_column_with_air_above = function(self)
|
||||||
description = S("Bubble Column Water Source"),
|
local velocity = self:get_velocity()
|
||||||
_doc_items_entry_name = S("Water"),
|
--[[if down.name == "mcl_nether:soul_sand" then
|
||||||
_doc_items_longdesc = S("Boosts you up"),
|
self:add_velocity({x = 0, y = math.min(4.3, math.abs(velocity.y)+2.8), z = 0})
|
||||||
_doc_items_hidden = false,
|
else]]
|
||||||
drawtype = "liquid",
|
self:add_velocity({x = 0, y = math.min(2.6, math.abs(velocity.y)+2), z = 0})
|
||||||
tiles = {
|
--end
|
||||||
{name="default_water_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=5.0}}
|
end
|
||||||
},
|
|
||||||
special_tiles = {
|
mcl_bubble_column.on_enter_whirlpool_with_air_above = function(self)
|
||||||
-- New-style water source material (mostly unused)
|
local velocity = self:get_velocity()
|
||||||
{
|
--self:add_velocity({x = 0, y = math.max(-3.5, (-math.abs(velocity.y))-2), z = 0})
|
||||||
name="default_water_source_animated.png",
|
self:add_velocity({x = 0, y = math.max(-0.9, (-math.abs(velocity.y))-0.03), z = 0})
|
||||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=5.0},
|
end
|
||||||
backface_culling = false,
|
|
||||||
}
|
minetest.register_abm{
|
||||||
},
|
label = "entGo",
|
||||||
sounds = mcl_sounds.node_sound_water_defaults(),
|
nodenames = {"group:water"},
|
||||||
is_ground_content = false,
|
interval = 0.05,
|
||||||
alpha = WATER_ALPHA,
|
chance = 1,
|
||||||
use_texture_alpha = USE_TEXTURE_ALPHA,
|
action = function(pos)
|
||||||
paramtype = "light",
|
--if not bubble column block return
|
||||||
walkable = false,
|
local meta = minetest.get_meta(pos)
|
||||||
pointable = false,
|
if meta:get_int("bubbly") == 1 then
|
||||||
diggable = false,
|
local up = minetest.get_node(vector.add(pos, {x = 0, y = 1, z = 0}))
|
||||||
buildable_to = true,
|
for _,entity in pairs(minetest.get_objects_inside_radius(pos, 0.75)) do
|
||||||
drop = "",
|
if up.name == "air" then
|
||||||
drowning = 4,
|
mcl_bubble_column.on_enter_bubble_column_with_air_above(entity)
|
||||||
liquidtype = "source",
|
else
|
||||||
liquid_alternative_flowing = "mcl_bubble_column:water_flowing_up",
|
mcl_bubble_column.on_enter_bubble_column(entity)
|
||||||
liquid_alternative_source = "mcl_bubble_column:water_source_up",
|
end
|
||||||
liquid_viscosity = WATER_VISC,
|
end
|
||||||
liquid_range = 7,
|
elseif meta:get_int("whirly") == 1 then
|
||||||
post_effect_color = {a=209, r=0x03, g=0x3C, b=0x5C},
|
local up = minetest.get_node(vector.add(pos, {x = 0, y = 1, z = 0}))
|
||||||
stack_max = 64,
|
for _,entity in pairs(minetest.get_objects_inside_radius(pos, 0.75)) do
|
||||||
groups = { water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, dig_by_piston=1},
|
if up.name == "air" then
|
||||||
_mcl_blast_resistance = 100,
|
mcl_bubble_column.on_enter_whirlpool_with_air_above(entity)
|
||||||
-- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode
|
else
|
||||||
_mcl_hardness = -1,
|
mcl_bubble_column.on_enter_whirlpool(entity)
|
||||||
})
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
minetest.register_globalstep(function()
|
minetest.register_globalstep(function()
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
for _,player in ipairs(minetest.get_connected_players()) do
|
||||||
local name = player:get_player_name()
|
local ppos = player:get_pos()
|
||||||
local pos = player:get_pos()
|
local eyepos = {x = ppos.x, y = ppos.y + player:get_properties().eye_height, z = ppos.z}
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(ppos)
|
||||||
if node.name == "mcl_bubble_column:water_source_up" then
|
local eyenode = minetest.get_node(eyepos)
|
||||||
local velocity = player:get_player_velocity()
|
local meta = minetest.get_meta(ppos)
|
||||||
local velocityadd = {x = 0, y = 3, z = 0}
|
local eyemeta = minetest.get_meta(eyepos)
|
||||||
player:add_player_velocity(velocityadd)
|
|
||||||
end
|
local eyemeta = minetest.get_meta(ppos)
|
||||||
end
|
--if minetest.get_item_group(node.name, "water") == 3 and minetest.get_item_group(eyenode.name, "water") == 3 then return end
|
||||||
|
if meta:get_int("bubbly") == 1 or eyemeta:get_int("bubbly") == 1 then
|
||||||
|
local up = minetest.get_node(vector.add(eyepos, {x = 0, y = 1, z = 0}))
|
||||||
|
if up.name == "air" then
|
||||||
|
mcl_bubble_column.on_enter_bubble_column_with_air_above(player)
|
||||||
|
else
|
||||||
|
mcl_bubble_column.on_enter_bubble_column(player)
|
||||||
|
end
|
||||||
|
elseif meta:get_int("whirly") == 1 or eyemeta:get_int("whirly") == 1 then
|
||||||
|
local up = minetest.get_node(vector.add(ppos, {x = 0, y = 1, z = 0}))
|
||||||
|
if up.name == "air" then
|
||||||
|
mcl_bubble_column.on_enter_whirlpool_with_air_above(player)
|
||||||
|
else
|
||||||
|
mcl_bubble_column.on_enter_whirlpool(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
--abms to remove and replace old bubble columns/whirlpools
|
||||||
minetest.register_abm{
|
minetest.register_abm{
|
||||||
label = "entities go up",
|
label = "removeOldFlowingColumns",
|
||||||
|
nodenames = {"mcl_bubble_column:water_flowing_up", "mcl_bubble_column:water_flowing_down"},
|
||||||
|
interval = 1,--reduce lag
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos)
|
||||||
|
minetest.set_node(pos, {name = "air"})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
minetest.register_abm{
|
||||||
|
label = "replaceBubbleColumns",
|
||||||
nodenames = {"mcl_bubble_column:water_source_up"},
|
nodenames = {"mcl_bubble_column:water_source_up"},
|
||||||
interval = 0.05,
|
interval = 1,--reduce lag
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
for _,entity in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do
|
minetest.set_node(pos, {name = "mcl_core:water_source"})
|
||||||
local pos = entity:get_pos()
|
local meta = minetest.get_meta(pos)
|
||||||
local velocity = entity:get_velocity()
|
meta:set_int("bubbly", 1)
|
||||||
local velocityadd = {x = 0, y = 2, z = 0}
|
|
||||||
entity:add_velocity(velocityadd)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
minetest.register_abm{
|
|
||||||
label = "bubbles go up",
|
|
||||||
nodenames = {"mcl_bubble_column:water_source_up"},
|
|
||||||
interval = 1,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos)
|
|
||||||
local uppos = vector.add(pos, {x = 0, y = 1, z = 0})
|
|
||||||
local upposnode = minetest.get_node(uppos)
|
|
||||||
if upposnode.name == "mcl_core:water_source" then
|
|
||||||
minetest.set_node(uppos, {name = "mcl_bubble_column:water_source_up"})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
minetest.register_abm{
|
|
||||||
label = "start bubble column",
|
|
||||||
nodenames = {"mcl_nether:soul_sand"},
|
|
||||||
interval = 1,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos)
|
|
||||||
local downpos = vector.add(pos, {x = 0, y = 1, z = 0})
|
|
||||||
local downposnode = minetest.get_node(downpos)
|
|
||||||
if downposnode.name == "mcl_core:water_source" then
|
|
||||||
minetest.set_node(downpos, {name = "mcl_bubble_column:water_source_up"})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
minetest.register_abm{
|
|
||||||
label = "stop bubble column",
|
|
||||||
nodenames = {"mcl_bubble_column:water_source_up"},
|
|
||||||
interval = 1,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos)
|
|
||||||
local downpos = vector.add(pos, {x = 0, y = -1, z = 0})
|
|
||||||
local downposnode = minetest.get_node(downpos)
|
|
||||||
if downposnode.name == "mcl_core:water_source" then
|
|
||||||
minetest.set_node(pos, {name = "mcl_core:water_source"})
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
minetest.register_abm{
|
minetest.register_abm{
|
||||||
label = "bubbles up",
|
label = "replaceWhirlpools",
|
||||||
nodenames = {"mcl_bubble_column:water_source_up"},
|
nodenames = {"mcl_bubble_column:water_source_down"},
|
||||||
interval = 1,
|
interval = 1,--reduce lag
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
minetest.add_particlespawner({
|
minetest.set_node(pos, {name = "mcl_core:water_source"})
|
||||||
amount = 10,
|
local meta = minetest.get_meta(pos)
|
||||||
time = 0.15,
|
meta:set_int("whirly", 1)
|
||||||
minpos = vector.add(pos, { x = -0.25, y = 0, z = -0.25 }),
|
end,
|
||||||
maxpos = vector.add(pos, { x = 0.25, y = 0, z = 0.75 }),
|
}
|
||||||
attached = player,
|
|
||||||
minvel = {x = -0.2, y = 0, z = -0.2},
|
|
||||||
maxvel = {x = 0.5, y = 0, z = 0.5},
|
|
||||||
minacc = {x = -0.4, y = 4, z = -0.4},
|
|
||||||
maxacc = {x = 0.5, y = 1, z = 0.5},
|
|
||||||
minexptime = 0.3,
|
|
||||||
maxexptime = 0.8,
|
|
||||||
minsize = 0.7,
|
|
||||||
maxsize = 2.4,
|
|
||||||
texture = "mcl_particles_bubble.png"
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
--whirlpools(take you down)
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("mcl_bubble_column:water_flowing_down", {
|
|
||||||
description = S("Bubble Column Flowing Water(down)"),
|
|
||||||
_doc_items_create_entry = false,
|
|
||||||
wield_image = "default_water_flowing_animated.png^[verticalframe:64:0",
|
|
||||||
drawtype = "flowingliquid",
|
|
||||||
tiles = {"default_water_flowing_animated.png^[verticalframe:64:0"},
|
|
||||||
special_tiles = {
|
|
||||||
{
|
|
||||||
image="default_water_flowing_animated.png",
|
|
||||||
backface_culling=false,
|
|
||||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=4.0}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
image="default_water_flowing_animated.png",
|
|
||||||
backface_culling=false,
|
|
||||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=4.0}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sounds = mcl_sounds.node_sound_water_defaults(),
|
|
||||||
is_ground_content = false,
|
|
||||||
alpha = WATER_ALPHA,
|
|
||||||
use_texture_alpha = USE_TEXTURE_ALPHA,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "flowingliquid",
|
|
||||||
walkable = false,
|
|
||||||
pointable = false,
|
|
||||||
diggable = false,
|
|
||||||
buildable_to = true,
|
|
||||||
drop = "",
|
|
||||||
drowning = 4,
|
|
||||||
liquidtype = "flowing",
|
|
||||||
liquid_alternative_flowing = "mcl_bubble_column:water_flowing_down",
|
|
||||||
liquid_alternative_source = "mcl_bubble_column:water_source_down",
|
|
||||||
liquid_viscosity = WATER_VISC,
|
|
||||||
liquid_range = 7,
|
|
||||||
post_effect_color = {a=209, r=0x03, g=0x3C, b=0x5C},
|
|
||||||
groups = { water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=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,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("mcl_bubble_column:water_source_down", {
|
|
||||||
description = S("Whirlpool Water Source"),
|
|
||||||
_doc_items_entry_name = S("Water"),
|
|
||||||
_doc_items_longdesc = S("Takes you down!"),
|
|
||||||
_doc_items_hidden = false,
|
|
||||||
drawtype = "liquid",
|
|
||||||
tiles = {
|
|
||||||
{name="default_water_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=5.0}}
|
|
||||||
},
|
|
||||||
special_tiles = {
|
|
||||||
-- New-style water source material (mostly unused)
|
|
||||||
{
|
|
||||||
name="default_water_source_animated.png",
|
|
||||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=5.0},
|
|
||||||
backface_culling = false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sounds = mcl_sounds.node_sound_water_defaults(),
|
|
||||||
is_ground_content = false,
|
|
||||||
alpha = WATER_ALPHA,
|
|
||||||
use_texture_alpha = USE_TEXTURE_ALPHA,
|
|
||||||
paramtype = "light",
|
|
||||||
walkable = false,
|
|
||||||
pointable = false,
|
|
||||||
diggable = false,
|
|
||||||
buildable_to = true,
|
|
||||||
drop = "",
|
|
||||||
drowning = 4,
|
|
||||||
liquidtype = "source",
|
|
||||||
liquid_alternative_flowing = "mcl_bubble_column:water_flowing_down",
|
|
||||||
liquid_alternative_source = "mcl_bubble_column:water_source_down",
|
|
||||||
liquid_viscosity = WATER_VISC,
|
|
||||||
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, 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,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_globalstep(function()
|
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
|
||||||
local name = player:get_player_name()
|
|
||||||
local pos = player:get_pos()
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
if node.name == "mcl_bubble_column:water_source_down" then
|
|
||||||
local velocity = player:get_player_velocity()
|
|
||||||
local velocityadd = {x = 0, y = -0.5, z = 0}
|
|
||||||
player:add_player_velocity(velocityadd)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_abm{
|
|
||||||
label = "entities go down",
|
|
||||||
nodenames = {"mcl_bubble_column:water_source_down"},
|
|
||||||
interval = 0.05,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos)
|
|
||||||
for _,entity in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do
|
|
||||||
local pos = entity:get_pos()
|
|
||||||
local velocity = entity:get_velocity()
|
|
||||||
local velocityadd = {x = 0, y = -3, z = 0}
|
|
||||||
entity:add_velocity(velocityadd)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
minetest.register_abm{
|
|
||||||
label = "whirlpools go up",
|
|
||||||
nodenames = {"mcl_bubble_column:water_source_down"},
|
|
||||||
interval = 1,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos)
|
|
||||||
local uppos = vector.add(pos, {x = 0, y = 1, z = 0})
|
|
||||||
local upposnode = minetest.get_node(uppos)
|
|
||||||
if upposnode.name == "mcl_core:water_source" then
|
|
||||||
minetest.set_node(uppos, {name = "mcl_bubble_column:water_source_down"})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
minetest.register_abm{
|
|
||||||
label = "start whirlpool",
|
|
||||||
nodenames = {"mcl_nether:magma"},
|
|
||||||
interval = 1,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos)
|
|
||||||
local downpos = vector.add(pos, {x = 0, y = 1, z = 0})
|
|
||||||
local downposnode = minetest.get_node(downpos)
|
|
||||||
if downposnode.name == "mcl_core:water_source" then
|
|
||||||
minetest.set_node(downpos, {name = "mcl_bubble_column:water_source_down"})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
minetest.register_abm{
|
|
||||||
label = "stop whirlpool",
|
|
||||||
nodenames = {"mcl_bubble_column:water_source_down"},
|
|
||||||
interval = 1,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos)
|
|
||||||
local downpos = vector.add(pos, {x = 0, y = -1, z = 0})
|
|
||||||
local downposnode = minetest.get_node(downpos)
|
|
||||||
if downposnode.name == "mcl_core:water_source" then
|
|
||||||
minetest.set_node(pos, {name = "mcl_core:water_source"})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
minetest.register_abm{
|
|
||||||
label = "bubbles down",
|
|
||||||
nodenames = {"mcl_bubble_column:water_source_down"},
|
|
||||||
interval = 1,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos)
|
|
||||||
minetest.add_particlespawner({
|
|
||||||
amount = 10,
|
|
||||||
time = 0.15,
|
|
||||||
minpos = vector.add(pos, { x = -0.25, y = 0, z = -0.25 }),
|
|
||||||
maxpos = vector.add(pos, { x = 0.25, y = 0, z = 0.75 }),
|
|
||||||
attached = player,
|
|
||||||
minvel = {x = -0.2, y = 0, z = -0.2},
|
|
||||||
maxvel = {x = 0.5, y = 0, z = 0.5},
|
|
||||||
minacc = {x = -0.4, y = -4, z = -0.4},
|
|
||||||
maxacc = {x = 0.5, y = -1, z = 0.5},
|
|
||||||
minexptime = 0.3,
|
|
||||||
maxexptime = 0.8,
|
|
||||||
minsize = 0.7,
|
|
||||||
maxsize = 2.4,
|
|
||||||
texture = "mcl_particles_bubble.png"
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
Loading…
Reference in New Issue