many changes, README.md is next

master
stub 2017-10-18 00:00:43 +03:00
parent 5fcb2bd3e8
commit a04e25ae35
119 changed files with 627 additions and 403 deletions

0
README.md Normal file → Executable file
View File

View File

@ -4,3 +4,5 @@ dye
bucket?
fire?
tnt?
moreores?
lightning?

View File

@ -29,6 +29,27 @@ minetest.register_node("throwing:arrow_dig_box", {
groups = {not_in_creative_inventory=1},
})
local function addEffect(pos, node)
minetest.sound_play("default_dug_node", {pos=pos, gain=1, max_hear_distance=2*64})
texture=minetest.registered_nodes[node.name].tiles[1]
minetest.add_particlespawner({
amount = 16,
time = 0.1,
minpos = pos,
maxpos = pos,
minvel = {x = -5, y = -5, z = -5},
maxvel = {x = 5, y = 5, z = 5},
minacc = {x = 0, y = -8, z = 0},
maxacc = {x = 0, y = -8, z = 0},
minexptime = 0.8,
maxexptime = 2.0,
minsize = 4,
maxsize = 6,
texture = texture,
collisiondetection = true,
})
end
local THROWING_ARROW_ENTITY={
physical = false,
timer=0,
@ -51,19 +72,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
for k, obj in pairs(objs) do
if throwing_is_player(self.player, obj) or throwing_is_entity(obj) then
if throwing_touch(pos, obj:getpos()) then
local puncher = self.object
if self.player and minetest.get_player_by_name(self.player) then
puncher = minetest.get_player_by_name(self.player)
end
local damage = 1.5
if self.bow_damage and self.bow_damage > 0 then
damage = damage + (self.bow_damage/12)
end
obj:punch(puncher, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
if math.random(0,100) % 2 == 0 then -- 50% of chance to drop //MFF (Mg|07/27/15)
if math.random(0,100) % 1.1 == 0 then -- chance to drop
minetest.add_item(pos, "throwing:arrow_dig")
end
self.object:remove()
@ -80,7 +89,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
if node.name ~= "ignore" and minetest.get_item_group(node.name, "unbreakable") == 0
and not minetest.is_protected(pos, self.player)
and node.diggable ~= false then
minetest.set_node(pos, {name = "air"})
addEffect(pos, node)
minetest.dig_node(pos)
minetest.add_item(pos, node.name)
end
self.object:remove()

View File

@ -37,7 +37,6 @@ local THROWING_ARROW_ENTITY={
lastpos={},
collisionbox = {0,0,0,0,0,0},
player = "",
bow_damage = 0,
}
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
@ -54,10 +53,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
if self.player and minetest.get_player_by_name(self.player) then
puncher = minetest.get_player_by_name(self.player)
end
local damage = 4
if self.bow_damage and self.bow_damage > 0 then
damage = damage + (self.bow_damage/12)
end
local speed = vector.length(self.object:getvelocity())
local damage = ((speed + 15)^1.2)/10
obj:punch(puncher, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},

View File

@ -1,4 +1,4 @@
local function throwing_register_fireworks(color, desc)
local function throwing_register_fireworks(color, color2, desc)
minetest.register_craftitem("throwing:arrow_fireworks_" .. color, {
description = desc .. "fireworks arrow",
inventory_image = "throwing_arrow_fireworks_" .. color .. ".png",
@ -26,7 +26,7 @@ local function throwing_register_fireworks(color, desc)
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_fireworks_" .. color .. ".png", "throwing_arrow_fireworks_" .. color .. ".png", "throwing_arrow_fireworks_" .. color .. "_back.png", "throwing_arrow_fireworks_" .. color .. "_front.png", "throwing_arrow_fireworks_" .. color .. "_2.png", "throwing_arrow_fireworks_" .. color .. ".png"},
tiles = {"throwing_arrow_fireworks" .. color .. ".png", "throwing_arrow_fireworks" .. color .. ".png", "throwing_arrow_fireworks_" .. color .. "back.png", "throwing_arrow_fireworks_" .. color .. "front.png", "throwing_arrow_fireworks_" .. color .. "2.png", "throwing_arrow_fireworks" .. color .. ".png"},
groups = {not_in_creative_inventory=1},
})
@ -39,7 +39,6 @@ local function throwing_register_fireworks(color, desc)
lastpos={},
collisionbox = {0,0,0,0,0,0},
player = "",
bow_damage = 0,
}
local radius = 0.5
@ -47,18 +46,37 @@ local function throwing_register_fireworks(color, desc)
local function add_effects(pos, radius)
minetest.add_particlespawner({
amount = 256,
time = 0.2,
time = 0.1,
minpos = vector.subtract(pos, radius / 2),
maxpos = vector.add(pos, radius / 2),
minvel = {x=-5, y=-5, z=-5},
maxvel = {x=5, y=5, z=5},
minvel = {x=-15, y=-15, z=-15},
maxvel = {x=15, y=15, z=15},
minacc = {x=0, y=-8, z=0},
--~ maxacc = {x=-20, y=-50, z=-50},
minexptime = 2.5,
maxexptime = 3,
minsize = 1,
maxsize = 2.5,
minsize = 3,
maxsize = 6,
texture = "throwing_sparkle_" .. color .. ".png",
glow=15,
collisiondetection = true,
})
minetest.add_particlespawner({
amount = 256,
time = 0.1,
minpos = vector.subtract(pos, radius / 2),
maxpos = vector.add(pos, radius / 2),
minvel = {x=-15, y=-15, z=-15},
maxvel = {x=15, y=15, z=15},
minacc = {x=0, y=-8, z=0},
--~ maxacc = {x=-20, y=-50, z=-50},
minexptime = 2.5,
maxexptime = 3,
minsize = 3,
maxsize = 6,
texture = "throwing_sparkle_" .. color2 .. ".png",
glow=15,
collisiondetection = true,
})
end
@ -77,12 +95,12 @@ local function throwing_register_fireworks(color, desc)
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer=self.timer+dtime
local newpos = self.object:getpos()
if self.timer < 0.07 then
minetest.sound_play("throwing_firework_launch", {pos=newpos, gain=0.8, max_hear_distance=2*64})
if self.timer < 0.15 then
minetest.sound_play("throwing_firework_launch", {pos=newpos, gain=1, max_hear_distance=2*64})
end
minetest.add_particlespawner({
amount = 16,
time = 0.1,
amount = 32,
time = 0.2,
minpos = newpos,
maxpos = newpos,
minvel = {x=-5, y=-5, z=-5},
@ -94,17 +112,20 @@ local function throwing_register_fireworks(color, desc)
minsize = 0.5,
maxsize = 1,
texture = "throwing_sparkle.png",
glow=10
})
if self.lastpos.x ~= nil then
for _, pos in pairs(throwing_get_trajectoire(self, newpos)) do
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 throwing_is_player(self.player, obj) or throwing_is_entity(obj) then
local damage = 2
if self.bow_damage and self.bow_damage > 0 then
damage = damage + (self.bow_damage/12)
local speed = vector.length(self.object:getvelocity())
local damage = ((speed + 15)^1.2)/10
local puncher = self.object
if self.player and minetest.get_player_by_name(self.player) then
puncher = minetest.get_player_by_name(self.player)
end
obj:punch(self.object, 1.0, {
obj:punch(puncher, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
@ -149,11 +170,15 @@ end
--~ Arrows
if not DISABLE_FIREWORKS_BLUE_ARROW then
throwing_register_fireworks('blue', 'Blue')
throwing_register_fireworks('blue', 'magenta', 'Blue')
end
if not DISABLE_FIREWORKS_RED_ARROW then
throwing_register_fireworks('red', 'Red')
throwing_register_fireworks('red', 'orange', 'Red')
end
if not DISABLE_FIREWORKS_GREEN_ARROW then
throwing_register_fireworks('green', 'cyan', 'Green')
end
--~ Nodes

View File

@ -3,15 +3,18 @@ throwing_arrows = {
{"throwing:arrow_stone", "throwing:arrow_stone_entity"},
{"throwing:arrow_obsidian", "throwing:arrow_obsidian_entity"},
{"throwing:arrow_diamond", "throwing:arrow_diamond_entity"},
{"throwing:arrow_mithril", "throwing:arrow_mithril_entity"},
{"throwing:arrow_fire", "throwing:arrow_fire_entity"},
{"throwing:arrow_teleport", "throwing:arrow_teleport_entity"},
{"throwing:arrow_dig", "throwing:arrow_dig_entity"},
{"throwing:arrow_build", "throwing:arrow_build_entity"},
{"throwing:arrow_tnt", "throwing:arrow_tnt_entity"},
{"throwing:arrow_torch", "throwing:arrow_torch_entity"},
{"throwing:arrow_shell", "throwing:arrow_shell_entity"},
{"throwing:arrow_fireworks_blue", "throwing:arrow_fireworks_blue_entity"},
{"throwing:arrow_fireworks_red", "throwing:arrow_fireworks_red_entity"},
{"throwing:arrow_fireworks_blue", "throwing:arrow_fireworks_blue_entity"},
{"throwing:arrow_fireworks_green", "throwing:arrow_fireworks_green_entity"},
{"throwing:arrow_rope", "throwing:arrow_rope_entity"},
{"throwing:arrow_lightning", "throwing:arrow_lightning_entity"},
}
dofile(minetest.get_modpath("throwing").."/defaults.lua")
@ -29,7 +32,6 @@ dofile(minetest.get_modpath("throwing").."/tools.lua")
dofile(minetest.get_modpath("throwing").."/standard_arrows.lua")
if minetest.get_modpath('fire') and minetest.get_modpath('bucket') and not DISABLE_FIRE_ARROW then
dofile(minetest.get_modpath("throwing").."/fire_arrow.lua")
end
@ -46,7 +48,7 @@ if not DISABLE_BUILD_ARROW then
dofile(minetest.get_modpath("throwing").."/build_arrow.lua")
end
if minetest.get_modpath('fire') and minetest.get_modpath('tnt') and not DISABLE_TNT_ARROW then
if minetest.get_modpath('tnt') and not DISABLE_TNT_ARROW then
dofile(minetest.get_modpath("throwing").."/tnt_arrow.lua")
end
@ -54,10 +56,6 @@ if not DISABLE_TORCH_ARROW then
dofile(minetest.get_modpath("throwing").."/torch_arrow.lua")
end
if minetest.get_modpath('tnt') and not DISABLE_SHELL_ARROW then
dofile(minetest.get_modpath("throwing").."/shell_arrow.lua")
end
if minetest.get_modpath('tnt') then
dofile(minetest.get_modpath("throwing").."/fireworks_arrows.lua")
end
@ -65,3 +63,11 @@ end
if minetest.setting_get("log_mods") then
minetest.log("action", "throwing loaded")
end
if minetest.get_modpath('vines') and not DISABLE_ROPE_ARROW then
dofile(minetest.get_modpath("throwing").."/rope_arrow.lua")
end
if minetest.get_modpath('lightning') and not DISABLE_LIGHTNING_ARROW then
dofile(minetest.get_modpath("throwing").."/lightning_arrow.lua")
end

169
lightning_arrow.lua Executable file
View File

@ -0,0 +1,169 @@
minetest.register_craftitem("throwing:arrow_lightning", {
description = "Lightning Arrow",
inventory_image = "throwing_arrow_lightning.png",
})
minetest.register_node("throwing:arrow_lightning_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
--Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
--Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_lightning.png", "throwing_arrow_lightning.png", "throwing_arrow_lightning_back.png", "throwing_arrow_lightning_front.png", "throwing_arrow_lightning_2.png", "throwing_arrow_lightning.png"},
groups = {not_in_creative_inventory=1},
})
local function addEffect(pos, node)
if minetest.registered_nodes[node.name].tiles~=nil then
texture = minetest.registered_nodes[node.name].tiles[1]
minetest.add_particlespawner({
amount = 32,
time = 0.1,
minpos = pos,
maxpos = pos,
minvel = {x = -5, y = 0, z = -5},
maxvel = {x = 5, y = 30, z = 5},
minacc = {x = 0, y = -8, z = 0},
maxacc = {x = 0, y = -8, z = 0},
minexptime = 0.8,
maxexptime = 2.0,
minsize = 4,
maxsize = 6,
texture = texture,
collisiondetection = true,
})
end
end
local function addSmoke(pos)
minetest.add_particle({
pos = pos,
velocity = vector.new(),
acceleration = vector.new(),
expirationtime = 0.4,
size = 50,
collisiondetection = false,
vertical = false,
texture = "tnt_boom.png",
glow = 15,
})
minetest.add_particlespawner({
amount = 32,
time = 0.5,
minpos = pos,
maxpos = pos,
minvel = {x = -10, y = -10, z = -10},
maxvel = {x = 10, y = 10, z = 10},
minacc = {x = 0, y = 4, z = 0},
maxacc = {x = 0, y = 4, z = 0},
minexptime = 1,
maxexptime = 2.5,
minsize = 6,
maxsize = 9,
texture = "tnt_smoke.png",
collisiondetection = true,
glow=5,
})
end
local THROWING_ARROW_ENTITY={
physical = false,
timer=0,
visual = "wielditem",
visual_size = {x=0.1, y=0.1},
textures = {"throwing:arrow_lightning_box"},
lastpos={},
collisionbox = {0,0,0,0,0,0},
player = "",
bow_damage = 0,
}
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
local newpos = self.object:getpos()
minetest.add_particlespawner({
amount = 16,
time = 0.1,
minpos = newpos,
maxpos = newpos,
minvel = {x=-5+math.random(-5,5), y=-5+math.random(-5,5), z=-5+math.random(-5,5)},
maxvel = {x=5+math.random(-5,5), y=5+math.random(-5,5), z=5+math.random(-5,5)},
minacc = vector.new(),
maxacc = {x=5+math.random(-5,5), y=5+math.random(-5,5), z=5+math.random(-5,5)},
minexptime = 0.1,
maxexptime = 0.2,
minsize = 0.5,
maxsize = 1,
texture = "throwing_sparkle_blue.png",
glow=10
})
if self.lastpos.x ~= nil then
for _, pos in pairs(throwing_get_trajectoire(self, newpos)) do
local node = minetest.get_node(pos)
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
for k, obj in pairs(objs) do
if throwing_is_player(self.player, obj) or throwing_is_entity(obj) then
if throwing_touch(pos, obj:getpos()) then
local puncher = self.object
if self.player and minetest.get_player_by_name(self.player) then
puncher = minetest.get_player_by_name(self.player)
end
local speed = vector.length(self.object:getvelocity())
local damage = ((speed + 10)^1.2)/10
obj:punch(puncher, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
lightning.strike(newpos)
minetest.sound_play("tnt_explode", {pos=newpos, gain=1, max_hear_distance=2*64})
addSmoke(newpos)
self.object:remove()
return
end
end
end
if node.name ~= "air" then
lightning.strike(newpos)
minetest.sound_play("tnt_explode", {pos=newpos, gain=1, max_hear_distance=2*64})
addEffect(newpos, node)
addSmoke(newpos)
self.object:remove()
return
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end
end
self.lastpos={x=newpos.x, y=newpos.y, z=newpos.z}
end
minetest.register_entity("throwing:arrow_lightning_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({
output = 'throwing:arrow_lightning',
recipe = {
{'default:stick', 'default:stick', 'default:pick_steel'},
}
})
minetest.register_craft({
output = 'throwing:arrow_lightning',
recipe = {
{'default:pick_steel', 'default:stick', 'default:stick'},
}
})

141
rope_arrow.lua Executable file
View File

@ -0,0 +1,141 @@
minetest.register_craftitem("throwing:arrow_rope", {
description = "Rope Arrow",
inventory_image = "throwing_arrow_rope.png",
})
minetest.register_node("throwing:arrow_rope_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
--Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
--Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_rope.png", "throwing_arrow_rope.png", "throwing_arrow_rope_back.png", "throwing_arrow_rope_front.png", "throwing_arrow_rope_2.png", "throwing_arrow_rope.png"},
groups = {not_in_creative_inventory=1},
})
local THROWING_ARROW_ENTITY={
physical = false,
visual = "wielditem",
visual_size = {x=0.1, y=0.1},
textures = {"throwing:arrow_rope"},
lastpos={},
collisionbox = {0,0,0,0,0,0},
node = "",
player = "",
}
local function addEffect(pos, node)
minetest.sound_play("default_dug_metal", {pos=pos, gain=1, max_hear_distance=2*64})
texture=minetest.registered_nodes[node.name].tiles[1]
minetest.add_particlespawner({
amount = 16,
time = 0.1,
minpos = pos,
maxpos = pos,
minvel = {x = -5, y = -5, z = -5},
maxvel = {x = 5, y = 5, z = 5},
minacc = {x = 0, y = -8, z = 0},
maxacc = {x = 0, y = -8, z = 0},
minexptime = 0.8,
maxexptime = 2.0,
minsize = 4,
maxsize = 6,
texture = texture,
collisiondetection = true,
})
end
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
local newpos = self.object:getpos()
if self.lastpos.x~= nil then
for _, pos in pairs(throwing_get_trajectoire(self, newpos)) do
local node = minetest.get_node(pos)
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
for k, obj in pairs(objs) do
local objpos = obj:getpos()
if throwing_is_player(self.player, obj) or throwing_is_entity(obj) then
if throwing_touch(pos, objpos) then
local puncher = self.object
if self.player and minetest.get_player_by_name(self.player) then
puncher = minetest.get_player_by_name(self.player)
end
local speed = vector.length(self.object:getvelocity())
local damage = ((speed + 5)^1.2)/10
obj:punch(puncher, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
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)
minetest.add_item(pos, 'throwing:arrow_torch')
end
else
minetest.add_item(pos, 'default:stick')
end
self.object:remove()
return
end
end
end
if node.name ~= "air"
and not string.find(node.name, "trail")
and not (string.find(node.name, 'grass') and not string.find(node.name, 'dirt'))
and not (string.find(node.name, 'farming:') and not string.find(node.name, 'soil'))
and not string.find(node.name, 'flowers:')
and not string.find(node.name, 'fire:') then
local player = minetest.get_player_by_name(self.player)
if not player then self.object:remove() return end
if node.name ~= "ignore" and 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
addEffect(self.lastpos, node)
minetest.place_node(self.lastpos, {name="vines:rope_block"})
else
local toughness = 0.9
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_rope')
else
minetest.add_item(self.lastpos, 'default:stick')
end
end
self.object:remove()
return
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end
end
self.lastpos={x=newpos.x, y=newpos.y+1, z=newpos.z}
end
minetest.register_entity("throwing:arrow_rope_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({
output = 'throwing:arrow_rope 4',
recipe = {
{'default:stick', 'default:stick', 'group:coal'},
}
})
minetest.register_craft({
output = 'throwing:arrow_rope 4',
recipe = {
{'group:coal', 'default:stick', 'default:stick'},
}
})

View File

@ -1,126 +0,0 @@
minetest.register_craftitem("throwing:arrow_shell", {
description = "Shell arrow",
inventory_image = "throwing_arrow_shell.png",
})
minetest.register_node("throwing:arrow_shell_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
--Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
--Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_shell.png", "throwing_arrow_shell.png", "throwing_arrow_shell_back.png", "throwing_arrow_shell_front.png", "throwing_arrow_shell_2.png", "throwing_arrow_shell.png"},
groups = {not_in_creative_inventory=1},
})
local THROWING_ARROW_ENTITY={
physical = false,
timer=0,
visual = "wielditem",
visual_size = {x=0.1, y=0.1},
textures = {"throwing:arrow_shell_box"},
lastpos={},
collisionbox = {0,0,0,0,0,0},
player = "",
bow_damage = 0,
}
local radius = 1
local function add_effects(pos, radius)
minetest.add_particlespawner({
amount = 8,
time = 0.5,
minpos = vector.subtract(pos, radius / 2),
maxpos = vector.add(pos, radius / 2),
minvel = {x=-10, y=-10, z=-10},
maxvel = {x=10, y=10, z=10},
minacc = vector.new(),
maxacc = vector.new(),
minexptime = 0.5,
maxexptime = 1,
minsize = 0.5,
maxsize = 1,
texture = "tnt_smoke.png",
})
end
local function boom(pos)
minetest.sound_play("shell_explode", {pos=pos, gain=1.5, max_hear_distance=2*64})
minetest.set_node(pos, {name="tnt:boom"})
minetest.get_node_timer(pos):start(0.1)
add_effects(pos, radius)
end
-- Back to the arrow
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
local newpos = self.object:getpos()
if self.lastpos.x ~= nil then
for _, pos in pairs(throwing_get_trajectoire(self, newpos)) do
local node = minetest.get_node(pos)
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 throwing_is_player(self.player, obj) or throwing_is_entity(obj) then
local speed = vector.length(self.object:getvelocity())
local damage = ((speed + 5)^1.2)/10 + 12
if self.bow_damage and self.bow_damage > 0 then
damage = damage + (self.bow_damage/12)
end
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
boom(pos)
self.object:remove()
return
end
end
if node.name ~= "air"
and not (string.find(node.name, 'grass') and not string.find(node.name, 'dirt'))
and not (string.find(node.name, 'farming:') and not string.find(node.name, 'soil'))
and not string.find(node.name, 'flowers:')
and not string.find(node.name, 'fire:') then
boom(self.lastpos)
self.object:remove()
return
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end
end
self.lastpos={x=newpos.x, y=newpos.y, z=newpos.z}
end
minetest.register_entity("throwing:arrow_shell_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({
output = 'throwing:arrow_shell 8',
recipe = {
{'default:stick', 'tnt:gunpowder', 'default:bronze_ingot'},
}
})
minetest.register_craft({
output = 'throwing:arrow_shell 8',
recipe = {
{'default:bronze_ingot', 'tnt:gunpowder', 'default:stick'},
}
})

BIN
sounds/help.ogg Executable file

Binary file not shown.

View File

@ -31,6 +31,28 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft)
groups = {not_in_creative_inventory=1},
})
local function add_effects(pos, node)
minetest.sound_play("default_dug_metal", {pos=pos, gain=1, max_hear_distance=2*64})
if minetest.registered_nodes[node.name].tiles~=nil then
texture = minetest.registered_nodes[node.name].tiles[1]
minetest.add_particlespawner({
amount = 8,
time = 0.1,
minpos = pos,
maxpos = pos,
minvel = {x = -2, y = -2, z = -2},
maxvel = {x = 2, y = 2, z = 2},
minacc = {x = 0, y = -8, z = 0},
maxacc = {x = 0, y = -8, z = 0},
minexptime = 0.8,
maxexptime = 2.0,
minsize = 1,
maxsize = 3,
texture = texture,
collisiondetection = true,
})
end
end
local THROWING_ARROW_ENTITY={
physical = false,
visual = "wielditem",
@ -39,7 +61,6 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft)
lastpos={},
collisionbox = {0,0,0,0,0,0},
player = "",
bow_damage = 0,
}
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
@ -56,14 +77,13 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft)
if self.player and minetest.get_player_by_name(self.player) then
puncher = minetest.get_player_by_name(self.player)
end
local damage = eq
if self.bow_damage and self.bow_damage > 0 then
damage = damage + (self.bow_damage/12)
end
local speed = vector.length(self.object:getvelocity())
local damage = ((speed + eq)^1.2)/10
obj:punch(puncher, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
minetest.sound_play("default_dug_metal", {pos=objpos, gain=1, max_hear_distance=2*64})
if math.random() < toughness then
if math.random(0,100) % 2 == 0 then
minetest.add_item(self.lastpos, 'throwing:arrow_' .. kind)
@ -82,6 +102,7 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft)
and not (string.find(node.name, 'farming:') and not string.find(node.name, 'soil'))
and not string.find(node.name, 'flowers:')
and not string.find(node.name, 'fire:') then
add_effects(self.lastpos, node)
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_' .. kind)
else
@ -114,18 +135,21 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft)
end
if not DISABLE_STONE_ARROW then
throwing_register_arrow_standard ('stone', 'Stone', 4, 0.40, 'group:stone')
throwing_register_arrow_standard ('stone', 'Stone', 5, 0.10, 'group:stone')
end
if not DISABLE_STEEL_ARROW then
throwing_register_arrow_standard ('steel', 'Steel', 5, 0.50, 'default:steel_ingot')
throwing_register_arrow_standard ('steel', 'Steel', 10, 0.80, 'default:steel_ingot')
end
if not DISABLE_OBSIDIAN_ARROW then
throwing_register_arrow_standard ('obsidian', 'Obsidian', 6, 0.60, 'default:obsidian')
throwing_register_arrow_standard ('obsidian', 'Obsidian', 15, 0.20, 'default:obsidian')
end
if not DISABLE_DIAMOND_ARROW then
throwing_register_arrow_standard ('diamond', 'Diamond', 7, 0.70, 'default:diamond')
throwing_register_arrow_standard ('diamond', 'Diamond', 20, 0.40, 'default:diamond')
end
if minetest.get_modpath('moreores') and not DISABLE_MITHRIL_ARROW then
throwing_register_arrow_standard ('mithril', 'Mithril', 30, 0.86, 'moreores:mithril_ingot')
end

View File

@ -37,11 +37,46 @@ local THROWING_ARROW_ENTITY={
lastpos={},
collisionbox = {0,0,0,0,0,0},
player = "",
bow_damage = 0,
}
local function add_effects(pos, radius)
minetest.sound_play("throwing_firework_boom", {pos=pos, gain=1, max_hear_distance=2*64})
minetest.add_particlespawner({
amount = 128,
time = 0.1,
minpos = vector.subtract(pos, radius / 2),
maxpos = vector.add(pos, radius / 2),
minvel = {x=-5, y=-5, z=-5},
maxvel = {x=5, y=5, z=5},
minacc = {x=0, y=0, z=0},
--~ maxacc = {x=-20, y=-50, z=-50},
minexptime = 2.5,
maxexptime = 3,
minsize = 2,
maxsize = 4,
texture = "particle_teleport.png",
glow=10,
})
end
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
local newpos = self.object:getpos()
minetest.add_particlespawner({
amount = 16,
time = 0.1,
minpos = newpos,
maxpos = newpos,
minvel = {x = -math.random(0,2), y = -math.random(0,2), z = -math.random(0,2)},
maxvel = {x = math.random(0,2), y = math.random(0,2), z = math.random(0,2)},
minacc = {x=0, y=0, z=0},
--~ maxacc = {x=-20, y=-50, z=-50},
minexptime = 2.5,
maxexptime = 3,
minsize = 0.5,
maxsize = 1.3,
texture = "particle_teleport.png",
glow=5,
})
if self.lastpos.x ~= nil then
for _, pos in pairs(throwing_get_trajectoire(self, newpos)) do
local node = minetest.get_node(pos)
@ -52,6 +87,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
local player = minetest.get_player_by_name(self.player)
if player then
player:setpos(self.lastpos)
add_effects(self.lastpos, 5)
end
end
self.object:remove()
@ -68,6 +104,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
local player = minetest.get_player_by_name(self.player)
if player then
player:setpos(self.lastpos)
add_effects(self.lastpos, 5)
end
end
self.object:remove()
@ -84,13 +121,13 @@ minetest.register_entity("throwing:arrow_teleport_entity", THROWING_ARROW_ENTITY
minetest.register_craft({
output = 'throwing:arrow_teleport',
recipe = {
{'default:stick', 'default:stick', 'default:mese_crystal_fragment'}
{'default:stick', 'default:stick', 'default:mese_crystal'}
}
})
minetest.register_craft({
output = 'throwing:arrow_teleport',
recipe = {
{'default:mese_crystal_fragment', 'default:stick', 'default:stick'}
{'default:mese_crystal', 'default:stick', 'default:stick'}
}
})

0
textures/.directory Normal file → Executable file
View File

BIN
textures/compound_bow.xcf Executable file

Binary file not shown.

BIN
textures/compound_bow_unload.xcf Executable file

Binary file not shown.

BIN
textures/particle_teleport.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

BIN
textures/repeater_crossbow.xcf Executable file

Binary file not shown.

0
textures/throwing_arbalest.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 760 B

After

Width:  |  Height:  |  Size: 760 B

0
textures/throwing_arbalest_auto.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 739 B

After

Width:  |  Height:  |  Size: 739 B

0
textures/throwing_arbalest_auto_loaded.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 798 B

After

Width:  |  Height:  |  Size: 798 B

0
textures/throwing_arbalest_loaded.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 807 B

After

Width:  |  Height:  |  Size: 807 B

0
textures/throwing_arrow_build.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 217 B

0
textures/throwing_arrow_build_2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

0
textures/throwing_arrow_build_back.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

0
textures/throwing_arrow_build_front.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 188 B

0
textures/throwing_arrow_diamond.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

0
textures/throwing_arrow_diamond_2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 217 B

0
textures/throwing_arrow_diamond_back.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 210 B

0
textures/throwing_arrow_diamond_front.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 191 B

0
textures/throwing_arrow_dig.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 229 B

0
textures/throwing_arrow_dig_2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 221 B

After

Width:  |  Height:  |  Size: 221 B

0
textures/throwing_arrow_dig_back.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 215 B

After

Width:  |  Height:  |  Size: 215 B

0
textures/throwing_arrow_dig_front.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

0
textures/throwing_arrow_fire.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 262 B

0
textures/throwing_arrow_fire_2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 271 B

0
textures/throwing_arrow_fire_back.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 268 B

After

Width:  |  Height:  |  Size: 268 B

0
textures/throwing_arrow_fire_front.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 306 B

After

Width:  |  Height:  |  Size: 306 B

0
textures/throwing_arrow_fireworks_blue.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 222 B

0
textures/throwing_arrow_fireworks_blue_2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

0
textures/throwing_arrow_fireworks_blue_back.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 232 B

0
textures/throwing_arrow_fireworks_blue_front.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

0
textures/throwing_arrow_fireworks_red.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 235 B

After

Width:  |  Height:  |  Size: 235 B

0
textures/throwing_arrow_fireworks_red_2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

0
textures/throwing_arrow_fireworks_red_back.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 234 B

After

Width:  |  Height:  |  Size: 234 B

0
textures/throwing_arrow_fireworks_red_front.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

0
textures/throwing_arrow_obsidian.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

0
textures/throwing_arrow_obsidian_2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 216 B

0
textures/throwing_arrow_obsidian_back.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 204 B

0
textures/throwing_arrow_obsidian_front.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 188 B

BIN
textures/throwing_arrow_rope.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

0
textures/throwing_arrow_steel.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 230 B

0
textures/throwing_arrow_steel_2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 227 B

0
textures/throwing_arrow_steel_back.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 209 B

0
textures/throwing_arrow_steel_front.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 189 B

0
textures/throwing_arrow_stone.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

0
textures/throwing_arrow_stone_2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 219 B

0
textures/throwing_arrow_stone_back.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

0
textures/throwing_arrow_stone_front.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

BIN
textures/throwing_arrow_teleport.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 251 B

BIN
textures/throwing_arrow_teleport_2.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 244 B

BIN
textures/throwing_arrow_teleport_back.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

BIN
textures/throwing_arrow_teleport_front.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 230 B

0
textures/throwing_arrow_tnt.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 241 B

After

Width:  |  Height:  |  Size: 241 B

0
textures/throwing_arrow_tnt_2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 241 B

After

Width:  |  Height:  |  Size: 241 B

0
textures/throwing_arrow_tnt_back.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 211 B

0
textures/throwing_arrow_tnt_front.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

0
textures/throwing_arrow_torch.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

0
textures/throwing_arrow_torch_2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 228 B

0
textures/throwing_arrow_torch_back.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 228 B

0
textures/throwing_arrow_torch_front.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 178 B

0
textures/throwing_bow_composite.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 646 B

After

Width:  |  Height:  |  Size: 646 B

0
textures/throwing_bow_composite_loaded.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 692 B

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 660 B

0
textures/throwing_bow_steel.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 633 B

0
textures/throwing_bow_steel_loaded.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 683 B

0
textures/throwing_bow_wood.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 581 B

After

Width:  |  Height:  |  Size: 581 B

0
textures/throwing_bow_wood_loaded.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 622 B

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Some files were not shown because too many files have changed in this diff Show More