mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-28 04:07:31 +01:00
Merge branch 'master' into swimming_fix
This commit is contained in:
commit
d54d8fc657
@ -1,66 +1,55 @@
|
|||||||
-- Dripping Water Mod
|
-- Dripping Water Mod
|
||||||
-- by kddekadenz
|
-- by kddekadenz
|
||||||
|
|
||||||
local math = math
|
|
||||||
|
|
||||||
-- License of code, textures & sounds: CC0
|
-- License of code, textures & sounds: CC0
|
||||||
|
|
||||||
local function register_drop(liquid, glow, sound, nodes)
|
local math = math
|
||||||
minetest.register_entity("mcl_dripping:drop_" .. liquid, {
|
local function make_drop(pos,liquid,sound,interval)
|
||||||
hp_max = 1,
|
local pt = {
|
||||||
physical = true,
|
velocity = vector.new(0,0,0),
|
||||||
collide_with_objects = false,
|
collision_removal = false,
|
||||||
collisionbox = {-0.01, 0.01, -0.01, 0.01, 0.01, 0.01},
|
}
|
||||||
glow = glow,
|
local t = math.random() + math.random(1, interval)
|
||||||
pointable = false,
|
minetest.after(t,function()
|
||||||
visual = "sprite",
|
local x, z = math.random(-45, 45) / 100, math.random(-45, 45) / 100
|
||||||
visual_size = {x = 0.1, y = 0.1},
|
pt.pos = vector.offset(pos,x,-0.52,z)
|
||||||
textures = {""},
|
pt.acceleration = vector.new(0,0,0)
|
||||||
spritediv = {x = 1, y = 1},
|
pt.collisiondetection = false
|
||||||
initial_sprite_basepos = {x = 0, y = 0},
|
pt.expirationtime = t
|
||||||
static_save = false,
|
|
||||||
_dropped = false,
|
pt.texture="[combine:2x2:" .. -math.random(1, 16) .. "," .. -math.random(1, 16) .. "=default_" .. liquid .. "_source_animated.png"
|
||||||
on_activate = function(self)
|
minetest.add_particle(pt)
|
||||||
self.object:set_properties({
|
minetest.after(t,function()
|
||||||
textures = {"[combine:2x2:" .. -math.random(1, 16) .. "," .. -math.random(1, 16) .. "=default_" .. liquid .. "_source_animated.png"}
|
pt.acceleration = vector.new(0,-5,0)
|
||||||
})
|
pt.collisiondetection = true
|
||||||
end,
|
pt.expirationtime = math.random() + math.random(1, interval/2)
|
||||||
on_step = function(self, dtime)
|
minetest.add_particle(pt)
|
||||||
local k = math.random(1, 222)
|
|
||||||
local ownpos = self.object:get_pos()
|
|
||||||
if k == 1 then
|
|
||||||
self.object:set_acceleration(vector.new(0, -5, 0))
|
|
||||||
end
|
|
||||||
if minetest.get_node(vector.offset(ownpos, 0, 0.5, 0)).name == "air" then
|
|
||||||
self.object:set_acceleration(vector.new(0, -5, 0))
|
|
||||||
end
|
|
||||||
if minetest.get_node(vector.offset(ownpos, 0, -0.1, 0)).name ~= "air" then
|
|
||||||
local ent = self.object:get_luaentity()
|
|
||||||
if not ent._dropped then
|
|
||||||
ent._dropped = true
|
|
||||||
minetest.sound_play({name = "drippingwater_" .. sound .. "drip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8}, true)
|
minetest.sound_play({name = "drippingwater_" .. sound .. "drip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8}, true)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
if k < 3 then
|
|
||||||
self.object:remove()
|
local function register_drop(liquid, glow, sound, nodes, interval, chance)
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Create drops",
|
label = "Create drops",
|
||||||
nodenames = nodes,
|
nodenames = nodes,
|
||||||
neighbors = {"group:" .. liquid},
|
neighbors = {"group:" .. liquid},
|
||||||
interval = 2,
|
interval = interval,
|
||||||
chance = 22,
|
chance = chance,
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
if minetest.get_item_group(minetest.get_node(vector.offset(pos, 0, 1, 0)).name, liquid) ~= 0
|
local r = math.ceil(interval / 20)
|
||||||
and minetest.get_node(vector.offset(pos, 0, -1, 0)).name == "air" then
|
local nn=minetest.find_nodes_in_area(vector.offset(pos,-r,0,-r),vector.offset(pos,r,0,r),nodes)
|
||||||
local x, z = math.random(-45, 45) / 100, math.random(-45, 45) / 100
|
--start a bunch of particle cycles to be able to get away
|
||||||
minetest.add_entity(vector.offset(pos, x, -0.520, z), "mcl_dripping:drop_" .. liquid)
|
--with longer abm cycles
|
||||||
|
table.shuffle(nn)
|
||||||
|
for i=1,math.random(#nn) do
|
||||||
|
if minetest.get_item_group(minetest.get_node(vector.offset(nn[i], 0, 1, 0)).name, liquid) ~= 0
|
||||||
|
and minetest.get_node(vector.offset(nn[i], 0, -1, 0)).name == "air" then
|
||||||
|
make_drop(nn[i],liquid,sound,interval)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
register_drop("water", 1, "", {"group:opaque", "group:leaves"})
|
register_drop("water", 1, "", {"group:opaque", "group:leaves"},60,10)
|
||||||
register_drop("lava", math.max(7, minetest.registered_nodes["mcl_core:lava_source"].light_source - 3), "lava", {"group:opaque"})
|
register_drop("lava", math.max(7, minetest.registered_nodes["mcl_core:lava_source"].light_source - 3), "lava", {"group:opaque"},60,10)
|
||||||
|
@ -1702,41 +1702,14 @@ end
|
|||||||
|
|
||||||
-- Obsidian crying
|
-- Obsidian crying
|
||||||
|
|
||||||
local crobby_psdef = {
|
local crobby_particle = {
|
||||||
amount = 1,
|
velocity = vector.new(0,0,0),
|
||||||
time = 0.9, --everything longer than 1 is a coord exploit
|
size = math.random(1.3,2.5),
|
||||||
minvel = vector.new(0,-2,0),
|
|
||||||
maxvel = vector.new(0,-0.5,0),
|
|
||||||
minacc = vector.new(0,-10,0),
|
|
||||||
maxacc = vector.new(0,-8,0),
|
|
||||||
minexptime = 1,
|
|
||||||
maxexptime = 6,
|
|
||||||
minsize = 1.5,
|
|
||||||
maxsize = 2,
|
|
||||||
collisiondetection = true,
|
|
||||||
collision_removal = true,
|
|
||||||
object_collision = true,
|
|
||||||
vertical = true,
|
|
||||||
texture = "mcl_core_crying_obsidian_tear.png",
|
|
||||||
}
|
|
||||||
local crobby_psdef2 = {
|
|
||||||
amount = 1,
|
|
||||||
time = 0.9, --everything longer than 1 is a coord exploit
|
|
||||||
minvel = vector.new(0,-0.01,0),
|
|
||||||
maxvel = vector.new(0,-0.005,0),
|
|
||||||
minacc = vector.new(0,-0.1,0),
|
|
||||||
maxacc = vector.new(0,-0.01,0),
|
|
||||||
minexptime = 2,
|
|
||||||
maxexptime = 3,
|
|
||||||
minsize = 0.3,
|
|
||||||
maxsize = 0.6,
|
|
||||||
collisiondetection = true,
|
|
||||||
collision_removal = true,
|
|
||||||
object_collision = true,
|
|
||||||
vertical = true,
|
|
||||||
texture = "mcl_core_crying_obsidian_tear.png",
|
texture = "mcl_core_crying_obsidian_tear.png",
|
||||||
|
collision_removal = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Obsidian cries",
|
label = "Obsidian cries",
|
||||||
nodenames = {"mcl_core:crying_obsidian"},
|
nodenames = {"mcl_core:crying_obsidian"},
|
||||||
@ -1744,22 +1717,18 @@ minetest.register_abm({
|
|||||||
chance = 10,
|
chance = 10,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
minetest.after(math.random(0.1,1.5),function()
|
minetest.after(math.random(0.1,1.5),function()
|
||||||
crobby_psdef.minpos = vector.offset(pos,-0.6,-0.51,-0.6)
|
local pt = table.copy(crobby_particle)
|
||||||
crobby_psdef.maxpos = vector.offset(pos,0.6,0.51,0.6)
|
pt.acceleration = vector.new(0,0,0)
|
||||||
minetest.add_particlespawner(crobby_psdef)
|
pt.collisiondetection = false
|
||||||
crobby_psdef2.minpos = vector.offset(pos,-0.51,-0.51,-0.51)
|
pt.expirationtime = math.random(0.5,1.5)
|
||||||
crobby_psdef2.maxpos = vector.offset(pos,-0.5,0.51,-0.5)
|
pt.pos = vector.offset(pos,math.random(-0.5,0.5),-0.51,math.random(-0.5,0.5))
|
||||||
minetest.add_particlespawner(crobby_psdef2)
|
minetest.add_particle(pt)
|
||||||
crobby_psdef2.minpos = vector.offset(pos,0.51,-0.51,-0.51)
|
minetest.after(pt.expirationtime,function()
|
||||||
crobby_psdef2.maxpos = vector.offset(pos,0.5,0.51,-0.5)
|
pt.acceleration = vector.new(0,-9,0)
|
||||||
minetest.add_particlespawner(crobby_psdef2)
|
pt.collisiondetection = true
|
||||||
crobby_psdef2.minpos = vector.offset(pos,0.51,-0.51,0.51)
|
pt.expirationtime = math.random(1.2,4.5)
|
||||||
crobby_psdef2.maxpos = vector.offset(pos,0.5,0.51,0.5)
|
minetest.add_particle(pt)
|
||||||
minetest.add_particlespawner(crobby_psdef2)
|
end)
|
||||||
crobby_psdef2.minpos = vector.offset(pos,-0.51,-0.51,0.51)
|
|
||||||
crobby_psdef2.maxpos = vector.offset(pos,-0.5,0.51,0.5)
|
|
||||||
minetest.add_particlespawner(crobby_psdef2)
|
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user