Upload files to 'mods/rangedweapons'

This commit is contained in:
thunderdog1138 2020-10-12 15:25:06 +00:00
parent ac6064c376
commit ef342e7916
4 changed files with 710 additions and 0 deletions

177
mods/rangedweapons/tec9.lua Normal file
View File

@ -0,0 +1,177 @@
minetest.register_craft({
output = 'rangedweapons:tec9',
recipe = {
{'rangedweapons:plastic_sheet', 'rangedweapons:plastic_sheet', 'rangedweapons:plastic_sheet'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:steel_ingot', 'default:mese_crystal_fragment', 'default:steel_ingot'},
}
})
minetest.register_craftitem("rangedweapons:tec9", {
stack_max= 1,
wield_scale = {x=1.25,y=1.25,z=1.50},
description = "" ..core.colorize("#35cdff","TEC-9\n") ..core.colorize("#FFFFFF", "Ranged damage: 2-4\n") ..core.colorize("#FFFFFF", "accuracy: 75%\n") ..core.colorize("#FFFFFF", "Mob knockback: 0\n") ..core.colorize("#FFFFFF", "Critical chance: 10%\n") ..core.colorize("#FFFFFF", "Critical damage: 4-7\n") ..core.colorize("#FFFFFF", "Ammunition: 9mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.2\n") ..core.colorize("#FFFFFF", "Gun type: machine pistol\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
range = 0,
inventory_image = "rangedweapons_tec9.png",
})
local timer = 0
minetest.register_globalstep(function(dtime, player)
timer = timer + dtime;
if timer >= 0.2 then
for _, player in pairs(minetest.get_connected_players()) do
local inv = player:get_inventory()
local controls = player:get_player_control()
if controls.LMB then
timer = 0
local wielded_item = player:get_wielded_item():get_name()
if wielded_item == "rangedweapons:tec9" then
if not inv:contains_item("main", "rangedweapons:9mm") then
minetest.sound_play("rangedweapons_empty", {object=player})
else
if wielded_item == "rangedweapons:tec9" then
inv:remove_item("main", "rangedweapons:9mm")
local pos = player:getpos()
local dir = player:get_look_dir()
local yaw = player:get_look_yaw()
if pos and dir and yaw then
pos.y = pos.y + 1.6
local obj = minetest.add_entity(pos, "rangedweapons:tec9shot")
if obj then
minetest.sound_play("rangedweapons_machine_pistol", {object=obj})
obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
obj:setacceleration({x=dir.x * math.random(-2.5,2.5), y=math.random(-2.5,2.5), z=dir.z * math.random(-2.5,2.5)})
obj:setyaw(yaw + math.pi)
pos.y = pos.y + 0
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
minetest.sound_play("", {object=obj})
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
obj:setyaw(yaw + math.pi)
minetest.add_particle({
pos = pos,
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
expirationtime = 0.30,
size = 4,
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png",
glow = 5,
})
local ent = obj:get_luaentity()
if ent then
ent.player = ent.player or player
end
end
end
end
end
end
end
end
end
end)
local rangedweapons_tec9shot = {
physical = false,
timer = 0,
visual = "sprite",
visual_size = {x=0.3, y=0.3},
textures = {"rangedweapons_invisible.png"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
rangedweapons_tec9shot.on_step = function(self, dtime, node, pos)
self.timer = self.timer + dtime
local tiem = 0.002
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.17 then
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 obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "rangedweapons:tec9shot" and obj:get_luaentity().name ~= "__builtin:item" then
if math.random(1, 100) <= 10 then
local damage = math.random(4,7)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage, knockback=0},
}, nil)
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
self.object:remove()
else
local damage = math.random(2,4)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage, knockback = 0},
}, nil)
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
else
if math.random(1, 100) <= 10 then
local damage = math.random(4,7)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
self.object:remove()
else
local damage = math.random(2,4)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
if timer >= 0.002 + tiem then
minetest.add_particle({
pos = pos,
velocity = 0,
acceleration = {x=0, y=0, z=0},
expirationtime = 0.06,
size = 3,
collisiondetection = false,
vertical = false,
texture = "rangedweapons_bullet_fly.png",
glow = 15,
})
tiem = tiem + 0.002
end
if self.timer >= 4.0 then
self.object:remove()
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
if not minetest.setting_getbool("creative_mode") then
end
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
if node.name == "rangedweapons:barrel" or
node.name == "doors:door_glass_a" or
node.name == "doors:door_glass_b" or
node.name == "xpanes:pane" or
node.name == "xpanes:pane_flat" or
node.name == "vessels:drinking_glass" or
node.name == "vessels:glass_bottle" or
node.name == "default:glass" then
minetest.get_node_timer(pos):start(0)
end
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
end
end
minetest.register_entity("rangedweapons:tec9shot", rangedweapons_tec9shot )

177
mods/rangedweapons/tmp.lua Normal file
View File

@ -0,0 +1,177 @@
minetest.register_craft({
output = 'rangedweapons:tmp',
recipe = {
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:steel_ingot', 'default:mese_crystal_fragment', 'default:steel_ingot'},
{'', 'dye:black', 'default:steel_ingot'},
}
})
minetest.register_craftitem("rangedweapons:tmp", {
stack_max= 1,
wield_scale = {x=1.15,y=1.15,z=1.15},
description = "" ..core.colorize("#35cdff","Steyr T.M.P.\n") ..core.colorize("#FFFFFF", "Ranged damage: 1-4\n") ..core.colorize("#FFFFFF", "accuracy: 62%\n") ..core.colorize("#FFFFFF", "Mob knockback: 0\n") ..core.colorize("#FFFFFF", "Critical chance: 4%\n") ..core.colorize("#FFFFFF", "Critical damage: 3-6\n") ..core.colorize("#FFFFFF", "Ammunition: 9mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.08\n") ..core.colorize("#FFFFFF", "Gun type: machine pistol\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
range = 0,
inventory_image = "rangedweapons_tmp.png",
})
local timer = 0
minetest.register_globalstep(function(dtime, player)
timer = timer + dtime;
if timer >= 0.08 then
for _, player in pairs(minetest.get_connected_players()) do
local inv = player:get_inventory()
local controls = player:get_player_control()
if controls.LMB then
timer = 0
local wielded_item = player:get_wielded_item():get_name()
if wielded_item == "rangedweapons:tmp" then
if not inv:contains_item("main", "rangedweapons:9mm") then
minetest.sound_play("rangedweapons_empty", {object=player})
else
if wielded_item == "rangedweapons:tmp" then
inv:remove_item("main", "rangedweapons:9mm")
local pos = player:getpos()
local dir = player:get_look_dir()
local yaw = player:get_look_yaw()
if pos and dir and yaw then
pos.y = pos.y + 1.6
local obj = minetest.add_entity(pos, "rangedweapons:tmpshot")
if obj then
minetest.sound_play("rangedweapons_machine_pistol", {object=obj})
obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
obj:setacceleration({x=dir.x * math.random(-3.8,3.8), y=math.random(-3.8,3.8), z=dir.z * math.random(-3.8,3.8)})
obj:setyaw(yaw + math.pi)
pos.y = pos.y + 0
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
minetest.sound_play("", {object=obj})
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
obj:setyaw(yaw + math.pi)
minetest.add_particle({
pos = pos,
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
expirationtime = 0.30,
size = 4,
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png",
glow = 5,
})
local ent = obj:get_luaentity()
if ent then
ent.player = ent.player or player
end
end
end
end
end
end
end
end
end
end)
local rangedweapons_tmpshot = {
physical = false,
timer = 0,
visual = "sprite",
visual_size = {x=0.3, y=0.3},
textures = {"rangedweapons_invisible.png"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
rangedweapons_tmpshot.on_step = function(self, dtime, node, pos)
self.timer = self.timer + dtime
local tiem = 0.002
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.17 then
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 obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "rangedweapons:tmpshot" and obj:get_luaentity().name ~= "__builtin:item" then
if math.random(1, 100) <= 4 then
local damage = math.random(3,6)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage, knockback=0},
}, nil)
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
self.object:remove()
else
local damage = math.random(1,4)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage, knockback = 0},
}, nil)
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
else
if math.random(1, 100) <= 4 then
local damage = math.random(3,6)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
self.object:remove()
else
local damage = math.random(1,4)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
if timer >= 0.002 + tiem then
minetest.add_particle({
pos = pos,
velocity = 0,
acceleration = {x=0, y=0, z=0},
expirationtime = 0.06,
size = 3,
collisiondetection = false,
vertical = false,
texture = "rangedweapons_bullet_fly.png",
glow = 15,
})
tiem = tiem + 0.002
end
if self.timer >= 4.0 then
self.object:remove()
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
if not minetest.setting_getbool("creative_mode") then
end
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
if node.name == "rangedweapons:barrel" or
node.name == "doors:door_glass_a" or
node.name == "doors:door_glass_b" or
node.name == "xpanes:pane" or
node.name == "xpanes:pane_flat" or
node.name == "vessels:drinking_glass" or
node.name == "vessels:glass_bottle" or
node.name == "default:glass" then
minetest.get_node_timer(pos):start(0)
end
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
end
end
minetest.register_entity("rangedweapons:tmpshot", rangedweapons_tmpshot )

178
mods/rangedweapons/ump.lua Normal file
View File

@ -0,0 +1,178 @@
minetest.register_craft({
output = 'rangedweapons:ump',
recipe = {
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'rangedweapons:gunsteel_ingot', 'default:diamond', 'default:steel_ingot'},
{'default:steel_ingot', '', 'default:steel_ingot'},
}
})
minetest.register_craftitem("rangedweapons:ump", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.20},
description = "" ..core.colorize("#35cdff","UMP-9\n") ..core.colorize("#FFFFFF", "Ranged damage: 4-8\n") ..core.colorize("#FFFFFF", "Accuracy: 77%\n") ..core.colorize("#FFFFFF", "Mob knockback: 1\n") ..core.colorize("#FFFFFF", "Critical chance: 8%\n") ..core.colorize("#FFFFFF", "Critical damage: 9-18\n") ..core.colorize("#FFFFFF", "Ammunition: 10mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.115\n") ..core.colorize("#FFFFFF", "Gun type: Sub-machinegun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
range = 0,
inventory_image = "rangedweapons_ump.png",
})
local timer = 0
minetest.register_globalstep(function(dtime, player)
timer = timer + dtime;
if timer >= 0.115 then
for _, player in pairs(minetest.get_connected_players()) do
local inv = player:get_inventory()
local controls = player:get_player_control()
if controls.LMB then
timer = 0
local wielded_item = player:get_wielded_item():get_name()
if wielded_item == "rangedweapons:ump" then
if not inv:contains_item("main", "rangedweapons:10mm") then
minetest.sound_play("rangedweapons_empty", {object=player})
else
if wielded_item == "rangedweapons:ump" then
inv:remove_item("main", "rangedweapons:10mm")
local pos = player:getpos()
local dir = player:get_look_dir()
local yaw = player:get_look_yaw()
if pos and dir and yaw then
pos.y = pos.y + 1.6
local obj = minetest.add_entity(pos, "rangedweapons:umpshot")
if obj then
minetest.sound_play("rangedweapons_machine_pistol", {object=obj})
obj:setvelocity({x=dir.x * 25, y=dir.y * 25, z=dir.z * 25})
obj:setacceleration({x=dir.x * math.random(-2.3,2.3), y=math.random(-2.3,2.3), z=dir.z * math.random(-2.3,2.3)})
obj:setyaw(yaw + math.pi)
pos.y = pos.y + 0
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell_white")
minetest.sound_play("", {object=obj})
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
obj:setyaw(yaw + math.pi)
minetest.add_particle({
pos = pos,
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
expirationtime = 0.35,
size = 4,
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png",
glow = 5,
})
obj:setyaw(yaw + math.pi)
local ent = obj:get_luaentity()
if ent then
ent.player = ent.player or player
end
end
end
end
end
end
end
end
end
end)
local rangedweapons_umpshot = {
physical = false,
timer = 0,
visual = "sprite",
visual_size = {x=0.3, y=0.3},
textures = {"rangedweapons_invisible.png"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
rangedweapons_umpshot.on_step = function(self, dtime, node, pos)
self.timer = self.timer + dtime
local tiem = 0.002
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.12 then
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 obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "rangedweapons:umpshot" and obj:get_luaentity().name ~= "__builtin:item" then
if math.random(1, 100) <= 8 then
local damage = math.random(9,18)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage, knockback=2},
}, nil)
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
self.object:remove()
else
local damage = math.random(4,8)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage, knockback = 1},
}, nil)
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
else
if math.random(1, 100) <= 8 then
local damage = math.random(9,18)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
self.object:remove()
else
local damage = math.random(4,8)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
if timer >= 0.002 + tiem then
minetest.add_particle({
pos = pos,
velocity = 0,
acceleration = {x=0, y=0, z=0},
expirationtime = 0.06,
size = 3,
collisiondetection = false,
vertical = false,
texture = "rangedweapons_bullet_fly.png",
glow = 15,
})
tiem = tiem + 0.002
end
if self.timer >= 4.0 then
self.object:remove()
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
if not minetest.setting_getbool("creative_mode") then
end
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
if node.name == "rangedweapons:barrel" or
node.name == "doors:door_glass_a" or
node.name == "doors:door_glass_b" or
node.name == "xpanes:pane" or
node.name == "xpanes:pane_flat" or
node.name == "vessels:drinking_glass" or
node.name == "vessels:glass_bottle" or
node.name == "default:glass" then
minetest.get_node_timer(pos):start(0)
end
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
end
end
minetest.register_entity("rangedweapons:umpshot", rangedweapons_umpshot )

178
mods/rangedweapons/uzi.lua Normal file
View File

@ -0,0 +1,178 @@
minetest.register_craft({
output = 'rangedweapons:uzi',
recipe = {
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:diamond', 'rangedweapons:plastic_sheet', 'default:steel_ingot'},
{'', 'default:steel_ingot', ''},
}
})
minetest.register_craftitem("rangedweapons:uzi", {
stack_max= 1,
wield_scale = {x=1.6,y=1.6,z=1.10},
description = "" ..core.colorize("#35cdff","UZI\n") ..core.colorize("#FFFFFF", "Ranged damage: 2-5\n") ..core.colorize("#FFFFFF", "accuracy: 69%\n") ..core.colorize("#FFFFFF", "Mob knockback: 0\n") ..core.colorize("#FFFFFF", "Critical chance: 5%\n") ..core.colorize("#FFFFFF", "Critical damage: 4-8\n") ..core.colorize("#FFFFFF", "Ammunition: 9mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.08\n") ..core.colorize("#FFFFFF", "Gun type: machine pistol\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
range = 0,
inventory_image = "rangedweapons_uzi.png",
})
local timer = 0
minetest.register_globalstep(function(dtime, player)
timer = timer + dtime;
if timer >= 0.08 then
for _, player in pairs(minetest.get_connected_players()) do
local inv = player:get_inventory()
local controls = player:get_player_control()
if controls.LMB then
timer = 0
local wielded_item = player:get_wielded_item():get_name()
if wielded_item == "rangedweapons:uzi" then
if not inv:contains_item("main", "rangedweapons:9mm") then
minetest.sound_play("rangedweapons_empty", {object=player})
else
if wielded_item == "rangedweapons:uzi" then
inv:remove_item("main", "rangedweapons:9mm")
local pos = player:getpos()
local dir = player:get_look_dir()
local yaw = player:get_look_yaw()
if pos and dir and yaw then
pos.y = pos.y + 1.6
local obj = minetest.add_entity(pos, "rangedweapons:uzishot")
if obj then
minetest.sound_play("rangedweapons_machine_pistol", {object=obj})
obj:setvelocity({x=dir.x * 25, y=dir.y * 25, z=dir.z * 25})
obj:setacceleration({x=dir.x * math.random(-3.1,3.1), y=math.random(-3.1,3.1), z=dir.z * math.random(-3.1,3.1)})
obj:setyaw(yaw + math.pi)
pos.y = pos.y + 0
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
minetest.sound_play("", {object=obj})
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
obj:setyaw(yaw + math.pi)
minetest.add_particle({
pos = pos,
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
expirationtime = 0.30,
size = 4,
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png",
glow = 5,
})
local ent = obj:get_luaentity()
if ent then
ent.player = ent.player or player
end
end
end
end
end
end
end
end
end
end)
local rangedweapons_uzishot = {
physical = false,
timer = 0,
visual = "sprite",
visual_size = {x=0.3, y=0.3},
textures = {"rangedweapons_invisible.png"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
rangedweapons_uzishot.on_step = function(self, dtime, node, pos)
self.timer = self.timer + dtime
local tiem = 0.002
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.125 then
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 obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "rangedweapons:uzishot" and obj:get_luaentity().name ~= "__builtin:item" then
if math.random(1, 100) <= 5 then
local damage = math.random(4,8)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage, knockback=0},
}, nil)
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
self.object:remove()
else
local damage = math.random(2,5)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage, knockback = 0},
}, nil)
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
else
if math.random(1, 100) <= 5 then
local damage = math.random(4,8)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
self.object:remove()
else
local damage = math.random(2,5)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
if timer >= 0.002 + tiem then
minetest.add_particle({
pos = pos,
velocity = 0,
acceleration = {x=0, y=0, z=0},
expirationtime = 0.06,
size = 3,
collisiondetection = false,
vertical = false,
texture = "rangedweapons_bullet_fly.png",
glow = 15,
})
tiem = tiem + 0.002
end
if self.timer >= 4.0 then
self.object:remove()
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
if not minetest.setting_getbool("creative_mode")
then
end
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
if node.name == "rangedweapons:barrel" or
node.name == "doors:door_glass_a" or
node.name == "doors:door_glass_b" or
node.name == "xpanes:pane" or
node.name == "xpanes:pane_flat" or
node.name == "vessels:drinking_glass" or
node.name == "vessels:glass_bottle" or
node.name == "default:glass" then
minetest.get_node_timer(pos):start(0)
end
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
end
end
minetest.register_entity("rangedweapons:uzishot", rangedweapons_uzishot )