mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-11 10:30:25 +01:00
fixed mores bug in throwing mod
enable dig_arrow
This commit is contained in:
parent
9ca3ac9383
commit
f1018dfaaf
@ -38,6 +38,9 @@ local THROWING_ARROW_ENTITY={
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
node = "",
|
||||
player = "",
|
||||
inventory = false,
|
||||
stack = false,
|
||||
}
|
||||
|
||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
@ -50,7 +53,6 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "throwing:arrow_build_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
self.object:remove()
|
||||
if self.inventory and self.stack and not minetest.setting_getbool("creative_mode") then
|
||||
self.inventory:remove_item("main", {name=self.stack:get_name()})
|
||||
end
|
||||
@ -63,6 +65,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
else
|
||||
minetest.add_item(self.lastpos, 'default:stick')
|
||||
end
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -70,18 +74,18 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" then
|
||||
self.object:remove()
|
||||
if self.inventory and self.stack and not minetest.setting_getbool("creative_mode") then
|
||||
self.inventory:remove_item("main", {name=self.stack:get_name()})
|
||||
self.inventory:remove_item("main", {name=self.stack:get_name()})
|
||||
end
|
||||
if self.stack then
|
||||
if not string.find(node.name, "water") and not string.find(node.name, "lava") and not string.find(node.name, "torch") and self.stack:get_definition().type == "node" and self.stack:get_name() ~= "default:torch" then
|
||||
if not minetest.is_protected(self.lastpos, self.player) and not string.find(node.name, "water") and not string.find(node.name, "lava") and not string.find(node.name, "torch") and self.stack:get_definition().type == "node" and self.stack:get_name() ~= "default:torch" then
|
||||
minetest.place_node(self.lastpos, {name=self.stack:get_name()})
|
||||
else
|
||||
minetest.add_item(self.lastpos, {name=self.stack:get_name()})
|
||||
end
|
||||
end
|
||||
minetest.add_item(self.lastpos, 'default:shovel_steel')
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
|
@ -37,6 +37,7 @@ local THROWING_ARROW_ENTITY={
|
||||
textures = {"throwing:arrow_dig_box"},
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
player = "",
|
||||
}
|
||||
|
||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
@ -54,26 +55,27 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
if math.random(0,100) % 2 == 0 then -- 50% of chance to drop //MFF (Mg|07/27/15)
|
||||
minetest.add_item(self.lastpos, "throwing:arrow_dig")
|
||||
end
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" then
|
||||
|
||||
if minetest.get_item_group(node.name, "unbreakable") == 0
|
||||
and areas:canInteract(self.lastpos, self.player:get_player_name())
|
||||
if node.name ~= "air" and not string.find(node.name, "water") then
|
||||
if node.name ~= "ignore" and minetest.get_item_group(node.name, "unbreakable") == 0
|
||||
and not minetest.is_protected(self.lastpos, self.player)
|
||||
and node.diggable ~= false then
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
minetest.add_item(self.lastpos, node.name)
|
||||
end
|
||||
minetest.add_item(self.lastpos, node.name)
|
||||
minetest.add_item(self.lastpos, "throwing:arrow_dig")
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
|
@ -37,6 +37,7 @@ local THROWING_ARROW_ENTITY={
|
||||
textures = {"throwing:arrow_fire_box"},
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
player = "",
|
||||
}
|
||||
|
||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
@ -54,10 +55,11 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
if math.random(0,100) % 2 == 0 then -- 50% of chance to drop //MFF (Mg|07/27/15)
|
||||
minetest.add_item(self.lastpos, 'default:stick')
|
||||
end
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -67,6 +69,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
if node.name ~= "air" and node.name ~= "throwing:light" then
|
||||
minetest.set_node(self.lastpos, {name="fire:basic_flame"})
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
if math.floor(self.lastpos.x+0.5) ~= math.floor(pos.x+0.5) or math.floor(self.lastpos.y+0.5) ~= math.floor(pos.y+0.5) or math.floor(self.lastpos.z+0.5) ~= math.floor(pos.z+0.5) then
|
||||
if minetest.get_node(self.lastpos).name == "throwing:light" then
|
||||
|
@ -38,6 +38,7 @@ local function throwing_register_fireworks(color, desc)
|
||||
textures = {"throwing:arrow_fireworks_" .. color .. "_box"},
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
player = "",
|
||||
}
|
||||
|
||||
local radius = 0.5
|
||||
@ -104,20 +105,23 @@ local function throwing_register_fireworks(color, desc)
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
boom(pos)
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.timer > 2 then
|
||||
self.object:remove()
|
||||
boom(self.lastpos)
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" and node.name ~= "throwing:firework_trail" then
|
||||
self.object:remove()
|
||||
boom(self.lastpos)
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
if node.name == 'air' then
|
||||
|
@ -34,7 +34,7 @@ function throwing_shoot_arrow (itemstack, player, stiffness, is_cross)
|
||||
minetest.sound_play("throwing_bow_sound", {pos=playerpos})
|
||||
end
|
||||
if obj:get_luaentity() then
|
||||
obj:get_luaentity().player = player
|
||||
obj:get_luaentity().player = player:get_player_name()
|
||||
obj:get_luaentity().inventory = player:get_inventory()
|
||||
obj:get_luaentity().stack = player:get_inventory():get_stack("main", player:get_wield_index()-1)
|
||||
end
|
||||
|
@ -37,6 +37,7 @@ local THROWING_ARROW_ENTITY={
|
||||
textures = {"throwing:arrow_shell_box"},
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
player = "",
|
||||
}
|
||||
|
||||
local radius = 1
|
||||
@ -85,8 +86,9 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
boom(pos)
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -94,8 +96,9 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" and not string.find(node.name, 'default:grass') and not string.find(node.name, 'default:junglegrass') and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then
|
||||
self.object:remove()
|
||||
boom(self.lastpos)
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
|
@ -38,6 +38,7 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft)
|
||||
textures = {"throwing:arrow_" .. kind .. "_box"},
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
player = "",
|
||||
}
|
||||
|
||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
@ -56,7 +57,6 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft)
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
if math.random() < toughness then
|
||||
if math.random(0,100) % 2 == 0 then
|
||||
minetest.add_item(self.lastpos, 'throwing:arrow_' .. kind)
|
||||
@ -64,19 +64,22 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft)
|
||||
else
|
||||
minetest.add_item(self.lastpos, 'default:stick')
|
||||
end
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" and not string.find(node.name, 'default:grass') and not string.find(node.name, 'default:junglegrass') and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then
|
||||
self.object:remove()
|
||||
if node.name ~= "air" and not string.find(node.name, 'water') and not string.find(node.name, 'default:grass') and not string.find(node.name, 'default:junglegrass') and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then
|
||||
if math.random() < toughness then
|
||||
minetest.add_item(self.lastpos, 'throwing:arrow_' .. kind)
|
||||
else
|
||||
minetest.add_item(self.lastpos, 'default:stick')
|
||||
end
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
|
@ -50,23 +50,31 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "throwing:arrow_teleport_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
self.object:remove()
|
||||
if self.player ~= "" then
|
||||
self.player:setpos(pos)
|
||||
self.player:get_inventory():add_item("main", ItemStack("default:stick 2"))
|
||||
local player = minetest.get_player_by_name(self.player)
|
||||
if player then
|
||||
player:setpos(pos)
|
||||
player:get_inventory():add_item("main", ItemStack("default:stick 2"))
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if self.lastpos.x~= nil then
|
||||
if node.name ~= "air" then
|
||||
self.object:remove()
|
||||
if self.player ~= "" then
|
||||
self.player:setpos(self.lastpos)
|
||||
self.player:get_inventory():add_item("main", ItemStack("default:stick 2"))
|
||||
local player = minetest.get_player_by_name(self.player)
|
||||
if player then
|
||||
player:setpos(self.lastpos)
|
||||
player:get_inventory():add_item("main", ItemStack("default:stick 2"))
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
|
@ -18,7 +18,7 @@ DISABLE_AUTOMATED_ARBALEST = false
|
||||
-- Arrow
|
||||
-- Special Arrows
|
||||
DISABLE_TELEPORT_ARROW = false
|
||||
DISABLE_DIG_ARROW = true -- Desactivated because too bugged
|
||||
DISABLE_DIG_ARROW = false
|
||||
DISABLE_BUILD_ARROW = false
|
||||
DISABLE_TNT_ARROW = true -- Desactivated because too dangerous
|
||||
DISABLE_FIRE_ARROW = true -- Desactivated because too dangerous
|
||||
|
@ -38,6 +38,7 @@ local THROWING_ARROW_ENTITY={
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
node = "",
|
||||
player = "",
|
||||
}
|
||||
|
||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
@ -55,7 +56,6 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
local toughness = 0.9
|
||||
if math.random() < toughness then
|
||||
if math.random(0,100) % 2 == 0 then -- 50% of chance to drop //MFF (Mg|07/27/15)
|
||||
@ -64,6 +64,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
else
|
||||
minetest.add_item(self.lastpos, 'default:stick')
|
||||
end
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -71,8 +73,11 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" then
|
||||
self.object:remove()
|
||||
if not string.find(node.name, "water") and not string.find(node.name, "lava") and not string.find(node.name, "torch") then
|
||||
local player = minetest.get_player_by_name(self.player)
|
||||
if not player then self.object:remove() return end
|
||||
if not string.find(node.name, "water") and not string.find(node.name, "lava")
|
||||
and not string.find(node.name, "torch") and minetest.get_item_group(node.name, "unbreakable") == 0
|
||||
and not minetest.is_protected(self.lastpos, self.player) and node.diggable ~= false then
|
||||
local dir=vector.direction(self.lastpos, pos)
|
||||
local wall=minetest.dir_to_wallmounted(dir)
|
||||
minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
|
||||
@ -84,6 +89,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
minetest.add_item(self.lastpos, 'default:stick')
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
|
Loading…
Reference in New Issue
Block a user