forked from MineClone5/MineClone5
Merge pull request 'Works good - why not merge production into master' (#53) from production into master
Reviewed-on: MineClone5/MineClone5#53
This commit is contained in:
commit
81dc652701
|
@ -1,3 +1,9 @@
|
|||
# mcl_bubble_column
|
||||
bubble_column mod for mineclone2
|
||||
put in /mtdir/games/mineclone2/mods/CORE/
|
||||
# mcl_bubble_column by j45
|
||||
|
||||
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
|
||||
local WATER_VISC = 1
|
||||
local LAVA_VISC = 7
|
||||
local LIGHT_LAVA = minetest.LIGHT_MAX
|
||||
local USE_TEXTURE_ALPHA
|
||||
if minetest.features.use_texture_alpha_string_modes then
|
||||
USE_TEXTURE_ALPHA = "blend"
|
||||
WATER_ALPHA = nil
|
||||
minetest.register_abm{
|
||||
label = "bubbleColumnUpStop",
|
||||
nodenames = {"group:water"},
|
||||
interval = 0.05,
|
||||
chance = 1,
|
||||
action = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
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
|
||||
|
||||
minetest.register_node("mcl_bubble_column:water_flowing_up", {
|
||||
description = S("Bubble Column Flowing Water (up)"),
|
||||
_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_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,
|
||||
})
|
||||
mcl_bubble_column.on_enter_whirlpool = function(self)
|
||||
local velocity = self:get_velocity()
|
||||
--self:add_velocity({x = 0, y = math.max(-3, (-math.abs(velocity.y))-2), z = 0})
|
||||
self:add_velocity({x = 0, y = math.max(-0.3, (-math.abs(velocity.y))-0.03), z = 0})
|
||||
end
|
||||
|
||||
minetest.register_node("mcl_bubble_column:water_source_up", {
|
||||
description = S("Bubble Column Water Source"),
|
||||
_doc_items_entry_name = S("Water"),
|
||||
_doc_items_longdesc = S("Boosts you up"),
|
||||
_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_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},
|
||||
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,
|
||||
})
|
||||
mcl_bubble_column.on_enter_bubble_column_with_air_above = function(self)
|
||||
local velocity = self:get_velocity()
|
||||
--[[if down.name == "mcl_nether:soul_sand" then
|
||||
self:add_velocity({x = 0, y = math.min(4.3, math.abs(velocity.y)+2.8), z = 0})
|
||||
else]]
|
||||
self:add_velocity({x = 0, y = math.min(2.6, math.abs(velocity.y)+2), z = 0})
|
||||
--end
|
||||
end
|
||||
|
||||
mcl_bubble_column.on_enter_whirlpool_with_air_above = function(self)
|
||||
local velocity = self:get_velocity()
|
||||
--self:add_velocity({x = 0, y = math.max(-3.5, (-math.abs(velocity.y))-2), z = 0})
|
||||
self:add_velocity({x = 0, y = math.max(-0.9, (-math.abs(velocity.y))-0.03), z = 0})
|
||||
end
|
||||
|
||||
minetest.register_abm{
|
||||
label = "entGo",
|
||||
nodenames = {"group:water"},
|
||||
interval = 0.05,
|
||||
chance = 1,
|
||||
action = function(pos)
|
||||
--if not bubble column block return
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_int("bubbly") == 1 then
|
||||
local up = minetest.get_node(vector.add(pos, {x = 0, y = 1, z = 0}))
|
||||
for _,entity in pairs(minetest.get_objects_inside_radius(pos, 0.75)) do
|
||||
if up.name == "air" then
|
||||
mcl_bubble_column.on_enter_bubble_column_with_air_above(entity)
|
||||
else
|
||||
mcl_bubble_column.on_enter_bubble_column(entity)
|
||||
end
|
||||
end
|
||||
elseif meta:get_int("whirly") == 1 then
|
||||
local up = minetest.get_node(vector.add(pos, {x = 0, y = 1, z = 0}))
|
||||
for _,entity in pairs(minetest.get_objects_inside_radius(pos, 0.75)) do
|
||||
if up.name == "air" then
|
||||
mcl_bubble_column.on_enter_whirlpool_with_air_above(entity)
|
||||
else
|
||||
mcl_bubble_column.on_enter_whirlpool(entity)
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
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_up" then
|
||||
local velocity = player:get_player_velocity()
|
||||
local velocityadd = {x = 0, y = 3, z = 0}
|
||||
player:add_player_velocity(velocityadd)
|
||||
local ppos = player:get_pos()
|
||||
local eyepos = {x = ppos.x, y = ppos.y + player:get_properties().eye_height, z = ppos.z}
|
||||
local node = minetest.get_node(ppos)
|
||||
local eyenode = minetest.get_node(eyepos)
|
||||
local meta = minetest.get_meta(ppos)
|
||||
local eyemeta = minetest.get_meta(eyepos)
|
||||
|
||||
local eyemeta = minetest.get_meta(ppos)
|
||||
--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)
|
||||
|
||||
--abms to remove and replace old bubble columns/whirlpools
|
||||
minetest.register_abm{
|
||||
label = "entities go up",
|
||||
nodenames = {"mcl_bubble_column:water_source_up"},
|
||||
interval = 0.05,
|
||||
label = "removeOldFlowingColumns",
|
||||
nodenames = {"mcl_bubble_column:water_flowing_up", "mcl_bubble_column:water_flowing_down"},
|
||||
interval = 1,--reduce lag
|
||||
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 = 2, z = 0}
|
||||
entity:add_velocity(velocityadd)
|
||||
end
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
end,
|
||||
}
|
||||
|
||||
minetest.register_abm{
|
||||
label = "bubbles go up",
|
||||
label = "replaceBubbleColumns",
|
||||
nodenames = {"mcl_bubble_column:water_source_up"},
|
||||
interval = 1,
|
||||
interval = 1,--reduce lag
|
||||
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
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("bubbly", 1)
|
||||
end,
|
||||
}
|
||||
minetest.register_abm{
|
||||
label = "bubbles up",
|
||||
nodenames = {"mcl_bubble_column:water_source_up"},
|
||||
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,
|
||||
}
|
||||
--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",
|
||||
label = "replaceWhirlpools",
|
||||
nodenames = {"mcl_bubble_column:water_source_down"},
|
||||
interval = 0.05,
|
||||
interval = 1,--reduce lag
|
||||
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"
|
||||
})
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("whirly", 1)
|
||||
end,
|
||||
}
|
|
@ -58,26 +58,27 @@ function mcl_loot.get_loot(loot_definitions, pr)
|
|||
end
|
||||
if item then
|
||||
local itemstring = item.itemstring
|
||||
local itemstack = item.itemstack
|
||||
|
||||
if itemstring then
|
||||
local stack = ItemStack(itemstring)
|
||||
|
||||
if item.amount_min and item.amount_max then
|
||||
itemstring = itemstring .. " " .. pr:next(item.amount_min, item.amount_max)
|
||||
stack:set_count(pr:next(item.amount_min, item.amount_max))
|
||||
end
|
||||
|
||||
if item.wear_min and item.wear_max then
|
||||
-- Sadly, PseudoRandom only allows very narrow ranges, so we set wear in steps of 10
|
||||
local wear_min = math.floor(item.wear_min / 10)
|
||||
local wear_max = math.floor(item.wear_max / 10)
|
||||
local wear = pr:next(wear_min, wear_max) * 10
|
||||
|
||||
if not item.amount_min and not item.amount_max then
|
||||
itemstring = itemstring .. " 1"
|
||||
stack:set_wear(pr:next(wear_min, wear_max) * 10)
|
||||
end
|
||||
|
||||
itemstring = itemstring .. " " .. tostring(wear)
|
||||
if item.func then
|
||||
item.func(stack, pr)
|
||||
end
|
||||
table.insert(items, itemstring)
|
||||
elseif itemstack then
|
||||
table.insert(items, itemstack)
|
||||
|
||||
table.insert(items, stack)
|
||||
else
|
||||
minetest.log("error", "[mcl_loot] INTERNAL ERROR! Failed to select random loot item!")
|
||||
end
|
||||
|
|
|
@ -31,6 +31,7 @@ local spawn_children_on_die = function(child_mob, children_count, spawn_distance
|
|||
speed_penalty = 0.5
|
||||
end
|
||||
local mob = minetest.add_entity(newpos, child_mob)
|
||||
if mob then
|
||||
if (not mother_stuck) then
|
||||
mob:set_velocity(vector.multiply(dir, eject_speed * speed_penalty))
|
||||
end
|
||||
|
@ -38,6 +39,7 @@ local spawn_children_on_die = function(child_mob, children_count, spawn_distance
|
|||
table.insert(children, mob)
|
||||
angle = angle + (math.pi*2)/children_count
|
||||
end
|
||||
end
|
||||
-- If mother was murdered, children attack the killer after 1 second
|
||||
if self.state == "attack" then
|
||||
minetest.after(1.0, function(children, enemy)
|
||||
|
|
|
@ -409,7 +409,7 @@ local init_trades = function(self, inv)
|
|||
local offered_stack = ItemStack({name = offered_item, count = offered_count})
|
||||
if mcl_enchanting.is_enchanted(offered_item) then
|
||||
if mcl_enchanting.is_book(offered_item) then
|
||||
offered_stack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"})
|
||||
mcl_enchanting.enchant_uniform_randomly(offered_stack, {"soul_speed"})
|
||||
else
|
||||
mcl_enchanting.enchant_randomly(offered_stack, math.random(5, 19), false, false, true)
|
||||
mcl_enchanting.unload_enchantments(offered_stack)
|
||||
|
|
|
@ -19,6 +19,7 @@ local set_node = minetest.set_node
|
|||
local sound_play = minetest.sound_play
|
||||
local add_particlespawner = minetest.add_particlespawner
|
||||
local after = minetest.after
|
||||
local add_entity = minetest.add_entity
|
||||
local get_objects_inside_radius = minetest.get_objects_inside_radius
|
||||
local get_item_group = minetest.get_item_group
|
||||
|
||||
|
@ -206,7 +207,7 @@ lightning.register_on_strike(function(pos, pos2, objects)
|
|||
if get_node(pos2).name == "air" then
|
||||
-- Low chance for a lightning to spawn skeleton horse + skeletons
|
||||
if skeleton_lightning then
|
||||
minetest.add_entity(pos2, "mobs_mc:skeleton_horse")
|
||||
add_entity(pos2, "mobs_mc:skeleton_horse")
|
||||
|
||||
local angle, posadd
|
||||
angle = math.random(0, math.pi*2)
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
minetest.register_on_mods_loaded(function ()
|
||||
local light_min = 1
|
||||
for i, def in pairs(minetest.registered_nodes) do
|
||||
local light_source = def.light_source
|
||||
if light_source == nil or light_source < light_min then
|
||||
minetest.override_item(i, { light_source = light_min })
|
||||
elseif light_source == light_min then
|
||||
minetest.override_item(i, { light_source = light_min + 1 })
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,3 @@
|
|||
name = ambient_light
|
||||
author = MikeRedwood
|
||||
description = Makes all nodes lit to a small degree!
|
|
@ -1,36 +1,66 @@
|
|||
mcl_weather.nether_dust = {}
|
||||
mcl_weather.nether_dust.particles_count = 99
|
||||
mcl_weather.nether_dust.particlespawners = {}
|
||||
|
||||
-- calculates coordinates and draw particles for Nether dust
|
||||
function mcl_weather.nether_dust.add_dust_particles(player)
|
||||
for i=mcl_weather.nether_dust.particles_count, 1,-1 do
|
||||
local rpx, rpy, rpz = mcl_weather.get_random_pos_by_player_look_dir(player)
|
||||
minetest.add_particle({
|
||||
pos = {x = rpx, y = rpy - math.random(6, 18), z = rpz},
|
||||
velocity = {x = math.random(-30,30)*0.01, y = math.random(-15,15)*0.01, z = math.random(-30,30)*0.01},
|
||||
acceleration = {x = math.random(-50,50)*0.02, y = math.random(-20,20)*0.02, z = math.random(-50,50)*0.02},
|
||||
expirationtime = 3,
|
||||
size = math.random(6,20)*0.01,
|
||||
local psdef= {
|
||||
amount = 150,
|
||||
time = 0,
|
||||
minpos = vector.new(-15,-15,-15),
|
||||
maxpos =vector.new(15,15,15),
|
||||
minvel = vector.new(-0.3,-0.15,-1),
|
||||
maxvel = vector.new(0.3,0.15,0.3),
|
||||
minacc = vector.new(-1,-0.4,-1),
|
||||
maxacc = vector.new(1,0.4,1),
|
||||
minexptime = 1,
|
||||
maxexptime = 10,
|
||||
minsize = 0.2,
|
||||
maxsize = 0.7,
|
||||
collisiondetection = false,
|
||||
collision_removal = false,
|
||||
object_collision = false,
|
||||
vertical = false,
|
||||
glow = math.random(0,minetest.LIGHT_MAX),
|
||||
texture = "mcl_particles_nether_dust"..tostring(i%3+1)..".png",
|
||||
playername = player:get_player_name()
|
||||
})
|
||||
vertical = false
|
||||
}
|
||||
|
||||
local function check_player(player)
|
||||
local name=player:get_player_name(name)
|
||||
if mcl_worlds.has_dust(player:get_pos()) and not mcl_weather.nether_dust.particlespawners[name] then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
timer = timer + dtime
|
||||
if timer < 0.7 then return end
|
||||
timer = 0
|
||||
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
if not mcl_worlds.has_dust(player:get_pos()) then
|
||||
return false
|
||||
mcl_weather.nether_dust.add_particlespawners = function(player)
|
||||
local name=player:get_player_name(name)
|
||||
mcl_weather.nether_dust.particlespawners[name]={}
|
||||
psdef.playername = name
|
||||
psdef.attached = player
|
||||
psdef.glow = math.random(0,minetest.LIGHT_MAX)
|
||||
for i=1,3 do
|
||||
psdef.texture="mcl_particles_nether_dust"..i..".png"
|
||||
mcl_weather.nether_dust.particlespawners[name][i]=minetest.add_particlespawner(psdef)
|
||||
end
|
||||
mcl_weather.nether_dust.add_dust_particles(player)
|
||||
end
|
||||
|
||||
mcl_weather.nether_dust.delete_particlespawners = function(player)
|
||||
local name=player:get_player_name(name)
|
||||
if mcl_weather.nether_dust.particlespawners[name] then
|
||||
for i=1,3 do
|
||||
minetest.delete_particlespawner(mcl_weather.nether_dust.particlespawners[name][i])
|
||||
end
|
||||
mcl_weather.nether_dust.particlespawners[name]=nil
|
||||
end
|
||||
end
|
||||
|
||||
mcl_worlds.register_on_dimension_change(function(player, dimension)
|
||||
if check_player(player) then
|
||||
return mcl_weather.nether_dust.add_particlespawners(player)
|
||||
end
|
||||
mcl_weather.nether_dust.delete_particlespawners(player)
|
||||
end)
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
if check_player(player) then
|
||||
mcl_weather.nether_dust.add_particlespawners(player)
|
||||
end
|
||||
end)
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
mcl_weather.nether_dust.delete_particlespawners(player)
|
||||
end)
|
|
@ -123,7 +123,7 @@ function mcl_enchanting.can_enchant(itemstack, enchantment, level)
|
|||
if itemname == "" then
|
||||
return false, "item missing"
|
||||
end
|
||||
local supported, primary = mcl_enchanting.item_supports_enchantment(itemstack:get_name(), enchantment)
|
||||
local supported, primary = mcl_enchanting.item_supports_enchantment(itemname, enchantment)
|
||||
if not supported then
|
||||
return false, "item not supported"
|
||||
end
|
||||
|
@ -295,50 +295,73 @@ function mcl_enchanting.initialize()
|
|||
end
|
||||
end
|
||||
|
||||
function mcl_enchanting.get_possible_enchantments(itemstack, enchantment_level, treasure)
|
||||
local possible_enchantments, weights, accum_weight = {}, {}, 0
|
||||
for enchantment, enchantment_def in pairs(mcl_enchanting.enchantments) do
|
||||
local _, _, _, primary = mcl_enchanting.can_enchant(itemstack, enchantment, 1)
|
||||
if primary or treasure then
|
||||
table.insert(possible_enchantments, enchantment)
|
||||
accum_weight = accum_weight + enchantment_def.weight
|
||||
weights[enchantment] = accum_weight
|
||||
function mcl_enchanting.random(pr, ...)
|
||||
local r = pr and pr:next(...) or math.random(...)
|
||||
|
||||
if pr and not ({...})[1] then
|
||||
r = r / 32767
|
||||
end
|
||||
end
|
||||
return possible_enchantments, weights, accum_weight
|
||||
|
||||
return r
|
||||
end
|
||||
|
||||
function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted)
|
||||
function mcl_enchanting.get_random_enchantment(itemstack, treasure, weighted, exclude, pr)
|
||||
local possible = {}
|
||||
|
||||
for enchantment, enchantment_def in pairs(mcl_enchanting.enchantments) do
|
||||
local can_enchant, _, _, primary = mcl_enchanting.can_enchant(itemstack, enchantment, 1)
|
||||
|
||||
if can_enchant and (primary or treasure) and (not exclude or table.indexof(exclude, enchantment) == -1) then
|
||||
local weight = weighted and enchantment_def.weight or 1
|
||||
|
||||
for i = 1, weight do
|
||||
table.insert(possible, enchantment)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return #possible > 0 and possible[mcl_enchanting.random(pr, 1, #possible)]
|
||||
end
|
||||
|
||||
function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr)
|
||||
local itemname = itemstack:get_name()
|
||||
|
||||
if not mcl_enchanting.can_enchant_freshly(itemname) and not ignore_already_enchanted then
|
||||
return
|
||||
end
|
||||
|
||||
itemstack = ItemStack(itemstack)
|
||||
|
||||
local enchantability = minetest.get_item_group(itemname, "enchantability")
|
||||
enchantability = 1 + math.random(0, math.floor(enchantability / 4)) + math.random(0, math.floor(enchantability / 4))
|
||||
enchantability = 1 + mcl_enchanting.random(pr, 0, math.floor(enchantability / 4)) + mcl_enchanting.random(pr, 0, math.floor(enchantability / 4))
|
||||
|
||||
enchantment_level = enchantment_level + enchantability
|
||||
enchantment_level = enchantment_level + enchantment_level * (math.random() + math.random() - 1) * 0.15
|
||||
enchantment_level = enchantment_level + enchantment_level * (mcl_enchanting.random(pr) + mcl_enchanting.random(pr) - 1) * 0.15
|
||||
enchantment_level = math.max(math.floor(enchantment_level + 0.5), 1)
|
||||
|
||||
local enchantments = {}
|
||||
local description
|
||||
|
||||
enchantment_level = enchantment_level * 2
|
||||
|
||||
repeat
|
||||
enchantment_level = math.floor(enchantment_level / 2)
|
||||
|
||||
if enchantment_level == 0 then
|
||||
break
|
||||
end
|
||||
local possible, weights, accum_weight = mcl_enchanting.get_possible_enchantments(itemstack, enchantment_level, treasure)
|
||||
local selected_enchantment, enchantment_power
|
||||
if #possible > 0 then
|
||||
local r = math.random(accum_weight)
|
||||
for _, enchantment in ipairs(possible) do
|
||||
if weights[enchantment] >= r then
|
||||
selected_enchantment = enchantment
|
||||
|
||||
local selected_enchantment = mcl_enchanting.get_random_enchantment(itemstack, treasure, true, nil, pr)
|
||||
|
||||
if not selected_enchantment then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local enchantment_def = mcl_enchanting.enchantments[selected_enchantment]
|
||||
local power_range_table = enchantment_def.power_range_table
|
||||
|
||||
local enchantment_power
|
||||
|
||||
for i = enchantment_def.max_level, 1, -1 do
|
||||
local power_range = power_range_table[i]
|
||||
if enchantment_level >= power_range[1] and enchantment_level <= power_range[2] then
|
||||
|
@ -346,64 +369,51 @@ function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_leve
|
|||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not description then
|
||||
if not enchantment_power then
|
||||
return
|
||||
end
|
||||
|
||||
description = mcl_enchanting.get_enchantment_description(selected_enchantment, enchantment_power)
|
||||
end
|
||||
|
||||
if enchantment_power then
|
||||
enchantments[selected_enchantment] = enchantment_power
|
||||
mcl_enchanting.enchant(itemstack, selected_enchantment, enchantment_power)
|
||||
end
|
||||
else
|
||||
break
|
||||
end
|
||||
until not no_reduced_bonus_chance and math.random() >= (enchantment_level + 1) / 50
|
||||
|
||||
until not no_reduced_bonus_chance and mcl_enchanting.random(pr) >= (enchantment_level + 1) / 50
|
||||
|
||||
return enchantments, description
|
||||
end
|
||||
|
||||
function mcl_enchanting.generate_random_enchantments_reliable(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted)
|
||||
function mcl_enchanting.generate_random_enchantments_reliable(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr)
|
||||
local enchantments
|
||||
|
||||
repeat
|
||||
enchantments = mcl_enchanting.generate_random_enchantments(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted)
|
||||
enchantments = mcl_enchanting.generate_random_enchantments(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr)
|
||||
until enchantments
|
||||
|
||||
return enchantments
|
||||
end
|
||||
|
||||
function mcl_enchanting.enchant_randomly(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted)
|
||||
function mcl_enchanting.enchant_randomly(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr)
|
||||
local enchantments = mcl_enchanting.generate_random_enchantments_reliable(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr)
|
||||
|
||||
mcl_enchanting.set_enchanted_itemstring(itemstack)
|
||||
mcl_enchanting.set_enchantments(itemstack, mcl_enchanting.generate_random_enchantments_reliable(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted))
|
||||
mcl_enchanting.set_enchantments(itemstack, enchantments)
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
||||
function mcl_enchanting.get_randomly_enchanted_book(enchantment_level, treasure, no_reduced_bonus_chance)
|
||||
return mcl_enchanting.enchant_randomly(ItemStack("mcl_books:book"), enchantment_level, treasure, no_reduced_bonus_chance, true)
|
||||
end
|
||||
function mcl_enchanting.enchant_uniform_randomly(stack, exclude, pr)
|
||||
local enchantment = mcl_enchanting.get_random_enchantment(stack, true, false, exclude, pr)
|
||||
|
||||
function mcl_enchanting.get_uniform_randomly_enchanted_book(except, pr)
|
||||
except = except or except
|
||||
local stack = ItemStack("mcl_enchanting:book_enchanted")
|
||||
local list = {}
|
||||
for enchantment in pairs(mcl_enchanting.enchantments) do
|
||||
if table.indexof(except, enchantment) == -1 then
|
||||
table.insert(list, enchantment)
|
||||
if enchantment then
|
||||
mcl_enchanting.enchant(stack, enchantment, mcl_enchanting.random(pr, 1, mcl_enchanting.enchantments[enchantment].max_level))
|
||||
end
|
||||
end
|
||||
local index, level
|
||||
if pr then
|
||||
index = pr:next(1,#list)
|
||||
else
|
||||
index = math.random(#list)
|
||||
end
|
||||
local enchantment = list[index]
|
||||
local enchantment_def = mcl_enchanting.enchantments[enchantment]
|
||||
if pr then
|
||||
level = pr:next(1, enchantment_def.max_level)
|
||||
else
|
||||
level = math.random(enchantment_def.max_level)
|
||||
end
|
||||
mcl_enchanting.enchant(stack, enchantment, level)
|
||||
|
||||
return stack
|
||||
end
|
||||
|
||||
|
|
|
@ -71,7 +71,9 @@ local fish = function(itemstack, player, pointed_thing)
|
|||
{ itemstring = "mcl_fishing:salmon_raw", weight = 25 },
|
||||
{ itemstring = "mcl_fishing:clownfish_raw", weight = 2 },
|
||||
{ itemstring = "mcl_fishing:pufferfish_raw", weight = 13 },
|
||||
}
|
||||
},
|
||||
stacks_min = 1,
|
||||
stacks_max = 1,
|
||||
}, pr)
|
||||
elseif r <= junk_value then
|
||||
-- Junk
|
||||
|
@ -88,21 +90,29 @@ local fish = function(itemstack, player, pointed_thing)
|
|||
{ itemstring = "mcl_mobitems:bone", weight = 10 },
|
||||
{ itemstring = "mcl_dye:black", weight = 1, amount_min = 10, amount_max = 10 },
|
||||
{ itemstring = "mcl_mobitems:string", weight = 10 }, -- TODO: Tripwire Hook
|
||||
}
|
||||
},
|
||||
stacks_min = 1,
|
||||
stacks_max = 1,
|
||||
}, pr)
|
||||
else
|
||||
-- Treasure
|
||||
items = mcl_loot.get_loot({
|
||||
items = {
|
||||
-- TODO: Enchanted Bow
|
||||
{ itemstring = "mcl_bows:bow", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage
|
||||
{ itemstack = mcl_enchanting.get_randomly_enchanted_book(30, true, true)},
|
||||
-- TODO: Enchanted Fishing Rod
|
||||
{ itemstring = "mcl_fishing:fishing_rod", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage
|
||||
{ itemstring = "mcl_bows:bow", wear_min = 49144, wear_max = 65535, func = function(stack, pr)
|
||||
mcl_enchanting.enchant_randomly(stack, 30, true, false, false, pr)
|
||||
end }, -- 75%-100% damage
|
||||
{ itemstring = "mcl_books:book", func = function(stack, pr)
|
||||
mcl_enchanting.enchant_randomly(stack, 30, true, true, false, pr)
|
||||
end },
|
||||
{ itemstring = "mcl_fishing:fishing_rod", wear_min = 49144, wear_max = 65535, func = function(stack, pr)
|
||||
mcl_enchanting.enchant_randomly(stack, 30, true, false, false, pr)
|
||||
end }, -- 75%-100% damage
|
||||
{ itemstring = "mcl_mobs:nametag", },
|
||||
{ itemstring = "mcl_mobitems:saddle", },
|
||||
{ itemstring = "mcl_flowers:waterlily", },
|
||||
}
|
||||
},
|
||||
stacks_min = 1,
|
||||
stacks_max = 1,
|
||||
}, pr)
|
||||
end
|
||||
local item
|
||||
|
|
|
@ -350,7 +350,7 @@ minetest.register_abm({
|
|||
local inv = meta:get_inventory()
|
||||
|
||||
for _,object in pairs(minetest.get_objects_inside_radius(pos, 2)) do
|
||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and not object:get_luaentity()._removed then
|
||||
if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
||||
-- Item must get sucked in when the item just TOUCHES the block above the hopper
|
||||
-- This is the reason for the Y calculation.
|
||||
|
|
|
@ -242,6 +242,11 @@ local function destroy_nether_portal(pos, node)
|
|||
check_remove({x = pos.x, y = pos.y + 1, z = pos.z})
|
||||
end
|
||||
|
||||
local on_rotate
|
||||
if minetest.get_modpath("screwdriver") then
|
||||
on_rotate = screwdriver.disallow
|
||||
end
|
||||
|
||||
minetest.register_node(PORTAL, {
|
||||
description = S("Nether Portal"),
|
||||
_doc_items_longdesc = S("A Nether portal teleports creatures and objects to the hot and dangerous Nether dimension (and back!). Enter at your own risk!"),
|
||||
|
@ -291,6 +296,7 @@ minetest.register_node(PORTAL, {
|
|||
groups = { creative_breakable = 1, portal = 1, not_in_creative_inventory = 1 },
|
||||
sounds = mcl_sounds.node_sound_glass_defaults(),
|
||||
after_destruct = destroy_nether_portal,
|
||||
on_rotate = on_rotate,
|
||||
|
||||
_mcl_hardness = -1,
|
||||
_mcl_blast_resistance = 0,
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# mcl_tridents by j45
|
||||
|
||||
Adds tridents to MineClone2.
|
|
@ -0,0 +1,87 @@
|
|||
local S = minetest.get_translator("mcl_tridents")
|
||||
local cooldown = {}
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
cooldown[player:get_player_name()] = false
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
cooldown[player:get_player_name()] = false
|
||||
end)
|
||||
|
||||
local GRAVITY = 9.81
|
||||
local TRIDENT_DURABILITY = 251
|
||||
local TRIDENT_COOLDOWN = 0.91
|
||||
|
||||
local TRIDENT_ENTITY = {
|
||||
physical = true,
|
||||
pointable = false,
|
||||
visual = "mesh",
|
||||
mesh = "mcl_trident.obj",
|
||||
visual_size = {x=-1, y=1},
|
||||
textures = {"mcl_trident.png"},
|
||||
collisionbox = {-.1, -.1, -1, .1, .1, 0.5},
|
||||
collide_with_objects = true,
|
||||
_fire_damage_resistant = true,
|
||||
|
||||
_lastpos={},
|
||||
_startpos=nil,
|
||||
_damage=8, -- Damage on impact
|
||||
_is_critical=false,
|
||||
_stuck=false, -- Whether arrow is stuck
|
||||
_stucktimer=nil,-- Amount of time (in seconds) the arrow has been stuck so far
|
||||
_stuckrechecktimer=nil,-- An additional timer for periodically re-checking the stuck status of an arrow
|
||||
_stuckin=nil, --Position of node in which arow is stuck.
|
||||
_shooter=nil, -- ObjectRef of player or mob who shot it
|
||||
|
||||
_viscosity=0, -- Viscosity of node the arrow is currently in
|
||||
_deflection_cooloff=0, -- Cooloff timer after an arrow deflection, to prevent many deflections in quick succession
|
||||
}
|
||||
|
||||
minetest.register_entity("mcl_tridents:trident_entity", TRIDENT_ENTITY)
|
||||
|
||||
local spawn_trident = function(player)
|
||||
local wielditem = player:get_wielded_item()
|
||||
local obj = minetest.add_entity(vector.add(player:get_pos(), {x = 0, y = 1.5, z = 0}), "mcl_tridents:trident_entity")
|
||||
local yaw = player:get_look_horizontal()+math.pi/2
|
||||
|
||||
if cooldown[player:get_player_name()] then
|
||||
return
|
||||
end
|
||||
|
||||
cooldown[player:get_player_name()] = true
|
||||
|
||||
minetest.after(TRIDENT_COOLDOWN, function()
|
||||
cooldown[player:get_player_name()] = false
|
||||
end)
|
||||
|
||||
if obj then
|
||||
local durability = TRIDENT_DURABILITY
|
||||
local unbreaking = mcl_enchanting.get_enchantment(wielditem, "unbreaking")
|
||||
if unbreaking > 0 then
|
||||
durability = durability * (unbreaking + 1)
|
||||
end
|
||||
wielditem:add_wear(65535/durability)
|
||||
minetest.chat_send_all(wielditem:get_wear())
|
||||
obj:set_velocity(vector.multiply(player:get_look_dir(), 20))
|
||||
obj:set_acceleration({x=0, y=-GRAVITY, z=0})
|
||||
obj:set_yaw(yaw)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
minetest.register_tool("mcl_tridents:trident", {
|
||||
description = S("Trident"),
|
||||
_tt_help = S("Launches a trident when you rightclick and it is in your hand"),
|
||||
_doc_items_durability = TRIDENT_DURABILITY,
|
||||
inventory_image = "mcl_trident_inv.png",
|
||||
stack_max = 1,
|
||||
groups = {weapon=1,weapon_ranged=1,trident=1,enchantability=1},
|
||||
_mcl_uses = TRIDENT_DURABILITY,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
spawn_trident(placer)
|
||||
end,
|
||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||
spawn_trident(user)
|
||||
end
|
||||
})
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 299 B |
|
@ -63,6 +63,67 @@ local surround_vectors = {
|
|||
{ x=0, y=0, z=1 },
|
||||
}
|
||||
|
||||
local loottable =
|
||||
{
|
||||
{
|
||||
stacks_min = 1,
|
||||
stacks_max = 3,
|
||||
items = {
|
||||
{ itemstring = "mcl_mobs:nametag", weight = 20 },
|
||||
{ itemstring = "mcl_mobitems:saddle", weight = 20 },
|
||||
{ itemstring = "mcl_jukebox:record_1", weight = 15 },
|
||||
{ itemstring = "mcl_jukebox:record_4", weight = 15 },
|
||||
{ itemstring = "mobs_mc:iron_horse_armor", weight = 15 },
|
||||
{ itemstring = "mcl_core:apple_gold", weight = 15 },
|
||||
{ itemstring = "mcl_books:book", weight = 10, func = function(stack, pr)
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
|
||||
end },
|
||||
{ itemstring = "mobs_mc:gold_horse_armor", weight = 10 },
|
||||
{ itemstring = "mobs_mc:diamond_horse_armor", weight = 5 },
|
||||
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2 },
|
||||
}
|
||||
},
|
||||
{
|
||||
stacks_min = 1,
|
||||
stacks_max = 4,
|
||||
items = {
|
||||
{ itemstring = "mcl_farming:wheat_item", weight = 20, amount_min = 1, amount_max = 4 },
|
||||
{ itemstring = "mcl_farming:bread", weight = 20 },
|
||||
{ itemstring = "mcl_core:coal_lump", weight = 15, amount_min = 1, amount_max = 4 },
|
||||
{ itemstring = "mesecons:redstone", weight = 15, amount_min = 1, amount_max = 4 },
|
||||
{ itemstring = "mcl_farming:beetroot_seeds", weight = 10, amount_min = 2, amount_max = 4 },
|
||||
{ itemstring = "mcl_farming:melon_seeds", weight = 10, amount_min = 2, amount_max = 4 },
|
||||
{ itemstring = "mcl_farming:pumpkin_seeds", weight = 10, amount_min = 2, amount_max = 4 },
|
||||
{ itemstring = "mcl_core:iron_ingot", weight = 10, amount_min = 1, amount_max = 4 },
|
||||
{ itemstring = "mcl_buckets:bucket_empty", weight = 10 },
|
||||
{ itemstring = "mcl_core:gold_ingot", weight = 5, amount_min = 1, amount_max = 4 },
|
||||
},
|
||||
},
|
||||
{
|
||||
stacks_min = 3,
|
||||
stacks_max = 3,
|
||||
items = {
|
||||
{ itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 1, amount_max = 8 },
|
||||
{ itemstring = "mcl_mobitems:gunpowder", weight = 10, amount_min = 1, amount_max = 8 },
|
||||
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 10, amount_min = 1, amount_max = 8 },
|
||||
{ itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
-- Bonus loot for v6 mapgen: Otherwise unobtainable saplings.
|
||||
if mg_name == "v6" then
|
||||
table.insert(loottable, {
|
||||
stacks_min = 1,
|
||||
stacks_max = 3,
|
||||
items = {
|
||||
{ itemstring = "mcl_core:birchsapling", weight = 1, amount_min = 1, amount_max = 2 },
|
||||
{ itemstring = "mcl_core:acaciasapling", weight = 1, amount_min = 1, amount_max = 2 },
|
||||
{ itemstring = "", weight = 6 },
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
|
||||
if calls_remaining >= 1 then return end
|
||||
|
||||
|
@ -310,66 +371,6 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
|
|||
|
||||
set_node(pos, {name="mcl_chests:chest", param2=facedir})
|
||||
local meta = get_meta(pos)
|
||||
|
||||
local loottable =
|
||||
{
|
||||
{
|
||||
stacks_min = 1,
|
||||
stacks_max = 3,
|
||||
items = {
|
||||
{ itemstring = "mcl_mobs:nametag", weight = 20 },
|
||||
{ itemstring = "mcl_mobitems:saddle", weight = 20 },
|
||||
{ itemstring = "mcl_jukebox:record_1", weight = 15 },
|
||||
{ itemstring = "mcl_jukebox:record_4", weight = 15 },
|
||||
{ itemstring = "mobs_mc:iron_horse_armor", weight = 15 },
|
||||
{ itemstring = "mcl_core:apple_gold", weight = 15 },
|
||||
{ itemstack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"}, pr), weight = 10 },
|
||||
{ itemstring = "mobs_mc:gold_horse_armor", weight = 10 },
|
||||
{ itemstring = "mobs_mc:diamond_horse_armor", weight = 5 },
|
||||
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2 },
|
||||
}
|
||||
},
|
||||
{
|
||||
stacks_min = 1,
|
||||
stacks_max = 4,
|
||||
items = {
|
||||
{ itemstring = "mcl_farming:wheat_item", weight = 20, amount_min = 1, amount_max = 4 },
|
||||
{ itemstring = "mcl_farming:bread", weight = 20 },
|
||||
{ itemstring = "mcl_core:coal_lump", weight = 15, amount_min = 1, amount_max = 4 },
|
||||
{ itemstring = "mesecons:redstone", weight = 15, amount_min = 1, amount_max = 4 },
|
||||
{ itemstring = "mcl_farming:beetroot_seeds", weight = 10, amount_min = 2, amount_max = 4 },
|
||||
{ itemstring = "mcl_farming:melon_seeds", weight = 10, amount_min = 2, amount_max = 4 },
|
||||
{ itemstring = "mcl_farming:pumpkin_seeds", weight = 10, amount_min = 2, amount_max = 4 },
|
||||
{ itemstring = "mcl_core:iron_ingot", weight = 10, amount_min = 1, amount_max = 4 },
|
||||
{ itemstring = "mcl_buckets:bucket_empty", weight = 10 },
|
||||
{ itemstring = "mcl_core:gold_ingot", weight = 5, amount_min = 1, amount_max = 4 },
|
||||
},
|
||||
},
|
||||
{
|
||||
stacks_min = 3,
|
||||
stacks_max = 3,
|
||||
items = {
|
||||
{ itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 1, amount_max = 8 },
|
||||
{ itemstring = "mcl_mobitems:gunpowder", weight = 10, amount_min = 1, amount_max = 8 },
|
||||
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 10, amount_min = 1, amount_max = 8 },
|
||||
{ itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
-- Bonus loot for v6 mapgen: Otherwise unobtainable saplings.
|
||||
if mg_name == "v6" then
|
||||
table_insert(loottable, {
|
||||
stacks_min = 1,
|
||||
stacks_max = 3,
|
||||
items = {
|
||||
{ itemstring = "mcl_core:birchsapling", weight = 1, amount_min = 1, amount_max = 2 },
|
||||
{ itemstring = "mcl_core:acaciasapling", weight = 1, amount_min = 1, amount_max = 2 },
|
||||
{ itemstring = "", weight = 6 },
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
minetest.log("action", "[mcl_dungeons] Filling chest " .. tostring(c) .. " at " .. minetest.pos_to_string(pos))
|
||||
mcl_loot.fill_inventory(meta:get_inventory(), "main", mcl_loot.get_multi_loot(loottable, pr), pr)
|
||||
end
|
||||
|
|
|
@ -454,7 +454,9 @@ local function temple_placement_callback(p1, p2, size, rotation, pr)
|
|||
{ itemstring = "mcl_mobitems:bone", weight = 25, amount_min = 4, amount_max=6 },
|
||||
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 25, amount_min = 3, amount_max=7 },
|
||||
{ itemstring = "mcl_mobitems:spider_eye", weight = 25, amount_min = 1, amount_max=3 },
|
||||
{ itemstack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"}, pr), weight = 20, },
|
||||
{ itemstring = "mcl_books:book", weight = 20, func = function(stack, pr)
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
|
||||
end },
|
||||
{ itemstring = "mcl_mobitems:saddle", weight = 20, },
|
||||
{ itemstring = "mcl_core:apple_gold", weight = 20, },
|
||||
{ itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 },
|
||||
|
|
|
@ -66,7 +66,9 @@ function tsm_railcorridors.get_treasures(pr)
|
|||
items = {
|
||||
{ itemstring = "mcl_mobs:nametag", weight = 30 },
|
||||
{ itemstring = "mcl_core:apple_gold", weight = 20 },
|
||||
{ itemstack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"}, pr), weight = 10 },
|
||||
{ itemstring = "mcl_books:book", weight = 10, func = function(stack, pr)
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
|
||||
end },
|
||||
{ itemstring = "", weight = 5},
|
||||
{ itemstring = "mcl_core:pick_iron", weight = 5 },
|
||||
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 1 },
|
||||
|
|
Loading…
Reference in New Issue