1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-01-13 03:20:26 +01:00

Fix usage of splash potions from witchcraft

This commit is contained in:
sys4-fr 2017-04-05 15:36:06 +02:00
parent 9417e3335d
commit 195f6173d0

View File

@ -1053,19 +1053,38 @@ minetest.register_entity("witchcraft:death_splash", {
damage = 2,
collisionbox = {0, 0, 0, 0, 0, 0},
on_step = function(self, obj, pos)
local remove = minetest.after(2, function()
local remove = minetest.after(5, function()
self.object:remove()
end)
local pos = self.object:getpos()
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "witchcraft:death_splash" and obj:get_luaentity().name ~= "__builtin:item" then
if obj:is_player() then
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy = 50},
}, nil)
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
return
end
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "witchcraft:death_splash" and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= "gauges:hp_bar" then
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy = 50},
}, nil)
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
return
end
end
end
@ -1076,13 +1095,14 @@ minetest.register_entity("witchcraft:death_splash", {
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if n ~= "witchcraft:death_splash" and n ~= "air" then
minetest.sound_play("default_break_glass.1", {
self.object:remove()
elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
self.object:remove()
return
end
@ -1098,19 +1118,39 @@ minetest.register_entity("witchcraft:heal_splash", {
damage = 2,
collisionbox = {0, 0, 0, 0, 0, 0},
on_step = function(self, obj, pos)
local remove = minetest.after(2, function()
local remove = minetest.after(5, function()
self.object:remove()
end)
local pos = self.object:getpos()
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "witchcraft:heal_splash" and obj:get_luaentity().name ~= "__builtin:item" then
if obj:is_player() then
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=-20},
}, nil)
minetest.sound_play("default_break_glass.1", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
return
end
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "witchcraft:heal_splash" and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= "gauges:hp_bar" then
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=-20},
}, nil)
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
return
end
end
end
@ -1121,14 +1161,14 @@ minetest.register_entity("witchcraft:heal_splash", {
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if n ~= "witchcraft:heal_splash" and n ~= "air" then
minetest.sound_play("default_break_glass.1", {
self.object:remove()
elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
self.object:remove()
return
end
end
@ -1143,17 +1183,33 @@ minetest.register_entity("witchcraft:slow_splash", {
damage = 2,
collisionbox = {0, 0, 0, 0, 0, 0},
on_step = function(self, obj, pos)
local remove = minetest.after(2, function()
local remove = minetest.after(5, function()
self.object:remove()
end)
local pos = self.object:getpos()
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:is_player() then
playereffects.apply_effect_type("potion_slow_lv1", 11, obj)
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
return
end
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "witchcraft:slow_splash" and obj:get_luaentity().name ~= "__builtin:item" then
if obj:get_luaentity().name ~= "witchcraft:slow_splash" and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= "gauges:hp_bar" then
local vel = obj:getvelocity()
obj:setvelocity({x=vel.x*0.5, y=vel.y*0.5, z=vel.z*0.5})
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
return
end
end
end
@ -1166,7 +1222,7 @@ minetest.register_entity("witchcraft:slow_splash", {
if n ~= "witchcraft:slow_splash" and n ~= "air" then
self.object:remove()
elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
minetest.sound_play("default_break_glass.1", {
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
@ -1193,7 +1249,7 @@ minetest.register_entity("witchcraft:fast_splash", {
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:is_player() then
playereffects.apply_effect_type("potion_slow_lv1", 11, obj)
playereffects.apply_effect_type("potion_speed_lv1", 11, obj)
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
@ -1225,7 +1281,7 @@ minetest.register_entity("witchcraft:fast_splash", {
if n ~= "witchcraft:fast_splash" and n ~= "air" then
self.object:remove()
elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
minetest.sound_play("default_break_glass.1", {
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
@ -1245,17 +1301,33 @@ minetest.register_entity("witchcraft:antigrav_splash", {
damage = 2,
collisionbox = {0, 0, 0, 0, 0, 0},
on_step = function(self, obj, pos)
local remove = minetest.after(2, function()
local remove = minetest.after(5, function()
self.object:remove()
end)
local pos = self.object:getpos()
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:is_player() then
playereffects.apply_effect_type("potion_antigrav_lvx", 11, obj)
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
return
end
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "witchcraft:antigrav_splash" and obj:get_luaentity().name ~= "__builtin:item" then
if obj:get_luaentity().name ~= "witchcraft:antigrav_splash" and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= "gauges:hp_bar" then
local vel = obj:getvelocity()
obj:setvelocity({x=vel.x*1, y=vel.y*0.1, z=vel.z*1})
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
return
end
end
end
@ -1292,11 +1364,27 @@ minetest.register_entity("witchcraft:jump_splash", {
local pos = self.object:getpos()
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:is_player() then
playereffects.apply_effect_type("potion_jump_lvx", 11, obj)
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
return
end
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "witchcraft:jump_splash" and obj:get_luaentity().name ~= "__builtin:item" then
if obj:get_luaentity().name ~= "witchcraft:jump_splash" and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= "gauges:hp_bar" then
local vel = obj:getvelocity()
obj:setvelocity({x=vel.x*1, y=(vel.y+2)*3, z=vel.z*1})
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
return
end
end
end
@ -1327,19 +1415,33 @@ minetest.register_entity("witchcraft:murky_splash", {
damage = 2,
collisionbox = {0, 0, 0, 0, 0, 0},
on_step = function(self, obj, pos)
local remove = minetest.after(2, function()
local remove = minetest.after(5, function()
self.object:remove()
end)
local pos = self.object:getpos()
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:is_player() then
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=20},
}, nil)
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
return
end
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "witchcraft:murky_splash" and obj:get_luaentity().name ~= "__builtin:item" then
if obj:get_luaentity().name ~= "witchcraft:murky_splash" and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= "gauges:hp_bar" then
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=20},
}, nil)
self.object:remove()
return
end
end
end
@ -1350,14 +1452,14 @@ minetest.register_entity("witchcraft:murky_splash", {
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if n ~= "witchcraft:murky_splash" and n ~= "air" then
minetest.sound_play("default_break_glass.1", {
self.object:remove()
elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
minetest.sound_play("default_break_glass", {
pos = self.object:getpos(),
max_hear_distance = 20,
gain = 10.0,
})
self.object:remove()
elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
self.object:remove()
return
end
end