This commit is contained in:
Andrea Plati 2015-09-14 19:44:47 +02:00
parent 28c2d02278
commit 150f862b41
47 changed files with 52 additions and 20 deletions

View File

@ -21,6 +21,11 @@ Grahpics & sounds: CC-BY 3.0 (see http://creativecommons.org/licenses/by/3.0/leg
Changelog:
Update 1.4.1:
- Fixed spears not retaining wear
- Improved textures
- Torch arrows have light trail
Update 1.4:
- Added spears, capable of melee and ranged attacks
- Improved arrows textures

View File

@ -44,6 +44,9 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer=self.timer+dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if not self.inventory or not self.stack then
self.object:remove()
end
if self.timer>0.2 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)

View File

@ -141,5 +141,6 @@ function throwing_shoot_spear (itemstack, player)
obj:setacceleration({x=-dir.x*1, y=-9.8, z=-dir.z*1})
obj:setyaw(player:get_look_yaw()+math.pi)
minetest.sound_play("throwing_bow_sound", {pos=playerpos})
obj:get_luaentity().wear = itemstack:get_wear()
return true
end

View File

@ -93,7 +93,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
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
if node.name ~= "air" and not (string.find(node.name, 'grass') and not string.find(node.name, 'dirt')) and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then
self.object:remove()
boom(self.lastpos)
end

View File

@ -11,7 +11,7 @@ function throwing_register_spear_standard (kind, desc, eq, toughness, craft)
damage_groups={fleshy=damage},
}, nil)
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/(toughness*100))
itemstack:add_wear(65535/toughness)
end
else
throwing_shoot_spear(itemstack, user)
@ -53,7 +53,11 @@ function throwing_register_spear_standard (kind, desc, eq, toughness, craft)
self.timer=self.timer+dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if not self.wear then
self.object:remove()
return
end
if self.timer>0.2 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
@ -66,24 +70,26 @@ function throwing_register_spear_standard (kind, desc, eq, toughness, craft)
damage_groups={fleshy=damage},
}, nil)
self.object:remove()
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:spear_' .. kind)
else
minetest.add_item(self.lastpos, 'default:stick')
end
minetest.add_item(self.lastpos, {name='throwing:spear_' .. kind, count=1, wear=self.wear+65535/toughness, metadata=""})
--if math.random() < toughness then
--minetest.add_item(self.lastpos, 'throwing:spear_' .. kind)
--else
--minetest.add_item(self.lastpos, 'default:stick')
--end
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
if node.name ~= "air" and not (string.find(node.name, 'grass') and not string.find(node.name, 'dirt')) and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then
self.object:remove()
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:spear_' .. kind)
else
minetest.add_item(self.lastpos, 'default:stick')
end
minetest.add_item(self.lastpos, {name='throwing:spear_' .. kind, count=1, wear=self.wear+65535/toughness, metadata=""})
--if math.random() < toughness then
--minetest.add_item(self.lastpos, 'throwing:spear_' .. kind)
--else
--minetest.add_item(self.lastpos, 'default:stick')
--end
end
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
@ -107,17 +113,17 @@ function throwing_register_spear_standard (kind, desc, eq, toughness, craft)
end
if not DISABLE_STONE_SPEAR then
throwing_register_spear_standard ('stone', 'Stone', 0, 0.75, 'group:stone')
throwing_register_spear_standard ('stone', 'Stone', 0, 20, 'group:stone')
end
if not DISABLE_STEEL_SPEAR then
throwing_register_spear_standard ('steel', 'Steel', 5, 0.90, 'default:steel_ingot')
throwing_register_spear_standard ('steel', 'Steel', 5, 30, 'default:steel_ingot')
end
if not DISABLE_DIAMOND_SPEAR then
throwing_register_spear_standard ('diamond', 'Diamond', 10, 0.99, 'default:diamond')
throwing_register_spear_standard ('diamond', 'Diamond', 10, 40, 'default:diamond')
end
if not DISABLE_OBSIDIAN_SPEAR then
throwing_register_spear_standard ('obsidian', 'Obsidian', 15, 0.80, 'default:obsidian')
throwing_register_spear_standard ('obsidian', 'Obsidian', 15, 30, 'default:obsidian')
end

View File

@ -68,7 +68,7 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft)
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
if node.name ~= "air" and not (string.find(node.name, 'grass') and not string.find(node.name, 'dirt')) and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then
self.object:remove()
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_' .. kind)

View File

@ -44,6 +44,9 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer=self.timer+dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if not self.player then
self.object:remove()
end
if self.timer>0.2 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 B

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 B

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 B

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 277 B

View File

@ -68,7 +68,10 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
end
if self.lastpos.x~=nil then
if node.name ~= "air" then
if node.name == 'air' then
minetest.add_node(pos, {name="throwing:torch_trail"})
minetest.get_node_timer(pos):start(0.1)
elseif node.name ~= "air" and not string.find(node.name, "trail") 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 dir=vector.direction(self.lastpos, pos)
@ -102,3 +105,14 @@ minetest.register_craft({
{'group:coal', 'default:stick', 'default:stick'},
}
})
minetest.register_node("throwing:torch_trail", {
drawtype = "airlike",
light_source = default.LIGHT_MAX-1,
walkable = false,
drop = "",
groups = {dig_immediate=3},
on_timer = function(pos, elapsed)
minetest.remove_node(pos)
end,
})