This commit is contained in:
Vitaliy Olkhin 2024-07-22 15:41:50 +05:00
commit bbe33a8151
262 changed files with 6211 additions and 0 deletions

6
README.md Normal file
View File

@ -0,0 +1,6 @@
# rangedweapons
A direct clone of https://github.com/daviddoesminetest/rangedweapons. ALL CREDIT GOES THERE!
See also: https://forum.minetest.net/viewtopic.php?f=9&t=15173
See list of commits for improvements.

74
aa12.lua Normal file
View File

@ -0,0 +1,74 @@
minetest.register_tool("rangedweapons:aa12_r", {
stack_max= 1,
wield_scale = {x=1.9,y=1.9,z=1.4},
description = "",
rw_next_reload = "rangedweapons:aa12_rr",
load_sound = "rangedweapons_rifle_clip_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_aa12_rld.png",
})
minetest.register_tool("rangedweapons:aa12_rr", {
stack_max= 1,
wield_scale = {x=1.9,y=1.9,z=1.4},
description = "",
rw_next_reload = "rangedweapons:aa12_rrr",
load_sound = "rangedweapons_reload_a",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_aa12.png",
})
minetest.register_tool("rangedweapons:aa12_rrr", {
stack_max= 1,
wield_scale = {x=1.9,y=1.9,z=1.4},
description = "",
rw_next_reload = "rangedweapons:aa12",
load_sound = "rangedweapons_reload_b",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_aa12.png",
})
-------------------------------------------
minetest.register_tool("rangedweapons:aa12", {
stack_max= 1,
wield_scale = {x=1.9,y=1.9,z=1.4},
description = "" ..core.colorize("#35cdff","AA-12\n") ..core.colorize("#FFFFFF", "Ranged damage: 1\n") ..core.colorize("#FFFFFF", "projectiles: 5\n") ..core.colorize("#FFFFFF", "Gun gravity: 4\n") ..core.colorize("#FFFFFF", "accuracy: 40%\n") ..core.colorize("#FFFFFF", "knockback: 5\n") ..core.colorize("#FFFFFF", "Reload delay: 1.5\n") ..core.colorize("#FFFFFF", "Clip size: 20\n") ..core.colorize("#FFFFFF", "Critical chance: 5%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.0x\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shell\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.2 (full-auto)\n") ..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
range = 0,
inventory_image = "rangedweapons_aa12.png",
RW_gun_capabilities = {
automatic_gun = 1,
gun_damage = {fleshy=1,knockback=5},
gun_crit = 5,
gun_critEffc = 2.0,
suitable_ammo = {{"rangedweapons:shell",20}},
gun_skill = {"shotgun_skill",40},
gun_magazine = "rangedweapons:drum_mag",
gun_unloaded = "rangedweapons:aa12_r",
gun_velocity = 25,
gun_accuracy = 40,
gun_cooldown = 0.2,
gun_reload = 1.5/4,
gun_projectiles = 1,
has_shell = 1,
gun_durability = 750,
gun_smokeSize = 8,
gun_door_breaking = 1,
gun_projectiles = 5,
gun_gravity = 4,
gun_unload_sound = "rangedweapons_rifle_clip_out",
gun_sound = "rangedweapons_shotgun_shot",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
})

75
ak47.lua Normal file
View File

@ -0,0 +1,75 @@
minetest.register_tool("rangedweapons:ak47_r", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "",
rw_next_reload = "rangedweapons:ak47_rr",
load_sound = "rangedweapons_rifle_clip_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_ak47_rld.png",
})
minetest.register_tool("rangedweapons:ak47_rr", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "",
rw_next_reload = "rangedweapons:ak47_rrr",
load_sound = "rangedweapons_rifle_reload_a",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_ak47.png",
})
minetest.register_tool("rangedweapons:ak47_rrr", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "",
rw_next_reload = "rangedweapons:ak47",
load_sound = "rangedweapons_rifle_reload_b",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_ak47.png",
})
minetest.register_tool("rangedweapons:ak47", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "" ..core.colorize("#35cdff","AK-47\n") ..core.colorize("#FFFFFF", "Gun damage: 7\n") ..core.colorize("#FFFFFF", "accuracy: 77%\n") ..core.colorize("#FFFFFF", "Gun knockback: 5\n") ..core.colorize("#FFFFFF", "Gun Critical chance: 12%\n")..core.colorize("#FFFFFF", "Critical efficiency: 2.9x\n") ..core.colorize("#FFFFFF", "Reload delay: 1.4\n") ..core.colorize("#FFFFFF", "Clip size: 30\n") ..core.colorize("#FFFFFF", "Ammunition: 7.62mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.10(full-auto)\n") ..core.colorize("#FFFFFF", "Gun type: assault rifle\n") ..core.colorize("#FFFFFF", "Block penetration: 5%\n")
..core.colorize("#FFFFFF", "Enemy penetration: 15%\n") ..core.colorize("#FFFFFF", "Bullet velocity: 40"),
range = 0,
inventory_image = "rangedweapons_ak47.png",
RW_gun_capabilities = {
automatic_gun = 1,
gun_damage = {fleshy=7,knockback=5},
gun_crit = 12,
gun_critEffc = 2.9,
suitable_ammo = {{"rangedweapons:762mm",30}},
gun_skill = {"arifle_skill",50},
gun_magazine = "rangedweapons:assaultrifle_mag",
gun_unloaded = "rangedweapons:ak47_r",
gun_velocity = 40,
gun_accuracy = 77,
gun_cooldown = 0.1,
gun_reload = 1.4/4,
gun_projectiles = 1,
has_shell = 1,
gun_gravity = 0,
gun_durability = 1200,
gun_smokeSize = 5,
gun_mob_penetration = 15,
gun_node_penetration = 5,
gun_unload_sound = "rangedweapons_rifle_clip_out",
gun_sound = "rangedweapons_ak",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
inventory_image = "rangedweapons_ak47.png",
})

797
ammo.lua Normal file
View File

@ -0,0 +1,797 @@
forbidden_ents = {
"",
}
minetest.register_alias("rangedweapons:726mm", "rangedweapons:762mm")
minetest.register_craftitem("rangedweapons:shot_bullet_visual", {
wield_scale = {x=1.0,y=1.0,z=1.0},
inventory_image = "rangedweapons_bulletshot.png",
})
local rangedweapons_shot_bullet = {
timer = 0,
initial_properties = {
physical = true,
hp_max = 420,
glow = 100,
visual = "wielditem",
visual_size = {x=0.75, y=0.75},
textures = {"rangedweapons:shot_bullet_visual"},
lastpos = {},
collide_with_objects = true,
collisionbox = {-0.0025, -0.0025, -0.0025, 0.0025, 0.0025, 0.0025},
},
}
local use_particles = minetest.settings:get_bool("rangedweapons_impact_particles", true)
local max_lifetime = tonumber(minetest.settings:get("rangedweapons_bullet_lifetime")) or 10.0
rangedweapons_shot_bullet.on_step = function(self, dtime, moveresult)
----------------------------------------
---------------------------------------
if self.owner == nil then
self.object:remove()
return
end
local sparks = self.sparks or 0
local ignite = self.ignite or 0
local size = self.size or 0.0025
local SBP = self.bullet_particles
if SBP ~= nil then
for i=1,math.random(SBP.amount[1],SBP.amount[2]) do
minetest.add_particle({
pos = {x=self.object:get_pos().x+(math.random(-SBP.pos_randomness,SBP.pos_randomness)/100),y=self.object:get_pos().y+(math.random(-SBP.pos_randomness,SBP.pos_randomness)/100),z=self.object:get_pos().z+(math.random(-SBP.pos_randomness,SBP.pos_randomness)/100)},
velocity = {x=math.random(-SBP.velocity.x,SBP.velocity.x), y=math.random(-SBP.velocity.y,SBP.velocity.y), z=math.random(-SBP.velocity.z,SBP.velocity.z)},
acceleration = {x=math.random(-SBP.acceleration.x,SBP.acceleration.x), y=math.random(-SBP.acceleration.y,SBP.acceleration.y)-SBP.gravity, z=math.random(-SBP.acceleration.z,SBP.acceleration.z)},
expirationtime = SBP.lifetime,
size = math.random(SBP.minsize,SBP.maxsize)/10,
collisiondetection = SBP.collisiondetection,
vertical = false,
texture = SBP.texture,
animation = {type="vertical_frames", aspect_w=8, aspect_h=8, length = SBP.lifetime+0.1,},
glow = SBP.glow,
})
end end
self.timer = self.timer + dtime
if self.timer >= 0 then
self.object:set_properties({collide_with_objects = true})
self.object:set_properties({collisionbox = {-size, -size, -size, size, size, size}})
end
if self.timer > max_lifetime then
self.object:remove()
end
if moveresult.collides == true then
if moveresult.collisions[1] ~= nil then
local mobPen = self.mobPen or 0
local nodePen = self.nodePen or 0
local door_break = self.door_break or 0
local glass_break = self.glass_break or 0
if moveresult.collisions[1].type == "node" then
minetest.check_for_falling(moveresult.collisions[1].node_pos)
if use_particles and
minetest.registered_nodes[minetest.get_node(moveresult.collisions[1].node_pos).name] and
minetest.registered_nodes[minetest.get_node(moveresult.collisions[1].node_pos).name].tiles and
minetest.registered_nodes[minetest.get_node(moveresult.collisions[1].node_pos).name].tiles[1]
then
local hit_texture = minetest.registered_nodes[minetest.get_node(moveresult.collisions[1].node_pos).name].tiles[1]
if hit_texture.name ~= nil then
hit_texture = hit_texture.name
end
minetest.add_particle({
pos = self.object:get_pos(),
velocity = {x=0, y=0, z=0},
acceleration = {x=0, y=0, z=0},
expirationtime = 30,
size = math.random(10,20)/10,
collisiondetection = false,
vertical = false,
texture = "rangedweapons_bullethole.png",
glow = 0,
})
for i=1,math.random(4,8) do
minetest.add_particle({
pos = self.object:get_pos(),
velocity = {x=math.random(-3.0,3.0), y=math.random(2.0,5.0), z=math.random(-3.0,3.0)},
acceleration = {x=math.random(-3.0,3.0), y=math.random(-10.0,-15.0), z=math.random(-3.0,3.0)},
expirationtime = 0.5,
size = math.random(10,20)/10,
collisiondetection = true,
vertical = false,
texture = ""..hit_texture.."^[resize:4x4".."",
glow = 0,
})
end
end
minetest.sound_play("default_dig_cracky", {pos = self.object:get_pos(), gain = 1.0})
if ignite > 0 then
if minetest.get_node(moveresult.collisions[1].node_pos).name == "rangedweapons:barrel" then
minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"})
tnt.boom(moveresult.collisions[1].node_pos, {radius = 3})
end
if minetest.get_node(moveresult.collisions[1].node_pos).name == "tnt:tnt" then
minetest.swap_node(moveresult.collisions[1].node_pos, {name = "tnt:tnt_burning"})
minetest.sound_play("tnt_ignite", {pos = moveresult.collisions[1].node_pos}, true)
minetest.get_node_timer(moveresult.collisions[1].node_pos):start(3)
minetest.check_for_falling(moveresult.collisions[1].node_pos)
end
end
if door_break > 0 and minetest.settings:get_bool("rangedweapons_door_breaking", true) then
if string.find(minetest.get_node(moveresult.collisions[1].node_pos).name,"door_wood") then
minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"})
minetest.add_item(moveresult.collisions[1].node_pos, "default:wood 5")
minetest.sound_play("rangedweapons_woodbreak",{pos = moveresult.collisions[1].node_pos})
end end
if glass_break > 0 and minetest.settings:get_bool("rangedweapons_glass_breaking", true) then
local nodeName = minetest.get_node(moveresult.collisions[1].node_pos).name
if nodeName == "default:glass" then
minetest.swap_node(moveresult.collisions[1].node_pos, {name = "rangedweapons:broken_glass"})
minetest.sound_play("glass_break",{pos = moveresult.collisions[1].node_pos})
end
if nodeName == "xpanes:pane" or
nodeName == "xpanes:pane_flat" then
minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"})
minetest.add_item(moveresult.collisions[1].node_pos, "rangedweapons:glass_shards")
minetest.sound_play("glass_break",{pos = moveresult.collisions[1].node_pos})
end
if string.find(nodeName,"door_glass") then
minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"})
minetest.add_item(moveresult.collisions[1].node_pos, "vessels:glass_fragments 5")
minetest.sound_play("glass_break",{pos = moveresult.collisions[1].node_pos})
end
end
if minetest.get_item_group(minetest.get_node(moveresult.collisions[1].node_pos).name, "level") > 1 then
if minetest.settings:get_bool("rangedweapons_bullet_ricochet", true) then
self.object:set_velocity(moveresult.collisions[1].old_velocity)
if sparks > 0 then
make_sparks(self.object:get_pos())
end
local objVel = moveresult.collisions[1].old_velocity
local objRot = self.object:get_rotation()
if objRot and objVel then
if moveresult.collisions[1].axis == "x" then
self.object:set_rotation({x=0,y=objRot.y,z=objRot.z+3})
self.object:set_velocity({x=objVel.x*-1,y=objVel.y,z=objVel.z})
end
if moveresult.collisions[1].axis == "z" then
self.object:set_rotation({x=0,y=objRot.y,z=objRot.z+3})
self.object:set_velocity({x=objVel.x,y=objVel.y,z=objVel.z*-1})
end
if moveresult.collisions[1].axis == "y" then
self.object:set_rotation({x=0,y=objRot.y+3,z=objRot.z+3})
self.object:set_velocity({x=objVel.x,y=objVel.y*-1,z=objVel.z})
end
end
else
self.object:remove()
end
else
if math.random(1,100) <= nodePen then
if use_particles then
for i=1,10 do
minetest.add_particle({
pos = self.object:get_pos(),
velocity = {x=1.5, y=1.5, z=1.5} ,
acceleration = {x=math.random(-3.0,3.0), y=math.random(-4.0,4.0), z=math.random(-3.0,3.0)},
expirationtime = 1.25,
size = math.random(3,6),
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png",
glow = 2,
})
end
end
minetest.sound_play("default_dig_cracky", {pos = self.object:get_pos(), gain = 1.0})
self.object:set_properties({collisionbox = {0,0,0,0,0,0}})
--minetest.chat_send_all("hit")
self.object:set_velocity(moveresult.collisions[1].old_velocity)
else
if minetest.get_item_group(minetest.get_node(moveresult.collisions[1].node_pos).name, "leaves") > 0 then
minetest.sound_play("default_dig_snappy", {pos = self.object:get_pos(), gain = 1.5})
if use_particles then
for i = 1,math.random(3,6) do
minetest.add_particle({
pos = self.object:get_pos(),
velocity = {x=math.random(-2,2), y=math.random(3,6), z=math.random(-2,2)},
acceleration = {x=math.random(-2,2), y=math.random(-3,-6), z=math.random(-2,2)},
expirationtime = math.random(2,4),
size = math.random(6,9),
collisiondetection = true,
collision_removal = false,
vertical = false,
texture = "rangedweapons_leaf.png",
animation = {type="vertical_frames", aspect_w=8, aspect_h=8, length = 0.8,},
glow = 15,
})
end
end
self.object:set_properties({collisionbox = {0,0,0,0,0,0}})
self.object:set_velocity(moveresult.collisions[1].old_velocity)
else
if self.OnCollision ~= nil then
self.OnCollision(self.owner,self,moveresult.collisions[1])
end
self.object:remove()
end
end
end
end
if moveresult.collisions[1].type == "object" and (not moveresult.collisions[1].object:is_player() or moveresult.collisions[1].object:get_player_name() ~= self.owner) then
local actualDamage = self.damage or {fleshy=1}
local damage = {}
local crit = self.crit or 0
local critEffc = self.critEffc or 1
local owner = minetest.get_player_by_name(self.owner)
local hit_texture = "rangedweapons_hit.png"
local dps = self.dps or 0
local skill = self.skill_value or 1
for _, dmg in pairs(actualDamage) do
damage[_] = actualDamage[_]
end
local player_dmg_multiplier = tonumber(minetest.settings:get("rangedweapons_player_dmg_multiplier")) or 1.0
local headshot_dmg_multiplier = tonumber(minetest.settings:get("rangedweapons_headshot_dmg_multiplier")) or 1.75
local mob_dmg_multiplier = tonumber(minetest.settings:get("rangedweapons_mob_dmg_multiplier")) or 1.0
if moveresult.collisions[1].object:is_player() then
for _, player_dmg in pairs(damage) do
damage[_] = damage[_] * player_dmg_multiplier
end
if self.object:get_pos().y - moveresult.collisions[1].object:get_pos().y > 1.5 then
for _, hs_dmg in pairs(damage) do
damage[_] = damage[_] * headshot_dmg_multiplier
end
end
knockback = damage.knockback or 0
projectile_kb(moveresult.collisions[1].object,self.object,knockback)
else
for _, mob_dmg in pairs(damage) do
damage[_] = damage[_] * mob_dmg_multiplier
end
end
for _, bonus_dmg in pairs(damage) do
damage[_] = (damage[_]*skill) + (self.dps*self.timer)
end
--minetest.chat_send_all(critEffc)
if math.random(1,100) <= crit+((skill*10)-10) then
for _, critDmg in pairs(damage) do
damage[_] = damage[_] * critEffc
end
local entpos = self.object:get_pos()
minetest.add_particle ({
pos = entpos, velocity = 0, acceleration = {x=0, y=5, z=0},
expirationtime = 0.75, size = 12, collisiondetection = false,
vertical = false, texture = "rangedweapons_crit.png", glow = 30,})
hit_texture = "rangedweapons_crithit.png"
end
moveresult.collisions[1].object:punch(owner, 1.0, {
full_punch_interval = 1.0,
damage_groups = damage,}, nil)
owner:hud_change(hit, "text", hit_texture)
local bloodyness = tonumber(minetest.settings:get("rangedweapons_bloodyness")) or 10
for i=1,math.random(math.ceil(bloodyness*0.66),math.ceil(bloodyness*1.5)) do
minetest.add_particle({
pos = self.object:get_pos(),
velocity = {x=math.random(-15.0,15.0)/10, y=math.random(2.0,5.0), z=math.random(-15.0,15.0)/10},
acceleration = {x=math.random(-3.0,3.0), y=math.random(-10.0,-15.0), z=math.random(-3.0,3.0)},
expirationtime = 0.75,
size = math.random(10,20)/10,
collisiondetection = true,
vertical = false,
texture = "rangedweapons_blood.png",
animation = {type="vertical_frames", aspect_w=8, aspect_h=8, length = 0.8,},
glow = 0,
})
end
if math.random(1,100) <= mobPen then
if use_particles then
for i=1,10 do
minetest.add_particle({
pos = self.object:get_pos(),
velocity = {x=1.5, y=1.5, z=1.5} ,
acceleration = {x=math.random(-3.0,3.0), y=math.random(-4.0,4.0), z=math.random(-3.0,3.0)},
expirationtime = 1.25,
size = math.random(3,6),
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png",
glow = 2,
})
end
end
minetest.sound_play("default_dig_cracky", {pos = self.object:get_pos(), gain = 1.0})
self.object:set_properties({collisionbox = {0,0,0,0,0,0}})
self.object:set_velocity(moveresult.collisions[1].old_velocity)
else
if self.OnCollision ~= nil then
self.OnCollision(self.owner,self,moveresult.collisions[1])
end
self.object:remove()
end
end
else
self.object:remove()
end
end
end
minetest.register_entity("rangedweapons:shot_bullet", rangedweapons_shot_bullet)
---
--- actual mags
---
---
--- visual drop mags
---
minetest.register_craftitem("rangedweapons:drum_mag", {
wield_scale = {x=1.0,y=1.0,z=1.5},
inventory_image = "rangedweapons_drum_mag.png",
})
minetest.register_craftitem("rangedweapons:handgun_mag_black", {
wield_scale = {x=0.6,y=0.6,z=0.8},
inventory_image = "rangedweapons_magazine_handgun.png",
})
local rangedweapons_mag = {
physical = false,
timer = 0,
visual = "wielditem",
visual_size = {x=0.3, y=0.3},
textures = {"rangedweapons:handgun_mag_black"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
rangedweapons_mag.on_step = function(self, dtime, pos)
self.timer = self.timer + dtime
local pos = self.object:get_pos()
local node = minetest.get_node(pos)
if self.lastpos.y ~= nil then
if minetest.registered_nodes[node.name] ~= nil then
if minetest.registered_nodes[node.name].walkable then
local vel = self.object:get_velocity()
local acc = self.object:get_acceleration()
self.object:set_velocity({x=0, y=0, z=0})
self.object:set_acceleration({x=0, y=0, z=0})
end end
end
if self.timer > 2.0 then
self.object:remove()
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("rangedweapons:mag", rangedweapons_mag)
minetest.register_craftitem("rangedweapons:handgun_mag_white", {
wield_scale = {x=0.6,y=0.6,z=0.8},
inventory_image = "rangedweapons_handgun_mag_white.png",
})
minetest.register_craftitem("rangedweapons:machinepistol_mag", {
wield_scale = {x=0.6,y=0.6,z=0.8},
inventory_image = "rangedweapons_machinepistol_mag.png",
})
minetest.register_craftitem("rangedweapons:assaultrifle_mag", {
wield_scale = {x=0.6,y=0.6,z=0.8},
inventory_image = "rangedweapons_assaultrifle_mag.png",
})
minetest.register_craftitem("rangedweapons:rifle_mag", {
wield_scale = {x=0.6,y=0.6,z=0.8},
inventory_image = "rangedweapons_rifle_mag.png",
})
minetest.register_craftitem("rangedweapons:9mm", {
stack_max= 500,
wield_scale = {x=0.4,y=0.4,z=1.2},
description = "" ..core.colorize("#35cdff","9x19mm Parabellum\n")..core.colorize("#FFFFFF", "Bullet damage: 1 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.25 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 1% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 25 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 1 \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
inventory_image = "rangedweapons_9mm.png",
RW_ammo_capabilities = {
ammo_damage = {fleshy=1,knockback=1},
ammo_critEffc = 0.25,
ammo_crit = 1,
ammo_velocity = 25,
ammo_glass_breaking = 1,
ammo_entity = "rangedweapons:shot_bullet",
ammo_visual = "wielditem",
ammo_texture = "rangedweapons:shot_bullet_visual",
shell_entity = "rangedweapons:empty_shell",
shell_visual = "wielditem",
shell_texture = "rangedweapons:shelldrop",
ammo_projectile_size = 0.0025,
has_sparks = 1,
ignites_explosives = 1,
}
})
minetest.register_craftitem("rangedweapons:45acp", {
stack_max= 450,
wield_scale = {x=0.4,y=0.4,z=1.2},
description = "" ..core.colorize("#35cdff",".45ACP catridge\n")..core.colorize("#FFFFFF", "Bullet damage: 2 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.50 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 2% \n")
..core.colorize("#FFFFFF", "Bullet velocity: 20 \n")
..core.colorize("#FFFFFF", "Bullet knockback: 2 \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
inventory_image = "rangedweapons_45acp.png",
RW_ammo_capabilities = {
ammo_damage = {fleshy=2,knockback=1},
ammo_critEffc = 0.50,
ammo_crit = 1,
ammo_velocity = 20,
ammo_glass_breaking = 1,
ammo_entity = "rangedweapons:shot_bullet",
ammo_visual = "wielditem",
ammo_texture = "rangedweapons:shot_bullet_visual",
shell_entity = "rangedweapons:empty_shell",
shell_visual = "wielditem",
shell_texture = "rangedweapons:shelldrop",
ammo_projectile_size = 0.0025,
has_sparks = 1,
ignites_explosives = 1,
},
})
minetest.register_craftitem("rangedweapons:10mm", {
stack_max= 400,
wield_scale = {x=0.4,y=0.4,z=1.2},
description = "" ..core.colorize("#35cdff","10mm Auto\n")..core.colorize("#FFFFFF", "Bullet damage: 2 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency:0.30 \n") ..core.colorize("#FFFFFF", "Bullet velocity: 25 \n")
..core.colorize("#FFFFFF", "Bullet knockback: 1 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 1% \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
inventory_image = "rangedweapons_10mm.png",
RW_ammo_capabilities = {
ammo_damage = {fleshy=2,knockback=1},
ammo_critEffc = 0.3,
ammo_crit = 1,
ammo_velocity = 25,
ammo_glass_breaking = 1,
ammo_entity = "rangedweapons:shot_bullet",
ammo_visual = "wielditem",
ammo_texture = "rangedweapons:shot_bullet_visual",
shell_entity = "rangedweapons:empty_shell",
shell_visual = "wielditem",
shell_texture = "rangedweapons:shell_whitedrop",
ammo_projectile_size = 0.0025,
has_sparks = 1,
ignites_explosives = 1,
}
})
minetest.register_craftitem("rangedweapons:357", {
stack_max= 150,
wield_scale = {x=0.4,y=0.4,z=1.2},
description = "" ..core.colorize("#35cdff",".357 magnum round\n")..core.colorize("#FFFFFF", "Bullet damage: 4 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.6 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 3% \n") ..core.colorize("#FFFFFF", "Bullet knockback: 5 \n") ..core.colorize("#FFFFFF", "Bullet enemy Penetration: 5%\n") ..core.colorize("#FFFFFF", "Bullet velocity: 45 \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
inventory_image = "rangedweapons_357.png",
RW_ammo_capabilities = {
ammo_damage = {fleshy=4,knockback=5},
ammo_critEffc = 0.6,
ammo_crit = 3,
ammo_velocity = 45,
ammo_glass_breaking = 1,
ammo_mob_penetration = 5,
ammo_entity = "rangedweapons:shot_bullet",
ammo_visual = "wielditem",
ammo_texture = "rangedweapons:shot_bullet_visual",
shell_entity = "rangedweapons:empty_shell",
shell_visual = "wielditem",
shell_texture = "rangedweapons:shelldrop",
ammo_projectile_size = 0.0025,
has_sparks = 1,
ignites_explosives = 1,
}
})
minetest.register_craftitem("rangedweapons:50ae", {
stack_max= 100,
wield_scale = {x=0.6,y=0.6,z=1.5},
description = "" ..core.colorize("#35cdff",".50AE catridge\n")..core.colorize("#FFFFFF", "Bullet damage: 8 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.9 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 6% \n") ..core.colorize("#FFFFFF", "Bullet knockback: 10 \n") ..core.colorize("#FFFFFF", "Bullet enemy Penetration: 15%\n") ..core.colorize("#FFFFFF", "Bullet velocity: 55 \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
inventory_image = "rangedweapons_50ae.png",
RW_ammo_capabilities = {
ammo_damage = {fleshy=8,knockback=10},
ammo_critEffc = 0.9,
ammo_crit = 6,
ammo_velocity = 55,
ammo_glass_breaking = 1,
ammo_mob_penetration = 15,
ammo_entity = "rangedweapons:shot_bullet",
ammo_visual = "wielditem",
ammo_texture = "rangedweapons:shot_bullet_visual",
shell_entity = "rangedweapons:empty_shell",
shell_visual = "wielditem",
shell_texture = "rangedweapons:shelldrop",
ammo_projectile_size = 0.0025,
has_sparks = 1,
ignites_explosives = 1,
}
})
minetest.register_craftitem("rangedweapons:44", {
stack_max= 150,
wield_scale = {x=0.4,y=0.4,z=1.2},
description = "" ..core.colorize("#35cdff",".44 magnum round\n")..core.colorize("#FFFFFF", "Bullet damage: 4 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.7 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 4% \n") ..core.colorize("#FFFFFF", "Bullet knockback: 6 \n") ..core.colorize("#FFFFFF", "Bullet enemy Penetration: 6%\n") ..core.colorize("#FFFFFF", "Bullet velocity: 50 \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
inventory_image = "rangedweapons_44.png",
RW_ammo_capabilities = {
ammo_damage = {fleshy=4,knockback=6},
ammo_critEffc = 0.7,
ammo_crit = 4,
ammo_velocity = 50,
ammo_glass_breaking = 1,
ammo_mob_penetration = 6,
ammo_entity = "rangedweapons:shot_bullet",
ammo_visual = "wielditem",
ammo_texture = "rangedweapons:shot_bullet_visual",
shell_entity = "rangedweapons:empty_shell",
shell_visual = "wielditem",
shell_texture = "rangedweapons:shelldrop",
ammo_projectile_size = 0.0025,
has_sparks = 1,
ignites_explosives = 1,
}
})
minetest.register_craftitem("rangedweapons:762mm", {
stack_max= 250,
wield_scale = {x=0.4,y=0.4,z=1.2},
description = "" ..core.colorize("#35cdff","7.62mm round\n")..core.colorize("#FFFFFF", "Bullet damage: 4 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.5 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 2% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 40 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 4 \n") ..core.colorize("#FFFFFF", "Bullet enemy Penetration: 5%\n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
inventory_image = "rangedweapons_762mm.png",
RW_ammo_capabilities = {
ammo_damage = {fleshy=4,knockback=4},
ammo_critEffc = 0.5,
ammo_crit = 2,
ammo_velocity = 40,
ammo_glass_breaking = 1,
ammo_entity = "rangedweapons:shot_bullet",
ammo_visual = "wielditem",
ammo_texture = "rangedweapons:shot_bullet_visual",
shell_entity = "rangedweapons:empty_shell",
shell_visual = "wielditem",
shell_texture = "rangedweapons:shelldrop",
ammo_mob_penetration = 5,
ammo_projectile_size = 0.0025,
has_sparks = 1,
ignites_explosives = 1,
},
})
minetest.register_craftitem("rangedweapons:556mm", {
stack_max= 300,
wield_scale = {x=0.4,y=0.4,z=1.2},
description = "" ..core.colorize("#35cdff","5.56mm round\n")..core.colorize("#FFFFFF", "Bullet damage: 3 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.4 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 2% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 35 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 3 \n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
inventory_image = "rangedweapons_556mm.png",
RW_ammo_capabilities = {
ammo_damage = {fleshy=3,knockback=3},
ammo_critEffc = 0.4,
ammo_crit = 2,
ammo_velocity = 35,
ammo_glass_breaking = 1,
ammo_entity = "rangedweapons:shot_bullet",
ammo_visual = "wielditem",
ammo_texture = "rangedweapons:shot_bullet_visual",
shell_entity = "rangedweapons:empty_shell",
shell_visual = "wielditem",
shell_texture = "rangedweapons:shelldrop",
ammo_projectile_size = 0.0025,
has_sparks = 1,
ignites_explosives = 1,
},
})
minetest.register_craftitem("rangedweapons:shell", {
stack_max= 50,
wield_scale = {x=0.4,y=0.4,z=1.2},
description = "" ..core.colorize("#35cdff","12 Gauge shell\n")..core.colorize("#FFFFFF", "Bullet damage: 2 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.15 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 1% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 20 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 4 \n") ..core.colorize("#FFFFFF", "Bullet gravity: 5 \n") ..core.colorize("#FFFFFF", "Bullet projectile multiplier: 1.5x\n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
inventory_image = "rangedweapons_shell.png",
RW_ammo_capabilities = {
ammo_damage = {fleshy=2,knockback=4},
ammo_projectile_multiplier = 1.5,
ammo_critEffc = 0.15,
ammo_crit = 1,
ammo_velocity = 20,
ammo_glass_breaking = 1,
ammo_entity = "rangedweapons:shot_bullet",
ammo_visual = "sprite",
ammo_texture = "rangedweapons_buckball.png",
shell_entity = "rangedweapons:empty_shell",
shell_visual = "wielditem",
shell_texture = "rangedweapons:shell_shotgundrop",
ammo_gravity = 5,
ammo_projectile_size = 0.00175,
ammo_projectile_glow = 0,
has_sparks = 1,
ignites_explosives = 1,
},
})
minetest.register_craftitem("rangedweapons:308winchester", {
stack_max= 75,
wield_scale = {x=0.4,y=0.4,z=1.2},
description = "" ..core.colorize("#35cdff",".308 winchester round\n")..core.colorize("#FFFFFF", "Bullet damage: 8 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.75 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 4% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 60 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 10 \n") ..core.colorize("#FFFFFF", "Damage gain over 1 sec of flight time: 40 \n") ..core.colorize("#FFFFFF", "Bullet enemy Penetration: 20%\n") ..core.colorize("#FFFFFF", "Bullet node Penetration: 10%\n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
inventory_image = "rangedweapons_308winchester.png",
RW_ammo_capabilities = {
ammo_damage = {fleshy=8,knockback=10},
ammo_critEffc = 0.75,
ammo_crit = 2,
ammo_velocity = 60,
ammo_glass_breaking = 1,
ammo_entity = "rangedweapons:shot_bullet",
ammo_visual = "wielditem",
ammo_texture = "rangedweapons:shot_bullet_visual",
shell_entity = "rangedweapons:empty_shell",
shell_visual = "wielditem",
shell_texture = "rangedweapons:shelldrop",
ammo_mob_penetration = 20,
ammo_node_penetration = 10,
ammo_projectile_size = 0.0025,
ammo_dps = 40,
has_sparks = 1,
ignites_explosives = 1,
},
})
minetest.register_craftitem("rangedweapons:408cheytac", {
stack_max= 40,
wield_scale = {x=0.65,y=0.65,z=1.5},
description = "" ..core.colorize("#35cdff",".408 chey tac\n")..core.colorize("#FFFFFF", "Bullet damage: 10 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 0.8 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 5% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 70 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 15 \n") ..core.colorize("#FFFFFF", "Damage gain over 1 sec of flight time: 80 \n") ..core.colorize("#FFFFFF", "Bullet enemy Penetration: 45%\n") ..core.colorize("#FFFFFF", "Bullet node Penetration: 20%\n") ..core.colorize("#FFFFFF", "Ammunition for some guns"),
inventory_image = "rangedweapons_408cheytac.png",
RW_ammo_capabilities = {
ammo_damage = {fleshy=10,knockback=15},
ammo_critEffc = 0.8,
ammo_crit = 5,
ammo_velocity = 70,
ammo_glass_breaking = 1,
ammo_entity = "rangedweapons:shot_bullet",
ammo_visual = "wielditem",
ammo_texture = "rangedweapons:shot_bullet_visual",
shell_entity = "rangedweapons:empty_shell",
shell_visual = "wielditem",
shell_texture = "rangedweapons:shelldrop",
ammo_mob_penetration = 45,
ammo_node_penetration = 20,
ammo_projectile_size = 0.0025,
ammo_dps = 80,
has_sparks = 1,
ignites_explosives = 1,
},
})
minetest.register_craftitem("rangedweapons:40mm", {
stack_max= 25,
wield_scale = {x=0.8,y=0.8,z=2.4},
description = "" ..core.colorize("#35cdff",".40mm grenade\n")..core.colorize("#FFFFFF", "Bullet damage: 10 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 1.0 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 1% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 15 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 10 \n") ..core.colorize("#FFFFFF", "Bullet gravity: 5 \n") ..core.colorize("#FFFFFF", "explodes on impact with a radius of 2\n") ..core.colorize("#FFFFFF", "Ammunition for grenade launchers"),
inventory_image = "rangedweapons_40mm.png",
RW_ammo_capabilities = {
ammo_damage = {fleshy=10,knockback=15},
ammo_critEffc = 1.0,
ammo_crit = 1,
ammo_velocity = 15,
ammo_glass_breaking = 1,
ammo_entity = "rangedweapons:shot_bullet",
ammo_visual = "sprite",
ammo_texture = "rangedweapons_rocket_fly.png",
shell_entity = "rangedweapons:empty_shell",
shell_visual = "wielditem",
shell_texture = "rangedweapons:shell_grenadedrop",
ammo_projectile_size = 0.15,
has_sparks = 1,
ammo_gravity = 5,
ignites_explosives = 1,
OnCollision = function(player,bullet,target)
tnt.boom(bullet.object:get_pos(), {radius = 2})
end,
ammo_particles = {
velocity = {x=1,y=1,z=1},
acceleration = {x=1,y=1,z=1},
collisiondetection = true,
lifetime = 1,
texture = "tnt_smoke.png",
minsize = 50,
maxsize = 75,
pos_randomness = 50,
glow = 20,
gravity = 10,
amount = {1,1}
},
},
})
minetest.register_craftitem("rangedweapons:rocket", {
stack_max= 15,
wield_scale = {x=1.2,y=1.2,z=2.4},
description = "" ..core.colorize("#35cdff","rocket\n")..core.colorize("#FFFFFF", "Bullet damage: 15 \n") ..core.colorize("#FFFFFF", "Bullet crit efficiency: 1.0 \n") ..core.colorize("#FFFFFF", "Bullet crit chance: 1% \n") ..core.colorize("#FFFFFF", "Bullet velocity: 20 \n") ..core.colorize("#FFFFFF", "Bullet knockback: 20 \n") ..core.colorize("#FFFFFF", "Bullet gravity: 5 \n") ..core.colorize("#FFFFFF", "explodes on impact with a radius of 3\n") ..core.colorize("#FFFFFF", "Ammunition for rocket launchers"),
inventory_image = "rangedweapons_rocket.png",
RW_ammo_capabilities = {
ammo_damage = {fleshy=15,knockback=20},
ammo_critEffc = 1.0,
ammo_crit = 1,
ammo_velocity = 20,
ammo_glass_breaking = 1,
ammo_entity = "rangedweapons:shot_bullet",
ammo_visual = "sprite",
ammo_texture = "rangedweapons_rocket_fly.png",
ammo_projectile_size = 0.15,
has_sparks = 1,
ignites_explosives = 1,
OnCollision = function(player,bullet,target)
tnt.boom(bullet.object:get_pos() , {radius = 3})
end,
ammo_particles = {
velocity = {x=1,y=1,z=1},
acceleration = {x=1,y=1,z=1},
collisiondetection = true,
lifetime = 1,
texture = "tnt_smoke.png",
minsize = 50,
maxsize = 75,
pos_randomness = 50,
glow = 20,
gravity = 10,
amount = {1,1}
},
},
})

101
awp.lua Normal file
View File

@ -0,0 +1,101 @@
minetest.register_tool("rangedweapons:awp_uld", {
stack_max= 1,
wield_scale = {x=1.9,y=1.9,z=1.1},
range = 0,
description = "" ..core.colorize("#35cdff","A.W.P. \n") ..core.colorize("#FFFFFF", "Ranged damage:18 + 35/sec of bullet lifetime\n")..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "knockback: 15\n") ..core.colorize("#FFFFFF", "Critical chance: 30%\n") ..core.colorize("#FFFFFF", "Critical efficiency: x3\n") ..core.colorize("#FFFFFF", "Ammunition: 7.62mm round/308.Winchester rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 1.0\n") ..core.colorize("#FFFFFF", "Reload time: 2.0\n") ..core.colorize("#FFFFFF", "Zoom: 12x\n") ..core.colorize("#be0d00", "Right-click to eject empty bullet shell\n") ..core.colorize("#FFFFFF", "Clip size: 10/10\n") ..core.colorize("#FFFFFF", "Enemy penetration:30%\n") ..core.colorize("#FFFFFF", "Block penetration:10%\n") ..core.colorize("#FFFFFF", "Gun type: Rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 75"),
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_awp.png",
weapon_zoom = 7.5,
on_use = function(itemstack, user)
minetest.sound_play("rangedweapons_empty", {pos = user:get_pos()})
end,
on_secondary_use = function(itemstack, user, pointed_thing)
eject_shell(itemstack,user,"rangedweapons:awp_rld",1.0,"rangedweapons_rifle_reload_a","rangedweapons:empty_shell")
return itemstack
end,
})
minetest.register_tool("rangedweapons:awp_r", {
rw_next_reload = "rangedweapons:awp_rr",
load_sound = "rangedweapons_rifle_clip_in",
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
description = "",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_awp_noclip.png",
})
minetest.register_tool("rangedweapons:awp_rr", {
rw_next_reload = "rangedweapons:awp_rrr",
load_sound = "rangedweapons_rifle_reload_a",
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
description = "",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_awp.png",
})
minetest.register_tool("rangedweapons:awp_rrr", {
rw_next_reload = "rangedweapons:awp",
load_sound = "rangedweapons_rifle_reload_b",
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
description = "",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_awp_rld.png",
})
minetest.register_tool("rangedweapons:awp_rld", {
stack_max= 1,
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
description = "",
loaded_gun = "rangedweapons:awp",
loaded_sound = "rangedweapons_rifle_reload_b",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_awp_rld.png",
})
minetest.register_tool("rangedweapons:awp", {
description = "" ..core.colorize("#35cdff","A.W.P. \n") ..core.colorize("#FFFFFF", "Ranged damage:18 + 35/sec of bullet lifetime\n")..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "knockback: 15\n") ..core.colorize("#FFFFFF", "Critical chance: 30%\n") ..core.colorize("#FFFFFF", "Critical efficiency: x3\n") ..core.colorize("#FFFFFF", "Ammunition: 7.62mm round/308.Winchester rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 1.0\n") ..core.colorize("#FFFFFF", "Reload time: 2.0\n") ..core.colorize("#FFFFFF", "Zoom: 12x\n") ..core.colorize("#27a600", "The gun is loaded!\n") ..core.colorize("#FFFFFF", "Clip size: 10/10\n") ..core.colorize("#FFFFFF", "Enemy penetration:30%\n") ..core.colorize("#FFFFFF", "Block penetration:10%\n") ..core.colorize("#FFFFFF", "Gun type: Rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 75"),
range = 0,
weapon_zoom = 7.5,
wield_scale = {x=1.9,y=1.9,z=1.1},
inventory_image = "rangedweapons_awp.png",
RW_gun_capabilities = {
gun_damage = {fleshy=18,knockback=15},
gun_crit = 30,
gun_critEffc = 3.0,
suitable_ammo = {{"rangedweapons:762mm",10},{"rangedweapons:308winchester",10}},
gun_skill = {"rifle_skill",20},
gun_magazine = "rangedweapons:rifle_mag",
gun_unloaded = "rangedweapons:awp_r",
gun_cooling = "rangedweapons:awp_uld",
gun_velocity = 75,
gun_accuracy = 100,
gun_cooldown = 1.0,
gun_reload = 2.0/4,
gun_projectiles = 1,
has_shell = 0,
gun_durability = 700,
gun_smokeSize = 8,
gun_dps = 35,
gun_mob_penetration = 30,
gun_node_penetration = 10,
gun_unload_sound = "rangedweapons_rifle_clip_out",
gun_sound = "rangedweapons_rifle_b",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})

62
benelli.lua Normal file
View File

@ -0,0 +1,62 @@
minetest.register_tool("rangedweapons:benelli_rld", {
stack_max= 1,
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
description = "",
loaded_gun = "rangedweapons:benelli",
loaded_sound = "rangedweapons_shotgun_reload_b",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_benelli_rld.png",
})
minetest.register_tool("rangedweapons:benelli", {
description = "" ..core.colorize("#35cdff","benelli m3\n") ..core.colorize("#FFFFFF", "Ranged damage: 2\n") ..core.colorize("#FFFFFF", "projectiles: 5\n") ..core.colorize("#FFFFFF", "Gun gravity: 4\n") ..core.colorize("#FFFFFF", "Accuracy: 48%\n")..core.colorize("#FFFFFF", "knockback: 6\n") ..core.colorize("#FFFFFF", "Critical chance: 6%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.0x\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Pump delay: 0.6\n")..core.colorize("#FFFFFF", "Clip size: 7\n") ..core.colorize("#27a600", "Gun is ready to fire!\n") ..core.colorize("#fff21c", "Right-click to load in a bullet!\n") ..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 26"),
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
inventory_image = "rangedweapons_benelli.png",
RW_gun_capabilities = {
gun_damage = {fleshy=2,knockback=6},
gun_crit = 6,
gun_critEffc = 2.0,
suitable_ammo = {{"rangedweapons:shell",7}},
gun_skill = {"shotgun_skill",20},
gun_unloaded = "rangedweapons:benelli_rld",
gun_cooling = "rangedweapons:benelli_uld",
gun_velocity = 25,
gun_accuracy = 48,
gun_cooldown = 0.6,
gun_gravity = 4,
gun_reload = 0.25,
gun_projectiles = 5,
has_shell = 0,
gun_durability = 325,
gun_smokeSize = 14,
gun_door_breaking = 1,
gun_sound = "rangedweapons_shotgun_shot",
gun_unload_sound = "rangedweapons_shell_insert",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_single_load_gun(itemstack, user, "")
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})
minetest.register_tool("rangedweapons:benelli_uld", {
stack_max= 1,
wield_scale = {x=1.9,y=1.9,z=1.1},
range = 0,
description = "" ..core.colorize("#35cdff","benelli m3\n") ..core.colorize("#FFFFFF", "Ranged damage: 2\n") ..core.colorize("#FFFFFF", "projectiles: 5\n") ..core.colorize("#FFFFFF", "Gun gravity: 4\n") ..core.colorize("#FFFFFF", "Accuracy: 48%\n")..core.colorize("#FFFFFF", "knockback: 6\n") ..core.colorize("#FFFFFF", "Critical chance: 6%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.0x\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Pump delay: 0.6\n")..core.colorize("#FFFFFF", "Clip size: 7\n") ..core.colorize("#be0d00", "Right-click, to eject the empty shell!\n") ..core.colorize("#fff21c", "Right-click to load in a bullet!\n") ..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
inventory_image = "rangedweapons_benelli.png",
groups = {not_in_creative_inventory = 1},
on_use = function(itemstack, user)
minetest.sound_play("rangedweapons_empty", {pos = user:get_pos()})
end,
on_secondary_use = function(itemstack, user, pointed_thing)
eject_shell(itemstack,user,"rangedweapons:benelli_rld",0.6,"rangedweapons_shotgun_reload_a","rangedweapons:empty_shell")
return itemstack
end,
})

57
beretta.lua Normal file
View File

@ -0,0 +1,57 @@
minetest.register_tool("rangedweapons:beretta_rld", {
stack_max= 1,
wield_scale = {x=1.1,y=1.1,z=1.05},
description = "",
range = 0,
loaded_gun = "rangedweapons:beretta",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_beretta_rld.png",
})
minetest.register_tool("rangedweapons:beretta_r", {
stack_max= 1,
wield_scale = {x=1.1,y=1.1,z=1.05},
description = "",
rw_next_reload = "rangedweapons:beretta",
load_sound = "rangedweapons_handgun_mag_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_beretta_rld.png",
})
minetest.register_tool("rangedweapons:beretta", {
description = "" ..core.colorize("#35cdff","Beretta M9\n") ..core.colorize("#FFFFFF", "Gun damage: 4\n")..core.colorize("#FFFFFF", "Accuracy: 94%\n") ..core.colorize("#FFFFFF", "gun knockback: 4\n") ..core.colorize("#FFFFFF", "Gun crit chance: 13%\n")..core.colorize("#FFFFFF", "Critical efficiency: 2.1x\n") ..core.colorize("#FFFFFF", "Reload delay: 0.5\n")..core.colorize("#FFFFFF", "Clip size: 15\n") ..core.colorize("#FFFFFF", "Ammunition: 9x19mm Parabellum\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.4\n") ..core.colorize("#FFFFFF", "Gun type: Handgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
wield_scale = {x=1.1,y=1.1,z=1.05},
range = 0,
inventory_image = "rangedweapons_beretta.png",
RW_gun_capabilities = {
gun_damage = {fleshy=4,knockback=4},
gun_crit = 15,
gun_critEffc = 2.1,
suitable_ammo = {{"rangedweapons:9mm",15}},
gun_skill = {"handgun_skill",43},
gun_magazine = "rangedweapons:handgun_mag_black",
gun_unloaded = "rangedweapons:beretta_r",
gun_cooling = "rangedweapons:beretta_rld",
gun_velocity = 25,
gun_accuracy = 94,
gun_cooldown = 0.4,
gun_reload = 0.5,
gun_projectiles = 1,
has_shell = 1,
gun_durability = 1150,
gun_smokeSize = 5,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_beretta",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})

15
bullet_knockback.lua Normal file
View File

@ -0,0 +1,15 @@
function projectile_kb(victim,projectile,kbamount)
if victim:get_pos() and projectile:get_pos() then
rw_proj_kb_pos_x = victim:get_pos().x - projectile:get_pos().x
rw_proj_kb_pos_y = victim:get_pos().y - projectile:get_pos().y
rw_proj_kb_pos_z = victim:get_pos().z - projectile:get_pos().z
else
rw_proj_kb_pos_x = 1
rw_proj_kb_pos_y = 1
rw_proj_kb_pos_z = 1
end
victim:add_player_velocity({x=kbamount*(rw_proj_kb_pos_x*2),y= kbamount*(math.abs(rw_proj_kb_pos_y)/2), z=kbamount*(rw_proj_kb_pos_z*2)})
end

102
cooldown_stuff.lua Normal file
View File

@ -0,0 +1,102 @@
minetest.register_globalstep(function(dtime, player)
for _, player in pairs(minetest.get_connected_players()) do
local w_item = player:get_wielded_item()
local controls = player:get_player_control()
if w_item:get_definition().weapon_zoom ~= nil then
if controls.zoom then
player:hud_change(scope_hud, "image", "rangedweapons_scopehud.png")
else
player:hud_change(scope_hud, "image", "rangedweapons_empty_icon.png")
end
local wpn_zoom = w_item:get_definition().weapon_zoom
if player:get_properties().zoom_fov ~= wpn_zoom then
player:set_properties({zoom_fov = wpn_zoom})
end
end
if w_item:get_definition().weapon_zoom == nil then
player:hud_change(scope_hud, "image", "rangedweapons_empty_icon.png")
if player:get_inventory():contains_item(
"main", "binoculars:binoculars") then
local new_zoom_fov = 10
if player:get_properties().zoom_fov ~= new_zoom_fov then
player:set_properties({zoom_fov = new_zoom_fov})
end
else
local new_zoom_fov = 0
if player:get_properties().zoom_fov ~= new_zoom_fov then
player:set_properties({zoom_fov = new_zoom_fov})
end
end
end
local u_meta = player:get_meta()
local cool_down = u_meta:get_float("rw_cooldown") or 0
if u_meta:get_float("rw_cooldown") > 0 then
u_meta:set_float("rw_cooldown", cool_down - dtime)
end
local itemstack = player:get_wielded_item()
if controls.LMB then
if player:get_wielded_item():get_definition().RW_gun_capabilities then
if
player:get_wielded_item():get_definition().RW_gun_capabilities.automatic_gun and player:get_wielded_item():get_definition().RW_gun_capabilities.automatic_gun > 0 then
rangedweapons_shoot_gun(itemstack, player)
player:set_wielded_item(itemstack)
end end
if player:get_wielded_item():get_definition().RW_powergun_capabilities then
if player:get_wielded_item():get_definition().RW_powergun_capabilities.automatic_gun and player:get_wielded_item():get_definition().RW_powergun_capabilities.automatic_gun > 0 then
rangedweapons_shoot_powergun(itemstack, player)
player:set_wielded_item(itemstack)
end end
end
--minetest.chat_send_all(u_meta:get_float("rw_cooldown"))
if u_meta:get_float("rw_cooldown") <= 0 then
if player:get_wielded_item():get_definition().loaded_gun ~= nil then
local itemstack = player:get_wielded_item()
if player:get_wielded_item():get_definition().loaded_sound ~= nil then
minetest.sound_play(itemstack:get_definition().loaded_sound, {pos = player:get_pos()})
end
itemstack:set_name(player:get_wielded_item():get_definition().loaded_gun)
player:set_wielded_item(itemstack)
end
if player:get_wielded_item():get_definition().rw_next_reload ~= nil then
local itemstack = player:get_wielded_item()
if itemstack:get_definition().load_sound ~= nil then
minetest.sound_play(itemstack:get_definition().load_sound, {pos = player:get_pos()})
end
local gunMeta = itemstack:get_meta()
u_meta:set_float("rw_cooldown",gunMeta:get_float("RW_reload_delay"))
itemstack:set_name(player:get_wielded_item():get_definition().rw_next_reload)
player:set_wielded_item(itemstack)
end
end
end end)

641
crafting.lua Normal file
View File

@ -0,0 +1,641 @@
----------------------------
----------------------------
if minetest.settings:get_bool("rangedweapons_gun_crafting", true) then
minetest.register_craft({
output = "rangedweapons:aa12",
recipe = {
{"rangedweapons:gunsteel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:diamondblock", "default:steel_ingot", "rangedweapons:plastic_sheet"},
{"default:steel_ingot", "dye:black", "rangedweapons:plastic_sheet"},
}
})
minetest.register_craft({
output = "rangedweapons:aa12",
recipe = {
{"moreores:silver_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:diamondblock", "default:steel_ingot", "rangedweapons:plastic_sheet"},
{"default:steel_ingot", "dye:black", "rangedweapons:plastic_sheet"},
}
})
minetest.register_craft({
output = "rangedweapons:ak47",
recipe = {
{"default:diamond", "default:steel_ingot", "group:tree"},
{"group:tree", "default:mese", "default:steel_ingot"},
{"default:steel_ingot", "", "group:tree"},
}
})
minetest.register_craft({
output = "rangedweapons:awp",
recipe = {
{"rangedweapons:gunsteel_ingot", "default:diamondblock", "rangedweapons:gunsteel_ingot"},
{"rangedweapons:gunsteel_ingot", "rangedweapons:gunsteel_ingot", "rangedweapons:gunsteel_ingot"},
{"dye:dark_green", "default:diamond", "rangedweapons:plastic_sheet"},
}
})
minetest.register_craft({
output = "rangedweapons:benelli",
recipe = {
{"rangedweapons:gunsteel_ingot", "default:diamond", "default:steel_ingot"},
{"rangedweapons:plastic_sheet", "default:diamond", "default:steel_ingot"},
{"", "default:mese_crystal", ""},
}
})
minetest.register_craft({
output = "rangedweapons:beretta",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"", "default:mese_crystal", "rangedweapons:plastic_sheet"},
{"", "", "rangedweapons:plastic_sheet"},
}
})
minetest.register_craft({
output = "rangedweapons:m1991",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"", "default:mese_crystal", "group:tree"},
{"", "", "group:tree"},
}
})
minetest.register_craft({
output = "rangedweapons:deagle",
recipe = {
{"rangedweapons:gunsteel_ingot", "rangedweapons:gunsteel_ingot", "rangedweapons:gunsteel_ingot"},
{"rangedweapons:gunsteel_ingot", "default:diamond", "rangedweapons:plastic_sheet"},
{"", "", "rangedweapons:plastic_sheet"},
}
})
minetest.register_craft({
output = "rangedweapons:golden_deagle",
recipe = {
{"default:gold_ingot", "default:gold_ingot", "default:gold_ingot"},
{"default:gold_ingot", "rangedweapons:deagle", "default:gold_ingot"},
{"default:gold_ingot", "default:gold_ingot", "default:gold_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:deagle",
recipe = {
{"moreores:silver_ingot", "moreores:silver_ingot", "moreores:silver_ingot"},
{"moreores:silver_ingot", "default:diamond", "rangedweapons:plastic_sheet"},
{"", "", "rangedweapons:plastic_sheet"},
}
})
minetest.register_craft({
output = "rangedweapons:python",
recipe = {
{"rangedweapons:gunsteel_ingot", "rangedweapons:gunsteel_ingot", "rangedweapons:gunsteel_ingot"},
{"", "default:diamond", "group:tree"},
{"", "default:mese_crystal", "group:tree"},
}
})
minetest.register_craft({
output = "rangedweapons:python",
recipe = {
{"moreores:silver_ingot", "moreores:silver_ingot", "moreores:silver_ingot"},
{"", "default:diamond", "group:tree"},
{"", "default:mese_crystal", "group:tree"},
}
})
minetest.register_craft({
output = "rangedweapons:g36",
recipe = {
{"default:diamond", "default:mese", "default:diamond"},
{"default:steel_ingot", "default:diamond", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:glock17",
recipe = {
{"rangedweapons:plastic_sheet", "rangedweapons:plastic_sheet", "rangedweapons:plastic_sheet"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"", "default:diamond", "rangedweapons:plastic_sheet"},
}
})
minetest.register_craft({
output = "rangedweapons:jackhammer",
recipe = {
{"", "rangedweapons:gunsteel_ingot", "rangedweapons:gunsteel_ingot"},
{"default:mese", "default:steelblock", "default:diamondblock"},
{"", "default:mese", "default:diamondblock"},
}
})
minetest.register_craft({
output = "rangedweapons:kriss_sv",
recipe = {
{"rangedweapons:plastic_sheet", "rangedweapons:plastic_sheet", "rangedweapons:plastic_sheet"},
{"default:gold_ingot", "default:mese_crystal", "rangedweapons:plastic_sheet"},
{"rangedweapons:plastic_sheet", "default:gold_ingot", ""},
}
})
minetest.register_craft({
output = "rangedweapons:laser_blaster",
recipe = {
{"default:steel_ingot", "rangedweapons:gun_power_core", "default:steel_ingot"},
{"rangedweapons:gunsteel_ingot", "rangedweapons:gunsteel_ingot", "rangedweapons:gunsteel_ingot"},
{"", "default:mese_crystal_fragment", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:forcegun",
recipe = {
{"rangedweapons:gunsteel_ingot", "default:diamondblock", "default:mese"},
{"rangedweapons:gunsteel_ingot", "rangedweapons:gunsteel_ingot", "rangedweapons:gunsteel_ingot"},
{"", "rangedweapons:gun_power_core", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:laser_rifle",
recipe = {
{"rangedweapons:ultra_gunsteel_ingot", "rangedweapons:gun_power_core", "rangedweapons:ultra_gunsteel_ingot"},
{"rangedweapons:gun_power_core", "rangedweapons:ultra_gunsteel_ingot", "default:gold_ingot"},
{"default:gold_ingot", "default:mese", "rangedweapons:ultra_gunsteel_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:laser_shotgun",
recipe = {
{"rangedweapons:ultra_gunsteel_ingot", "rangedweapons:gun_power_core", "rangedweapons:ultra_gunsteel_ingot"},
{"rangedweapons:gun_power_core", "rangedweapons:gun_power_core", "rangedweapons:ultra_gunsteel_ingot"},
{"", "rangedweapons:ultra_gunsteel_ingot", "rangedweapons:ultra_gunsteel_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:luger",
recipe = {
{"", "", "default:mese_crystal_fragment"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"", "default:mese_crystal_fragment", "group:tree"},
}
})
minetest.register_craft({
output = "rangedweapons:m16",
recipe = {
{"default:diamond", "default:steelblock", "default:steel_ingot"},
{"default:steel_ingot", "default:diamond", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:m60",
recipe = {
{"default:diamond", "default:mese", "default:mese"},
{"default:steel_ingot", "default:steelblock", "default:steelblock"},
{"dye:black", "default:diamond", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:m79",
recipe = {
{"default:steel_ingot", "", "default:mese_crystal"},
{"default:steelblock", "default:diamond", "group:tree"},
{"group:tree", "group:tree", "group:tree"},
}
})
minetest.register_craft({
output = "rangedweapons:m200",
recipe = {
{"default:diamondblock", "default:steel_ingot", "default:diamondblock"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:diamond", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:makarov",
recipe = {
{"", "default:steel_ingot", "default:steel_ingot"},
{"", "default:mese_crystal_fragment", "group:tree"},
{"", "", "dye:black"},
}
})
minetest.register_craft({
output = "rangedweapons:milkor",
recipe = {
{"default:diamond", "default:steel_ingot", "default:diamond"},
{"default:steel_ingot", "default:steelblock", "default:steel_ingot"},
{"default:steel_ingot", "default:mese", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:minigun",
recipe = {
{"", "default:steelblock", "default:mese"},
{"default:diamondblock", "default:diamondblock", "default:diamondblock"},
{"default:steelblock", "default:steelblock", "default:steelblock"},
}
})
minetest.register_craft({
output = "rangedweapons:mp5",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:diamond", "default:steel_ingot"},
{"default:steel_ingot", "rangedweapons:plastic_sheet", "dye:black"},
}
})
minetest.register_craft({
output = "rangedweapons:thompson",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:diamond"},
{"group:tree", "group:tree", "default:steel_ingot"},
{"default:steel_ingot", "default:diamond", "group:tree"},
}
})
minetest.register_craft({
output = "rangedweapons:mp40",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"},
{"default:steel_ingot", "default:mese_crystal_fragment", ""},
}
})
minetest.register_craft({
output = "rangedweapons:remington",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"group:tree", "default:mese_crystal", "group:tree"},
}
})
minetest.register_craft({
output = "rangedweapons:rpg",
recipe = {
{"default:diamond", "default:steel_ingot", ""},
{"default:steelblock", "group:tree", "default:diamondblock"},
{"default:diamond", "group:tree", ""},
}
})
minetest.register_craft({
output = "rangedweapons:rpk",
recipe = {
{"default:diamond", "rangedweapons:ak47", ""},
{"default:steel_ingot", "default:steelblock", "group:tree"},
{"", "default:diamond", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:scar",
recipe = {
{"default:diamond", "default:mese", "default:mese"},
{"default:steel_ingot", "default:steel_ingot", "default:mese"},
{"rangedweapons:plastic_sheet", "", "default:mese_crystal"},
}
})
minetest.register_craft({
output = "rangedweapons:spas12",
recipe = {
{"", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:mese", "default:diamond"},
{"rangedweapons:plastic_sheet", "default:diamond", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:svd",
recipe = {
{"default:steel_ingot", "default:diamondblock", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"group:tree", "default:diamond", "group:tree"},
}
})
minetest.register_craft({
output = "rangedweapons:taurus",
recipe = {
{"rangedweapons:gunsteel_ingot", "default:mese_crystal", "default:mese_crystal_fragment"},
{"rangedweapons:gunsteel_ingot", "default:diamondblock", "rangedweapons:gunsteel_ingot"},
{"", "rangedweapons:gunsteel_ingot", "rangedweapons:plastic_sheet"},
}
})
minetest.register_craft({
output = "rangedweapons:taurus",
recipe = {
{"moreores:silver_ingot", "default:mese_crystal", "default:mese_crystal_fragment"},
{"moreores:silver_ingot", "default:diamondblock", "moreores:silver_ingot"},
{"", "moreores:silver_ingot", "rangedweapons:plastic_sheet"},
}
})
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_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_craft({
output = "rangedweapons:ump",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"rangedweapons:gunsteel_ingot", "default:diamond", "default:diamond"},
{"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"},
}
})
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", ""},
}
})
end
----------------------------------
----------------------------------
if minetest.settings:get_bool("rangedweapons_other_weapons_crafting", true) then
minetest.register_craft({
output = "rangedweapons:barrel",
recipe = {
{"default:wood", "tnt:gunpowder", "default:wood"},
{"default:wood", "tnt:tnt", "default:wood"},
}
})
minetest.register_craft({
output = "rangedweapons:hand_grenade",
recipe = {
{"", "", "default:mese_crystal_fragment"},
{"default:steel_ingot", "tnt:gunpowder", ""},
{"tnt:gunpowder", "tnt:gunpowder", ""},
}
})
minetest.register_craft({
output = "rangedweapons:javelin 1",
recipe = {
{"default:diamond", "default:steel_ingot", ""},
{"default:steel_ingot", "", "group:stick"},
{"", "", "group:stick"},
}
})
minetest.register_craft({
output = "rangedweapons:wooden_shuriken 20",
recipe = {
{"", "group:wood", ""},
{"group:wood", "", "group:wood"},
{"", "group:wood", ""},
}
})
minetest.register_craft({
output = "rangedweapons:stone_shuriken 10",
recipe = {
{"", "default:cobble", ""},
{"default:cobble", "", "default:cobble"},
{"", "default:cobble", ""},
}
})
minetest.register_craft({
output = "rangedweapons:steel_shuriken 30",
recipe = {
{"", "default:steel_ingot", ""},
{"default:steel_ingot", "", "default:steel_ingot"},
{"", "default:steel_ingot", ""},
}
})
minetest.register_craft({
output = "rangedweapons:bronze_shuriken 35",
recipe = {
{"", "default:bronze_ingot", ""},
{"default:bronze_ingot", "", "default:bronze_ingot"},
{"", "default:bronze_ingot", ""},
}
})
minetest.register_craft({
output = "rangedweapons:golden_shuriken 42",
recipe = {
{"", "default:gold_ingot", ""},
{"default:gold_ingot", "", "default:gold_ingot"},
{"", "default:gold_ingot", ""},
}
})
minetest.register_craft({
output = "rangedweapons:mese_shuriken 55",
recipe = {
{"", "default:mese_crystal", ""},
{"default:mese_crystal", "", "default:mese_crystal"},
{"", "default:mese_crystal", ""},
}
})
minetest.register_craft({
output = "rangedweapons:diamond_shuriken 69",
recipe = {
{"", "default:diamond", ""},
{"default:diamond", "", "default:diamond"},
{"", "default:diamond", ""},
}
})
end
------------------------------------
------------------------------------
if minetest.settings:get_bool("rangedweapons_ammo_crafting", true) then
minetest.register_craft({
output = "rangedweapons:9mm 40",
recipe = {
{"default:steel_ingot", "", ""},
{"tnt:gunpowder", "", ""},
{"default:copper_ingot", "", ""},
}
})
minetest.register_craft({
output = "rangedweapons:45acp 40",
recipe = {
{"","default:bronze_ingot", ""},
{"default:gold_ingot","tnt:gunpowder", "default:gold_ingot"},
{"","default:tin_ingot", ""},
}
})
minetest.register_craft({
output = "rangedweapons:10mm 60",
recipe = {
{"", "default:bronze_ingot", ""},
{"default:steel_ingot", "tnt:gunpowder", "default:steel_ingot"},
{"default:steel_ingot", "tnt:gunpowder", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:357 15",
recipe = {
{"default:copper_ingot", "", ""},
{"tnt:gunpowder", "", ""},
{"default:gold_ingot", "", ""},
}
})
minetest.register_craft({
output = "rangedweapons:50ae 15",
recipe = {
{"default:bronze_ingot", "default:coal_lump", "default:bronze_ingot"},
{"default:gold_ingot", "tnt:gunpowder", "default:gold_ingot"},
{"default:gold_ingot", "tnt:gunpowder", "default:gold_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:44 15",
recipe = {
{"default:bronze_ingot", "default:coal_lump", ""},
{"tnt:gunpowder", "", ""},
{"default:gold_ingot", "", ""},
}
})
minetest.register_craft({
output = "rangedweapons:762mm 50",
recipe = {
{"default:bronze_ingot", "tnt:gunpowder", "default:bronze_ingot"},
{"default:gold_ingot", "tnt:gunpowder", "default:gold_ingot"},
{"default:gold_ingot", "tnt:gunpowder", "default:gold_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:408cheytac 10",
recipe = {
{"default:bronze_ingot", "tnt:gunpowder", "default:bronze_ingot"},
{"default:gold_ingot", "default:gold_ingot", "default:gold_ingot"},
{"default:gold_ingot", "tnt:gunpowder", "default:gold_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:556mm 90",
recipe = {
{"", "default:gold_ingot", ""},
{"default:gold_ingot", "tnt:gunpowder", "default:gold_ingot"},
{"default:gold_ingot", "tnt:gunpowder", "default:gold_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:shell 12",
recipe = {
{"default:bronze_ingot", "default:steel_ingot", "default:bronze_ingot"},
{"default:bronze_ingot", "tnt:gunpowder", "default:bronze_ingot"},
{"default:gold_ingot", "tnt:gunpowder", "default:gold_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:308winchester 15",
recipe = {
{"", "default:steel_ingot", ""},
{"default:bronze_ingot", "tnt:gunpowder", "default:bronze_ingot"},
{"default:gold_ingot", "tnt:gunpowder", "default:gold_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:40mm 5",
recipe = {
{"", "default:gold_ingot", ""},
{"default:steel_ingot", "tnt:gunpowder", "default:steel_ingot"},
{"tnt:gunpowder", "default:bronze_ingot", "tnt:gunpowder"},
}
})
minetest.register_craft({
output = "rangedweapons:rocket 1",
recipe = {
{"", "", "rangedweapons:40mm"},
{"", "tnt:gunpowder", ""},
{"default:steel_ingot", "", ""},
}
})
end
-------------------------------------
-------------------------------------
if minetest.settings:get_bool("rangedweapons_item_crafting", true) then
minetest.register_craft({
output = "rangedweapons:generator",
recipe = {
{"default:gold_ingot", "default:gold_ingot", "default:gold_ingot"},
{"rangedweapons:gunsteel_ingot", "rangedweapons:gun_power_core", "rangedweapons:gunsteel_ingot"},
{"rangedweapons:gunsteel_ingot", "rangedweapons:gunsteel_ingot", "rangedweapons:gunsteel_ingot"},
}
})
minetest.register_craft({
output = "rangedweapons:gunsteel_ingot",
recipe = {
{"default:steel_ingot", "default:tin_ingot", "default:coal_lump"},
}
})
minetest.register_craft({
output = "rangedweapons:ultra_gunsteel_ingot",
recipe = {
{"", "default:mese_crystal", ""},
{"default:gold_ingot", "rangedweapons:gunsteel_ingot", "default:gold_ingot"},
{"", "default:diamond", ""},
}
})
minetest.register_craft({
output = "rangedweapons:plastic_sheet",
recipe = {
{"group:tree", "default:coal_lump", "group:tree"},
{"default:coal_lump", "group:tree", "default:coal_lump"},
}
})
minetest.register_craft({
output = "rangedweapons:gun_power_core",
recipe = {
{"rangedweapons:gunsteel_ingot", "default:goldblock", "rangedweapons:gunsteel_ingot"},
{"default:diamondblock", "default:mese", "default:diamondblock"},
{"rangedweapons:gunsteel_ingot", "default:goldblock", "rangedweapons:gunsteel_ingot"},
}
})
end

119
deagle.lua Normal file
View File

@ -0,0 +1,119 @@
minetest.register_tool("rangedweapons:deagle_rld", {
stack_max= 1,
wield_scale = {x=1.25,y=1.25,z=1.5},
description = "",
range = 0,
loaded_gun = "rangedweapons:deagle",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_deagle_rld.png",
})
minetest.register_tool("rangedweapons:deagle_r", {
stack_max= 1,
wield_scale = {x=1.25,y=1.25,z=1.5},
description = "",
range = 0,
rw_next_reload = "rangedweapons:deagle",
load_sound = "rangedweapons_handgun_mag_in",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_deagle_rld.png",
})
minetest.register_tool("rangedweapons:deagle", {
description = "" ..core.colorize("#35cdff","Desert Eagle\n")..core.colorize("#FFFFFF", "Ranged damage: 11\n") ..core.colorize("#FFFFFF", "Accuracy: 85%\n") ..core.colorize("#FFFFFF", "knockback: 6\n") ..core.colorize("#FFFFFF", "Critical chance: 20%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 3x\n")..core.colorize("#FFFFFF", "Reload delay: 0.6\n")..core.colorize("#FFFFFF", "Clip size: 9/8/7\n") ..core.colorize("#FFFFFF", "Ammunition: .357 Magnum rounds/.44 magnum rounds/.50AE catridges\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.7\n") ..core.colorize("#FFFFFF", "Gun type: Magnum\n") ..core.colorize("#FFFFFF", "Block penetration: 5%\n")
..core.colorize("#FFFFFF", "penetration: 15%\n")..core.colorize("#FFFFFF", "Bullet velocity: 50"),
wield_scale = {x=1.25,y=1.25,z=1.5},
range = 0,
inventory_image = "rangedweapons_deagle.png",
RW_gun_capabilities = {
gun_damage = {fleshy=11,knockback=6},
gun_crit = 20,
gun_critEffc = 2.2,
suitable_ammo = {{"rangedweapons:357",9},{"rangedweapons:44",8},{"rangedweapons:50ae",7}},
gun_skill = {"revolver_skill",40},
gun_magazine = "rangedweapons:handgun_mag_white",
gun_unloaded = "rangedweapons:deagle_r",
gun_cooling = "rangedweapons:deagle_rld",
gun_velocity = 50,
gun_accuracy = 85,
gun_cooldown = 0.7,
gun_reload = 0.6/1,
gun_projectiles = 1,
has_shell = 1,
gun_durability = 900,
gun_smokeSize = 7,
gun_mob_penetration = 15,
gun_node_penetration = 5,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_deagle",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})
minetest.register_tool("rangedweapons:golden_deagle_rld", {
stack_max= 1,
wield_scale = {x=1.25,y=1.25,z=1.5},
description = "",
range = 0,
loaded_gun = "rangedweapons:golden_deagle",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_golden_deagle_rld.png",
})
minetest.register_tool("rangedweapons:golden_deagle_r", {
stack_max= 1,
wield_scale = {x=1.25,y=1.25,z=1.5},
description = "",
range = 0,
rw_next_reload = "rangedweapons:golden_deagle",
load_sound = "rangedweapons_handgun_mag_in",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_golden_deagle_rld.png",
})
minetest.register_tool("rangedweapons:golden_deagle", {
description = "" ..core.colorize("#35cdff","Golden Desert Eagle\n")..core.colorize("#FFFFFF", "Ranged damage: 14\n") ..core.colorize("#FFFFFF", "Accuracy: 90%\n") ..core.colorize("#FFFFFF", "knockback: 6\n") ..core.colorize("#FFFFFF", "Critical chance: 23%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 3x\n")..core.colorize("#FFFFFF", "Reload delay: 0.6\n")..core.colorize("#FFFFFF", "Clip size: 9/8/7\n") ..core.colorize("#FFFFFF", "Ammunition: .357 Magnum rounds/.44 magnum rounds/.50AE catridges\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.75\n") ..core.colorize("#FFFFFF", "Gun type: Magnum\n") ..core.colorize("#FFFFFF", "Block penetration: 5%\n")
..core.colorize("#FFFFFF", "penetration: 15%\n")..core.colorize("#FFFFFF", "Bullet velocity: 50"),
wield_scale = {x=1.25,y=1.25,z=1.5},
range = 0,
inventory_image = "rangedweapons_golden_deagle.png",
RW_gun_capabilities = {
gun_damage = {fleshy=14,knockback=6},
gun_crit = 23,
gun_critEffc = 2.2,
suitable_ammo = {{"rangedweapons:357",9},{"rangedweapons:44",8},{"rangedweapons:50ae",7}},
gun_skill = {"revolver_skill",38},
gun_magazine = "rangedweapons:handgun_mag_white",
gun_unloaded = "rangedweapons:golden_deagle_r",
gun_cooling = "rangedweapons:golden_deagle_rld",
gun_velocity = 50,
gun_accuracy = 90,
gun_cooldown = 0.75,
gun_reload = 0.6/1,
gun_projectiles = 1,
has_shell = 1,
gun_durability = 1000,
gun_smokeSize = 7,
gun_mob_penetration = 15,
gun_node_penetration = 5,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_deagle",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})

203
explosives.lua Normal file
View File

@ -0,0 +1,203 @@
local he_boom = {
name = "rangedweapons:he_explosion",
--description = "DuN mInD mEh...",
radius = 2,
tiles = {
side = "rangedweapons_invisible.png",
top = "rangedweapons_invisible.png",
bottom = "rangedweapons_invisible.png",
burning = "rangedweapons_invisible.png"
},
}
tnt.register_tnt(he_boom)
local rocket_boom = {
name = "rangedweapons:rocket_explosion",
--description = "DuN mInD mEh...",
radius = 3,
tiles = {
side = "rangedweapons_invisible.png",
top = "rangedweapons_invisible.png",
bottom = "rangedweapons_invisible.png",
burning = "rangedweapons_invisible.png"
},
}
tnt.register_tnt(rocket_boom)
local rangedweapons_rocket = {
physical = false,
timer = 0,
visual = "sprite",
visual_size = {x=0.0, y=0.0},
textures = {"rangedweapons_invisible.png"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
rangedweapons_rocket.on_step = function(self, dtime, pos)
self.timer = self.timer + dtime
local tiem = 0.002
local pos = self.object:get_pos()
local node = minetest.get_node(pos)
if self.timer >= 0.002 then
minetest.add_particle({
pos = pos,
velocity = 0,
acceleration = {x=0, y=0, z=0},
expirationtime = 0.04,
size = 7,
collisiondetection = false,
vertical = false,
texture = "rangedweapons_rocket_fly.png",
glow = 15,
})
minetest.add_particle({
pos = pos,
velocity = 0,
acceleration = {x=0, y=6, z=0},
expirationtime = 0.4,
size = 4,
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png",
glow = 5,
})
tiem = tiem + 0.002
end
if self.timer >= 0.375 then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1.5)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "rangedweapons:rocket" and obj:get_luaentity().name ~= "__builtin:item" then
tnt.boom(pos, rocket_boom)
self.object:remove()
end
end
end
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
tnt.boom(pos, rocket_boom)
self.object:remove()
end
if self.timer >= 7.5 then
tnt.boom(pos, rocket_boom)
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("rangedweapons:rocket", rangedweapons_rocket)
local rangedweapons_he_grenade = {
physical = false,
timer = 0,
visual = "sprite",
visual_size = {x=0.0, y=0.0},
textures = {"rangedweapons_invisible.png"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
rangedweapons_he_grenade.on_step = function(self, dtime, pos)
self.timer = self.timer + dtime
local tiem = 0.002
local pos = self.object:get_pos()
local node = minetest.get_node(pos)
if self.timer >= 0.002 then
minetest.add_particle({
pos = pos,
velocity = 0,
acceleration = {x=0, y=0, z=0},
expirationtime = 0.04,
size = 7,
collisiondetection = false,
vertical = false,
texture = "rangedweapons_rocket_fly.png",
glow = 15,
})
minetest.add_particle({
pos = pos,
velocity = 0,
acceleration = {x=0, y=16, z=0},
expirationtime = 0.4,
size = 4,
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png",
glow = 5,
})
tiem = tiem + 0.002
end
if self.timer >= 0.4 then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1.5)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "rangedweapons:he_grenade" and obj:get_luaentity().name ~= "__builtin:item" then
tnt.boom(pos, rocket_boom)
self.object:remove()
end
end
end
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
tnt.boom(pos, he_boom)
self.object:remove()
end
if self.timer >= 7.5 then
tnt.boom(pos, he_boom)
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("rangedweapons:he_grenade", rangedweapons_he_grenade)
local barrel_boom = {
name = "rangedweapons:explosion",
--description = "DuN mInD mEh...",
radius = 3,
tiles = {
side = "rangedweapons_invisible.png",
top = "rangedweapons_invisible.png",
bottom = "rangedweapons_invisible.png",
burning = "rangedweapons_invisible.png"
},
}
tnt.register_tnt(barrel_boom)
minetest.register_node("rangedweapons:barrel", {
description = "" ..core.colorize("#35cdff","Explosive barrel\n")..core.colorize("#FFFFFF", "It will explode if shot by gun"),
tiles = {
"rangedweapons_barrel_top.png",
"rangedweapons_barrel_top.png",
"rangedweapons_barrel_side.png",
"rangedweapons_barrel_side.png",
"rangedweapons_barrel_side.png",
"rangedweapons_barrel_side.png"
},
drawtype = "nodebox",
paramtype = "light",
groups = {choppy = 3, oddly_breakable_by_hand = 3},
on_blast = function(pos)
tnt.boom(pos, {radius = 3})
end,
sounds = default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, -0.5, 0.1875, 0.5, 0.5}, -- NodeBox1
{-0.5, -0.5, -0.1875, 0.5, 0.5, 0.1875}, -- NodeBox2
{-0.4375, -0.5, -0.3125, 0.4375, 0.5, 0.3125}, -- NodeBox3
{-0.3125, -0.5, -0.4375, 0.3125, 0.5, 0.4375}, -- NodeBox4
{-0.375, -0.5, -0.375, 0.375, 0.5, 0.375}, -- NodeBox5
}
}
})

150
forcegun.lua Normal file
View File

@ -0,0 +1,150 @@
local proj_dir
minetest.register_tool("rangedweapons:forcegun", {
description = "" ..core.colorize("#35cdff","Force gun\n") ..core.colorize("#FFFFFF", "Completelly harmless... by itself...\n")..core.colorize("#FFFFFF", "It's projectile will push either the entity it hits directly, or everyone near the node it collides with far away.\n") ..core.colorize("#FFFFFF", "Perfect for rocket-jumping or YEETing enemies away.\n")..core.colorize("#FFFFFF", "Power usage: 40\n")..core.colorize("#FFFFFF", "Gun type:Power Special-gun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 60"),
range = 0,
wield_scale = {x=2.0,y=2.0,z=1.75},
inventory_image = "rangedweapons_forcegun.png",
on_use = function(itemstack, user, pointed_thing)
local pos = user:get_pos()
local dir = user:get_look_dir()
local yaw = user:get_look_horizontal()
local inv = user:get_inventory()
if inv:contains_item("main", "rangedweapons:power_particle 40") then
if pos and dir then
inv:remove_item("main", "rangedweapons:power_particle 25")
pos.y = pos.y + 1.5
local obj = minetest.add_entity(pos, "rangedweapons:forceblast")
if obj then
minetest.sound_play("rangedweapons_rocket", {object=obj})
obj:set_velocity({x=dir.x * 60, y=dir.y * 60, z=dir.z * 60})
obj:set_yaw(yaw - math.pi/2)
proj_dir = dir
local ent = obj:get_luaentity()
if ent then
ent.player = ent.player or user
end
end
end
end
end,
})
local rangedweapons_forceblast = {
timer = 0,
initial_properties = {
physical = true,
hp_max = 420,
glow = 30,
visual = "sprite",
visual_size = {x=0.4, y=0.4,},
textures = {"rangedweapons_force_bullet.png"},
lastpos = {},
collide_with_objects = false,
collisionbox = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
},
}
rangedweapons_forceblast.on_step = function(self, dtime, moveresult)
self.timer = self.timer + dtime
local pos = self.object:get_pos()
proj_dir = proj_dir or ({x=0,y=0,z=0})
if self.timer > 10 then
self.object:remove()
end
if self.timer > 0.05 then
self.object:set_properties({collide_with_objects = true})
end
if moveresult.collides == true then
if moveresult.collisions[1] ~= nil then
if moveresult.collisions[1].type == "object" then
if moveresult.collisions[1].object:is_player() then
moveresult.collisions[1].object:add_player_velocity({x=proj_dir.x * 20, y=5+ (proj_dir.y * 20), z=proj_dir.z * 20})
else
moveresult.collisions[1].object:add_velocity({x=proj_dir.x * 20, y=5+ (proj_dir.y * 20), z=proj_dir.z * 20})
end
minetest.add_particle({
pos = ({x = pos.x, y = pos.y, z = pos.z}),
velocity ={x=0,y=0,z=0},
acceleration ={x=0,y=0,z=0},
expirationtime = 0.20,
size = 16,
collisiondetection = true,
collision_removal = false,
vertical = false,
texture = "rangedweapons_force_blast.png",
glow = 20,
animation = {type="vertical_frames", aspect_w=64, aspect_h=64, length = 0.20,},
})
self.object:remove()
end
if moveresult.collisions[1].type == "node" then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 7)
for k, obj in pairs(objs) do
local posd_x = 1
local posd_y = 1
local posd_z = 1
if obj:get_pos() then
posd_x = pos.x - obj:get_pos().x
posd_y = pos.y - obj:get_pos().y
posd_z = pos.z - obj:get_pos().z
end
if posd_y < 0 and posd_y > -1 then posd_y = -1 end
if posd_y > 0 and posd_y < 1 then posd_y = 1 end
if posd_y > 0 then posd_y=posd_y*3 end
posd_y = (posd_y + 0.5) * (((math.abs(posd_x)+0.5)+(math.abs(posd_z)+0.5))/2)
if posd_y > -1.0 and posd_y < 0 then posd_y = -1.0 end
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "rangedweapons:forceblast" then
obj:add_velocity({x=10*(-posd_x), y=30*(-1/posd_y), z=10*(-posd_z)})
self.object:remove()
end
else
obj:add_player_velocity({x=30*((-posd_x)/(1+math.abs(posd_x))), y=25*(-1/posd_y), z=30*((-posd_z)/(1+math.abs(posd_z)))})
self.object:remove()
end
end
minetest.add_particle({
pos = ({x = pos.x, y = pos.y, z = pos.z}),
velocity ={x=0,y=0,z=0},
acceleration ={x=0,y=0,z=0},
expirationtime = 0.20,
size = 128,
collisiondetection = true,
collision_removal = false,
vertical = false,
texture = "rangedweapons_force_blast.png",
glow = 20,
animation = {type="vertical_frames", aspect_w=64, aspect_h=64, length = 0.20,},
})
self.object:remove()
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
end
end
minetest.register_entity("rangedweapons:forceblast", rangedweapons_forceblast)

73
g36.lua Normal file
View File

@ -0,0 +1,73 @@
minetest.register_tool("rangedweapons:g36_r", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "",
rw_next_reload = "rangedweapons:g36_rr",
load_sound = "rangedweapons_handgun_mag_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_g36_rld.png",
})
minetest.register_tool("rangedweapons:g36_rr", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "",
rw_next_reload = "rangedweapons:g36_rrr",
load_sound = "rangedweapons_rifle_reload_a",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_g36.png",
})
minetest.register_tool("rangedweapons:g36_rrr", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "",
rw_next_reload = "rangedweapons:g36",
load_sound = "rangedweapons_rifle_reload_b",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_g36.png",
})
minetest.register_tool("rangedweapons:g36", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "" ..core.colorize("#35cdff","g36\n") ..core.colorize("#FFFFFF", "Gun damage: 7\n") ..core.colorize("#FFFFFF", "accuracy: 80%\n") ..core.colorize("#FFFFFF", "Gun knockback: 5\n") ..core.colorize("#FFFFFF", "Gun Critical chance: 12%\n")..core.colorize("#FFFFFF", "Critical efficiency: 2.9x\n") ..core.colorize("#FFFFFF", "Reload delay: 1.2\n") ..core.colorize("#FFFFFF", "Clip size: 30\n") ..core.colorize("#FFFFFF", "Ammunition: 5.56mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.08(full-auto)\n") ..core.colorize("#FFFFFF", "Gun type: assault rifle\n") ..core.colorize("#FFFFFF", "Block penetration: 6%\n")
..core.colorize("#FFFFFF", "Enemy penetration: 17%\n") ..core.colorize("#FFFFFF", "Bullet velocity: 40"),
range = 0,
inventory_image = "rangedweapons_g36.png",
RW_gun_capabilities = {
automatic_gun = 1,
gun_damage = {fleshy=7,knockback=5},
gun_crit = 12,
gun_critEffc = 2.9,
suitable_ammo = {{"rangedweapons:556mm",30}},
gun_skill = {"arifle_skill",55},
gun_magazine = "rangedweapons:assaultrifle_mag",
gun_unloaded = "rangedweapons:g36_r",
gun_velocity = 40,
gun_accuracy = 80,
gun_cooldown = 0.08,
gun_reload = 1.2/4,
gun_projectiles = 1,
has_shell = 1,
gun_gravity = 0,
gun_durability = 1500,
gun_smokeSize = 5,
gun_mob_penetration = 17,
gun_node_penetration = 6,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_smg",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
inventory_image = "rangedweapons_g36.png",
})

39
generator.lua Normal file
View File

@ -0,0 +1,39 @@
minetest.register_node("rangedweapons:generator", {
description = "" ..core.colorize("#35cdff","Power particle generator\n")..core.colorize("#FFFFFF", "generates 1 power particle every 3 seconds (can hold up to 200). Punch to harvest them"),
tiles = {
"rangedweapons_generator_top.png",
"rangedweapons_generator_bottom.png",
"rangedweapons_generator_side.png",
"rangedweapons_generator_side.png",
"rangedweapons_generator_side.png",
"rangedweapons_generator_side.png"
},
paramtype = "light",
light_source = 9,
groups = {cracky = 3, oddly_breakable_by_hand = 3},
on_timer = function(pos, elapsed)
minetest.get_node_timer(pos):start(3)
local nodemeta = minetest.get_meta(pos)
if nodemeta:get_int("power_generated") < 200 then
nodemeta:set_int("power_generated",nodemeta:get_int("power_generated")+1)
nodemeta:set_string("infotext", "currently generated power:"..nodemeta:get_int("power_generated"))
end
end,
on_punch = function(pos, node, puncher)
local nodemeta = minetest.get_meta(pos)
local inv = puncher:get_inventory()
inv:add_item("main", "rangedweapons:power_particle "..nodemeta:get_int("power_generated"))
nodemeta:set_int("power_generated",0)
nodemeta:set_string("infotext", "currently generated power:"..nodemeta:get_int("power_generated"))
end,
on_construct = function(pos)
minetest.get_node_timer(pos):start(3)
end,
sounds = default.node_sound_wood_defaults(),
})

31
glass_breaking.lua Normal file
View File

@ -0,0 +1,31 @@
minetest.register_craftitem("rangedweapons:glass_shards", {
description = "" ..core.colorize("#35cdff","Glass shards\n")..core.colorize("#FFFFFF", "3 of those, can be crafted into a file of glass fragments"),
inventory_image = "rangedweapons_glass_shards.png",
})
minetest.register_craft({
output = "vessels:glass_fragments",
recipe = {
{"rangedweapons:glass_shards", "rangedweapons:glass_shards", "rangedweapons:glass_shards"},
}
})
minetest.register_node("rangedweapons:broken_glass", {
description = "Broken glass",
drawtype = "glasslike",
tiles = {
"rangedweapons_broken_glass.png"
},
paramtype = "light",
walkable = false,
is_ground_content = false,
liquidtype = "source",
liquid_alternative_flowing = "rangedweapons:broken_glass",
liquid_alternative_source = "rangedweapons:broken_glass",
liquid_viscosity = 7,
alpha = 160,
liquid_range= 0,
liquid_renewable = false,
damage_per_second = 2,
groups = {oddly_breakable_by_hand = 3},
})

83
glock17.lua Normal file
View File

@ -0,0 +1,83 @@
minetest.register_tool("rangedweapons:glock17_rld", {
stack_max= 1,
wield_scale = {x=1.1,y=1.1,z=1.05},
description = "",
loaded_gun = "rangedweapons:glock17",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_glock17_rld.png",
})
minetest.register_tool("rangedweapons:glock17_r", {
stack_max= 1,
wield_scale = {x=1.2,y=1.2,z=1.2},
description = "",
rw_next_reload = "rangedweapons:glock17_rr",
load_sound = "rangedweapons_handgun_mag_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_glock17.png",
})
minetest.register_tool("rangedweapons:glock17_rr", {
stack_max= 1,
wield_scale = {x=1.2,y=1.2,z=1.2},
description = "",
rw_next_reload = "rangedweapons:glock17_rrr",
load_sound = "rangedweapons_reload_a",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_glock17.png",
})
minetest.register_tool("rangedweapons:glock17_rrr", {
stack_max= 1,
wield_scale = {x=1.2,y=1.2,z=1.2},
description = "",
rw_next_reload = "rangedweapons:glock17",
load_sound = "rangedweapons_reload_b",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_glock17_rld.png",
})
minetest.register_tool("rangedweapons:glock17", {
description = "" ..core.colorize("#35cdff","Glock 17\n") ..core.colorize("#FFFFFF", "Gun damage: 5\n") ..core.colorize("#FFFFFF", "Accuracy: 96%\n") ..core.colorize("#FFFFFF", "Gun knockback: 4\n") ..core.colorize("#FFFFFF", "Gun Critical chance: 15%\n") ..core.colorize("#FFFFFF", "Gun Critical efficiency: 2.2x\n") ..core.colorize("#FFFFFF", "Reload delay: 0.9\n")..core.colorize("#FFFFFF", "Clip size: 17/17/17\n") ..core.colorize("#FFFFFF", "Ammunition: 9x19mm Parabellum/10mm Auto/.45acp\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.35\n") ..core.colorize("#FFFFFF", "Gun type: Handgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 30"),
wield_scale = {x=1.2,y=1.2,z=1.2},
range = 0,
inventory_image = "rangedweapons_glock17.png",
RW_gun_capabilities = {
gun_damage = {fleshy=5,knockback=4},
gun_crit = 15,
gun_critEffc = 2.2,
suitable_ammo = {{"rangedweapons:9mm",17},{"rangedweapons:10mm",17},{"rangedweapons:45acp",17}},
gun_skill = {"handgun_skill",45},
gun_magazine = "rangedweapons:handgun_mag_black",
gun_unloaded = "rangedweapons:glock17_r",
gun_cooling = "rangedweapons:glock17_rld",
gun_velocity = 30,
gun_accuracy = 96,
gun_cooldown = 0.35,
gun_reload = 0.9/4,
gun_projectiles = 1,
has_shell = 1,
gun_durability = 1400,
gun_smokeSize = 5,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_glock",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})

149
hand_grenade.lua Normal file
View File

@ -0,0 +1,149 @@
minetest.register_craftitem("rangedweapons:pin", {
wield_scale = {x=2.5,y=2.5,z=1.0},
inventory_image = "rangedweapons_pin.png",
})
local rangedweapons_grenade_pin = {
physical = false,
timer = 0,
visual = "wielditem",
visual_size = {x=0.15, y=0.15},
textures = {"rangedweapons:pin"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
rangedweapons_grenade_pin.on_step = function(self, dtime, pos)
self.timer = self.timer + dtime
local pos = self.object:get_pos()
local node = minetest.get_node(pos)
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
self.object:remove()
minetest.sound_play("rangedweapons_bulletdrop", {pos = self.lastpos, gain = 0.8})
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("rangedweapons:grenade_pin", rangedweapons_grenade_pin)
local grenade_boom = {
name = "rangedweapons:grenade_explosion",
--description = "DuN mInD mEh...",
radius = 3,
tiles = {
side = "rangedweapons_invisible.png",
top = "rangedweapons_invisible.png",
bottom = "rangedweapons_invisible.png",
burning = "rangedweapons_invisible.png"
},
}
local gtimer = 0
minetest.register_craftitem("rangedweapons:hand_grenade", {
stack_max= 1,
wield_scale = {x=1.1,y=1.1,z=1.05},
description = "" ..core.colorize("#35cdff","Hand grenade\n") ..core.colorize("#FFFFFF", "Explosion radius: 3\n")..core.colorize("#FFFFFF", "Throw force: 12\n") ..core.colorize("#FFFFFF", "Grenade gravitational pull: 6\n") ..core.colorize("#ffc000", "Right-click to unpin, Left click to throw after unpinning\n") ..core.colorize("#ffc000", "Thrown or not, it will explode after 3 secons from unpinning, be careful!"),
range = 0,
inventory_image = "rangedweapons_hand_grenade.png",
on_secondary_use = function(itemstack, user, pointed_thing)
if minetest.find_node_near(user:get_pos(), 10,"rangedweapons:antigun_block")
then
minetest.chat_send_player(user:get_player_name(), "" ..core.colorize("#ff0000","Grenades are prohibited in this area!"))
return itemstack
end
gtimer = 0
minetest.sound_play("rangedweapons_reload_a", {pos = user:get_pos()})
itemstack = "rangedweapons:hand_grenade_nopin"
local pos = user:get_pos()
pos.y = pos.y + 1.5
local pinEnt = minetest.add_entity(pos, "rangedweapons:grenade_pin")
if pinEnt then
local dir = user:get_look_dir()
local yaw = user:get_look_horizontal()
local svertical = user:get_look_vertical()
pinEnt:set_velocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
pinEnt:set_acceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
pinEnt:set_rotation({x=0,y=yaw - math.pi/2,z=-svertical})
end
return itemstack end,
})
minetest.register_craftitem("rangedweapons:hand_grenade_nopin", {
stack_max= 1,
wield_scale = {x=1.1,y=1.1,z=1.05},
description = "***HURRY UP AND THROW IT!!!***",
range = 0,
inventory_image = "rangedweapons_hand_grenade_nopin.png",
groups = {not_in_creative_inventory = 1},
on_use = function(itemstack, user, pointed_thing)
local pos = user:get_pos()
local dir = user:get_look_dir()
local yaw = user:get_look_horizontal()
if pos and dir and yaw then
pos.y = pos.y + 1.6
local obj = minetest.add_entity(pos, "rangedweapons:grenade")
if obj then
obj:set_velocity({x=dir.x * 12, y=dir.y * 12, z=dir.z * 12})
obj:set_acceleration({x=0, y=-6, z=0})
obj:set_yaw(yaw - math.pi/2)
btimer = gtimer
local ent = obj:get_luaentity()
if ent then
ent.player = ent.player or user
itemstack = ""
end
end
end
return itemstack
end,
})
tnt.register_tnt(grenade_boom)
minetest.register_globalstep(function(dtime, player, pos)
gtimer = gtimer + dtime;
if gtimer >= 3.0 then
for _, player in pairs(minetest.get_connected_players()) do
local pos = player:get_pos()
if player:get_wielded_item():get_name() == "rangedweapons:hand_grenade_nopin" then
player:set_wielded_item("")
gtimer = 0
tnt.boom(pos, grenade_boom)
end end end end)
local rangedweapons_grenade = {
physical = true,
btimer = 0,
timer = 0,
hp_max = 420,
visual = "sprite",
visual_size = {x=0.5, y=0.5},
textures = {"rangedweapons_hand_grenade_nopin.png"},
lastpos= {},
collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
}
rangedweapons_grenade.on_step = function(self, dtime, pos)
local pos = self.object:get_pos()
local node = minetest.get_node(pos)
local btimer = btimer or 0
self.timer = self.timer + dtime
if self.timer > (3.0 - btimer) then
tnt.boom(pos, grenade_boom)
self.object:remove()
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("rangedweapons:grenade", rangedweapons_grenade)

921
init.lua Normal file
View File

@ -0,0 +1,921 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
if minetest.global_exists("armor") and armor.attributes then
table.insert(armor.attributes, "bullet_res")
end
if minetest.global_exists("armor") and armor.attributes then
table.insert(armor.attributes, "ammo_save")
end
if minetest.global_exists("armor") and armor.attributes then
table.insert(armor.attributes, "ranged_dmg")
end
minetest.register_node("rangedweapons:antigun_block", {
description = "" ..core.colorize("#35cdff","Anti-gun block\n")..core.colorize("#FFFFFF", "Prevents people from using guns, in 10 node radius to each side from this block"),
tiles = {"rangedweapons_antigun_block.png"},
groups = {choppy = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_wood_defaults(),
})
----
---- gun_funcs
----
local function update_ammo_counter_on_gun(gunMeta)
gunMeta:set_string("count_meta", tostring(gunMeta:get_int("RW_bullets")))
end
make_sparks = function(pos)
minetest.sound_play("rengedweapons_ricochet", {pos = pos, gain = 0.75})
for i=1,9 do
minetest.add_particle({
pos = pos,
velocity = {x=math.random(-6.0,6.0), y=math.random(-10.0,15.0), z=math.random(-6.0,6.0)},
acceleration = {x=math.random(-9.0,9.0), y=math.random(-15.0,-3.0), z=math.random(-9.0,9.0)},
expirationtime = 1.0,
size = math.random(1,2),
collisiondetection = true,
vertical = false,
texture = "rangedweapons_spark.png",
glow = 25,
})
end
end
local max_gun_efficiency = tonumber(minetest.settings:get("rangedweapons_max_gun_efficiency")) or 300
rangedweapons_gain_skill = function(player,skill,chance)
if math.random(1, chance) == 1 then
local p_meta = player:get_meta()
local skill_num = p_meta:get_int(skill)
if skill_num < max_gun_efficiency then
p_meta:set_int(skill, skill_num + 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#25c200","You've improved your skill with this type of gun!"))
end
end
end
rangedweapons_reload_gun = function(itemstack, player)
local GunCaps = itemstack:get_definition().RW_gun_capabilities
local gun_unload_sound = ""
if GunCaps ~= nil then
gun_unload_sound = GunCaps.gun_unload_sound or ""
end
minetest.sound_play(gun_unload_sound, {pos = player:get_pos()})
local gun_reload = 0.25
if GunCaps ~= nil then
gun_reload = GunCaps.gun_reload or 0.25
end
local playerMeta = player:get_meta()
local gunMeta = itemstack:get_meta()
gunMeta:set_float("RW_reload_delay",gun_reload)
playerMeta:set_float("rw_cooldown",gun_reload)
local player_has_ammo = 0
local clipSize = 0
local reload_ammo = ""
if GunCaps.suitable_ammo ~= nil then
local inv = player:get_inventory()
for i = 1,inv:get_size("main") do
for _, ammo in pairs(GunCaps.suitable_ammo) do
if inv:get_stack("main",i):get_name() == ammo[1] then
reload_ammo = inv:get_stack("main",i)
clipSize = ammo[2]
player_has_ammo = 1
break
end end
if player_has_ammo == 1 then
break
end
end end
if player_has_ammo == 1 then
local gunMeta = itemstack:get_meta()
local ammoCount = gunMeta:get_int("RW_bullets")
local ammoName = gunMeta:get_string("RW_ammo_name")
local inv = player:get_inventory()
if minetest.settings:get_bool("rangedweapons_infinite_ammo", false) then
gunMeta:set_int("RW_bullets",clipSize)
else
inv:add_item("main",ammoName.." "..ammoCount)
if inv:contains_item("main",reload_ammo:get_name().." "..clipSize) then
inv:remove_item("main",reload_ammo:get_name().." "..clipSize)
gunMeta:set_int("RW_bullets",clipSize)
else
gunMeta:set_int("RW_bullets",reload_ammo:get_count())
inv:remove_item("main",reload_ammo:get_name().." "..reload_ammo:get_count())
end
end
gunMeta:set_string("RW_ammo_name",reload_ammo:get_name())
update_ammo_counter_on_gun(gunMeta)
if GunCaps.gun_magazine ~= nil then
local pos = player:get_pos()
local dir = player:get_look_dir()
local yaw = player:get_look_horizontal()
if pos and dir and yaw then
pos.y = pos.y + 1.4
local obj = minetest.add_entity(pos,"rangedweapons:mag")
if obj then
obj:set_properties({textures = {GunCaps.gun_magazine}})
obj:set_velocity({x=dir.x*2, y=dir.y*2, z=dir.z*2})
obj:set_acceleration({x=0, y=-5, z=0})
obj:set_rotation({x=0,y=yaw - math.pi/2,z=0})
end end end
if GunCaps.gun_unloaded ~= nil then
itemstack:set_name(GunCaps.gun_unloaded)
end
end
end
rangedweapons_single_load_gun = function(itemstack, player)
local GunCaps = itemstack:get_definition().RW_gun_capabilities
if GunCaps ~= nil then
gun_unload_sound = GunCaps.gun_unload_sound or ""
end
minetest.sound_play(gun_unload_sound, {pos = player:get_pos()})
local gun_reload = 0.25
if GunCaps ~= nil then
gun_reload = GunCaps.gun_reload or 0.25
end
local playerMeta = player:get_meta()
local gunMeta = itemstack:get_meta()
gunMeta:set_float("RW_reload_delay",gun_reload)
playerMeta:set_float("rw_cooldown",gun_reload)
local player_has_ammo = 0
local clipSize = 0
local reload_ammo = ""
if GunCaps.suitable_ammo ~= nil then
local inv = player:get_inventory()
for i = 1,inv:get_size("main") do
for _, ammo in pairs(GunCaps.suitable_ammo) do
if inv:get_stack("main",i):get_name() == ammo[1] then
reload_ammo = inv:get_stack("main",i)
clipSize = ammo[2]
player_has_ammo = 1
break
end end
if player_has_ammo == 1 then
break
end
end end
if player_has_ammo == 1 then
local gunMeta = itemstack:get_meta()
local ammoCount = gunMeta:get_int("RW_bullets")
local ammoName = gunMeta:get_string("RW_ammo_name")
local inv = player:get_inventory()
if ammoName ~= reload_ammo:get_name() then
inv:add_item("main",ammoName.." "..ammoCount)
gunMeta:set_int("RW_bullets",0)
end
if inv:contains_item("main",reload_ammo:get_name()) and
gunMeta:get_int("RW_bullets") < clipSize then
if not minetest.settings:get_bool("rangedweapons_infinite_ammo", false) then
inv:remove_item("main",reload_ammo:get_name())
end
gunMeta:set_int("RW_bullets",gunMeta:get_int("RW_bullets")+1)
end
gunMeta:set_string("RW_ammo_name",reload_ammo:get_name())
update_ammo_counter_on_gun(gunMeta)
if GunCaps.gun_unloaded ~= nil then
itemstack:set_name(GunCaps.gun_unloaded)
end
end
end
rangedweapons_yeet = function(itemstack, player)
if minetest.find_node_near(player:get_pos(), 10,"rangedweapons:antigun_block")
then
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","throwable weapons are prohibited in this area!"))
else
local ThrowCaps = itemstack:get_definition().RW_throw_capabilities
local playerMeta = player:get_meta()
local throw_cooldown = 0
if ThrowCaps ~= nil then
throw_cooldown = ThrowCaps.throw_cooldown or 0
end
if playerMeta:get_float("rw_cooldown") <= 0 then
playerMeta:set_float("rw_cooldown", throw_cooldown)
local throw_damage = {fleshy=1}
local throw_sound = "rangedweapons_throw"
local throw_velocity = 20
local throw_accuracy = 100
local throw_cooling = 0
local throw_crit = 0
local throw_critEffc = 1
local throw_mobPen = 0
local throw_nodePen = 0
local throw_dps = 0
local throw_gravity = 0
local throw_door_breaking = 0
local throw_skill = ""
local throw_skillChance = 0
local throw_smokeSize = 0
local throw_ent = "rangedweapons:shot_bullet"
local throw_visual = "wielditem"
local throw_texture = "rangedweapons:shot_bullet_visual"
local throw_glass_breaking = 0
local throw_particles = {}
local throw_sparks = 0
local throw_bomb_ignite = 0
local throw_size = 0
local throw_glow = 0
local OnCollision = function()end
if ThrowCaps ~= nil then
throw_damage = ThrowCaps.throw_damage or {fleshy=1}
throw_sound = ThrowCaps.throw_sound or "rangedweapons_glock"
throw_velocity = ThrowCaps.throw_velocity or 20
throw_accuracy = ThrowCaps.throw_accuracy or 100
throw_cooling = ThrowCaps.throw_cooling or itemstack:get_name()
throw_crit = ThrowCaps.throw_crit or 0
throw_critEffc = ThrowCaps.throw_critEffc or 1
throw_projectiles = ThrowCaps.throw_projectiles or 1
throw_mobPen = ThrowCaps.throw_mob_penetration or 0
throw_nodePen = ThrowCaps.throw_node_penetration or 0
throw_dps = ThrowCaps.throw_dps or 0
throw_gravity = ThrowCaps.throw_gravity or 0
throw_door_breaking = ThrowCaps.throw_door_breaking or 0
throw_ent = ThrowCaps.throw_entity or "rangedweapons:shot_bullet"
throw_visual = ThrowCaps.throw_visual or "wielditem"
throw_texture = ThrowCaps.throw_texture or "rangedweapons:shot_bullet_visual"
throw_glass_breaking = ThrowCaps.throw_glass_breaking or 0
throw_particles = ThrowCaps.throw_particles or nil
throw_sparks = ThrowCaps.throw_sparks or 0
throw_bomb_ignite = ThrowCaps.ignites_explosives or 0
throw_size = ThrowCaps.throw_projectile_size or 0
throw_glow = ThrowCaps.throw_projectile_glow or 0
OnCollision = ThrowCaps.OnCollision or function()end
if ThrowCaps.throw_skill ~= nil then
throw_skill = ThrowCaps.throw_skill[1] or ""
throw_skillChance = ThrowCaps.throw_skill[2] or 0
else
throw_skill = ""
throw_skillChance = 0
end
end
if throw_skillChance > 0 and throw_skill ~= "" then
rangedweapons_gain_skill(player,throw_skill,throw_skillChance)
end
local skill_value = 1
if throw_skill ~= "" then
skill_value = playerMeta:get_int(throw_skill)/100
end
rangedweapons_launch_projectile(player,throw_projectiles,throw_damage,throw_ent,throw_visual,throw_texture,throw_sound,throw_velocity,throw_accuracy,skill_value,OnCollision,throw_crit,throw_critEffc,throw_mobPen,throw_nodePen,0,"","","",throw_dps,throw_gravity,throw_door_breaking,throw_glass_breaking,throw_particles,throw_sparks,throw_bomb_ignite,throw_size,0,itemstack:get_wear(),throw_glow)
itemstack:take_item()
end
end
end
rangedweapons_shoot_gun = function(itemstack, player)
if minetest.find_node_near(player:get_pos(), 10,"rangedweapons:antigun_block")
then
minetest.sound_play("rangedweapons_empty", {pos = player:get_pos()})
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Guns are prohibited in this area!"))
else
local gun_cooldown = 0
local GunCaps = itemstack:get_definition().RW_gun_capabilities
local gun_ammo_save = 0
if GunCaps ~= nil then
gun_cooldown = GunCaps.gun_cooldown or 0
gun_ammo_save = GunCaps.ammo_saving or 0
end
local gunMeta = itemstack:get_meta()
local playerMeta = player:get_meta()
if gunMeta:get_int("RW_bullets") > 0 and
playerMeta:get_float("rw_cooldown") <= 0 then
playerMeta:set_float("rw_cooldown", gun_cooldown)
if math.random(1,100) > gun_ammo_save then
gunMeta:set_int("RW_bullets",gunMeta:get_int("RW_bullets")-1)
end
update_ammo_counter_on_gun(gunMeta)
local OnCollision = function() end
local bulletStack = ItemStack({name = gunMeta:get_string("RW_ammo_name")})
local AmmoCaps = bulletStack:get_definition().RW_ammo_capabilities
local gun_damage = {fleshy=1}
local gun_sound = "rangedweapons_glock"
local gun_velocity = 20
local gun_accuracy = 100
local gun_cooling = 0
local gun_crit = 0
local gun_critEffc = 1
local gun_projectiles = 1
local gun_mobPen = 0
local gun_nodePen = 0
local gun_shell = 0
local gun_durability = 0
local gun_dps = 0
local gun_gravity = 0
local gun_door_breaking = 0
local gun_skill = ""
local gun_skillChance = 0
local gun_smokeSize = 0
local bullet_damage = {fleshy=0}
local bullet_velocity = 0
local bullet_ent = "rangedweapons:shot_bullet"
local bullet_visual = "wielditem"
local bullet_texture = "rangedweapons:shot_bullet_visual"
local bullet_crit = 0
local bullet_critEffc = 0
local bullet_projMult = 1
local bullet_mobPen = 0
local bullet_nodePen = 0
local bullet_shell_ent = "rangedweapons:empty_shell"
local bullet_shell_visual = "wielditem"
local bullet_shell_texture = "rangedweapons:shelldrop"
local bullet_dps = 0
local bullet_gravity = 0
local bullet_glass_breaking = 0
local bullet_particles = {}
local bullet_sparks = 0
local bullet_bomb_ignite = 0
local bullet_size = 0
local bullet_glow = 20
if GunCaps ~= nil then
gun_damage = GunCaps.gun_damage or {fleshy=1}
gun_sound = GunCaps.gun_sound or "rangedweapons_glock"
gun_velocity = GunCaps.gun_velocity or 20
gun_accuracy = GunCaps.gun_accuracy or 100
gun_cooling = GunCaps.gun_cooling or itemstack:get_name()
gun_crit = GunCaps.gun_crit or 0
gun_critEffc = GunCaps.gun_critEffc or 1
gun_projectiles = GunCaps.gun_projectiles or 1
gun_mobPen = GunCaps.gun_mob_penetration or 0
gun_nodePen = GunCaps.gun_node_penetration or 0
gun_shell = GunCaps.has_shell or 0
gun_durability = GunCaps.gun_durability or 0
gun_dps = GunCaps.gun_dps or 0
gun_ammo_save = GunCaps.ammo_saving or 0
gun_gravity = GunCaps.gun_gravity or 0
gun_door_breaking = GunCaps.gun_door_breaking or 0
gun_smokeSize = GunCaps.gun_smokeSize or 0
if GunCaps.gun_skill ~= nil then
gun_skill = GunCaps.gun_skill[1] or ""
gun_skillChance = GunCaps.gun_skill[2] or 0
else
gun_skill = ""
gun_skillChance = 0
end
end
if gun_skillChance > 0 and gun_skill ~= "" then
rangedweapons_gain_skill(player,gun_skill,gun_skillChance)
end
if AmmoCaps ~= nil then
OnCollision = AmmoCaps.OnCollision or function()end
bullet_damage = AmmoCaps.ammo_damage or {fleshy=1}
bullet_velocity = AmmoCaps.ammo_velocity or 0
bullet_ent = AmmoCaps.ammo_entity or "rangedweapons:shot_bullet"
bullet_visual = AmmoCaps.ammo_visual or "wielditem"
bullet_texture = AmmoCaps.ammo_texture or "rangedweapons:shot_bullet_visual"
bullet_crit = AmmoCaps.ammo_crit or 0
bullet_critEffc = AmmoCaps.ammo_critEffc or 0
bullet_projMult = AmmoCaps.ammo_projectile_multiplier or 1
bullet_mobPen = AmmoCaps.ammo_mob_penetration or 0
bullet_nodePen = AmmoCaps.ammo_node_penetration or 0
bullet_shell_ent = AmmoCaps.shell_entity or "rangedweapons:empty_shell"
bullet_shell_visual = AmmoCaps.shell_visual or "wielditem"
bullet_shell_texture = AmmoCaps.shell_texture or "rangedweapons:shelldrop"
bullet_dps = AmmoCaps.ammo_dps or 0
bullet_gravity = AmmoCaps.ammo_gravity or 0
bullet_glass_breaking = AmmoCaps.ammo_glass_breaking or 0
bullet_particles = AmmoCaps.ammo_particles or nil
bullet_sparks = AmmoCaps.has_sparks or 0
bullet_bomb_ignite = AmmoCaps.ignites_explosives or 0
bullet_size = AmmoCaps.ammo_projectile_size or 0.0025
bullet_glow = AmmoCaps.ammo_projectile_glow or 20
end
local combined_crit = gun_crit + bullet_crit
local combined_critEffc = gun_critEffc + bullet_critEffc
local combined_velocity = gun_velocity + bullet_velocity
local combined_projNum = math.ceil(gun_projectiles * bullet_projMult)
local combined_mobPen = gun_mobPen + bullet_mobPen
local combined_nodePen = gun_nodePen + bullet_nodePen
local combined_dps = gun_dps + bullet_dps
local combined_dmg = {}
local combined_gravity = gun_gravity + bullet_gravity
for _, gunDmg in pairs(gun_damage) do
if bullet_damage[_] ~= nil then
combined_dmg[_] = gun_damage[_] + bullet_damage[_]
else
combined_dmg[_] = gun_damage[_]
end
end
for _, bulletDmg in pairs(bullet_damage) do
if gun_damage[_] == nil then
combined_dmg[_] = bullet_damage[_]
end
end
--minetest.chat_send_all(minetest.serialize(combined_dmg))
local skill_value = 1
if gun_skill ~= "" then
skill_value = playerMeta:get_int(gun_skill)/100
end
rangedweapons_launch_projectile(player,combined_projNum,combined_dmg,bullet_ent,bullet_visual,bullet_texture,gun_sound,combined_velocity,gun_accuracy,skill_value,OnCollision,combined_crit,combined_critEffc,combined_mobPen,combined_nodePen,gun_shell,bullet_shell_ent,bullet_shell_texture,bullet_shell_visual,combined_dps,combined_gravity,gun_door_breaking,bullet_glass_breaking,bullet_particles,bullet_sparks,bullet_bomb_ignite,bullet_size,gun_smokeSize,0,bullet_glow)
if minetest.settings:get_bool("rangedweapons_gun_wear", true) then
itemstack:add_wear(65535/gun_durability)
end
itemstack:set_name(gun_cooling)
end
end end
rangedweapons_shoot_powergun = function(itemstack, player)
if minetest.find_node_near(player:get_pos(), 10,"rangedweapons:antigun_block")
then
minetest.sound_play("rangedweapons_empty", {pos = player:get_pos()})
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Guns are prohibited in this area!"))
else
local power_cooldown = 0
local power_consumption = 0
local PowerCaps = itemstack:get_definition().RW_powergun_capabilities
if PowerCaps ~= nil then
power_cooldown = PowerCaps.power_cooldown or 0
power_consumption = PowerCaps.power_consumption or 0
end
local inv = player:get_inventory()
local playerMeta = player:get_meta()
if inv:contains_item("main", "rangedweapons:power_particle "..PowerCaps.power_consumption) and
playerMeta:get_float("rw_cooldown") <= 0 then
playerMeta:set_float("rw_cooldown", power_cooldown)
local OnCollision = function() end
local power_damage = {fleshy=1}
local power_sound = "rangedweapons_laser"
local power_velocity = 20
local power_accuracy = 100
local power_cooling = 0
local power_crit = 0
local power_critEffc = 1
local power_mobPen = 0
local power_nodePen = 0
local power_durability = 0
local power_dps = 0
local power_gravity = 0
local power_door_breaking = 0
local power_skill = ""
local power_skillChance = 0
local power_ent = "rangedweapons:shot_bullet"
local power_visual = "wielditem"
local power_texture = "rangedweapons:shot_bullet_visual"
local power_glass_breaking = 0
local power_particles = {}
local power_sparks = 0
local power_bomb_ignite = 0
local power_size = 0
local power_glow = 20
local power_projectiles = 1
if PowerCaps ~= nil then
power_damage = PowerCaps.power_damage or {fleshy=1}
power_sound = PowerCaps.power_sound or "rangedweapons_glock"
power_velocity = PowerCaps.power_velocity or 20
power_accuracy = PowerCaps.power_accuracy or 100
power_cooling = PowerCaps.power_cooling or itemstack:get_name()
power_crit = PowerCaps.power_crit or 0
power_critEffc = PowerCaps.power_critEffc or 1
power_projectiles = PowerCaps.power_projectiles or 1
power_mobPen = PowerCaps.power_mob_penetration or 0
power_nodePen = PowerCaps.power_node_penetration or 0
power_durability = PowerCaps.power_durability or 0
power_dps = PowerCaps.power_dps or 0
power_gravity = PowerCaps.power_gravity or 0
power_door_breaking = PowerCaps.power_door_breaking or 0
OnCollision = PowerCaps.OnCollision or function()end
power_ent = PowerCaps.power_entity or "rangedweapons:shot_bullet"
power_visual = PowerCaps.power_visual or "wielditem"
power_texture = PowerCaps.power_texture or "rangedweapons:shot_bullet_visual"
power_glass_breaking = PowerCaps.power_glass_breaking or 0
power_particles = PowerCaps.power_particles or nil
power_sparks = PowerCaps.has_sparks or 0
power_bomb_ignite = PowerCaps.ignites_explosives or 0
power_size = PowerCaps.power_projectile_size or 0.0025
power_glow = PowerCaps.power_projectile_glow or 20
if PowerCaps.power_skill ~= nil then
power_skill = PowerCaps.power_skill[1] or ""
power_skillChance = PowerCaps.power_skill[2] or 0
else
power_skill = ""
power_skillChance = 0
end
end
if power_skillChance > 0 and power_skill ~= "" then
rangedweapons_gain_skill(player,power_skill,power_skillChance)
end
local skill_value = 1
if power_skill ~= "" then
skill_value = playerMeta:get_int(power_skill)/100
end
rangedweapons_launch_projectile(player,power_projectiles,power_damage,power_ent,power_visual,power_texture,power_sound,power_velocity,power_accuracy,skill_value,OnCollision,power_crit,power_critEffc,power_mobPen,power_nodePen,0,"","","",power_dps,power_gravity,power_door_breaking,power_glass_breaking,power_particles,power_sparks,power_bomb_ignite,power_size,0,0,power_glow)
if minetest.settings:get_bool("rangedweapons_gun_wear", true) then
itemstack:add_wear(65535/power_durability)
end
itemstack:set_name(power_cooling)
inv:remove_item("main", "rangedweapons:power_particle "..PowerCaps.power_consumption)
end
end end
rangedweapons_launch_projectile = function(player,projNum,projDmg,projEnt,visualType,texture,shoot_sound,combined_velocity,accuracy,skill_value,ColResult,projCrit,projCritEffc,mobPen,nodePen,has_shell,shellEnt,shellTexture,shellVisual,dps,gravity,door_break,glass_break,bullet_particles,sparks,ignite,size,smokeSize,proj_wear,proj_glow)
--minetest.chat_send_all(accuracy)
----------------------------------
local pos = player:get_pos()
local dir = player:get_look_dir()
local yaw = player:get_look_horizontal()
local svertical = player:get_look_vertical()
if pos and dir and yaw then
minetest.sound_play(shoot_sound, {pos = pos, max_hear_distance = 500})
pos.y = pos.y + 1.45
if has_shell > 0 and minetest.settings:get_bool("rangedweapons_animate_empty_shells", true) then
local shl = minetest.add_entity(pos, shellEnt)
shl:set_velocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
shl:set_acceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
shl:set_rotation({x=0,y=yaw - math.pi/2,z=-svertical})
shl:set_properties({
textures = {shellTexture},
visual = shellVisual,})
end
if smokeSize > 0 then
minetest.add_particle({
pos = pos,
velocity = {x=(dir.x*3)+(math.random(-10,10)/10), y=(dir.y*3)+(math.random(-10,10)/10), z=(dir.z*3)+(math.random(-10,10)/10)} ,
acceleration = {x=dir.x * -3, y=2, z=dir.z * -3},
expirationtime = math.random(5,10)/10,
size = smokeSize / 2,
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png",
glow = 5,
})
end
local projectiles = projNum or 1
for i=1,projectiles do
local obj = minetest.add_entity(pos, projEnt)
local ent = obj:get_luaentity()
obj:set_properties(
{textures = {texture},
visual = visualType,
collisionbox = {-size,-size,-size, size,size,size},
glow = proj_glow,}
)
ent.owner = player:get_player_name()
if obj then
ent.damage = projDmg
ent.crit = projCrit
ent.critEffc = projCritEffc
ent.OnCollision = ColResult
ent.mobPen = mobPen
ent.nodePen = nodePen
ent.dps = dps
ent.door_break = door_break
ent.glass_break = glass_break
ent.skill_value = skill_value
ent.bullet_particles = bullet_particles
ent.sparks = sparks
ent.ignite = ignite
ent.size = size
ent.timer = 0 + (combined_velocity/2000)
ent.wear = proj_wear
local acc = ((( 100 - accuracy ) / 10) / skill_value ) or 0
obj:set_velocity({x=dir.x * combined_velocity + math.random(-acc,acc), y=dir.y * combined_velocity + math.random(-acc,acc), z=dir.z * combined_velocity + math.random(-acc,acc)})
obj:set_acceleration({x=0, y=-gravity, z=0})
obj:set_rotation({x=0,y=yaw - math.pi/2,z=-svertical})
end end end
end
eject_shell = function(itemstack,player,rld_item,rld_time,rldsound,shell)
itemstack:set_name(rld_item)
local meta = player:get_meta()
meta:set_float("rw_cooldown", rld_time)
local gunMeta = itemstack:get_meta()
local bulletStack = ItemStack({name = gunMeta:get_string("RW_ammo_name")})
local pos = player:get_pos()
minetest.sound_play(rldsound, {pos = pos})
local dir = player:get_look_dir()
local yaw = player:get_look_horizontal()
if pos and dir and yaw then
pos.y = pos.y + 1.6
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
if bulletStack ~= "" then
local AmmoCaps = bulletStack:get_definition().RW_ammo_capabilities
local bullet_shell_visual = "wielditem"
local bullet_shell_texture = "rangedweapons:shelldrop"
bullet_shell_visual = AmmoCaps.shell_visual or "wielditem"
bullet_shell_texture = AmmoCaps.shell_texture or "rangedweapons:shelldrop"
obj:set_properties({textures = {bullet_shell_texture}})
obj:set_properties({visual = bullet_shell_visual})
end
if obj then
obj:set_velocity({x=dir.x*-10, y=dir.y*-10, z=dir.z*-10})
obj:set_acceleration({x=dir.x*-5, y=-10, z=dir.z*-5})
obj:set_yaw(yaw - math.pi/2)
end end end
---------------------------------------------------
dofile(modpath.."/cooldown_stuff.lua")
dofile(modpath.."/skills.lua")
dofile(modpath.."/misc.lua")
dofile(modpath.."/bullet_knockback.lua")
dofile(modpath.."/ammo.lua")
dofile(modpath.."/crafting.lua")
if minetest.settings:get_bool("rangedweapons_shurikens", true) then
dofile(modpath.."/shurikens.lua")
end
if minetest.settings:get_bool("rangedweapons_handguns", true) then
dofile(modpath.."/makarov.lua")
dofile(modpath.."/luger.lua")
dofile(modpath.."/beretta.lua")
dofile(modpath.."/m1991.lua")
dofile(modpath.."/glock17.lua")
dofile(modpath.."/deagle.lua")
end
if minetest.settings:get_bool("rangedweapon_forceguns", true) then
dofile(modpath.."/forcegun.lua")
end
if minetest.settings:get_bool("rangedweapons_javelins", true) then
dofile(modpath.."/javelin.lua")
end
if minetest.settings:get_bool("rangedweapons_power_weapons", true) then
dofile(modpath.."/generator.lua")
dofile(modpath.."/laser_blaster.lua")
dofile(modpath.."/laser_rifle.lua")
dofile(modpath.."/laser_shotgun.lua")
end
if minetest.settings:get_bool("rangedweapons_machine_pistols", true) then
dofile(modpath.."/tmp.lua")
dofile(modpath.."/tec9.lua")
dofile(modpath.."/uzi.lua")
dofile(modpath.."/kriss_sv.lua")
end
if minetest.settings:get_bool("rangedweapons_shotguns", true) then
dofile(modpath.."/remington.lua")
dofile(modpath.."/spas12.lua")
dofile(modpath.."/benelli.lua")
end
if minetest.settings:get_bool("rangedweapons_auto_shotguns", true) then
dofile(modpath.."/jackhammer.lua")
dofile(modpath.."/aa12.lua")
end
if minetest.settings:get_bool("rangedweapons_smgs", true) then
dofile(modpath.."/mp5.lua")
dofile(modpath.."/ump.lua")
dofile(modpath.."/mp40.lua")
dofile(modpath.."/thompson.lua")
end
if minetest.settings:get_bool("rangedweapons_rifles", true) then
dofile(modpath.."/awp.lua")
dofile(modpath.."/svd.lua")
dofile(modpath.."/m200.lua")
end
if minetest.settings:get_bool("rangedweapons_heavy_machineguns", true) then
dofile(modpath.."/m60.lua")
dofile(modpath.."/rpk.lua")
dofile(modpath.."/minigun.lua")
end
if minetest.settings:get_bool("rangedweapons_revolvers", true) then
dofile(modpath.."/python.lua")
dofile(modpath.."/taurus.lua")
end
if minetest.settings:get_bool("rangedweapons_assault_rifles", true) then
dofile(modpath.."/m16.lua")
dofile(modpath.."/g36.lua")
dofile(modpath.."/ak47.lua")
dofile(modpath.."/scar.lua")
end
if minetest.settings:get_bool("rangedweapons_explosives", true) then
dofile(modpath.."/explosives.lua")
dofile(modpath.."/m79.lua")
dofile(modpath.."/milkor.lua")
dofile(modpath.."/rpg.lua")
dofile(modpath.."/hand_grenade.lua")
end
if minetest.settings:get_bool("rangedweapons_glass_breaking", true) then
dofile(modpath.."/glass_breaking.lua")
--[[ What is this good for?
minetest.register_abm({
nodenames = {"rangedweapons:broken_glass"},
interval = 1,
chance = 1,
action = function(pos, node)
if minetest.get_node(pos).name == "rangedweapons:broken_glass" then
node.name = "default:glass"
minetest.set_node(pos, node)
end
end
})
end
--]]
end
local rangedweapons_empty_shell = {
physical = false,
timer = 0,
visual = "wielditem",
visual_size = {x=0.3, y=0.3},
textures = {"rangedweapons:shelldrop"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
rangedweapons_empty_shell.on_step = function(self, dtime, pos)
self.timer = self.timer + dtime
local pos = self.object:get_pos()
local node = minetest.get_node(pos)
if self.lastpos.y ~= nil then
if minetest.registered_nodes[node.name]~= nil then
if minetest.registered_nodes[node.name].walkable then
local vel = self.object:get_velocity()
local acc = self.object:get_acceleration()
self.object:set_velocity({x=vel.x*-0.3, y=vel.y*-0.75, z=vel.z*-0.3})
minetest.sound_play("rangedweapons_shellhit", {pos = self.lastpos, gain = 0.8})
self.object:set_acceleration({x=acc.x, y=acc.y, z=acc.z})
end end
end
if self.timer > 1.69 then
minetest.sound_play("rangedweapons_bulletdrop", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("rangedweapons:empty_shell", rangedweapons_empty_shell )
minetest.register_abm({
nodenames = {"doors:hidden"},
interval = 1,
chance = 1,
action = function(pos, node)
pos.y = pos.y-1
if minetest.get_node(pos).name == "air" then
pos.y = pos.y+1
node.name = "air"
minetest.set_node(pos, node)
end
end
})
minetest.register_on_joinplayer(function(player)
hit =
player:hud_add({
hud_elem_type = "image",
text = "rangedweapons_empty_icon.png",
scale = {x = 2, y = 2},
position = {x = 0.5, y = 0.5},
offset = {x = 0, y = 0},
alignment = {x = 0, y = 0}
})
scope_hud =
player:hud_add({
hud_elem_type = "image",
position = { x=0.5, y=0.5 },
scale = { x=-100, y=-100 },
text = "rangedweapons_empty_icon.png",
})
end)
local timer = 0
minetest.register_globalstep(function(dtime)
timer = timer + dtime;
if timer >= 1.0 then
for _, player in pairs(minetest.get_connected_players()) do
player:hud_change(hit, "image", "rangedweapons_empty_icon.png")
timer = 0
end
end
end)

68
jackhammer.lua Normal file
View File

@ -0,0 +1,68 @@
minetest.register_tool("rangedweapons:jackhammer_r", {
stack_max= 1,
wield_scale = {x=2.6,y=2.6,z=1.8},
description = "",
rw_next_reload = "rangedweapons:jackhammer_rr",
load_sound = "rangedweapons_rifle_clip_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_jackhammer_rld.png",
})
minetest.register_tool("rangedweapons:jackhammer_rr", {
stack_max= 1,
wield_scale = {x=2.6,y=2.6,z=1.8},
description = "",
rw_next_reload = "rangedweapons:jackhammer_rrr",
load_sound = "rangedweapons_reload_a",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_jackhammer.png",
})
minetest.register_tool("rangedweapons:jackhammer_rrr", {
stack_max= 1,
wield_scale = {x=2.6,y=2.6,z=1.8},
description = "",
rw_next_reload = "rangedweapons:jackhammer",
load_sound = "rangedweapons_reload_b",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_jackhammer.png",
})
-------------------------------------------
minetest.register_tool("rangedweapons:jackhammer", {
stack_max= 1,
wield_scale = {x=2.6,y=2.6,z=1.8},
description = "" ..core.colorize("#35cdff","Jackhammer\n") ..core.colorize("#FFFFFF", "Ranged damage: 3\n") ..core.colorize("#FFFFFF", "projectiles: 8\n") ..core.colorize("#FFFFFF", "Gun gravity: 3\n") ..core.colorize("#FFFFFF", "accuracy: 35%\n") ..core.colorize("#FFFFFF", "knockback: 6\n") ..core.colorize("#FFFFFF", "Reload delay: 1.6\n") ..core.colorize("#FFFFFF", "Clip size: 10\n") ..core.colorize("#FFFFFF", "Critical chance: 7%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.2x\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shell\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.25 (full-auto)\n") ..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 30"),
range = 0,
inventory_image = "rangedweapons_jackhammer.png",
RW_gun_capabilities = {
automatic_gun = 1,
gun_damage = {fleshy=3,knockback=6},
gun_crit = 7,
gun_critEffc = 2.2,
suitable_ammo = {{"rangedweapons:shell",10}},
gun_skill = {"shotgun_skill",35},
gun_magazine = "rangedweapons:drum_mag",
gun_unloaded = "rangedweapons:jackhammer_r",
gun_velocity = 30,
gun_accuracy = 35,
gun_cooldown = 0.25,
gun_reload = 1.6/4,
gun_projectiles = 1,
has_shell = 1,
gun_durability = 825,
gun_smokeSize = 9,
gun_door_breaking = 1,
gun_projectiles = 8,
gun_gravity = 3,
gun_unload_sound = "rangedweapons_rifle_clip_out",
gun_sound = "rangedweapons_shotgun_shot",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
})

58
javelin.lua Normal file
View File

@ -0,0 +1,58 @@
minetest.register_craftitem("rangedweapons:thrown_javelin", {
wield_scale = {x=2.0,y=2.0,z=1.0},
inventory_image = "rangedweapons_thrown_javelin.png",
})
minetest.register_tool("rangedweapons:javelin", {
description = "" ..core.colorize("#35cdff","Javelin\n") ..core.colorize("#FFFFFF", "Melee damage: 8\n") ..core.colorize("#FFFFFF", "Melee range: 4.5\n")..core.colorize("#FFFFFF", "Full punch interval: 1.25\n") ..core.colorize("#FFFFFF", "Ranged damage: 9\n") ..core.colorize("#FFFFFF", "Accuracy: 92%\n") ..core.colorize("#FFFFFF", "knockback: 10\n") ..core.colorize("#FFFFFF", "Critical chance: 11%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.5x\n") ..core.colorize("#FFFFFF", "Projectile gravity: 6\n") ..core.colorize("#FFFFFF", "Projectile velocity: 35\n") ..core.colorize("#FFFFFF", "Enemy penetration: 50%\n") ..core.colorize("#ffc000", "Right-click to throw, Left-click to stab\n")..core.colorize("#ffc000", "Throwing wears the javelin out 5x faster than stabbing.") ,
wield_scale = {x=2.0,y=2.0,z=1.0},
range = 4.5,
inventory_image = "rangedweapons_javelin.png",
tool_capabilities = {
full_punch_interval = 1.25,
max_drop_level = 0,
groupcaps = {
stabby = {times={[1]=0.25, [2]=0.50, [3]=0.75}, uses=66.6, maxlevel=2},
},
damage_groups = {fleshy=8,knockback=10},
},
RW_throw_capabilities = {
throw_damage = {fleshy=9,knockback=10},
throw_crit = 11,
throw_critEffc = 2.5,
throw_skill = {"throw_skill",20},
throw_velocity = 40,
throw_accuracy = 92,
throw_cooldown = 0.0,
throw_projectiles = 1,
throw_gravity = 6,
throw_sound = "rangedweapons_throw",
throw_dps = 0,
throw_mob_penetration = 50,
throw_node_penetration = 0,
throw_entity = "rangedweapons:shot_bullet",
throw_visual = "wielditem",
throw_texture = "rangedweapons:thrown_javelin",
throw_projectile_size = 0.15,
throw_glass_breaking = 1,
has_sparks = 1,
ignites_explosives = 0,
throw_door_breaking = 0,
OnCollision = function(player,bullet,target)
local throwDur = 40
if bullet.wear+(65535/throwDur) < 65535 then
javStack = {name="rangedweapons:javelin",wear=(bullet.wear)+(65535/throwDur)}
minetest.add_item(bullet.object:get_pos(),javStack) end end,
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_yeet(itemstack, user)
return itemstack
end,
})

67
kriss_sv.lua Normal file
View File

@ -0,0 +1,67 @@
minetest.register_tool("rangedweapons:kriss_sv_r", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.15},
description = "",
rw_next_reload = "rangedweapons:kriss_sv_rr",
load_sound = "rangedweapons_handgun_mag_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_kriss_sv_rld.png",
})
minetest.register_tool("rangedweapons:kriss_sv_rr", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.15},
description = "",
rw_next_reload = "rangedweapons:kriss_sv_rrr",
load_sound = "rangedweapons_reload_a",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_kriss_sv.png",
})
minetest.register_tool("rangedweapons:kriss_sv_rrr", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.15},
description = "",
rw_next_reload = "rangedweapons:kriss_sv",
load_sound = "rangedweapons_reload_b",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_kriss_sv.png",
})
minetest.register_tool("rangedweapons:kriss_sv", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.15},
description = "" ..core.colorize("#35cdff","Kriss Super V\n") ..core.colorize("#FFFFFF", "Gun damage: 1\n") ..core.colorize("#FFFFFF", "accuracy: 60%\n") ..core.colorize("#FFFFFF", "Gun knockback: 0\n") ..core.colorize("#FFFFFF", "Gun Critical chance: 6%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 1.85x\n") ..core.colorize("#FFFFFF", "Reload delay: 0.9\n") ..core.colorize("#FFFFFF", "Clip size: 33/33/13\n") ..core.colorize("#FFFFFF", "Ammunition: 9x19mm parabellum/10mm auto/.45 acp\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.05\n") ..core.colorize("#FFFFFF", "Gun type: machine pistol\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
range = 0,
inventory_image = "rangedweapons_kriss_sv.png",
RW_gun_capabilities = {
automatic_gun = 1,
gun_damage = {fleshy=1,knockback=0},
gun_crit = 6,
gun_critEffc = 1.95,
suitable_ammo = {{"rangedweapons:9mm",33},{"rangedweapons:10mm",33},{"rangedweapons:45acp",13}},
gun_skill = {"mp_skill",90},
gun_magazine = "rangedweapons:machinepistol_mag",
gun_unloaded = "rangedweapons:kriss_sv_r",
gun_velocity = 20,
gun_accuracy = 60,
gun_cooldown = 0.05,
gun_reload = 0.9/4,
gun_projectiles = 1,
has_shell = 1,
gun_gravity = 0,
gun_durability = 1750,
gun_smokeSize = 4,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_machine_pistol",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
})

46
laser_blaster.lua Normal file
View File

@ -0,0 +1,46 @@
minetest.register_craftitem("rangedweapons:blue_ray_visual", {
wield_scale = {x=1.75,y=1.75,z=1.75},
inventory_image = "rangedweapons_blue_ray.png",
})
minetest.register_tool("rangedweapons:laser_blaster", {
stack_max= 1,
wield_scale = {x=1.15,y=1.15,z=1.15},
description = "" ..core.colorize("#35cdff","Laser blaster\n") ..core.colorize("#FFFFFF", "Ranged damage: 15\n") ..core.colorize("#FFFFFF", "accuracy: 100%\n") ..core.colorize("#FFFFFF", "knockback: 0\n") ..core.colorize("#FFFFFF", "Critical chance: 10%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.0x\n") ..core.colorize("#FFFFFF", "Power usage: 10\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.3\n") ..core.colorize("#FFFFFF", "Enemy penetration: 50%\n") ..core.colorize("#FFFFFF", "Gun type: power pistol\n") ..core.colorize("#FFFFFF", "Bullet velocity: 65"),
range = 0,
inventory_image = "rangedweapons_laser_blaster.png",
RW_powergun_capabilities = {
power_damage = {fleshy=15,knockback=0},
power_crit = 10,
power_critEffc = 2.0,
power_skill = {"",1},
power_cooling = "rangedweapons:laser_blaster",
power_velocity = 65,
power_accuracy = 100,
power_cooldown = 0.3,
power_projectiles = 1,
power_durability = 5000,
power_sound = "rangedweapons_laser",
power_glass_breaking = 1,
power_door_breaking = 1,
power_dps = 0,
power_mob_penetration = 50,
power_node_penetration = 0,
power_dps = 0,
power_consumption = 10,
power_entity = "rangedweapons:shot_bullet",
power_visual = "wielditem",
power_texture = "rangedweapons:blue_ray_visual",
power_projectile_size = 0.1,
has_sparks = 0,
ignites_explosives = 1,
},
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_powergun(itemstack, user)
return itemstack
end,
})

38
laser_rifle.lua Normal file
View File

@ -0,0 +1,38 @@
minetest.register_craftitem("rangedweapons:red_ray_visual", {
wield_scale = {x=1.5,y=1.5,z=2.0},
inventory_image = "rangedweapons_red_ray.png",
})
minetest.register_tool("rangedweapons:laser_rifle", {
wield_scale = {x=1.9,y=1.9,z=2.5},
description = "" ..core.colorize("#35cdff","Laser rifle\n") ..core.colorize("#FFFFFF", "Ranged damage: 12\n") ..core.colorize("#FFFFFF", "accuracy: 100%\n") ..core.colorize("#FFFFFF", "knockback: 0\n") ..core.colorize("#FFFFFF", "Critical chance: 9%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.0x\n") ..core.colorize("#FFFFFF", "Power usage: 8\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.1 (full-auto)\n") ..core.colorize("#FFFFFF", "Enemy penetration: 40%\n") ..core.colorize("#FFFFFF", "Gun type: power assault rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 60"),
range = 0,
RW_powergun_capabilities = {
automatic_gun = 1,
power_damage = {fleshy=12,knockback=0},
power_crit = 9,
power_critEffc = 2.0,
power_skill = {"",1},
power_cooling = "rangedweapons:laser_rifle",
power_velocity = 60,
power_accuracy = 100,
power_cooldown = 0.1,
power_projectiles = 1,
power_durability = 12500,
power_sound = "rangedweapons_laser",
power_glass_breaking = 1,
power_door_breaking = 1,
power_dps = 0,
power_mob_penetration = 40,
power_node_penetration = 0,
power_dps = 0,
power_consumption = 8,
power_entity = "rangedweapons:shot_bullet",
power_visual = "wielditem",
power_texture = "rangedweapons:red_ray_visual",
power_projectile_size = 0.075,
has_sparks = 0,
ignites_explosives = 1,
},
inventory_image = "rangedweapons_laser_rifle.png",
})

39
laser_shotgun.lua Normal file
View File

@ -0,0 +1,39 @@
minetest.register_tool("rangedweapons:laser_shotgun", {
stack_max= 1,
wield_scale = {x=2.0,y=2.0,z=1.75},
description = "" ..core.colorize("#35cdff","Laser shotgun\n") ..core.colorize("#FFFFFF", "Ranged damage: 10\n") ..core.colorize("#FFFFFF", "accuracy: 40%\n") ..core.colorize("#FFFFFF", "projectiles: 6\n") ..core.colorize("#FFFFFF", "knockback: 0\n") ..core.colorize("#FFFFFF", "Critical chance: 8%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.2x\n") ..core.colorize("#FFFFFF", "Power usage: 30\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.5\n") ..core.colorize("#FFFFFF", "Enemy penetration: 40%\n") ..core.colorize("#FFFFFF", "Gun type: power pistol\n") ..core.colorize("#FFFFFF", "Bullet velocity: 55"),
range = 0,
inventory_image = "rangedweapons_laser_shotgun.png",
RW_powergun_capabilities = {
power_damage = {fleshy=10,knockback=0},
power_crit = 8,
power_critEffc = 2.2,
power_skill = {"",1},
power_cooling = "rangedweapons:laser_shotgun",
power_velocity = 55,
power_accuracy = 40,
power_cooldown = 0.5,
power_projectiles = 1,
power_durability = 2000,
power_sound = "rangedweapons_laser",
power_glass_breaking = 1,
power_door_breaking = 1,
power_dps = 0,
power_mob_penetration = 40,
power_node_penetration = 0,
power_dps = 0,
power_consumption = 30,
power_entity = "rangedweapons:shot_bullet",
power_visual = "sprite",
power_texture = "rangedweapons_green_ray.png",
power_projectile_size = 0.005,
power_projectiles = 6,
has_sparks = 0,
ignites_explosives = 1,
},
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_powergun(itemstack, user)
return itemstack
end,
})

1
license.txt Normal file
View File

@ -0,0 +1 @@
cc-by-sa 4.0

77
luger.lua Normal file
View File

@ -0,0 +1,77 @@
------------reload--------------------
minetest.register_tool("rangedweapons:luger_r", {
stack_max= 1,
wield_scale = {x=0.9,y=0.9,z=1.0},
description = "",
range = 0,
groups = {not_in_creative_inventory = 1},
rw_next_reload = "rangedweapons:luger_rr",
load_sound = "rangedweapons_handgun_mag_in",
inventory_image = "rangedweapons_luger.png",
})
minetest.register_tool("rangedweapons:luger_rr", {
stack_max= 1,
wield_scale = {x=0.9,y=0.9,z=1.0},
description = "",
range = 0,
groups = {not_in_creative_inventory = 1},
rw_next_reload = "rangedweapons:luger_rrr",
load_sound = "rangedweapons_reload_a",
inventory_image = "rangedweapons_luger.png",
})
minetest.register_tool("rangedweapons:luger_rrr", {
stack_max= 1,
wield_scale = {x=0.9,y=0.9,z=1.0},
description = "",
range = 0,
groups = {not_in_creative_inventory = 1},
rw_next_reload = "rangedweapons:luger",
load_sound = "rangedweapons_reload_b",
inventory_image = "rangedweapons_luger_rld.png",
})
minetest.register_tool("rangedweapons:luger_rld", {
stack_max= 1,
wield_scale = {x=0.9,y=0.9,z=1.0},
description = "",
range = 0,
loaded_gun = "rangedweapons:luger",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_luger_rld.png",
})
-----------------gun--------------
minetest.register_tool("rangedweapons:luger", {
description = "" ..core.colorize("#35cdff","Luger P08\n") ..core.colorize("#FFFFFF", "Ranged damage: 4\n")..core.colorize("#FFFFFF", "Accuracy: 92%\n") ..core.colorize("#FFFFFF", "Gun knockback: 3\n") ..core.colorize("#FFFFFF", "Critical chance: 10%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2x\n") ..core.colorize("#FFFFFF", "Ammunition: 9x19mm parabellum\n")..core.colorize("#FFFFFF", "Reload delay: 1.0\n")..core.colorize("#FFFFFF", "Clip size: 8\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.625\n") ..core.colorize("#FFFFFF", "Gun type: Handgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
range = 0,
wield_scale = {x=0.9,y=0.9,z=1.0},
inventory_image = "rangedweapons_luger.png",
RW_gun_capabilities = {
gun_damage = {fleshy=4,knockback=3},
gun_crit = 10,
gun_critEffc = 2.0,
suitable_ammo = {{"rangedweapons:9mm",8}},
gun_skill = {"handgun_skill",40},
gun_magazine = "rangedweapons:handgun_mag_black",
gun_unloaded = "rangedweapons:luger_r",
gun_cooling = "rangedweapons:luger_rld",
gun_velocity = 20,
gun_accuracy = 92,
gun_cooldown = 0.625,
gun_reload = 1.0/4,
gun_projectiles = 1,
has_shell = 1,
gun_durability = 600,
gun_smokeSize = 5,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_glock",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})

72
m16.lua Normal file
View File

@ -0,0 +1,72 @@
minetest.register_tool("rangedweapons:m16_r", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "",
rw_next_reload = "rangedweapons:m16_rr",
load_sound = "rangedweapons_handgun_mag_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m16_rld.png",
})
minetest.register_tool("rangedweapons:m16_rr", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "",
rw_next_reload = "rangedweapons:m16_rrr",
load_sound = "rangedweapons_rifle_reload_a",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m16.png",
})
minetest.register_tool("rangedweapons:m16_rrr", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "",
rw_next_reload = "rangedweapons:m16",
load_sound = "rangedweapons_rifle_reload_b",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m16.png",
})
minetest.register_tool("rangedweapons:m16", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "" ..core.colorize("#35cdff","m16\n") ..core.colorize("#FFFFFF", "Gun damage: 6\n") ..core.colorize("#FFFFFF", "accuracy: 75%\n") ..core.colorize("#FFFFFF", "Gun knockback: 4\n") ..core.colorize("#FFFFFF", "Gun Critical chance: 11%\n")..core.colorize("#FFFFFF", "Critical efficiency: 2.75x\n") ..core.colorize("#FFFFFF", "Reload delay: 1.0\n") ..core.colorize("#FFFFFF", "Clip size: 20\n") ..core.colorize("#FFFFFF", "Ammunition: 5.56mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.067(full-auto)\n") ..core.colorize("#FFFFFF", "Gun type: assault rifle\n")
..core.colorize("#FFFFFF", "Enemy penetration: 10%\n") ..core.colorize("#FFFFFF", "Bullet velocity: 35"),
range = 0,
inventory_image = "rangedweapons_m16.png",
RW_gun_capabilities = {
automatic_gun = 1,
gun_damage = {fleshy=6,knockback=4},
gun_crit = 11,
gun_critEffc = 2.75,
suitable_ammo = {{"rangedweapons:556mm",20}},
gun_skill = {"arifle_skill",55},
gun_magazine = "rangedweapons:assaultrifle_mag",
gun_unloaded = "rangedweapons:m16_r",
gun_velocity = 35,
gun_accuracy = 75,
gun_cooldown = 0.067,
gun_reload = 1.0/4,
gun_projectiles = 1,
has_shell = 1,
gun_gravity = 0,
gun_durability = 1350,
gun_smokeSize = 5,
gun_mob_penetration = 10,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_smg",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
inventory_image = "rangedweapons_m16.png",
})

77
m1991.lua Normal file
View File

@ -0,0 +1,77 @@
minetest.register_tool("rangedweapons:m1991_rld", {
stack_max= 1,
wield_scale = {x=1.1,y=1.1,z=1.05},
description = "",
range = 0,
loaded_gun = "rangedweapons:m1991",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m1991_rld.png",
})
minetest.register_tool("rangedweapons:m1991_r", {
stack_max= 1,
wield_scale = {x=1.1,y=1.1,z=1.05},
description = "",
rw_next_reload = "rangedweapons:m1991_rr",
load_sound = "rangedweapons_handgun_mag_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m1991.png",
})
minetest.register_tool("rangedweapons:m1991_rr", {
stack_max= 1,
wield_scale = {x=1.1,y=1.1,z=1.05},
description = "",
rw_next_reload = "rangedweapons:m1991_rrr",
load_sound = "rangedweapons_reload_a",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m1991.png",
})
minetest.register_tool("rangedweapons:m1991_rrr", {
stack_max= 1,
wield_scale = {x=1.1,y=1.1,z=1.05},
description = "",
rw_next_reload = "rangedweapons:m1991",
load_sound = "rangedweapons_reload_b",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m1991_rld.png",
})
minetest.register_tool("rangedweapons:m1991", {
description = "" ..core.colorize("#35cdff","m1991\n") ..core.colorize("#FFFFFF", "Gun damage: 4\n")..core.colorize("#FFFFFF", "Accuracy: 92%\n") ..core.colorize("#FFFFFF", "gun knockback: 4\n") ..core.colorize("#FFFFFF", "Gun crit chance: 13%\n")..core.colorize("#FFFFFF", "Critical efficiency: 2.1x\n") ..core.colorize("#FFFFFF", "Reload delay: 1.0\n")..core.colorize("#FFFFFF", "Clip size: 8\n") ..core.colorize("#FFFFFF", "Ammunition: .45acp\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.4\n") ..core.colorize("#FFFFFF", "Gun type: Handgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
wield_scale = {x=1.1,y=1.1,z=1.05},
range = 0,
inventory_image = "rangedweapons_m1991.png",
RW_gun_capabilities = {
gun_damage = {fleshy=4,knockback=4},
gun_crit = 15,
gun_critEffc = 2.1,
suitable_ammo = {{"rangedweapons:45acp",8}},
gun_skill = {"handgun_skill",40},
gun_magazine = "rangedweapons:handgun_mag_black",
gun_unloaded = "rangedweapons:m1991_r",
gun_cooling = "rangedweapons:m1991_rld",
gun_velocity = 25,
gun_accuracy = 92,
gun_cooldown = 0.4,
gun_reload = 1.0/4,
gun_projectiles = 1,
has_shell = 1,
gun_durability = 1000,
gun_smokeSize = 5,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_beretta",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})

102
m200.lua Normal file
View File

@ -0,0 +1,102 @@
minetest.register_tool("rangedweapons:m200_uld", {
stack_max= 1,
wield_scale = {x=2.1,y=2.1,z=1.2},
range = 0,
description = "" ..core.colorize("#35cdff","m200 intervention \n") ..core.colorize("#FFFFFF", "Ranged damage:22 + 75/sec of bullet lifetime\n")..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "knockback: 20\n") ..core.colorize("#FFFFFF", "Critical chance: 33%\n") ..core.colorize("#FFFFFF", "Critical efficiency: x3.25\n") ..core.colorize("#FFFFFF", "Ammunition: .408 chey tac\n") ..core.colorize("#FFFFFF", "Rate of fire: 1.5\n") ..core.colorize("#FFFFFF", "Reload time: 2.5\n") ..core.colorize("#FFFFFF", "Zoom: 15x\n") ..core.colorize("#be0d00", "Right-click to eject empty bullet shell\n") ..core.colorize("#FFFFFF", "Clip size: 7\n") ..core.colorize("#FFFFFF", "Enemy penetration:45%\n") ..core.colorize("#FFFFFF", "Block penetration:15%\n") ..core.colorize("#FFFFFF", "Gun type: Rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 80"),
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m200.png",
weapon_zoom = 7.5,
on_use = function(itemstack, user)
minetest.sound_play("rangedweapons_empty", {pos = user:get_pos()})
end,
on_secondary_use = function(itemstack, user, pointed_thing)
eject_shell(itemstack,user,"rangedweapons:m200_rld",1.0,"rangedweapons_rifle_reload_a","rangedweapons:empty_shell")
return itemstack
end,
})
minetest.register_tool("rangedweapons:m200_r", {
rw_next_reload = "rangedweapons:m200_rr",
load_sound = "rangedweapons_rifle_clip_in",
range = 0,
wield_scale = {x=2.1,y=2.1,z=1.2},
description = "",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m200_noclip.png",
})
minetest.register_tool("rangedweapons:m200_rr", {
rw_next_reload = "rangedweapons:m200_rrr",
load_sound = "rangedweapons_rifle_reload_a",
range = 0,
wield_scale = {x=2.1,y=2.1,z=1.2},
description = "",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m200.png",
})
minetest.register_tool("rangedweapons:m200_rrr", {
rw_next_reload = "rangedweapons:m200",
load_sound = "rangedweapons_rifle_reload_b",
range = 0,
wield_scale = {x=2.1,y=2.1,z=1.2},
description = "",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m200_rld.png",
})
minetest.register_tool("rangedweapons:m200_rld", {
stack_max= 1,
range = 0,
wield_scale = {x=2.1,y=2.1,z=1.2},
description = "",
loaded_gun = "rangedweapons:m200",
loaded_sound = "rangedweapons_rifle_reload_b",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m200_rld.png",
})
minetest.register_tool("rangedweapons:m200", {
description = "" ..core.colorize("#35cdff","m200 intervention \n") ..core.colorize("#FFFFFF", "Ranged damage:22 + 75/sec of bullet lifetime\n")..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "knockback: 20\n") ..core.colorize("#FFFFFF", "Critical chance: 33%\n") ..core.colorize("#FFFFFF", "Critical efficiency: x3.25\n") ..core.colorize("#FFFFFF", "Ammunition: .408 chey tac\n") ..core.colorize("#FFFFFF", "Rate of fire: 1.5\n") ..core.colorize("#FFFFFF", "Reload time: 2.5\n") ..core.colorize("#FFFFFF", "Zoom: 15x\n") ..core.colorize("#27a600", "The gun is loaded!\n") ..core.colorize("#FFFFFF", "Clip size: 7\n") ..core.colorize("#FFFFFF", "Enemy penetration:45%\n") ..core.colorize("#FFFFFF", "Block penetration:15%\n") ..core.colorize("#FFFFFF", "Gun type: Rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 80"),
range = 0,
weapon_zoom = 6,
wield_scale = {x=2.1,y=2.1,z=1.2},
inventory_image = "rangedweapons_m200.png",
RW_gun_capabilities = {
gun_damage = {fleshy=22,knockback=20},
gun_crit = 33,
gun_critEffc = 3.25,
suitable_ammo = {{"rangedweapons:408cheytac",7}},
gun_skill = {"rifle_skill",12},
gun_magazine = "rangedweapons:rifle_mag",
gun_unloaded = "rangedweapons:m200_r",
gun_cooling = "rangedweapons:m200_uld",
gun_velocity = 80,
gun_accuracy = 100,
gun_cooldown = 1.5,
gun_reload = 2.5/4,
gun_projectiles = 1,
has_shell = 0,
gun_durability = 900,
gun_smokeSize = 8,
gun_dps = 75,
gun_mob_penetration = 45,
gun_node_penetration = 15,
gun_unload_sound = "rangedweapons_rifle_clip_out",
gun_sound = "rangedweapons_rifle_b",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})

52
m60.lua Normal file
View File

@ -0,0 +1,52 @@
minetest.register_tool("rangedweapons:m60_r", {
stack_max= 1,
wield_scale = {x=2.0,y=2.0,z=1.4},
description = "",
rw_next_reload = "rangedweapons:m60",
load_sound = "rangedweapons_rifle_clip_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m60_rld.png",
})
minetest.register_tool("rangedweapons:m60", {
stack_max= 1,
wield_scale = {x=2.0,y=2.0,z=1.4},
description = "" ..core.colorize("#35cdff","m60\n") ..core.colorize("#FFFFFF", "Gun damage: 9\n") ..core.colorize("#FFFFFF", "accuracy: 65%\n") ..core.colorize("#FFFFFF", "Gun knockback: 7\n") ..core.colorize("#FFFFFF", "Gun Critical chance: 13%\n")..core.colorize("#FFFFFF", "Critical efficiency: 3.0x\n") ..core.colorize("#FFFFFF", "Reload delay: 1.0\n") ..core.colorize("#FFFFFF", "Clip size: 100\n") ..core.colorize("#FFFFFF", "Ammunition: 7.62mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.09(full-auto)\n") ..core.colorize("#FFFFFF", "Gun type: heavy machinegun\n") ..core.colorize("#FFFFFF", "Block penetration: 12%\n")
..core.colorize("#FFFFFF", "Enemy penetration: 27%\n") ..core.colorize("#FFFFFF", "Bullet velocity: 64"),
range = 0,
inventory_image = "rangedweapons_m60.png",
RW_gun_capabilities = {
automatic_gun = 1,
gun_damage = {fleshy=9,knockback=7},
gun_crit = 13,
gun_critEffc = 3.0,
suitable_ammo = {{"rangedweapons:762mm",100}},
gun_skill = {"heavy_skill",60},
gun_unloaded = "rangedweapons:m60_r",
gun_velocity = 64,
gun_accuracy = 65,
gun_cooldown = 0.09,
gun_reload = 1.0,
gun_projectiles = 1,
has_shell = 1,
gun_gravity = 0,
gun_durability = 2750,
gun_smokeSize = 5,
gun_mob_penetration = 27,
gun_node_penetration = 12,
gun_unload_sound = "rangedweapons_rifle_clip_out",
gun_sound = "rangedweapons_machinegun",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
inventory_image = "rangedweapons_m60.png",
})

50
m79.lua Normal file
View File

@ -0,0 +1,50 @@
minetest.register_tool("rangedweapons:m79_r", {
stack_max= 1,
wield_scale = {x=2.0,y=2.0,z=2.5},
range = 0,
description = "",
groups = {not_in_creative_inventory = 1},
rw_next_reload = "rangedweapons:m79",
load_sound = "rangedweapons_reload_a",
inventory_image = "rangedweapons_m79_rld.png",
})
minetest.register_tool("rangedweapons:m79", {
description = "" ..core.colorize("#35cdff","m79\n") ..core.colorize("#FFFFFF", "Direct contact damage: 10\n")..core.colorize("#FFFFFF", "Accuracy: 92%\n") ..core.colorize("#FFFFFF", "direct contact knockback: 25\n") ..core.colorize("#FFFFFF", "Gun crit chance: 8%\n")..core.colorize("#FFFFFF", "Critical efficiency: 3x\n") ..core.colorize("#FFFFFF", "Reload delay: 0.9\n")..core.colorize("#FFFFFF", "Clip size: 1\n") ..core.colorize("#FFFFFF", "Gun gravity: 5\n")..core.colorize("#FFFFFF", "Ammunition: 40mm grenades\n")..core.colorize("#FFFFFF", "Gun type: grenade launcher\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
range = 0,
wield_scale = {x=2.0,y=2.0,z=2.5},
inventory_image = "rangedweapons_m79.png",
RW_gun_capabilities = {
gun_damage = {fleshy=10,knockback=25},
gun_crit = 8,
gun_critEffc = 3.0,
suitable_ammo = {{"rangedweapons:40mm",1}},
gun_skill = {"",1},
gun_magazine = "rangedweapons:shell_grenadedrop",
gun_unloaded = "rangedweapons:m79_r",
gun_cooling = "rangedweapons:m79",
gun_velocity = 20,
gun_accuracy = 92,
gun_cooldown = 0.0,
gun_reload = 0.9,
gun_projectiles = 1,
gun_smokeSize = 15,
gun_durability = 100,
gun_gravity = 5,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_rocket",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})

81
makarov.lua Normal file
View File

@ -0,0 +1,81 @@
minetest.register_tool("rangedweapons:makarov_rld", {
stack_max= 1,
wield_scale = {x=0.9,y=0.9,z=1.0},
description = "",
range = 0,
loaded_gun = "rangedweapons:makarov",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_makarov_rld.png",
})
minetest.register_tool("rangedweapons:makarov_r", {
stack_max= 1,
wield_scale = {x=0.9,y=0.9,z=1.0},
description = "",
range = 0,
rw_next_reload = "rangedweapons:makarov_rr",
load_sound = "rangedweapons_handgun_mag_in",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_makarov.png",
})
minetest.register_tool("rangedweapons:makarov_rr", {
stack_max= 1,
wield_scale = {x=0.9,y=0.9,z=1.0},
description = "",
range = 0,
rw_next_reload = "rangedweapons:makarov_rrr",
load_sound = "rangedweapons_reload_a",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_makarov.png",
})
minetest.register_tool("rangedweapons:makarov_rrr", {
stack_max= 1,
wield_scale = {x=0.9,y=0.9,z=1.0},
description = "",
range = 0,
groups = {not_in_creative_inventory = 1},
rw_next_reload = "rangedweapons:makarov",
load_sound = "rangedweapons_reload_b",
inventory_image = "rangedweapons_makarov_rld.png",
})
minetest.register_tool("rangedweapons:makarov", {
description = "" ..core.colorize("#35cdff","Makarov pistol\n") ..core.colorize("#FFFFFF", "Gun damage: 3\n")..core.colorize("#FFFFFF", "Accuracy: 90%\n") ..core.colorize("#FFFFFF", "gun knockback: 3\n") ..core.colorize("#FFFFFF", "Gun crit chance: 10%\n")..core.colorize("#FFFFFF", "Critical efficiency: 2x\n") ..core.colorize("#FFFFFF", "Reload delay: 1.1\n")..core.colorize("#FFFFFF", "Clip size: 8\n") ..core.colorize("#FFFFFF", "Ammunition: 9x19mm Parabellum\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.5\n") ..core.colorize("#FFFFFF", "Gun type: Handgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
range = 0,
wield_scale = {x=0.9,y=0.9,z=1.0},
inventory_image = "rangedweapons_makarov.png",
RW_gun_capabilities = {
gun_damage = {fleshy=3,knockback=3},
gun_crit = 10,
gun_critEffc = 2.0,
suitable_ammo = {{"rangedweapons:9mm",8}},
gun_skill = {"handgun_skill",40},
gun_magazine = "rangedweapons:handgun_mag_black",
gun_unloaded = "rangedweapons:makarov_r",
gun_cooling = "rangedweapons:makarov_rld",
gun_velocity = 20,
gun_accuracy = 90,
gun_cooldown = 0.5,
gun_reload = 1.1/4,
gun_projectiles = 1,
gun_smokeSize = 5,
has_shell = 1,
gun_durability = 450,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_glock",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})

46
milkor.lua Normal file
View File

@ -0,0 +1,46 @@
minetest.register_tool("rangedweapons:milkor_rld", {
stack_max= 1,
range = 0,
wield_scale = {x=1.75,y=1.75,z=2.0},
description = "",
loaded_gun = "rangedweapons:milkor",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_milkor_rld.png",
})
minetest.register_tool("rangedweapons:milkor", {
description = "" ..core.colorize("#35cdff","Milkor MGL\n") ..core.colorize("#FFFFFF", "Direct contact damage: 15\n")..core.colorize("#FFFFFF", "Accuracy: 96%\n") ..core.colorize("#FFFFFF", "Direct contact knockback: 25\n") ..core.colorize("#FFFFFF", "Critical chance: 9%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 3.0x\n") ..core.colorize("#FFFFFF", "Ammunition: 40mm grenades\n") ..core.colorize("#FFFFFF", "Reload time: 0.75\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.35\n") ..core.colorize("#FFFFFF", "Gun gravity: 1\n") ..core.colorize("#FFFFFF", "Clip Size: 6\n")..core.colorize("#FFFFFF", "Gun type: grenade launcher\n") ..core.colorize("#FFFFFF", "Bullet velocity: 30"),
range = 0,
wield_scale = {x=1.75,y=1.75,z=2.0},
inventory_image = "rangedweapons_milkor.png",
RW_gun_capabilities = {
gun_damage = {fleshy=15,knockback=25},
gun_crit = 9,
gun_critEffc = 3.0,
suitable_ammo = {{"rangedweapons:40mm",6}},
gun_skill = {"",1},
gun_magazine = "rangedweapons:shell_grenadedrop",
gun_unloaded = "rangedweapons:milkor_rld",
gun_cooling = "rangedweapons:milkor",
gun_velocity = 30,
gun_accuracy = 96,
gun_cooldown = 0.35,
gun_reload = 0.75,
gun_projectiles = 1,
gun_durability = 225,
gun_smokeSize = 15,
gun_gravity = 1,
gun_unload_sound = "rangedweapons_shell_insert",
gun_sound = "rangedweapons_rocket",
},
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_single_load_gun(itemstack, user)
return itemstack
end,
})

51
minigun.lua Normal file
View File

@ -0,0 +1,51 @@
if minetest.settings:get_bool("minigun_aswell") then
minetest.register_tool("rangedweapons:minigun_r", {
stack_max= 1,
wield_scale = {x=3.0,y=3.0,z=3.0},
description = "",
rw_next_reload = "rangedweapons:minigun",
load_sound = "rangedweapons_rifle_clip_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_minigun_rld.png",
})
minetest.register_tool("rangedweapons:minigun", {
stack_max= 1,
wield_scale = {x=3.0,y=3.0,z=3.0},
description = "" ..core.colorize("#35cdff","minigun\n") ..core.colorize("#FFFFFF", "Gun damage: 10\n") ..core.colorize("#FFFFFF", "accuracy: 50%\n") ..core.colorize("#FFFFFF", "Gun knockback: 8\n") ..core.colorize("#FFFFFF", "Gun Critical chance: 14%\n")..core.colorize("#FFFFFF", "Critical efficiency: 3.0x\n") ..core.colorize("#FFFFFF", "Reload delay: 2.0\n") ..core.colorize("#FFFFFF", "Clip size: 100\n") ..core.colorize("#FFFFFF", "Ammunition: 7.62mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.04(full-auto)\n") ..core.colorize("#FFFFFF", "Gun type: heavy machinegun\n") ..core.colorize("#FFFFFF", "Block penetration: 15%\n")
..core.colorize("#FFFFFF", "Enemy penetration: 33%\n") ..core.colorize("#FFFFFF", "Bullet velocity: 70"),
range = 0,
inventory_image = "rangedweapons_minigun.png",
RW_gun_capabilities = {
automatic_gun = 1,
gun_damage = {fleshy=10,knockback=8},
gun_crit = 14,
gun_critEffc = 3.0,
suitable_ammo = {{"rangedweapons:762mm",200}},
gun_skill = {"heavy_skill",100},
gun_unloaded = "rangedweapons:minigun_r",
gun_velocity = 70,
gun_accuracy = 50,
gun_cooldown = 0.04,
gun_reload = 2.0,
gun_projectiles = 1,
has_shell = 1,
gun_gravity = 0,
gun_durability = 4000,
gun_smokeSize = 5,
gun_mob_penetration = 33,
gun_node_penetration = 15,
gun_unload_sound = "rangedweapons_rifle_clip_out",
gun_sound = "rangedweapons_machinegun",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
inventory_image = "rangedweapons_minigun.png",
})
end

50
misc.lua Normal file
View File

@ -0,0 +1,50 @@
minetest.register_craftitem("rangedweapons:shell_shotgundrop", {
wield_scale = {x=2.5,y=1.5,z=1.0},
inventory_image = "rangedweapons_shelldrop_shotgun.png",
})
minetest.register_craftitem("rangedweapons:shell_whitedrop", {
wield_scale = {x=2.5,y=1.5,z=1.0},
inventory_image = "rangedweapons_shelldrop_white.png",
})
minetest.register_craftitem("rangedweapons:shell_grenadedrop", {
wield_scale = {x=2.5,y=1.5,z=3.0},
inventory_image = "rangedweapons_shelldrop_grenade.png",
})
minetest.register_craftitem("rangedweapons:shelldrop", {
wield_scale = {x=2.5,y=1.5,z=1.0},
inventory_image = "rangedweapons_shelldrop.png",
})
minetest.register_craftitem("rangedweapons:plastic_sheet", {
description = "" ..core.colorize("#35cdff","Black plastic sheet\n")..core.colorize("#FFFFFF", "Used in guncraft"),
inventory_image = "rangedweapons_plastic_sheet.png",
})
minetest.register_craftitem("rangedweapons:gunsteel_ingot", {
description = "" ..core.colorize("#35cdff","GunSteel ingot\n")..core.colorize("#FFFFFF", "A strong, but light alloy, used in guncraft"),
inventory_image = "rangedweapons_gunsteel_ingot.png",
})
minetest.register_craftitem("rangedweapons:ultra_gunsteel_ingot", {
description = "" ..core.colorize("#35cdff","Ultra-GunSteel ingot\n")..core.colorize("#FFFFFF", "A even stronger alloy, for even stronger guns."),
inventory_image = "rangedweapons_ultra_gunsteel_ingot.png",
})
minetest.register_craftitem("rangedweapons:gun_power_core", {
description = "" ..core.colorize("#35cdff","Gun Power Core\n")..core.colorize("#FFFFFF", "A powerful core, for making the most powerful weapons"),
inventory_image = "rangedweapons_gun_power_core.png",
})
minetest.register_craftitem("rangedweapons:power_particle", {
description = "" ..core.colorize("#35cdff","Power Particle\n")..core.colorize("#FFFFFF", "A power unit, that strangelly can be carryed arround with no vessel, used by power guns"),
stack_max = 10000,
inventory_image = "rangedweapons_power_particle.png",
})

8
mod.conf Normal file
View File

@ -0,0 +1,8 @@
name = rangedweapons
description = A mod that adds guns and throwable weapons
depends = default, tnt
optional_depends = doors, xpanes, vessels, moreores, 3d_armor
min_minetest_version = 5.8
release = 25331
author = Lars
title = Ranged Weapons

62
mp40.lua Normal file
View File

@ -0,0 +1,62 @@
minetest.register_tool("rangedweapons:mp40_r", {
wield_scale = {x=1.75,y=1.75,z=1.5},
description = "",
range = 0,
rw_next_reload = "rangedweapons:mp40_rr",
load_sound = "rangedweapons_handgun_mag_in",
inventory_image = "rangedweapons_mp40_rld.png",
groups = {not_in_creative_inventory = 1},
})
minetest.register_tool("rangedweapons:mp40_rr", {
wield_scale = {x=1.75,y=1.75,z=1.5},
description = "",
range = 0,
rw_next_reload = "rangedweapons:mp40_rrr",
load_sound = "rangedweapons_reload_a",
inventory_image = "rangedweapons_mp40.png",
groups = {not_in_creative_inventory = 1},
})
minetest.register_tool("rangedweapons:mp40_rrr", {
wield_scale = {x=1.75,y=1.75,z=1.5},
description = "",
range = 0,
inventory_image = "rangedweapons_mp40.png",
rw_next_reload = "rangedweapons:mp40",
load_sound = "rangedweapons_reload_b",
groups = {not_in_creative_inventory = 1},
})
minetest.register_tool("rangedweapons:mp40", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.5},
description = "" ..core.colorize("#35cdff","MP-40\n") ..core.colorize("#FFFFFF", "Ranged damage: 2\n") ..core.colorize("#FFFFFF", "accuracy: 75%\n") ..core.colorize("#FFFFFF", "Gun knockback: 1\n") ..core.colorize("#FFFFFF", "Critical chance: 8%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2x\n") ..core.colorize("#FFFFFF", "Ammunition: 9x19mm parabellum\n") ..core.colorize("#FFFFFF", "Clip size: 32\n") ..core.colorize("#FFFFFF", "Reload delay: 1.3\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.14\n") ..core.colorize("#FFFFFF", "Gun type: sub-machinegun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
range = 0,
inventory_image = "rangedweapons_mp40.png",
RW_gun_capabilities = {
automatic_gun = 1,
gun_damage = {fleshy=2,knockback=1},
gun_crit = 8,
gun_critEffc = 2.0,
suitable_ammo = {{"rangedweapons:9mm",32}},
gun_skill = {"smg_skill",75},
gun_magazine = "rangedweapons:machinepistol_mag",
gun_unloaded = "rangedweapons:mp40_r",
gun_velocity = 25,
gun_accuracy = 75,
gun_cooldown = 0.14,
gun_reload = 1.3/4,
gun_projectiles = 1,
has_shell = 1,
gun_gravity = 0,
gun_durability = 1500,
gun_smokeSize = 4,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_machine_pistol",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
})

67
mp5.lua Normal file
View File

@ -0,0 +1,67 @@
minetest.register_tool("rangedweapons:mp5_r", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.20},
description = "",
rw_next_reload = "rangedweapons:mp5_rr",
load_sound = "rangedweapons_handgun_mag_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_mp5_rld.png",
})
minetest.register_tool("rangedweapons:mp5_rr", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.20},
description = "",
rw_next_reload = "rangedweapons:mp5_rrr",
load_sound = "rangedweapons_reload_a",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_mp5.png",
})
minetest.register_tool("rangedweapons:mp5_rrr", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.20},
description = "",
rw_next_reload = "rangedweapons:mp5",
load_sound = "rangedweapons_reload_b",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_mp5.png",
})
minetest.register_tool("rangedweapons:mp5", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.20},
description = "" ..core.colorize("#35cdff","MP5\n") ..core.colorize("#FFFFFF", "Gun damage: 3\n") ..core.colorize("#FFFFFF", "accuracy: 74%\n") ..core.colorize("#FFFFFF", "Gun knockback: 1\n") ..core.colorize("#FFFFFF", "Gun Critical chance: 7%\n")..core.colorize("#FFFFFF", "Critical efficiency: 2.0x\n") ..core.colorize("#FFFFFF", "Reload delay: 1.0\n") ..core.colorize("#FFFFFF", "Clip size: 40/40\n") ..core.colorize("#FFFFFF", "Ammunition: 9x19mm parabellum/10mm auto\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.075(full-auto)\n") ..core.colorize("#FFFFFF", "Gun type: sub-machinegun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
range = 0,
inventory_image = "rangedweapons_mp5.png",
RW_gun_capabilities = {
automatic_gun = 1,
gun_damage = {fleshy=3,knockback=1},
gun_crit = 7,
gun_critEffc = 2.0,
suitable_ammo = {{"rangedweapons:9mm",40},{"rangedweapons:10mm",40}},
gun_skill = {"smg_skill",75},
gun_magazine = "rangedweapons:machinepistol_mag",
gun_unloaded = "rangedweapons:mp5_r",
gun_velocity = 25,
gun_accuracy = 74,
gun_cooldown = 0.075,
gun_reload = 1.0/4,
gun_projectiles = 1,
has_shell = 1,
gun_gravity = 0,
gun_durability = 1600,
gun_smokeSize = 4,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_machine_pistol",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
})

51
python.lua Normal file
View File

@ -0,0 +1,51 @@
minetest.register_tool("rangedweapons:python_rld", {
stack_max= 1,
range = 0,
wield_scale = {x=1.25,y=1.25,z=1.1},
description = "",
loaded_gun = "rangedweapons:python",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_python_rld.png",
})
minetest.register_tool("rangedweapons:python", {
description = "" ..core.colorize("#35cdff","Colt Python \n") ..core.colorize("#FFFFFF", "Ranged damage: 10\n")..core.colorize("#FFFFFF", "Accuracy: 95%\n") ..core.colorize("#FFFFFF", "Gun knockback: 6\n") ..core.colorize("#FFFFFF", "Critical chance: 19%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.5x\n") ..core.colorize("#FFFFFF", "Ammunition: .357 Magnum rounds\n") ..core.colorize("#FFFFFF", "Reload time: 0.25\n") ..core.colorize("#FFFFFF", "Clip Size: 6\n")..core.colorize("#FFFFFF", "Gun type: Revolver\n")..core.colorize("#FFFFFF", "Block penetration: 5%\n")
..core.colorize("#FFFFFF", "penetration: 15%\n") ..core.colorize("#FFFFFF", "Bullet velocity: 55"),
range = 0,
wield_scale = {x=1.25,y=1.25,z=1.1},
inventory_image = "rangedweapons_python.png",
RW_gun_capabilities = {
gun_damage = {fleshy=10,knockback=6},
gun_crit = 19,
gun_critEffc = 2.2,
suitable_ammo = {{"rangedweapons:357",6}},
gun_skill = {"revolver_skill",40},
gun_unloaded = "rangedweapons:python_rld",
gun_cooling = "rangedweapons:python",
gun_velocity = 55,
gun_accuracy = 95,
gun_cooldown = 0.2,
gun_reload = 0.4,
gun_projectiles = 1,
gun_durability = 1000,
gun_smokeSize = 7,
gun_mob_penetration = 15,
gun_node_penetration = 5,
gun_unload_sound = "rangedweapons_shell_insert",
gun_sound = "rangedweapons_deagle",
},
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_single_load_gun(itemstack, user)
return itemstack
end,
})

63
remington.lua Normal file
View File

@ -0,0 +1,63 @@
minetest.register_tool("rangedweapons:remington_rld", {
stack_max= 1,
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
description = "",
loaded_gun = "rangedweapons:remington",
loaded_sound = "rangedweapons_shotgun_reload_b",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_remington_rld.png",
})
minetest.register_tool("rangedweapons:remington", {
description = "" ..core.colorize("#35cdff","Remington 870\n") ..core.colorize("#FFFFFF", "Ranged damage: 1\n") ..core.colorize("#FFFFFF", "projectiles: 4\n") ..core.colorize("#FFFFFF", "Gun gravity: 5\n") ..core.colorize("#FFFFFF", "Accuracy: 40%\n")..core.colorize("#FFFFFF", "knockback: 5\n") ..core.colorize("#FFFFFF", "Critical chance: 4%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.0x\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Pump delay: 0.8\n")..core.colorize("#FFFFFF", "Clip size: 4\n") ..core.colorize("#27a600", "Gun is ready to fire!\n") ..core.colorize("#fff21c", "Right-click to load in a bullet!\n") ..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 18"),
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
inventory_image = "rangedweapons_remington.png",
RW_gun_capabilities = {
gun_damage = {fleshy=1,knockback=5},
gun_crit = 4,
gun_critEffc = 2.0,
suitable_ammo = {{"rangedweapons:shell",4}},
gun_skill = {"shotgun_skill",20},
gun_unloaded = "rangedweapons:remington_rld",
gun_cooling = "rangedweapons:remington_uld",
gun_velocity = 18,
gun_accuracy = 40,
gun_cooldown = 0.8,
gun_gravity = 5,
gun_reload = 0.25,
gun_projectiles = 4,
has_shell = 0,
gun_durability = 275,
gun_smokeSize = 14,
gun_door_breaking = 1,
gun_sound = "rangedweapons_shotgun_shot",
gun_unload_sound = "rangedweapons_shell_insert",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_single_load_gun(itemstack, user, "")
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})
minetest.register_tool("rangedweapons:remington_uld", {
stack_max= 1,
wield_scale = {x=1.9,y=1.9,z=1.1},
range = 0,
description = "" ..core.colorize("#35cdff","Remington 870\n") ..core.colorize("#FFFFFF", "Ranged damage: 1\n") ..core.colorize("#FFFFFF", "projectiles: 4\n") ..core.colorize("#FFFFFF", "Gun gravity: 5\n") ..core.colorize("#FFFFFF", "Accuracy: 40%\n")..core.colorize("#FFFFFF", "knockback: 5\n") ..core.colorize("#FFFFFF", "Critical chance: 4%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.0x\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Pump delay: 0.8\n")..core.colorize("#FFFFFF", "Clip size: 4\n") ..core.colorize("#be0d00", "Right-click, to eject the empty shell!\n") ..core.colorize("#fff21c", "Right-click to load in a bullet!\n") ..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
inventory_image = "rangedweapons_remington.png",
groups = {not_in_creative_inventory = 1},
on_use = function(user)
minetest.sound_play("rangedweapons_empty", {user})
end,
on_secondary_use = function(itemstack, user, pointed_thing)
eject_shell(itemstack,user,"rangedweapons:remington_rld",0.8,"rangedweapons_shotgun_reload_a","rangedweapons:empty_shell")
return itemstack
end,
})

72
rpg.lua Normal file
View File

@ -0,0 +1,72 @@
minetest.register_tool("rangedweapons:rpg_rld", {
description = "" ..core.colorize("#35cdff","rpg7\n") ..core.colorize("#FFFFFF", "Direct contact damage: 20\n")..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "direct contact knockback: 35\n") ..core.colorize("#FFFFFF", "Gun crit chance: 10%\n")..core.colorize("#FFFFFF", "Critical efficiency: 3x\n") ..core.colorize("#FFFFFF", "Reload delay: 1.0\n")..core.colorize("#FFFFFF", "Clip size: 1\n") ..core.colorize("#FFFFFF", "Gun gravity: 5\n")..core.colorize("#FFFFFF", "Ammunition: rockets\n")..core.colorize("#FFFFFF", "Gun type: rocket launcher\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
range = 0,
wield_scale = {x=2.5,y=2.5,z=3.75},
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_rpg_rld.png",
RW_gun_capabilities = {
gun_damage = {fleshy=20,knockback=35},
gun_crit = 10,
gun_critEffc = 3.0,
suitable_ammo = {{"rangedweapons:rocket",1}},
gun_skill = {"",1},
gun_unloaded = "rangedweapons:rpg_rld",
gun_cooling = "rangedweapons:rpg",
gun_velocity = 25,
gun_accuracy = 100,
gun_cooldown = 1.0,
gun_reload = 1.0,
gun_projectiles = 1,
gun_smokeSize = 15,
gun_durability = 150,
gun_unload_sound = "",
gun_sound = "rangedweapons_rocket",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})
minetest.register_tool("rangedweapons:rpg", {
description = "" ..core.colorize("#35cdff","rpg7\n") ..core.colorize("#FFFFFF", "Direct contact damage: 20\n")..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "direct contact knockback: 35\n") ..core.colorize("#FFFFFF", "Gun crit chance: 10%\n")..core.colorize("#FFFFFF", "Critical efficiency: 3x\n") ..core.colorize("#FFFFFF", "Reload delay: 1.0\n")..core.colorize("#FFFFFF", "Clip size: 1\n") ..core.colorize("#FFFFFF", "Gun gravity: 5\n")..core.colorize("#FFFFFF", "Ammunition: rockets\n")..core.colorize("#FFFFFF", "Gun type: rocket launcher\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
range = 0,
wield_scale = {x=2.5,y=2.5,z=3.75},
inventory_image = "rangedweapons_rpg.png",
RW_gun_capabilities = {
gun_damage = {fleshy=20,knockback=35},
gun_crit = 10,
gun_critEffc = 3.0,
suitable_ammo = {{"rangedweapons:rocket",1}},
gun_skill = {"",1},
gun_unloaded = "rangedweapons:rpg_rld",
gun_cooling = "rangedweapons:rpg",
gun_velocity = 25,
gun_accuracy = 100,
gun_cooldown = 1.0,
gun_reload = 1.0,
gun_projectiles = 1,
gun_smokeSize = 15,
gun_durability = 150,
gun_unload_sound = "",
gun_sound = "rangedweapons_rocket",
gun_unload_sound = "rangedweapons_shell_insert",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})

75
rpk.lua Normal file
View File

@ -0,0 +1,75 @@
minetest.register_tool("rangedweapons:rpk_r", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "",
rw_next_reload = "rangedweapons:rpk_rr",
load_sound = "rangedweapons_rifle_clip_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_rpk_rld.png",
})
minetest.register_tool("rangedweapons:rpk_rr", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "",
rw_next_reload = "rangedweapons:rpk_rrr",
load_sound = "rangedweapons_rifle_reload_a",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_rpk.png",
})
minetest.register_tool("rangedweapons:rpk_rrr", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "",
rw_next_reload = "rangedweapons:rpk",
load_sound = "rangedweapons_rifle_reload_b",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_rpk.png",
})
minetest.register_tool("rangedweapons:rpk", {
stack_max= 1,
wield_scale = {x=1.75,y=1.75,z=1.3},
description = "" ..core.colorize("#35cdff","rpk\n") ..core.colorize("#FFFFFF", "Gun damage: 7\n") ..core.colorize("#FFFFFF", "accuracy: 60%\n") ..core.colorize("#FFFFFF", "Gun knockback: 6\n") ..core.colorize("#FFFFFF", "Gun Critical chance: 12%\n")..core.colorize("#FFFFFF", "Critical efficiency: 3.0x\n") ..core.colorize("#FFFFFF", "Reload delay: 2.0\n") ..core.colorize("#FFFFFF", "Clip size: 75\n") ..core.colorize("#FFFFFF", "Ammunition: 7.62mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.10(full-auto)\n") ..core.colorize("#FFFFFF", "Gun type: heavy machinegun\n") ..core.colorize("#FFFFFF", "Block penetration: 10%\n")
..core.colorize("#FFFFFF", "Enemy penetration: 25%\n") ..core.colorize("#FFFFFF", "Bullet velocity: 55"),
range = 0,
inventory_image = "rangedweapons_rpk.png",
RW_gun_capabilities = {
automatic_gun = 1,
gun_damage = {fleshy=7,knockback=6},
gun_crit = 12,
gun_critEffc = 3.0,
suitable_ammo = {{"rangedweapons:762mm",75}},
gun_skill = {"heavy_skill",55},
gun_magazine = "rangedweapons:drum_mag",
gun_unloaded = "rangedweapons:rpk_r",
gun_velocity = 55,
gun_accuracy = 70,
gun_cooldown = 0.1,
gun_reload = 2.0/4,
gun_projectiles = 1,
has_shell = 1,
gun_gravity = 0,
gun_durability = 2250,
gun_smokeSize = 5,
gun_mob_penetration = 25,
gun_node_penetration = 10,
gun_unload_sound = "rangedweapons_rifle_clip_out",
gun_sound = "rangedweapons_ak",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
inventory_image = "rangedweapons_rpk.png",
})

74
scar.lua Normal file
View File

@ -0,0 +1,74 @@
minetest.register_tool("rangedweapons:scar_r", {
stack_max= 1,
wield_scale = {x=1.7,y=1.7,z=1.25},
description = "",
rw_next_reload = "rangedweapons:scar_rr",
load_sound = "rangedweapons_rifle_clip_in",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_scar_rld.png",
})
minetest.register_tool("rangedweapons:scar_rr", {
stack_max= 1,
wield_scale = {x=1.7,y=1.7,z=1.25},
description = "",
rw_next_reload = "rangedweapons:scar_rrr",
load_sound = "rangedweapons_rifle_reload_a",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_scar.png",
})
minetest.register_tool("rangedweapons:scar_rrr", {
stack_max= 1,
wield_scale = {x=1.7,y=1.7,z=1.25},
description = "",
rw_next_reload = "rangedweapons:scar",
load_sound = "rangedweapons_rifle_reload_b",
range = 0,
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_scar.png",
})
minetest.register_tool("rangedweapons:scar", {
stack_max= 1,
wield_scale = {x=1.7,y=1.7,z=1.25},
description = "" ..core.colorize("#35cdff","FN SCAR 16\n") ..core.colorize("#FFFFFF", "Ranged damage: 9\n") ..core.colorize("#FFFFFF", "Accuracy: 85%\n") ..core.colorize("#FFFFFF", "Gun knockback: 6\n")..core.colorize("#FFFFFF", "Critical chance: 11%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.75x\n") ..core.colorize("#FFFFFF", "Ammunition: 7.62mm rounds/5.56mm rounds\n") ..core.colorize("#FFFFFF", "Reload delay: 1.2\n") ..core.colorize("#FFFFFF", "Clip size: 20/30\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.15\n") ..core.colorize("#FFFFFF", "Block penetration: 7%\n")
..core.colorize("#FFFFFF", "penetration: 20%\n") ..core.colorize("#FFFFFF", "Gun type: Assault rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 45"),
range = 0,
inventory_image = "rangedweapons_scar.png",
RW_gun_capabilities = {
automatic_gun = 1,
gun_damage = {fleshy=9,knockback=6},
gun_crit = 11,
gun_critEffc = 2.75,
suitable_ammo = {{"rangedweapons:762mm",20},{"rangedweapons:556mm",30}},
gun_skill = {"arifle_skill",50},
gun_magazine = "rangedweapons:assaultrifle_mag",
gun_unloaded = "rangedweapons:scar_r",
gun_velocity = 45,
gun_accuracy = 85,
gun_cooldown = 0.15,
gun_reload = 1.2/4,
gun_projectiles = 1,
has_shell = 1,
gun_gravity = 0,
gun_durability = 1600,
gun_smokeSize = 5,
gun_mob_penetration = 20,
gun_node_penetration = 7,
gun_unload_sound = "rangedweapons_rifle_clip_out",
gun_sound = "rangedweapons_ak",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
inventory_image = "rangedweapons_scar.png",
})

79
settingtypes.txt Normal file
View File

@ -0,0 +1,79 @@
# If true, a guns will wear off with use
rangedweapons_gun_wear (Gun Usage-Wear) bool true
# If true, guns can be crafted
rangedweapons_gun_crafting (Gun Crafting) bool true
# If true, items can be crafted
rangedweapons_item_crafting (Item Crafting) bool true
# If true, ammonition can be crafted
rangedweapons_ammo_crafting (Ammonition Crafting) bool true
# If true, other weapons can be crafted
rangedweapons_other_weapon_crafting (Other Weapon Crafting) bool true
# If true, a gun can always be reloaded (just need at least one matching bullet in the inventory)
rangedweapons_infinite_ammo (Inifinite Ammo) bool false
# Maximum lifetime of a bullet (or rocket)
rangedweapons_bullet_lifetime (Bullet Lifetime) int 10
# Damage multiplier for hits on other players
rangedweapons_player_dmg_multiplier (Player Damage Multiplier) float 1.0
# Damage multiplier for head shots
rangedweapons_headshot_dmg_multiplier (Headshot Damage Multiplier) float 1.75
# Damage multiplier for hits on mobs
rangedweapons_mob_dmg_multiplier (Mob Damage Multiplier) float 1.0
# Amount of blood (0 to disable)
rangedweapons_bloodyness (Bloodyness) int 10
# Maximum Gun Skill (set to 100 to disable gaining skill)
rangedweapons_max_gun_efficiency (Maximum Gun Skill) int 300
# Minimum Gun Skill (set to 100 to disable loosing skill)
rangedweapons_min_gun_efficiency (Minimum Gun Skill) int 40
# Use particles on bullet impact (disabling can improve server lag)
rangedweapons_impact_particles (Particles on impact) bool true
# Animate Empty Shells as Entities (disabling can improve server lag)
rangedweapons_animate_empty_shells (Animate Empty Shells) bool true
# Bullet ricochet (disabling can improve server lag)
rangedweapons_bullet_ricochet (Bullets Ricocet) bool true
rangedweapons_shurikens (Enable Shurikens) bool true
rangedweapons_handguns (Enable Handgus) bool true
rangedweapons_forceguns (Enable Force-Guns) bool true
rangedweapons_javelins (Enable Javelins) bool true
rangedweapons_power_weapons (Enable Power-Weapons) bool true
rangedweapons_machine_pistols (Enable Pistols) bool true
rangedweapons_shotguns (Enable Shotguns) bool true
rangedweapons_auto_shotguns (Enable Auto-Shotguns) bool true
rangedweapons_smgs (Enable Submachine Guns) bool true
rangedweapons_rifles (Enable Rifles) bool true
rangedweapons_assault_rifles (Enable Assault-Rifles) bool true
rangedweapons_heavy_machineguns (Enable Heavy Machineguns) bool true
rangedweapons_revolvers (Enable Revolvers) bool true
rangedweapons_explosives (Enable Explosives) bool true
rangedweapons_glass_breaking (Breaking Glass) bool true
rangedweapons_door_breaking (Breaking Doors) bool true

269
shurikens.lua Normal file
View File

@ -0,0 +1,269 @@
minetest.register_craftitem("rangedweapons:wooden_shuriken", {
description = "" ..core.colorize("#35cdff","Wooden shuriken\n") ..core.colorize("#FFFFFF", "Ranged damage: 2\n") ..core.colorize("#FFFFFF", "Accuracy: 80%\n") ..core.colorize("#FFFFFF", "knockback: 5\n") ..core.colorize("#FFFFFF", "Critical chance: 6%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2x\n") ..core.colorize("#FFFFFF", "Shuriken survival rate: 10%\n") ..core.colorize("#FFFFFF", "Projectile gravity: 10\n") ..core.colorize("#FFFFFF", "Throwing cooldown: 0.35\n") ..core.colorize("#FFFFFF", "Projectile velocity: 25"),
range = 0,
stack_max= 100,
wield_scale = {x=0.6,y=0.6,z=0.5},
inventory_image = "rangedweapons_wooden_shuriken.png",
RW_throw_capabilities = {
throw_damage = {fleshy=2,knockback=5},
throw_crit = 6,
throw_critEffc = 2.0,
throw_skill = {"throw_skill",35},
throw_velocity = 25,
throw_accuracy = 80,
throw_cooldown = 0.35,
throw_projectiles = 1,
throw_gravity = 10,
throw_sound = "rangedweapons_throw",
throw_dps = 0,
throw_mob_penetration = 0,
throw_node_penetration = 0,
throw_entity = "rangedweapons:shot_bullet",
throw_visual = "wielditem",
throw_texture = "rangedweapons:wooden_shuriken",
throw_projectile_size = 0.15,
throw_glass_breaking = 0,
has_sparks = 0,
ignites_explosives = 0,
throw_door_breaking = 0,
OnCollision = function(player,bullet,target)
if math.random(1, 100) <= 10 then
minetest.add_item(bullet.object:get_pos(), "rangedweapons:wooden_shuriken") end end,
},
on_use = function(itemstack, user, pointed_thing)
rangedweapons_yeet(itemstack, user)
return itemstack
end,
})
minetest.register_craftitem("rangedweapons:stone_shuriken", {
description = "" ..core.colorize("#35cdff","Stone shuriken\n") ..core.colorize("#FFFFFF", "Ranged damage: 4\n") ..core.colorize("#FFFFFF", "Accuracy: 75%\n") ..core.colorize("#FFFFFF", "knockback: 8\n") ..core.colorize("#FFFFFF", "Critical chance: 7%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.1x\n") ..core.colorize("#FFFFFF", "Shuriken survival rate: 15%\n") ..core.colorize("#FFFFFF", "Projectile gravity: 15\n") ..core.colorize("#FFFFFF", "Throwing cooldown: 0.35\n") ..core.colorize("#FFFFFF", "Projectile velocity: 20"),
range = 0,
stack_max= 125,
wield_scale = {x=0.6,y=0.6,z=0.5},
inventory_image = "rangedweapons_stone_shuriken.png",
RW_throw_capabilities = {
throw_damage = {fleshy=4,knockback=8},
throw_crit = 7,
throw_critEffc = 2.1,
throw_skill = {"throw_skill",30},
throw_velocity = 20,
throw_accuracy = 75,
throw_cooldown = 0.5,
throw_projectiles = 1,
throw_gravity = 15,
throw_sound = "rangedweapons_throw",
throw_dps = 0,
throw_mob_penetration = 0,
throw_node_penetration = 0,
throw_entity = "rangedweapons:shot_bullet",
throw_visual = "wielditem",
throw_texture = "rangedweapons:stone_shuriken",
throw_projectile_size = 0.15,
throw_glass_breaking = 1,
has_sparks = 0,
ignites_explosives = 0,
throw_door_breaking = 0,
OnCollision = function(player,bullet,target)
if math.random(1, 100) <= 15 then
minetest.add_item(bullet.object:get_pos(), "rangedweapons:stone_shuriken") end end,
},
on_use = function(itemstack, user, pointed_thing)
rangedweapons_yeet(itemstack, user)
return itemstack
end,
})
minetest.register_craftitem("rangedweapons:steel_shuriken", {
description = "" ..core.colorize("#35cdff","Steel shuriken\n") ..core.colorize("#FFFFFF", "Ranged damage: 6\n") ..core.colorize("#FFFFFF", "Accuracy: 85%\n") ..core.colorize("#FFFFFF", "knockback: 3\n") ..core.colorize("#FFFFFF", "Critical chance: 8%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.2x\n") ..core.colorize("#FFFFFF", "Shuriken survival rate: 35%\n") ..core.colorize("#FFFFFF", "Projectile gravity: 8\n") ..core.colorize("#FFFFFF", "Throwing cooldown: 0.25\n") ..core.colorize("#FFFFFF", "Projectile velocity: 30"),
range = 0,
stack_max= 150,
wield_scale = {x=0.6,y=0.6,z=0.5},
inventory_image = "rangedweapons_steel_shuriken.png",
RW_throw_capabilities = {
throw_damage = {fleshy=6,knockback=3},
throw_crit = 8,
throw_critEffc = 2.2,
throw_skill = {"throw_skill",40},
throw_velocity = 30,
throw_accuracy = 85,
throw_cooldown = 0.25,
throw_projectiles = 1,
throw_gravity = 8,
throw_sound = "rangedweapons_throw",
throw_dps = 0,
throw_mob_penetration = 0,
throw_node_penetration = 0,
throw_entity = "rangedweapons:shot_bullet",
throw_visual = "wielditem",
throw_texture = "rangedweapons:steel_shuriken",
throw_projectile_size = 0.15,
throw_glass_breaking = 0,
has_sparks = 1,
ignites_explosives = 0,
throw_door_breaking = 0,
OnCollision = function(player,bullet,target)
if math.random(1, 100) <= 35 then
minetest.add_item(bullet.object:get_pos(), "rangedweapons:steel_shuriken") end end,
},
on_use = function(itemstack, user, pointed_thing)
rangedweapons_yeet(itemstack, user)
return itemstack
end,
})
minetest.register_craftitem("rangedweapons:bronze_shuriken", {
description = "" ..core.colorize("#35cdff","Bronze shuriken\n") ..core.colorize("#FFFFFF", "Ranged damage: 6\n") ..core.colorize("#FFFFFF", "Accuracy: 85%\n") ..core.colorize("#FFFFFF", "knockback: 3\n") ..core.colorize("#FFFFFF", "Critical chance: 8%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.2x\n") ..core.colorize("#FFFFFF", "Shuriken survival rate: 30%\n") ..core.colorize("#FFFFFF", "Projectile gravity: 8\n") ..core.colorize("#FFFFFF", "Throwing cooldown: 0.25\n") ..core.colorize("#FFFFFF", "Projectile velocity: 30"),
range = 0,
stack_max= 150,
wield_scale = {x=0.6,y=0.6,z=0.5},
inventory_image = "rangedweapons_bronze_shuriken.png",
RW_throw_capabilities = {
throw_damage = {fleshy=6,knockback=3},
throw_crit = 8,
throw_critEffc = 2.2,
throw_skill = {"throw_skill",40},
throw_velocity = 30,
throw_accuracy = 85,
throw_cooldown = 0.25,
throw_projectiles = 1,
throw_gravity = 8,
throw_sound = "rangedweapons_throw",
throw_dps = 0,
throw_mob_penetration = 0,
throw_node_penetration = 0,
throw_entity = "rangedweapons:shot_bullet",
throw_visual = "wielditem",
throw_texture = "rangedweapons:bronze_shuriken",
throw_projectile_size = 0.15,
throw_glass_breaking = 0,
has_sparks = 1,
ignites_explosives = 0,
throw_door_breaking = 0,
OnCollision = function(player,bullet,target)
if math.random(1, 100) <= 30 then
minetest.add_item(bullet.object:get_pos(), "rangedweapons:bronze_shuriken") end end,
},
on_use = function(itemstack, user, pointed_thing)
rangedweapons_yeet(itemstack, user)
return itemstack
end,
})
minetest.register_craftitem("rangedweapons:golden_shuriken", {
description = "" ..core.colorize("#35cdff","Golden shuriken\n") ..core.colorize("#FFFFFF", "Ranged damage: 8\n") ..core.colorize("#FFFFFF", "Accuracy: 75%\n") ..core.colorize("#FFFFFF", "knockback: 10\n") ..core.colorize("#FFFFFF", "Critical chance: 12%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.5x\n") ..core.colorize("#FFFFFF", "Shuriken survival rate: 25%\n") ..core.colorize("#FFFFFF", "Projectile gravity: 15\n") ..core.colorize("#FFFFFF", "Throwing cooldown: 0.4\n") ..core.colorize("#FFFFFF", "Projectile velocity: 25"),
range = 0,
stack_max= 175,
wield_scale = {x=0.6,y=0.6,z=0.5},
inventory_image = "rangedweapons_golden_shuriken.png",
RW_throw_capabilities = {
throw_damage = {fleshy=8,knockback=10},
throw_crit = 12,
throw_critEffc = 2.5,
throw_skill = {"throw_skill",35},
throw_velocity = 25,
throw_accuracy = 75,
throw_cooldown = 0.4,
throw_projectiles = 1,
throw_gravity = 15,
throw_sound = "rangedweapons_throw",
throw_dps = 0,
throw_mob_penetration = 0,
throw_node_penetration = 0,
throw_entity = "rangedweapons:shot_bullet",
throw_visual = "wielditem",
throw_texture = "rangedweapons:golden_shuriken",
throw_projectile_size = 0.15,
throw_glass_breaking = 1,
has_sparks = 1,
ignites_explosives = 0,
throw_door_breaking = 0,
OnCollision = function(player,bullet,target)
if math.random(1, 100) <= 25 then
minetest.add_item(bullet.object:get_pos(), "rangedweapons:golden_shuriken") end end,
},
on_use = function(itemstack, user, pointed_thing)
rangedweapons_yeet(itemstack, user)
return itemstack
end,
})
minetest.register_craftitem("rangedweapons:mese_shuriken", {
description = "" ..core.colorize("#35cdff","MESE shuriken\n") ..core.colorize("#FFFFFF", "Ranged damage: 7\n") ..core.colorize("#FFFFFF", "Accuracy: 90%\n") ..core.colorize("#FFFFFF", "knockback: 2\n") ..core.colorize("#FFFFFF", "Critical chance: 9%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.3x\n") ..core.colorize("#FFFFFF", "Shuriken survival rate: 50%\n") ..core.colorize("#FFFFFF", "Projectile gravity: 5\n") ..core.colorize("#FFFFFF", "Throwing cooldown: 0.2\n") ..core.colorize("#FFFFFF", "Enemy penetration: 25%\n") ..core.colorize("#FFFFFF", "Projectile velocity: 35"),
range = 0,
stack_max= 175,
wield_scale = {x=0.6,y=0.6,z=0.5},
inventory_image = "rangedweapons_mese_shuriken.png",
RW_throw_capabilities = {
throw_damage = {fleshy=7,knockback=2},
throw_crit = 9,
throw_critEffc = 2.3,
throw_skill = {"throw_skill",45},
throw_velocity = 35,
throw_accuracy = 90,
throw_cooldown = 0.2,
throw_projectiles = 1,
throw_gravity = 5,
throw_sound = "rangedweapons_throw",
throw_dps = 0,
throw_mob_penetration = 25,
throw_node_penetration = 0,
throw_entity = "rangedweapons:shot_bullet",
throw_visual = "wielditem",
throw_texture = "rangedweapons:mese_shuriken",
throw_projectile_size = 0.15,
throw_glass_breaking = 1,
has_sparks = 1,
ignites_explosives = 0,
throw_door_breaking = 0,
OnCollision = function(player,bullet,target)
if math.random(1, 100) <= 50 then
minetest.add_item(bullet.object:get_pos(), "rangedweapons:mese_shuriken") end end,
},
on_use = function(itemstack, user, pointed_thing)
rangedweapons_yeet(itemstack, user)
return itemstack
end,
})
minetest.register_craftitem("rangedweapons:diamond_shuriken", {
description = "" ..core.colorize("#35cdff","Diamond shuriken\n") ..core.colorize("#FFFFFF", "Ranged damage: 8\n") ..core.colorize("#FFFFFF", "Accuracy: 95%\n") ..core.colorize("#FFFFFF", "knockback: 2\n") ..core.colorize("#FFFFFF", "Critical chance: 10%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.4x\n") ..core.colorize("#FFFFFF", "Shuriken survival rate: 60%\n") ..core.colorize("#FFFFFF", "Projectile gravity: 5\n") ..core.colorize("#FFFFFF", "Throwing cooldown: 0.15\n") ..core.colorize("#FFFFFF", "Enemy penetration: 33%\n") ..core.colorize("#FFFFFF", "Projectile velocity: 40"),
range = 0,
stack_max= 200,
wield_scale = {x=0.6,y=0.6,z=0.5},
inventory_image = "rangedweapons_diamond_shuriken.png",
RW_throw_capabilities = {
throw_damage = {fleshy=8,knockback=2},
throw_crit = 10,
throw_critEffc = 2.4,
throw_skill = {"throw_skill",50},
throw_velocity = 40,
throw_accuracy = 95,
throw_cooldown = 0.15,
throw_projectiles = 1,
throw_gravity = 5,
throw_sound = "rangedweapons_throw",
throw_dps = 0,
throw_mob_penetration = 33,
throw_node_penetration = 0,
throw_entity = "rangedweapons:shot_bullet",
throw_visual = "wielditem",
throw_texture = "rangedweapons:diamond_shuriken",
throw_projectile_size = 0.15,
throw_glass_breaking = 1,
has_sparks = 1,
ignites_explosives = 0,
throw_door_breaking = 0,
OnCollision = function(player,bullet,target)
if math.random(1, 100) <= 60 then
minetest.add_item(bullet.object:get_pos(), "rangedweapons:diamond_shuriken") end end,
},
on_use = function(itemstack, user, pointed_thing)
rangedweapons_yeet(itemstack, user)
return itemstack
end,
})

156
skills.lua Normal file
View File

@ -0,0 +1,156 @@
minetest.register_on_joinplayer(function(player)
local meta = player:get_meta()
if meta:get_int("handgun_skill") == 0
then
meta:set_int("handgun_skill",100)
end
if meta:get_int("mp_skill") == 0
then
meta:set_int("mp_skill",100)
end
if meta:get_int("smg_skill") == 0
then
meta:set_int("smg_skill",100)
end
if meta:get_int("shotgun_skill") == 0
then
meta:set_int("shotgun_skill",100)
end
if meta:get_int("heavy_skill") == 0
then
meta:set_int("heavy_skill",100)
end
if meta:get_int("arifle_skill") == 0
then
meta:set_int("arifle_skill",100)
end
if meta:get_int("revolver_skill") == 0
then
meta:set_int("revolver_skill",100)
end
if meta:get_int("rifle_skill") == 0
then
meta:set_int("rifle_skill",100)
end
if meta:get_int("throw_skill") == 0
then
meta:set_int("throw_skill",100)
end
end)
minetest.register_chatcommand("gunskills", {
func = function(name, param)
for _, player in pairs(minetest.get_connected_players()) do
local meta = player:get_meta()
local handguns = meta:get_int("handgun_skill")
local mps = meta:get_int("mp_skill")
local smgs = meta:get_int("smg_skill")
local shotguns = meta:get_int("shotgun_skill")
local heavy = meta:get_int("heavy_skill")
local arifle = meta:get_int("arifle_skill")
local revolver = meta:get_int("revolver_skill")
local rifle = meta:get_int("rifle_skill")
local throw = meta:get_int("throw_skill")
minetest.show_formspec(name, "rangedweapons:gunskills_form",
"size[11,7]"..
"label[0,0;Gun efficiency: increases damage, accuracy and crit chance.]"..
"image[0,1;1,1;rangedweapons_handgun_img.png]"..
"label[1,1.2;Handgun efficiency: " .. handguns .. "%]"..
"image[0,2;1,1;rangedweapons_machinepistol_img.png]"..
"label[1,2.2;M.Pistol efficiency: " .. mps .. "%]"..
"image[0,3;1,1;rangedweapons_smg_img.png]"..
"label[1,3.2;S.M.G efficiency: " .. smgs .. "%]"..
"image[0,4;1,1;rangedweapons_shotgun_img.png]"..
"label[1,4.2;Shotgun efficiency: " .. shotguns .. "%]"..
"image[0,5;1,1;rangedweapons_heavy_img.png]"..
"label[1,5.2;Heavy.MG efficiency: " .. heavy .. "%]"..
"image[0,6;1,1;rangedweapons_arifle_img.png]"..
"label[1,6.2;A.rifle efficiency: " .. arifle .. "%]"..
"image[5,1;1,1;rangedweapons_revolver_img.png]"..
"label[6,1.2;Revl./mgn. efficiency: " .. revolver .. "%]"..
"image[5,2;1,1;rangedweapons_rifle_img.png]"..
"label[6,2.2;Rifle efficiency: " .. rifle .. "%]"..
"image[5,3;1,1;rangedweapons_yeetable_img.png]"..
"label[6,3.2;Throwing efficiency: " .. throw .. "%]"..
"button_exit[9,0;2,1;exit;Done]")
end
end
})
local min_gun_efficiency = tonumber(minetest.settings:get("rangedweapons_min_gun_efficiency")) or 40
local timer = 0
minetest.register_globalstep(function(dtime, player)
timer = timer + dtime;
if timer >= 60.0 then
for _, player in pairs(minetest.get_connected_players()) do
local meta = player:get_meta()
local handguns = meta:get_int("handgun_skill")
local mps = meta:get_int("mp_skill")
local smgs = meta:get_int("smg_skill")
local shotguns = meta:get_int("shotgun_skill")
local heavy = meta:get_int("heavy_skill")
local arifle = meta:get_int("arifle_skill")
local revolver = meta:get_int("revolver_skill")
local rifle = meta:get_int("rifle_skill")
local throw = meta:get_int("throw_skill")
if math.random(1, 40) == 1 then
if handguns > min_gun_efficiency then
meta:set_int("handgun_skill", handguns - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Handgun skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if mps > min_gun_efficiency then
meta:set_int("mp_skill", mps - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Machine Pistol skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if smgs > min_gun_efficiency then
meta:set_int("smg_skill", smgs - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","S.M.G skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if shotguns > min_gun_efficiency then
meta:set_int("shotgun_skill", shotguns - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Shotgun skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if heavy > min_gun_efficiency then
meta:set_int("heavy_skill", heavy - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Heavy.MG skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if arifle > min_gun_efficiency then
meta:set_int("arifle_skill", arifle - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","A.Rifle skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if revolver > min_gun_efficiency then
meta:set_int("revolver_skill", revolver - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Revolver/magnum skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if rifle > min_gun_efficiency then
meta:set_int("rifle_skill", rifle - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Rifle skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if throw > min_gun_efficiency then
meta:set_int("throw_skill", throw - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Throwing skill degraded! "))
end
end
timer = 0
end
end
end)

BIN
sounds/glass_break.ogg Normal file

Binary file not shown.

BIN
sounds/hit.ogg Normal file

Binary file not shown.

BIN
sounds/rangedweapons_ak.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

62
spas12.lua Normal file
View File

@ -0,0 +1,62 @@
minetest.register_tool("rangedweapons:spas12_rld", {
stack_max= 1,
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
description = "",
loaded_gun = "rangedweapons:spas12",
loaded_sound = "rangedweapons_shotgun_reload_b",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_spas12_rld.png",
})
minetest.register_tool("rangedweapons:spas12", {
description = "" ..core.colorize("#35cdff","spas-12\n") ..core.colorize("#FFFFFF", "Ranged damage: 3\n") ..core.colorize("#FFFFFF", "projectiles: 6\n") ..core.colorize("#FFFFFF", "Gun gravity: 3\n") ..core.colorize("#FFFFFF", "Accuracy: 52%\n")..core.colorize("#FFFFFF", "knockback: 7\n") ..core.colorize("#FFFFFF", "Critical chance: 7%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.1x\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Pump delay: 0.45\n")..core.colorize("#FFFFFF", "Clip size: 8\n") ..core.colorize("#27a600", "Gun is ready to fire!\n") ..core.colorize("#fff21c", "Right-click to load in a bullet!\n") ..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 32"),
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
inventory_image = "rangedweapons_spas12.png",
RW_gun_capabilities = {
gun_damage = {fleshy=3,knockback=7},
gun_crit = 7,
gun_critEffc = 2.1,
suitable_ammo = {{"rangedweapons:shell",8}},
gun_skill = {"shotgun_skill",20},
gun_unloaded = "rangedweapons:spas12_rld",
gun_cooling = "rangedweapons:spas12_uld",
gun_velocity = 32,
gun_accuracy = 52,
gun_cooldown = 0.45,
gun_gravity = 3,
gun_reload = 0.25,
gun_projectiles = 6,
has_shell = 0,
gun_durability = 550,
gun_smokeSize = 15,
gun_door_breaking = 1,
gun_sound = "rangedweapons_shotgun_shot",
gun_unload_sound = "rangedweapons_shell_insert",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_single_load_gun(itemstack, user, "")
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})
minetest.register_tool("rangedweapons:spas12_uld", {
stack_max= 1,
wield_scale = {x=1.9,y=1.9,z=1.1},
range = 0,
description = "" ..core.colorize("#35cdff","spas-12\n") ..core.colorize("#FFFFFF", "Ranged damage: 2\n") ..core.colorize("#FFFFFF", "projectiles: 6\n") ..core.colorize("#FFFFFF", "Gun gravity: 3\n") ..core.colorize("#FFFFFF", "Accuracy: 52%\n")..core.colorize("#FFFFFF", "knockback: 7\n") ..core.colorize("#FFFFFF", "Critical chance: 7%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.1x\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Pump delay: 0.45\n")..core.colorize("#FFFFFF", "Clip size: 8\n") ..core.colorize("#be0d00", "Right-click, to eject the empty shell!\n") ..core.colorize("#fff21c", "Right-click to load in a bullet!\n") ..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 28"),
inventory_image = "rangedweapons_spas12.png",
groups = {not_in_creative_inventory = 1},
on_use = function(itemstack, user)
minetest.sound_play("rangedweapons_empty", {pos = user:get_pos()})
end,
on_secondary_use = function(itemstack, user, pointed_thing)
eject_shell(itemstack,user,"rangedweapons:spas12_rld",0.6,"rangedweapons_shotgun_reload_a","rangedweapons:empty_shell")
return itemstack
end,
})

102
svd.lua Normal file
View File

@ -0,0 +1,102 @@
minetest.register_tool("rangedweapons:svd_uld", {
stack_max= 1,
wield_scale = {x=1.9,y=1.9,z=1.1},
range = 0,
description = "" ..core.colorize("#35cdff","S.V.D. \n") ..core.colorize("#FFFFFF", "Ranged damage:17 + 30/sec of bullet lifetime\n")..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "knockback: 14\n") ..core.colorize("#FFFFFF", "Critical chance: 30%\n") ..core.colorize("#FFFFFF", "Critical efficiency: x3\n") ..core.colorize("#FFFFFF", "Ammunition: 7.62mm round\n") ..core.colorize("#FFFFFF", "Rate of fire: 1.0\n") ..core.colorize("#FFFFFF", "Reload time: 2.0\n") ..core.colorize("#FFFFFF", "Zoom: 10x\n") ..core.colorize("#be0d00", "Right-click to eject empty bullet shell\n") ..core.colorize("#FFFFFF", "Clip size: 10\n") ..core.colorize("#FFFFFF", "Enemy penetration:30%\n") ..core.colorize("#FFFFFF", "Block penetration:10%\n") ..core.colorize("#FFFFFF", "Gun type: Rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 75"),
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_svd.png",
weapon_zoom = 9,
on_use = function(itemstack, user)
minetest.sound_play("rangedweapons_empty", {pos = user:get_pos()})
end,
on_secondary_use = function(itemstack, user, pointed_thing)
eject_shell(itemstack,user,"rangedweapons:svd_rld",1.0,"rangedweapons_rifle_reload_a","rangedweapons:empty_shell")
return itemstack
end,
})
minetest.register_tool("rangedweapons:svd_r", {
rw_next_reload = "rangedweapons:svd_rr",
load_sound = "rangedweapons_rifle_clip_in",
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
description = "",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_svd_noclip.png",
})
minetest.register_tool("rangedweapons:svd_rr", {
rw_next_reload = "rangedweapons:svd_rrr",
load_sound = "rangedweapons_rifle_reload_a",
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
description = "",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_svd.png",
})
minetest.register_tool("rangedweapons:svd_rrr", {
rw_next_reload = "rangedweapons:svd",
load_sound = "rangedweapons_rifle_reload_b",
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
description = "",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_svd_rld.png",
})
minetest.register_tool("rangedweapons:svd_rld", {
stack_max= 1,
range = 0,
wield_scale = {x=1.9,y=1.9,z=1.1},
description = "",
loaded_gun = "rangedweapons:svd",
loaded_sound = "rangedweapons_rifle_reload_b",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_svd_rld.png",
})
minetest.register_tool("rangedweapons:svd", {
description = "" ..core.colorize("#35cdff","S.V.D. \n") ..core.colorize("#FFFFFF", "Ranged damage:17 + 30/sec of bullet lifetime\n")..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "knockback: 14\n") ..core.colorize("#FFFFFF", "Critical chance: 30%\n") ..core.colorize("#FFFFFF", "Critical efficiency: x3\n") ..core.colorize("#FFFFFF", "Ammunition: 7.62mm round\n") ..core.colorize("#FFFFFF", "Rate of fire: 1.0\n") ..core.colorize("#FFFFFF", "Reload time: 2.0\n") ..core.colorize("#FFFFFF", "Zoom: 10x\n") ..core.colorize("#27a600", "The gun is loaded!\n") ..core.colorize("#FFFFFF", "Clip size: 10\n") ..core.colorize("#FFFFFF", "Enemy penetration:30%\n") ..core.colorize("#FFFFFF", "Block penetration:10%\n") ..core.colorize("#FFFFFF", "Gun type: Rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 75"),
range = 0,
weapon_zoom = 9,
wield_scale = {x=1.9,y=1.9,z=1.1},
inventory_image = "rangedweapons_svd.png",
RW_gun_capabilities = {
gun_damage = {fleshy=17,knockback=14},
gun_crit = 30,
gun_critEffc = 3.0,
suitable_ammo = {{"rangedweapons:762mm",10}},
gun_skill = {"rifle_skill",20},
gun_magazine = "rangedweapons:rifle_mag",
gun_unloaded = "rangedweapons:svd_r",
gun_cooling = "rangedweapons:svd_uld",
gun_velocity = 75,
gun_accuracy = 100,
gun_cooldown = 1.0,
gun_reload = 2.0/4,
gun_projectiles = 1,
has_shell = 0,
gun_durability = 700,
gun_smokeSize = 8,
gun_dps = 30,
gun_mob_penetration = 30,
gun_node_penetration = 10,
gun_unload_sound = "rangedweapons_rifle_clip_out",
gun_sound = "rangedweapons_rifle_b",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
})

49
taurus.lua Normal file
View File

@ -0,0 +1,49 @@
minetest.register_tool("rangedweapons:taurus_rld", {
stack_max= 1,
range = 0,
wield_scale = {x=1.25,y=1.25,z=1.1},
description = "",
loaded_gun = "rangedweapons:taurus",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_taurus_rld.png",
})
minetest.register_tool("rangedweapons:taurus", {
description = "" ..core.colorize("#35cdff","Taurus raging bull \n") ..core.colorize("#FFFFFF", "Ranged damage: 14\n")..core.colorize("#FFFFFF", "Accuracy: 97%\n") ..core.colorize("#FFFFFF", "Gun knockback: 8\n") ..core.colorize("#FFFFFF", "Critical chance: 22%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 3.1x\n") ..core.colorize("#FFFFFF", "Ammunition: .44 Magnum rounds\n") ..core.colorize("#FFFFFF", "Reload time: 0.25\n") ..core.colorize("#FFFFFF", "Clip Size: 6\n") ..core.colorize("#FFFFFF", "Block penetration: 8%\n")
..core.colorize("#FFFFFF", "penetration: 24%\n") ..core.colorize("#FFFFFF", "Gun type: Revolver\n") ..core.colorize("#FFFFFF", "Bullet velocity: 64"),
range = 0,
wield_scale = {x=1.25,y=1.25,z=1.1},
inventory_image = "rangedweapons_taurus.png",
RW_gun_capabilities = {
gun_damage = {fleshy=14,knockback=8},
gun_crit = 22,
gun_critEffc = 3.1,
suitable_ammo = {{"rangedweapons:44",6}},
gun_skill = {"revolver_skill",40},
gun_unloaded = "rangedweapons:taurus_rld",
gun_cooling = "rangedweapons:taurus",
gun_velocity = 55,
gun_accuracy = 97,
gun_cooldown = 0.2,
gun_reload = 0.4,
gun_projectiles = 1,
gun_durability = 1750,
gun_smokeSize = 7,
gun_mob_penetration = 24,
gun_node_penetration = 8,
gun_unload_sound = "rangedweapons_shell_insert",
gun_sound = "rangedweapons_deagle",
},
on_use = function(itemstack, user, pointed_thing)
rangedweapons_shoot_gun(itemstack, user)
return itemstack
end,
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_single_load_gun(itemstack, user)
return itemstack
end,
})

71
tec9.lua Normal file
View File

@ -0,0 +1,71 @@
minetest.register_craftitem("rangedweapons:tec9_r", {
stack_max= 1,
wield_scale = {x=1.25,y=1.25,z=1.50},
description = "",
range = 0,
rw_next_reload = "rangedweapons:tec9_rr",
load_sound = "rangedweapons_handgun_mag_in",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_tec9_rld.png",
})
minetest.register_craftitem("rangedweapons:tec9_rr", {
stack_max= 1,
wield_scale = {x=1.25,y=1.25,z=1.50},
description = "",
range = 0,
rw_next_reload = "rangedweapons:tec9_rrr",
load_sound = "rangedweapons_reload_a",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_tec9.png",
})
minetest.register_craftitem("rangedweapons:tec9_rrr", {
stack_max= 1,
wield_scale = {x=1.25,y=1.25,z=1.50},
description = "",
range = 0,
rw_next_reload = "rangedweapons:tec9",
load_sound = "rangedweapons_reload_b",
groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_tec9.png",
})
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", "Gun damage: 1\n") ..core.colorize("#FFFFFF", "accuracy: 75%\n") ..core.colorize("#FFFFFF", "Gun knockback: 0\n") ..core.colorize("#FFFFFF", "Gun Critical chance: 9%\n") ..core.colorize("#FFFFFF", "Gun Critical efficiency: 1.9x\n") ..core.colorize("#FFFFFF", "Reload delay: 1.0\n") ..core.colorize("#FFFFFF", "Clip size: 50\n") ..core.colorize("#FFFFFF", "Ammunition: 9x19mm parabellum\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",
RW_gun_capabilities = {
automatic_gun = 1,
gun_damage = {fleshy=1,knockback=0},
gun_crit = 9,
gun_critEffc = 1.9,
suitable_ammo = {{"rangedweapons:9mm",50}},
gun_skill = {"mp_skill",80},
gun_magazine = "rangedweapons:machinepistol_mag",
gun_unloaded = "rangedweapons:tec9_r",
gun_velocity = 20,
gun_accuracy = 75,
gun_cooldown = 0.2,
gun_reload = 1.0/4,
gun_projectiles = 1,
has_shell = 1,
gun_gravity = 0,
gun_durability = 1100,
gun_smokeSize = 4,
gun_unload_sound = "rangedweapons_handgun_mag_out",
gun_sound = "rangedweapons_machine_pistol",
},
on_secondary_use = function(itemstack, user, pointed_thing)
rangedweapons_reload_gun(itemstack, user)
return itemstack
end,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

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