Unpacking ZIPs DONE
Stage 5: Unpack of 0.4 Making v0.4 branch here. Unpacking completed.
262
aa12.lua
@ -1,207 +1,75 @@
|
||||
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_craftitem("rangedweapons:aa12", {
|
||||
minetest.register_tool("rangedweapons:aa12_r", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=1.75,y=1.75,z=1.3},
|
||||
description = "" ..core.colorize("#35cdff","AA-12\n") ..core.colorize("#FFFFFF", "Ranged damage: 2-6 X 10\n") ..core.colorize("#FFFFFF", "Accuracy: 65%\n") ..core.colorize("#FFFFFF", "Mob knockback: 2\n")..core.colorize("#FFFFFF", "Critical chance: 3%\n") ..core.colorize("#FFFFFF", "Critical damage: 8-16 X 10\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.2\n") ..core.colorize("#FFFFFF", "Gun type: Auto-shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
|
||||
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_icon = "rangedweapons_aa12_icon.png",
|
||||
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,
|
||||
})
|
||||
|
||||
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.2 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:aa12" then
|
||||
if not inv:contains_item("main", "rangedweapons:shell") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:aa12" then
|
||||
inv:remove_item("main", "rangedweapons:shell")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:aa12shot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_shotgun_shot", {object=obj})
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.5,3.5), y=math.random(-3.5,3.5), z=dir.z * math.random(-3.5,3.5)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:aa12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.5,3.5), y=math.random(-3.5,3.5), z=dir.z * math.random(-3.5,3.5)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:aa12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.5,3.5), y=math.random(-3.5,3.5), z=dir.z * math.random(-3.5,3.5)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:aa12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.5,3.5), y=math.random(-3.5,3.5), z=dir.z * math.random(-3.5,3.5)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:aa12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.5,3.5), y=math.random(-3.5,3.5), z=dir.z * math.random(-3.5,3.5)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:aa12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.5,3.5), y=math.random(-3.5,3.5), z=dir.z * math.random(-3.5,3.5)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:aa12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.5,3.5), y=math.random(-3.5,3.5), z=dir.z * math.random(-3.5,3.5)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:aa12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.5,3.5), y=math.random(-3.5,3.5), z=dir.z * math.random(-3.5,3.5)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:aa12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.5,3.5), y=math.random(-3.5,3.5), z=dir.z * math.random(-3.5,3.5)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:aa12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.5,3.5), y=math.random(-3.5,3.5), z=dir.z * math.random(-3.5,3.5)})
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell_shotgun")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.5,
|
||||
size = 6,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_aa12shot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.1, y=0.1},
|
||||
textures = {"rangedweapons_buckball.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_aa12shot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.20 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:aa12shot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 3 then
|
||||
local damage = math.random(8,16)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=4},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(2,6)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 2},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 3 then
|
||||
local damage = math.random(8,16)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(2,6)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_wood_a" or
|
||||
node.name == "doors:door_wood_b" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:aa12shot", rangedweapons_aa12shot )
|
233
ak47.lua
@ -1,177 +1,76 @@
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:ak47',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:steel_ingot', 'default:tree'},
|
||||
{'default:tree', 'default:mese', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', '', 'default:tree'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("rangedweapons:ak47", {
|
||||
|
||||
minetest.register_tool("rangedweapons:ak47_r", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=1.75,y=1.75,z=1.3},
|
||||
description = "" ..core.colorize("#35cdff","AK-47\n") ..core.colorize("#FFFFFF", "Ranged damage: 6-16\n") ..core.colorize("#FFFFFF", "Accuracy: 77%\n") ..core.colorize("#FFFFFF", "Mob knockback: 5\n")..core.colorize("#FFFFFF", "Critical chance: 16%\n") ..core.colorize("#FFFFFF", "Critical damage: 17-26\n") ..core.colorize("#FFFFFF", "Ammunition: 7.26mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.165\n") ..core.colorize("#FFFFFF", "Gun type: Assault rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 40"),
|
||||
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",
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.165 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:ak47" then
|
||||
if not inv:contains_item("main", "rangedweapons:726mm") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:ak47" then
|
||||
inv:remove_item("main", "rangedweapons:726mm")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:ak47shot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_ak", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 40, y=dir.y * 40, z=dir.z * 40})
|
||||
obj:setacceleration({x=dir.x * math.random(-2.3,2.3), y=math.random(-2.3,2.3), z=dir.z * math.random(-2.3,2.3)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.5,
|
||||
size = 4,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_ak47shot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_ak47shot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.08 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:ak47shot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 16 then
|
||||
local damage = math.random(17,26)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=10},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(6,16)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 5},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 16 then
|
||||
local damage = math.random(17,26)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(6,16)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.register_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_icon = "rangedweapons_ak47_icon.png",
|
||||
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",
|
||||
})
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:ak47shot", rangedweapons_ak47shot )
|
848
ammo.lua
@ -1,154 +1,778 @@
|
||||
forbidden_ents = {
|
||||
"",
|
||||
}
|
||||
|
||||
|
||||
minetest.register_alias("rangedweapons:726mm", "rangedweapons:762mm")
|
||||
|
||||
bullet_particles = bullet_particles or "rangedweapons_bullet_fly.png"
|
||||
|
||||
|
||||
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 = false,
|
||||
collisionbox = {-0.0025, -0.0025, -0.0025, 0.0025, 0.0025, 0.0025},
|
||||
},
|
||||
}
|
||||
rangedweapons_shot_bullet.on_step = function(self, dtime, moveresult)
|
||||
----------------------------------------
|
||||
---------------------------------------
|
||||
|
||||
if self.owner == nil then
|
||||
self.object:remove()
|
||||
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.06 then
|
||||
self.object:set_properties({collide_with_objects = true})
|
||||
self.object:set_properties({collisionbox = {-size, -size, -size, size, size, size}})
|
||||
end
|
||||
|
||||
if self.timer > 10 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 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", {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", {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 rweapons_door_breaking == "true" and door_break > 0 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",{moveresult.collisions[1].node_pos})
|
||||
|
||||
end end
|
||||
|
||||
if rweapons_glass_breaking == "true" and glass_break > 0 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",{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",{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",{moveresult.collisions[1].node_pos})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if minetest.get_item_group(minetest.get_node(moveresult.collisions[1].node_pos).name, "level") > 1 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
|
||||
|
||||
if math.random(1,100) <= nodePen 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
|
||||
minetest.sound_play("default_dig_cracky", {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", {self.object:get_pos(), gain = 1.5})
|
||||
|
||||
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
|
||||
|
||||
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" 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
|
||||
|
||||
if moveresult.collisions[1].object:is_player() then
|
||||
for _, player_dmg in pairs(damage) do
|
||||
damage[_] = damage[_] * rweapons_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[_] * rweapons_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[_] * rweapons_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
|
||||
|
||||
|
||||
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)
|
||||
|
||||
for i=1,math.random(math.ceil(rweapons_bloodyness*0.66),math.ceil(rweapons_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
|
||||
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
|
||||
minetest.sound_play("default_dig_cracky", {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= 10000,
|
||||
stack_max= 500,
|
||||
wield_scale = {x=0.4,y=0.4,z=1.2},
|
||||
description = "" ..core.colorize("#35cdff","9mm round\n")..core.colorize("#FFFFFF", "Ammunition for handguns, machine-pistols and rarely sub-machineguns"),
|
||||
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",
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:9mm 30',
|
||||
recipe = {
|
||||
{'default:steel_ingot', '', ''},
|
||||
{'tnt:gunpowder', '', ''},
|
||||
{'default:copper_ingot', '', ''},
|
||||
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:10mm", {
|
||||
stack_max= 1500,
|
||||
minetest.register_craftitem("rangedweapons:45acp", {
|
||||
stack_max= 450,
|
||||
wield_scale = {x=0.4,y=0.4,z=1.2},
|
||||
description = "" ..core.colorize("#35cdff","10mm round\n")..core.colorize("#FFFFFF", "Ammunition for sub-machineguns"),
|
||||
inventory_image = "rangedweapons_10mm.png",
|
||||
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_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_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",".357 magnum round\n")..core.colorize("#FFFFFF", "Ammunition for magnums/revolvers"),
|
||||
inventory_image = "rangedweapons_357.png",
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:357 15',
|
||||
recipe = {
|
||||
{'default:copper_ingot', '', ''},
|
||||
{'tnt:gunpowder', '', ''},
|
||||
{'default:gold_ingot', '', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("rangedweapons:726mm", {
|
||||
stack_max= 2000,
|
||||
wield_scale = {x=0.4,y=0.4,z=1.2},
|
||||
description = "" ..core.colorize("#35cdff","7.26mm round\n")..core.colorize("#FFFFFF", "Ammunition for Heavy machineguns and some assault rifles"),
|
||||
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_craft({
|
||||
output = 'rangedweapons:726mm 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_craftitem("rangedweapons:556mm", {
|
||||
stack_max= 1000,
|
||||
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", "Ammunition for most assault rifles"),
|
||||
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_craft({
|
||||
output = 'rangedweapons:556mm 75',
|
||||
recipe = {
|
||||
{'', 'default:gold_ingot', ''},
|
||||
{'default:gold_ingot', 'tnt:gunpowder', 'default:gold_ingot'},
|
||||
{'default:gold_ingot', 'tnt:gunpowder', 'default:gold_ingot'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("rangedweapons:shell", {
|
||||
stack_max= 84,
|
||||
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", "Ammunition for shotguns"),
|
||||
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_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_craftitem("rangedweapons:308winchester", {
|
||||
stack_max= 120,
|
||||
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", "Ammunition for rifles"),
|
||||
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_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_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= 48,
|
||||
stack_max= 25,
|
||||
wield_scale = {x=0.8,y=0.8,z=2.4},
|
||||
description = "" ..core.colorize("#35cdff","40mm grenade\n")..core.colorize("#FFFFFF", "Ammunition for grenade launchers"),
|
||||
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,
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:40mm 6',
|
||||
recipe = {
|
||||
{'', 'default:gold_ingot', ''},
|
||||
{'default:steel_ingot', 'tnt:gunpowder', 'default:steel_ingot'},
|
||||
{'tnt:gunpowder', 'default:bronze_ingot', 'tnt:gunpowder'},
|
||||
}
|
||||
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= 25,
|
||||
stack_max= 15,
|
||||
wield_scale = {x=1.2,y=1.2,z=2.4},
|
||||
description = "" ..core.colorize("#35cdff","Rocket\n")..core.colorize("#FFFFFF", "Ammunition for rocket launchers"),
|
||||
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}
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:rocket 1',
|
||||
recipe = {
|
||||
{'', '', 'rangedweapons:40mm'},
|
||||
{'', 'tnt:gunpowder', ''},
|
||||
{'default:steel_ingot', '', ''},
|
||||
}
|
||||
})
|
263
awp.lua
@ -1,219 +1,102 @@
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:awp_uld',
|
||||
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_craftitem("rangedweapons:awp_uld", {
|
||||
|
||||
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: 100/sec of bullet lifetime\n") ..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "Mob knockback: 15\n") ..core.colorize("#FFFFFF", "Critical chance: 45%\n") ..core.colorize("#FFFFFF", "Critical damage: 250/sec of bullet lifetime\n") ..core.colorize("#FFFFFF", "Ammunition: 308.Winchester rounds\n") ..core.colorize("#FFFFFF", "Reload time: 1.5\n") ..core.colorize("#be0d00", "The gun is NOT loaded! (Right-click to load)\n")..core.colorize("#FFFFFF", "Gun type: Rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 60"),
|
||||
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(user)
|
||||
minetest.sound_play("rangedweapons_empty", {user})
|
||||
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,
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.001 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:awp_uld"
|
||||
and inv:contains_item("main", "rangedweapons:308winchester")then
|
||||
if controls.RMB then
|
||||
inv:remove_item("main", "rangedweapons:308winchester")
|
||||
player:set_wielded_item("rangedweapons:awp_rld")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_a", {player})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if timer >= 1.5 and
|
||||
player:get_wielded_item():get_name() == "rangedweapons:awp_rld" then
|
||||
player:set_wielded_item("rangedweapons:awp")
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_b", {player})
|
||||
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",
|
||||
})
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:awp_rld", {
|
||||
minetest.register_tool("rangedweapons:awp_rld", {
|
||||
stack_max= 1,
|
||||
range = 0,
|
||||
wield_scale = {x=1.9,y=1.9,z=1.1},
|
||||
description = "**RELOADING A.W.P.**",
|
||||
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: 100/sec of bullet lifetime\n")..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "Mob knockback: 15\n") ..core.colorize("#FFFFFF", "Critical chance: 45%\n") ..core.colorize("#FFFFFF", "Critical damage: 250/sec of bullet lifetime\n") ..core.colorize("#FFFFFF", "Ammunition: 308.Winchester rounds\n") ..core.colorize("#FFFFFF", "Reload time: 1.5\n") ..core.colorize("#27a600", "The gun is loaded!\n")..core.colorize("#FFFFFF", "Gun type: Rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 60"),
|
||||
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,
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
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_icon = "rangedweapons_awp_icon.png",
|
||||
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)
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:awpshot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_rifle_a", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 60, y=dir.y * 60, z=dir.z * 60})
|
||||
obj:setacceleration({x=dir.x * 0, y=0, z=dir.z * 0})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 1.5,
|
||||
size = 8,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:awp_uld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
rangedweapons_shoot_gun(itemstack, user)
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
local rangedweapons_awpshot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_awpshot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.05 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:awpshot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 45 then
|
||||
local damage = 250 * self.timer
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 30},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = 100 * self.timer
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 15},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 45 then
|
||||
local damage = 250 * self.timer
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = 100 * self.timer
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:awpshot", rangedweapons_awpshot )
|
||||
|
||||
|
||||
|
286
benelli.lua
@ -1,249 +1,63 @@
|
||||
minetest.register_craft({
|
||||
output = "rangedweapons:benelli_uld",
|
||||
recipe = {
|
||||
{"rangedweapons:gunsteel_ingot", "default:diamond", "default:steelblock"},
|
||||
{"rangedweapons:plastic_sheet", "default:diamond", "default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("rangedweapons:benelli_uld", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=2.0,y=2.0,z=1.20},
|
||||
range = 0,
|
||||
description = "" ..core.colorize("#35cdff","Benelli M3\n") ..core.colorize("#FFFFFF", "Ranged damage: 3-9 X 12\n") ..core.colorize("#FFFFFF", "Accuracy: 62%\n") ..core.colorize("#FFFFFF", "Mob knockback: 6\n") ..core.colorize("#FFFFFF", "Critical chance: 4%\n") ..core.colorize("#FFFFFF", "Critical damage: 9-19 X 12\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Reload time: 0.60\n") ..core.colorize("#be0d00", "The gun is NOT loaded! (Right-click to load)\n")..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
|
||||
inventory_image = "rangedweapons_benelli.png",
|
||||
on_use = function(user)
|
||||
minetest.sound_play("rangedweapons_empty", {user})
|
||||
end,
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.001 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:benelli_uld"
|
||||
and inv:contains_item("main", "rangedweapons:shell")then
|
||||
if controls.RMB then
|
||||
inv:remove_item("main", "rangedweapons:shell")
|
||||
player:set_wielded_item("rangedweapons:benelli_rld")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell_shotgun")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_shotgun_reload_a", {player})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if timer >= 0.60 and
|
||||
player:get_wielded_item():get_name() == "rangedweapons:benelli_rld" then
|
||||
player:set_wielded_item("rangedweapons:benelli")
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_shotgun_reload_b", {player})
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:benelli_rld", {
|
||||
minetest.register_tool("rangedweapons:benelli_rld", {
|
||||
stack_max= 1,
|
||||
range = 0,
|
||||
wield_scale = {x=2.0,y=2.0,z=1.20},
|
||||
description = "**RELOADING BENELLI M3**",
|
||||
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: 3-9 X 12\n") ..core.colorize("#FFFFFF", "Accuracy: 62%\n")..core.colorize("#FFFFFF", "Mob knockback: 6\n") ..core.colorize("#FFFFFF", "Critical chance: 4%\n") ..core.colorize("#FFFFFF", "Critical damage: 9-19 X 12\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Reload time: 0.60\n") ..core.colorize("#27a600", "The gun is loaded!\n")..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
|
||||
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,
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
wield_scale = {x=2.0,y=2.0,z=1.20},
|
||||
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_icon = "rangedweapons_benelli_icon.png",
|
||||
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)
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:benellishot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_shotgun_shot", {object=obj})
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.8,3.8), y=math.random(-3.8,3.8), z=dir.z * math.random(-3.8,3.8)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:benellishot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.8,3.8), y=math.random(-3.8,3.8), z=dir.z * math.random(-3.8,3.8)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:benellishot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.8,3.8), y=math.random(-3.8,3.8), z=dir.z * math.random(-3.8,3.8)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:benellishot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.8,3.8), y=math.random(-3.8,3.8), z=dir.z * math.random(-3.8,3.8)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:benellishot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.8,3.8), y=math.random(-3.8,3.8), z=dir.z * math.random(-3.8,3.8)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:benellishot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.8,3.8), y=math.random(-3.8,3.8), z=dir.z * math.random(-3.8,3.8)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:benellishot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.8,3.8), y=math.random(-3.8,3.8), z=dir.z * math.random(-3.8,3.8)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:benellishot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.8,3.8), y=math.random(-3.8,3.8), z=dir.z * math.random(-3.8,3.8)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:benellishot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.8,3.8), y=math.random(-3.8,3.8), z=dir.z * math.random(-3.8,3.8)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:benellishot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.8,3.8), y=math.random(-3.8,3.8), z=dir.z * math.random(-3.8,3.8)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:benellishot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.8,3.8), y=math.random(-3.8,3.8), z=dir.z * math.random(-3.8,3.8)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:benellishot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.8,3.8), y=math.random(-3.8,3.8), z=dir.z * math.random(-3.8,3.8)})
|
||||
-----------------------------------------------------
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 1.25,
|
||||
size = 10,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:benelli_uld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
rangedweapons_shoot_gun(itemstack, user)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
local rangedweapons_benellishot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.1, y=0.1},
|
||||
textures = {"rangedweapons_buckball.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_benellishot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.225 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1.25)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:benellishot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 4 then
|
||||
local damage = math.random(9,19)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 12},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(3,9)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 6},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 4 then
|
||||
local damage = math.random(9,19)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(3,9)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_wood_a" or
|
||||
node.name == "doors:door_wood_b" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:benellishot", rangedweapons_benellishot )
|
||||
|
||||
|
||||
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(user)
|
||||
minetest.sound_play("rangedweapons_empty", {user})
|
||||
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,
|
||||
})
|
||||
|
214
beretta.lua
@ -1,190 +1,58 @@
|
||||
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.4 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:beretta_rld" then
|
||||
player:set_wielded_item("rangedweapons:beretta")
|
||||
minetest.sound_play("", {player})
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:beretta_rld", {
|
||||
minetest.register_tool("rangedweapons:beretta_rld", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=1.1,y=1.1,z=1.05},
|
||||
description = "***RELOADING BERETTA M9***",
|
||||
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", "Ranged damage: 5-8\n") ..core.colorize("#FFFFFF", "Accuracy: 94%\n") ..core.colorize("#FFFFFF", "Mob knockback: 3\n") ..core.colorize("#FFFFFF", "Critical chance: 15%\n") ..core.colorize("#FFFFFF", "Critical damage: 9-14\n") ..core.colorize("#FFFFFF", "Ammunition: 9mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.4\n") ..core.colorize("#FFFFFF", "Gun type: Handgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
|
||||
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_icon = "rangedweapons_beretta_icon.png",
|
||||
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)
|
||||
timer = 0
|
||||
local inv = user:get_inventory()
|
||||
if not inv:contains_item("main", "rangedweapons:9mm 1") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=user})
|
||||
return itemstack
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
inv:remove_item("main", "rangedweapons:9mm")
|
||||
end
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:berettashot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_beretta", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 25, y=dir.y * 25, z=dir.z * 25})
|
||||
obj:setacceleration({x=dir.x * math.random(-0.6,0.6), y=math.random(-0.6,0.6), z=dir.z * math.random(-0.6,0.6)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:smoke")
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.7,
|
||||
size = 5,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:beretta_rld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
rangedweapons_shoot_gun(itemstack, user)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
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'},
|
||||
}
|
||||
})
|
||||
|
||||
local rangedweapons_berettashot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_berettashot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.11 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:berettashot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 15 then
|
||||
local damage = math.random(9,14)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=6},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(5,8)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=3},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 15 then
|
||||
local damage = math.random(9,14)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(5,8)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:berettashot", rangedweapons_berettashot )
|
||||
|
||||
|
||||
|
15
bullet_knockback.lua
Normal 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
@ -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, "text", "rangedweapons_scopehud.png")
|
||||
else
|
||||
player:hud_change(scope_hud, "text", "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, "text", "rangedweapons_empty_icon.png")
|
||||
if player:get_inventory():contains_item(
|
||||
"main", "binoculars:binoculars") then
|
||||
new_zoom_fov = 10
|
||||
if player:get_properties().zoom_fov ~= new_zoom_fov then
|
||||
player:set_properties({zoom_fov = new_zoom_fov})
|
||||
end
|
||||
else
|
||||
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, {player})
|
||||
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, {player})
|
||||
end
|
||||
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
@ -0,0 +1,641 @@
|
||||
----------------------------
|
||||
----------------------------
|
||||
if rweapons_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", "default:tree"},
|
||||
{"default:tree", "default:mese", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "", "default: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", "default:tree"},
|
||||
{"", "", "default: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", "rangedweapons:tree"},
|
||||
{"", "default:mese_crystal", "rangedweapons:tree"},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "rangedweapons:python",
|
||||
recipe = {
|
||||
{"moreores:silver_ingot", "moreores:silver_ingot", "moreores:silver_ingot"},
|
||||
{"", "default:diamond", "rangedweapons:tree"},
|
||||
{"", "default:mese_crystal", "rangedweapons: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", "default: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", "default:tree"},
|
||||
{"default:tree", "default:tree", "default: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", "default: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"},
|
||||
{"default:tree", "default:tree", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:diamond", "default: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"},
|
||||
{"default:tree", "default:mese_crystal", "default:tree"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "rangedweapons:rpg",
|
||||
recipe = {
|
||||
{"default:diamond", "default:steel_ingot", ""},
|
||||
{"default:steelblock", "default:tree", "default:diamondblock"},
|
||||
{"default:diamond", "default:tree", ""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "rangedweapons:rpk",
|
||||
recipe = {
|
||||
{"default:diamond", "rangedweapons:ak47", ""},
|
||||
{"default:steel_ingot", "default:steelblock", "default: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"},
|
||||
{"default:tree", "default:diamond", "default: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 rweapons_other_weapon_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 rweapons_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 rweapons_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 = {
|
||||
{"default:tree", "default:coal_lump", "default:tree"},
|
||||
{"default:coal_lump", "default: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
|
276
deagle.lua
@ -1,197 +1,121 @@
|
||||
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.75 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:deagle_rld" then
|
||||
player:set_wielded_item("rangedweapons:deagle")
|
||||
minetest.sound_play("", {player})
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:deagle_rld", {
|
||||
minetest.register_tool("rangedweapons:deagle_rld", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=1.25,y=1.25,z=1.5},
|
||||
description = "***RELOADING DESERT EAGLE***",
|
||||
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-18\n") ..core.colorize("#FFFFFF", "Accuracy: 85%\n") ..core.colorize("#FFFFFF", "Mob knockback: 9\n") ..core.colorize("#FFFFFF", "Critical chance: 29%\n") ..core.colorize("#FFFFFF", "Critical damage: 25-44\n") ..core.colorize("#FFFFFF", "Ammunition: .357 Magnum rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.75\n") ..core.colorize("#FFFFFF", "Gun type: Magnum\n") ..core.colorize("#FFFFFF", "Bullet velocity: 45"),
|
||||
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_icon = "rangedweapons_deagle_icon.png",
|
||||
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)
|
||||
timer = 0
|
||||
local inv = user:get_inventory()
|
||||
if not inv:contains_item("main", "rangedweapons:357 1") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=user})
|
||||
return itemstack
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
inv:remove_item("main", "rangedweapons:357")
|
||||
end
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:deagleshot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_deagle", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 45, y=dir.y * 45, z=dir.z * 45})
|
||||
obj:setacceleration({x=dir.x * math.random(-1.5,1.5), y=math.random(-1.5,1.5), z=dir.z * math.random(-1.5,1.5)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 1.0,
|
||||
size = 8,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:deagle_rld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
rangedweapons_shoot_gun(itemstack, user)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
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_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_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_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",
|
||||
})
|
||||
|
||||
local rangedweapons_deagleshot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_deagleshot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.065 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1.25)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:deagleshot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 29 then
|
||||
local damage = math.random(25,44)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=18},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(11,18)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=9},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 29 then
|
||||
local damage = math.random(25,44)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(11,18)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:deagleshot", rangedweapons_deagleshot )
|
||||
|
||||
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_icon = "rangedweapons_golden_deagle_icon.png",
|
||||
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,
|
||||
})
|
||||
|
||||
|
@ -3,4 +3,8 @@ tnt
|
||||
doors?
|
||||
xpanes?
|
||||
vessels?
|
||||
moreores?
|
||||
moreores?
|
||||
3d_armor?
|
||||
|
||||
|
||||
|
||||
|
@ -169,14 +169,6 @@ local barrel_boom = {
|
||||
}
|
||||
tnt.register_tnt(barrel_boom)
|
||||
|
||||
minetest.register_craft({
|
||||
output = "rangedweapons:barrel",
|
||||
recipe = {
|
||||
{"default:wood", "tnt:gunpowder", "default:wood"},
|
||||
{"default:wood", "tnt:tnt", "default:wood"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("rangedweapons:barrel", {
|
||||
description = "" ..core.colorize("#35cdff","Explosive barrel\n")..core.colorize("#FFFFFF", "It will explode if shot by gun"),
|
||||
tiles = {
|
||||
@ -190,11 +182,8 @@ minetest.register_node("rangedweapons:barrel", {
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
groups = {choppy = 3, oddly_breakable_by_hand = 3},
|
||||
on_timer = function(pos)
|
||||
tnt.boom(pos, barrel_boom)
|
||||
end,
|
||||
on_blast = function(pos)
|
||||
tnt.boom(pos, barrel_boom)
|
||||
tnt.boom(pos, {radius = 3})
|
||||
end,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
|
148
forcegun.lua
Normal file
@ -0,0 +1,148 @@
|
||||
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_yaw()
|
||||
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:setyaw(yaw + math.pi)
|
||||
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
|
||||
|
||||
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
|
||||
else
|
||||
posd_x = 1
|
||||
posd_y = 1
|
||||
posd_z = 1
|
||||
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)
|
231
g36.lua
@ -1,177 +1,74 @@
|
||||
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_craftitem("rangedweapons:g36", {
|
||||
|
||||
minetest.register_tool("rangedweapons:g36_r", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=1.75,y=1.75,z=1.3},
|
||||
description = "" ..core.colorize("#35cdff","G36\n") ..core.colorize("#FFFFFF", "Ranged damage: 6-13\n") ..core.colorize("#FFFFFF", "Accuracy: 84%\n") ..core.colorize("#FFFFFF", "Mob knockback: 3\n")..core.colorize("#FFFFFF", "Critical chance: 10%\n") ..core.colorize("#FFFFFF", "Critical damage: 12-25\n") ..core.colorize("#FFFFFF", "Ammunition: 5.56mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.14\n") ..core.colorize("#FFFFFF", "Gun type: Assault rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 35"),
|
||||
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",
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.14 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:g36" then
|
||||
if not inv:contains_item("main", "rangedweapons:556mm") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:g36" then
|
||||
inv:remove_item("main", "rangedweapons:556mm")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:g36shot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_smg", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 35, y=dir.y * 35, z=dir.z * 35})
|
||||
obj:setacceleration({x=dir.x * math.random(-1.6,1.6), y=math.random(-1.6,1.6), z=dir.z * math.random(-1.6,1.6)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.5,
|
||||
size = 4,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_g36shot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_g36shot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.085 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:g36shot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 10 then
|
||||
local damage = math.random(12,25)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=6},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(6,13)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 3},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 10 then
|
||||
local damage = math.random(12,25)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(6,13)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.register_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_icon = "rangedweapons_g36_icon.png",
|
||||
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,
|
||||
|
||||
minetest.register_entity("rangedweapons:g36shot", rangedweapons_g36shot )
|
||||
inventory_image = "rangedweapons_g36.png",
|
||||
})
|
@ -1,14 +1,7 @@
|
||||
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_node("rangedweapons:generator", {
|
||||
description = "" ..core.colorize("#35cdff","Power particle generator\n")..core.colorize("#FFFFFF", "generates 6 power particles on top of itself, every 15 seconds"),
|
||||
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",
|
||||
@ -18,14 +11,25 @@ minetest.register_node("rangedweapons:generator", {
|
||||
"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(15)
|
||||
pos.y = pos.y+1
|
||||
minetest.add_item(pos, "rangedweapons:power_particle 6")
|
||||
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(15)
|
||||
minetest.get_node_timer(pos):start(3)
|
||||
end,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
@ -9,14 +9,6 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.override_item("default:glass", {
|
||||
on_timer = function(pos)
|
||||
minetest.swap_node(pos, {name = "rangedweapons:broken_glass"})
|
||||
minetest.sound_play("glass_break",{pos})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("rangedweapons:broken_glass", {
|
||||
description = "Broken glass",
|
||||
drawtype = "glasslike",
|
||||
@ -37,76 +29,3 @@ minetest.register_node("rangedweapons:broken_glass", {
|
||||
groups = {oddly_breakable_by_hand = 3},
|
||||
})
|
||||
|
||||
if minetest.get_modpath("doors") then
|
||||
|
||||
minetest.override_item("doors:door_glass_a", {
|
||||
on_timer = function(pos)
|
||||
minetest.swap_node(pos, {name = "air"})
|
||||
minetest.add_item(pos, "vessels:glass_fragments 5")
|
||||
minetest.sound_play("glass_break",{pos})
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.override_item("doors:door_glass_b", {
|
||||
on_timer = function(pos)
|
||||
minetest.swap_node(pos, {name = "air"})
|
||||
minetest.add_item(pos, "vessels:glass_fragments 5")
|
||||
minetest.sound_play("glass_break",{pos})
|
||||
end,
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
if minetest.get_modpath("xpanes") then
|
||||
|
||||
minetest.override_item("xpanes:pane", {
|
||||
on_timer = function(pos)
|
||||
minetest.swap_node(pos, {name = "air"})
|
||||
minetest.add_item(pos, "rangedweapons:glass_shards")
|
||||
minetest.sound_play("glass_break",{pos})
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.override_item("xpanes:pane_flat", {
|
||||
on_timer = function(pos)
|
||||
minetest.swap_node(pos, {name = "air"})
|
||||
minetest.add_item(pos, "rangedweapons:glass_shards")
|
||||
minetest.sound_play("glass_break",{pos})
|
||||
end,
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
if minetest.get_modpath("vessels") then
|
||||
|
||||
minetest.override_item("vessels:glass_bottle", {
|
||||
on_timer = function(pos)
|
||||
minetest.swap_node(pos, {name = "air"})
|
||||
minetest.add_item(pos, "rangedweapons:glass_shards")
|
||||
minetest.sound_play("glass_break",{pos})
|
||||
end,
|
||||
walkable = true,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.override_item("vessels:drinking_glass", {
|
||||
on_timer = function(pos)
|
||||
minetest.swap_node(pos, {name = "air"})
|
||||
minetest.add_item(pos, "rangedweapons:glass_shards")
|
||||
minetest.sound_play("glass_break",{pos})
|
||||
end,
|
||||
walkable = true,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
end
|
||||
|
240
glock17.lua
@ -1,190 +1,84 @@
|
||||
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.35 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:glock17_rld" then
|
||||
player:set_wielded_item("rangedweapons:glock17")
|
||||
minetest.sound_play("", {player})
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:glock17_rld", {
|
||||
minetest.register_tool("rangedweapons:glock17_rld", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=1.1,y=1.1,z=1.05},
|
||||
description = "***RELOADING GLOCK 17 ***",
|
||||
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", "Ranged damage: 7-11\n") ..core.colorize("#FFFFFF", "Accuracy: 96%\n") ..core.colorize("#FFFFFF", "Mob knockback: 4\n") ..core.colorize("#FFFFFF", "Critical chance: 19%\n") ..core.colorize("#FFFFFF", "Critical damage: 12-22\n") ..core.colorize("#FFFFFF", "Ammunition: 9mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.35\n") ..core.colorize("#FFFFFF", "Gun type: Handgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 30"),
|
||||
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_icon = "rangedweapons_glock17_icon.png",
|
||||
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)
|
||||
timer = 0
|
||||
local inv = user:get_inventory()
|
||||
if not inv:contains_item("main", "rangedweapons:9mm 1") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=user})
|
||||
return itemstack
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
inv:remove_item("main", "rangedweapons:9mm")
|
||||
end
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:glock17shot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_glock", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 30, y=dir.y * 30, z=dir.z * 30})
|
||||
obj:setacceleration({x=dir.x * math.random(-0.4,0.4), y=math.random(-0.4,0.4), z=dir.z * math.random(-0.4,0.4)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:smoke")
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.7,
|
||||
size = 5,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:glock17_rld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
rangedweapons_shoot_gun(itemstack, user)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
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'},
|
||||
}
|
||||
})
|
||||
|
||||
local rangedweapons_glock17shot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_glock17shot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.1 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:glock17shot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 19 then
|
||||
local damage = math.random(12,22)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=8},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(7,11)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=4},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 19 then
|
||||
local damage = math.random(12,22)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(7,11)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:glock17shot", rangedweapons_glock17shot )
|
||||
|
||||
|
||||
|
111
hand_grenade.lua
@ -1,11 +1,4 @@
|
||||
minetest.register_craft({
|
||||
output = "rangedweapons:hand_grenade",
|
||||
recipe = {
|
||||
{"", "", "default:mese_crystal_fragment"},
|
||||
{"default:steel_ingot", "tnt:gunpowder", ""},
|
||||
{"tnt:gunpowder", "tnt:gunpowder", ""},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:pin", {
|
||||
wield_scale = {x=2.5,y=2.5,z=1.0},
|
||||
@ -22,7 +15,7 @@ local rangedweapons_grenade_pin = {
|
||||
}
|
||||
rangedweapons_grenade_pin.on_step = function(self, dtime, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local pos = self.object:getpos()
|
||||
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
|
||||
@ -48,14 +41,38 @@ local grenade_boom = {
|
||||
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", {user})
|
||||
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_yaw()
|
||||
local svertical = user:get_look_vertical()
|
||||
pinEnt:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
pinEnt:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
pinEnt:set_rotation({x=0,y=yaw + math.pi,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},
|
||||
@ -63,17 +80,19 @@ minetest.register_craftitem("rangedweapons:hand_grenade_nopin", {
|
||||
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:getpos()
|
||||
local pos = user:get_pos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
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:setvelocity({x=dir.x * 12, y=dir.y * 12, z=dir.z * 12})
|
||||
obj:setacceleration({x=dir.x * -1, y=-6, z=dir.z * -1})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
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)
|
||||
btimer = gtimer
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
@ -87,69 +106,35 @@ minetest.register_craftitem("rangedweapons:hand_grenade_nopin", {
|
||||
|
||||
tnt.register_tnt(grenade_boom)
|
||||
|
||||
local timer = 0
|
||||
|
||||
minetest.register_globalstep(function(dtime, player, pos)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.001 then
|
||||
gtimer = gtimer + dtime;
|
||||
if gtimer >= 3.0 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local pos = player:getpos()
|
||||
local controls = player:get_player_control()
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:hand_grenade" then
|
||||
if controls.RMB then
|
||||
player:set_wielded_item("rangedweapons:hand_grenade_nopin")
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_a", {player})
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:grenade_pin")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if timer >= 3.0 and
|
||||
player:get_wielded_item():get_name() == "rangedweapons:hand_grenade_nopin" then
|
||||
local pos = player:get_pos()
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:hand_grenade_nopin" then
|
||||
player:set_wielded_item("")
|
||||
timer = 0
|
||||
gtimer = 0
|
||||
tnt.boom(pos, grenade_boom)
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end end end end)
|
||||
|
||||
local rangedweapons_grenade = {
|
||||
physical = false,
|
||||
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, 0, 0, 0, 0, 0},
|
||||
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:getpos()
|
||||
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
|
||||
local vel = self.object:getvelocity()
|
||||
local acc = self.object:getacceleration()
|
||||
self.object:setvelocity({x=vel.x*-0.3, y=vel.y*-1, z=vel.z*-0.3})
|
||||
self.object:setacceleration({x=acc.x, y=acc.y, z=acc.z})
|
||||
end
|
||||
end
|
||||
self.timer = timer
|
||||
if self.timer > 3.0 then
|
||||
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
|
||||
|
273
jackhammer.lua
@ -1,218 +1,69 @@
|
||||
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_craftitem("rangedweapons:jackhammer", {
|
||||
|
||||
minetest.register_tool("rangedweapons:jackhammer_r", {
|
||||
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: 5-12 X 15\n") ..core.colorize("#FFFFFF", "Accuracy: 70%\n") ..core.colorize("#FFFFFF", "Mob knockback: 3\n")..core.colorize("#FFFFFF", "Critical chance: 5%\n") ..core.colorize("#FFFFFF", "Critical damage: 13-25 X 15\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.35\n") ..core.colorize("#FFFFFF", "Gun type: Auto-shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
|
||||
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",
|
||||
})
|
||||
-------------------------------------------
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.35 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:jackhammer" then
|
||||
if not inv:contains_item("main", "rangedweapons:shell") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:jackhammer" then
|
||||
inv:remove_item("main", "rangedweapons:shell")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_shotgun_shot", {object=obj})
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:jackhammershot")
|
||||
obj:setvelocity({x=dir.x * math.random(23,27), y=dir.y * math.random(23,27), z=dir.z * math.random(23,27)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell_shotgun")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.5,
|
||||
size = 6,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_jackhammershot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.1, y=0.1},
|
||||
textures = {"rangedweapons_buckball.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_jackhammershot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.17 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:jackhammershot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 5 then
|
||||
local damage = math.random(13,25)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=6},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(5,12)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 3},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 5 then
|
||||
local damage = math.random(13,25)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(5,12)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_wood_a" or
|
||||
node.name == "doors:door_wood_b" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:jackhammershot", rangedweapons_jackhammershot )
|
||||
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_icon = "rangedweapons_jackhammer_icon.png",
|
||||
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,
|
||||
})
|
||||
|
139
javelin - Copy.lua
Normal file
@ -0,0 +1,139 @@
|
||||
|
||||
|
||||
|
||||
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_craftitem("rangedweapons:javelin", {
|
||||
description = "" ..core.colorize("#35cdff","Javelin\n") ..core.colorize("#FFFFFF", "Mele damage: 9\n") ..core.colorize("#FFFFFF", "Mele range: 5\n")..core.colorize("#FFFFFF", "Full punch interval: 1.25\n") ..core.colorize("#FFFFFF", "Ranged damage: 4-16\n") ..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "Mob knockback: 10\n") ..core.colorize("#FFFFFF", "Critical chance: 15%\n") ..core.colorize("#FFFFFF", "Critical damage: 25-45\n") ..core.colorize("#FFFFFF", "javelin survival rate: 95%\n")..core.colorize("#FFFFFF", "Projectile gravity: 4\n") ..core.colorize("#FFFFFF", "Projectile velocity: 20\n")..core.colorize("#ffc000", "Right-click to throw, Left-click to stab") ,
|
||||
wield_scale = {x=2.0,y=2.0,z=1.0},
|
||||
range = 5,
|
||||
stack_max= 10,
|
||||
inventory_image = "rangedweapons_javelin.png",
|
||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item()
|
||||
end
|
||||
if pointed_thing.type ~= "nothing" then
|
||||
local pointed = minetest.get_pointed_thing_position(pointed_thing)
|
||||
if vector.distance(user:getpos(), pointed) < 8 then
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir then
|
||||
pos.y = pos.y + 1.5
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:javelin")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_throw", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
|
||||
obj:setacceleration({x=dir.x * -1, y=-4, z=dir.z * -1})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.25,
|
||||
max_drop_level = 0,
|
||||
groupcaps = {
|
||||
stabby = {times={[1]=0.25, [2]=0.50, [3]=0.75}, uses=0, maxlevel=1},
|
||||
},
|
||||
damage_groups = {fleshy=9,knockback=10},
|
||||
}
|
||||
})
|
||||
|
||||
local rangedweapons_javelin = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "wielditem",
|
||||
visual_size = {x=0.5, y=0.5,},
|
||||
textures = {"rangedweapons:thrown_javelin"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_javelin.on_step = function(self, dtime)
|
||||
self.timer = self.timer + dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.15 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:javelin" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 15 then
|
||||
local damage = math.random(25,45)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=20},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
|
||||
minetest.add_item(self.lastpos, "rangedweapons:javelin")
|
||||
end
|
||||
else
|
||||
local damage = math.random(4,16)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=10},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
|
||||
minetest.add_item(self.lastpos, "rangedweapons:javelin")
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
if math.random(1, 100) <= 15 then
|
||||
local damage = math.random(25,45)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
|
||||
minetest.add_item(self.lastpos, "rangedweapons:javelin")
|
||||
end
|
||||
else
|
||||
local damage = math.random(4,16)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
|
||||
minetest.add_item(self.lastpos, "rangedweapons:javelin")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
|
||||
minetest.add_item(self.lastpos, "rangedweapons:javelin")
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
|
||||
minetest.register_entity("rangedweapons:javelin", rangedweapons_javelin)
|
||||
|
||||
|
||||
|
169
javelin.lua
@ -6,142 +6,53 @@ minetest.register_craftitem("rangedweapons:thrown_javelin", {
|
||||
inventory_image = "rangedweapons_thrown_javelin.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("rangedweapons:javelin", {
|
||||
description = "" ..core.colorize("#35cdff","Javelin\n") ..core.colorize("#FFFFFF", "Mele damage: 9\n") ..core.colorize("#FFFFFF", "Mele range: 5\n")..core.colorize("#FFFFFF", "Full punch interval: 1.25\n") ..core.colorize("#FFFFFF", "Ranged damage: 4-16\n") ..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "Mob knockback: 10\n") ..core.colorize("#FFFFFF", "Critical chance: 15%\n") ..core.colorize("#FFFFFF", "Critical damage: 25-45\n") ..core.colorize("#FFFFFF", "javelin survival rate: 95%\n")..core.colorize("#FFFFFF", "Projectile gravity: 4\n") ..core.colorize("#FFFFFF", "Projectile velocity: 20\n")..core.colorize("#ffc000", "Right-click to throw, Left-click to stab") ,
|
||||
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 = 5,
|
||||
stack_max= 10,
|
||||
range = 4.5,
|
||||
inventory_image = "rangedweapons_javelin.png",
|
||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item()
|
||||
end
|
||||
if pointed_thing.type ~= "nothing" then
|
||||
local pointed = minetest.get_pointed_thing_position(pointed_thing)
|
||||
if vector.distance(user:getpos(), pointed) < 8 then
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir then
|
||||
pos.y = pos.y + 1.5
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:javelin")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_throw", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
|
||||
obj:setacceleration({x=dir.x * -1, y=-4, z=dir.z * -1})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.25,
|
||||
max_drop_level = 0,
|
||||
groupcaps = {
|
||||
stabby = {times={[1]=0.25, [2]=0.50, [3]=0.75}, uses=0, maxlevel=1},
|
||||
stabby = {times={[1]=0.25, [2]=0.50, [3]=0.75}, uses=66.6, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=9,knockback=10},
|
||||
}
|
||||
})
|
||||
|
||||
local rangedweapons_javelin = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "wielditem",
|
||||
visual_size = {x=0.5, y=0.5,},
|
||||
textures = {"rangedweapons:thrown_javelin"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_javelin.on_step = function(self, dtime)
|
||||
self.timer = self.timer + dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.15 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:javelin" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 15 then
|
||||
local damage = math.random(25,45)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=20},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
|
||||
minetest.add_item(self.lastpos, "rangedweapons:javelin")
|
||||
end
|
||||
else
|
||||
local damage = math.random(4,16)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=10},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
|
||||
minetest.add_item(self.lastpos, "rangedweapons:javelin")
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
if math.random(1, 100) <= 15 then
|
||||
local damage = math.random(25,45)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
|
||||
minetest.add_item(self.lastpos, "rangedweapons:javelin")
|
||||
end
|
||||
else
|
||||
local damage = math.random(4,16)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
|
||||
minetest.add_item(self.lastpos, "rangedweapons:javelin")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
|
||||
minetest.add_item(self.lastpos, "rangedweapons:javelin")
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
|
||||
minetest.register_entity("rangedweapons:javelin", rangedweapons_javelin)
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:javelin 1',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:steel_ingot', ''},
|
||||
{'default:steel_ingot', '', 'group:stick'},
|
||||
{'', '', 'group:stick'},
|
||||
}
|
||||
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,
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
227
kriss_sv.lua
@ -1,177 +1,68 @@
|
||||
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_craftitem("rangedweapons:kriss_sv", {
|
||||
minetest.register_tool("rangedweapons:kriss_sv_r", {
|
||||
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", "Ranged damage: 2-4\n") ..core.colorize("#FFFFFF", "accuracy: 60%\n") ..core.colorize("#FFFFFF", "Mob knockback: 0\n") ..core.colorize("#FFFFFF", "Critical chance: 5%\n") ..core.colorize("#FFFFFF", "Critical damage: 3-7\n") ..core.colorize("#FFFFFF", "Ammunition: 9mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.06\n") ..core.colorize("#FFFFFF", "Gun type: machine pistol\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
|
||||
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",
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.06 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:kriss_sv" then
|
||||
if not inv:contains_item("main", "rangedweapons:9mm") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:kriss_sv" then
|
||||
inv:remove_item("main", "rangedweapons:9mm")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:kriss_svshot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_machine_pistol", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
|
||||
obj:setacceleration({x=dir.x * math.random(-4.0,4.0), y=math.random(-3.8,3.8), z=dir.z * math.random(-4.0,4.0)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.30,
|
||||
size = 4,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_kriss_svshot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_kriss_svshot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.17 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:kriss_svshot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 5 then
|
||||
local damage = math.random(3,7)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=0},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(2,4)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 0},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 5 then
|
||||
local damage = math.random(3,7)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(2,4)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.register_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_entity("rangedweapons:kriss_svshot", rangedweapons_kriss_svshot )
|
||||
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_icon = "rangedweapons_kriss_sv_icon.png",
|
||||
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,
|
||||
})
|
||||
|
@ -1,153 +1,46 @@
|
||||
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_craftitem("rangedweapons:blue_ray_visual", {
|
||||
wield_scale = {x=1.75,y=1.75,z=1.75},
|
||||
inventory_image = "rangedweapons_blue_ray.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("rangedweapons:laser_blaster", {
|
||||
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: 12-18\n") ..core.colorize("#FFFFFF", "accuracy: 100%\n") ..core.colorize("#FFFFFF", "Mob knockback: 0\n") ..core.colorize("#FFFFFF", "Critical chance: 10%\n") ..core.colorize("#FFFFFF", "Critical damage: 28-40\n") ..core.colorize("#FFFFFF", "Power usage: 1\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.35\n") ..core.colorize("#FFFFFF", "Gun type: power pistol\n") ..core.colorize("#FFFFFF", "Bullet velocity: 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,
|
||||
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.35 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:laser_blaster" then
|
||||
if not inv:contains_item("main", "rangedweapons:power_particle") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:laser_blaster" then
|
||||
inv:remove_item("main", "rangedweapons:power_particle")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:laser_blastershot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_laser", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 15, y=dir.y * 15, z=dir.z * 15})
|
||||
obj:setacceleration({x=dir.x * math.random(0,0), y=math.random(0,0), z=dir.z * math.random(0,0)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_laser_blastershot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_laser_blastershot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.21 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:laser_blastershot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 10 then
|
||||
local damage = math.random(28,40)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=0},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(12,18)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 0},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 10 then
|
||||
local damage = math.random(28,40)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(12,18)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.2,
|
||||
size = 7,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_ray_blue.png",
|
||||
glow = 30,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:laser_blastershot", rangedweapons_laser_blastershot )
|
179
laser_rifle.lua
@ -1,153 +1,38 @@
|
||||
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_craftitem("rangedweapons:red_ray_visual", {
|
||||
wield_scale = {x=1.5,y=1.5,z=2.0},
|
||||
inventory_image = "rangedweapons_red_ray.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("rangedweapons:laser_rifle", {
|
||||
stack_max= 1,
|
||||
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: 10-20\n") ..core.colorize("#FFFFFF", "accuracy: 100%\n") ..core.colorize("#FFFFFF", "Mob knockback: 0\n") ..core.colorize("#FFFFFF", "Critical chance: 8%\n") ..core.colorize("#FFFFFF", "Critical damage: 22-46\n") ..core.colorize("#FFFFFF", "Power usage: 2\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.1\n") ..core.colorize("#FFFFFF", "Gun type: power assault rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
|
||||
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",
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.1 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:laser_rifle" then
|
||||
if not inv:contains_item("main", "rangedweapons:power_particle 2") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:laser_rifle" then
|
||||
inv:remove_item("main", "rangedweapons:power_particle 2")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:laser_rifleshot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_laser", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
|
||||
obj:setacceleration({x=dir.x * math.random(0,0), y=math.random(0,0), z=dir.z * math.random(0,0)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_laser_rifleshot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_laser_rifleshot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.175 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:laser_rifleshot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 8 then
|
||||
local damage = math.random(22,46)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=0},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(10,20)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 0},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 8 then
|
||||
local damage = math.random(22,46)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(12,18)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.2,
|
||||
size = 7,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_ray_red.png",
|
||||
glow = 30,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:laser_rifleshot", rangedweapons_laser_rifleshot )
|
@ -1,178 +1,39 @@
|
||||
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_craftitem("rangedweapons:laser_shotgun", {
|
||||
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: 15-26 X 5\n") ..core.colorize("#FFFFFF", "accuracy: 100%\n") ..core.colorize("#FFFFFF", "Mob knockback: 0\n") ..core.colorize("#FFFFFF", "Critical chance: 12%\n") ..core.colorize("#FFFFFF", "Critical damage: 31-59 X 5\n") ..core.colorize("#FFFFFF", "Power usage: 7\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.75\n") ..core.colorize("#FFFFFF", "Gun type: power shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 15"),
|
||||
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,
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.75 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:laser_shotgun" then
|
||||
if not inv:contains_item("main", "rangedweapons:power_particle 7") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:laser_shotgun" then
|
||||
inv:remove_item("main", "rangedweapons:power_particle 7")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:laser_shotgunshot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_laser", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 15, y=dir.y * 15, z=dir.z * 15})
|
||||
obj:setacceleration({x=dir.x * math.random(0,0), y=math.random(0,0), z=dir.z * math.random(0,0)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:laser_shotgunshot")
|
||||
minetest.sound_play("rangedweapons_laser", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 15, y=dir.y * 15, z=dir.z * 18})
|
||||
obj:setacceleration({x=dir.x * math.random(0,0), y=math.random(0,0), z=dir.z * math.random(0,0)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:laser_shotgunshot")
|
||||
minetest.sound_play("rangedweapons_laser", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 15, y=dir.y * 15, z=dir.z * 21})
|
||||
obj:setacceleration({x=dir.x * math.random(0,0), y=math.random(0,0), z=dir.z * math.random(0,0)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:laser_shotgunshot")
|
||||
minetest.sound_play("rangedweapons_laser", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 18, y=dir.y * 15, z=dir.z * 15})
|
||||
obj:setacceleration({x=dir.x * math.random(0,0), y=math.random(0,0), z=dir.z * math.random(0,0)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
------------------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:laser_shotgunshot")
|
||||
minetest.sound_play("rangedweapons_laser", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 21, y=dir.y * 15, z=dir.z * 15})
|
||||
obj:setacceleration({x=dir.x * math.random(0,0), y=math.random(0,0), z=dir.z * math.random(0,0)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_laser_shotgunshot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_laser_shotgunshot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.22 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:laser_shotgunshot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 12 then
|
||||
local damage = math.random(31,59)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=0},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(15,26)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 0},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 12 then
|
||||
local damage = math.random(31,59)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(15,26)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.2,
|
||||
size = 7,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_ray_green.png",
|
||||
glow = 30,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:laser_shotgunshot", rangedweapons_laser_shotgunshot )
|
||||
})
|
@ -1 +1 @@
|
||||
cc-by-sa 3.0
|
||||
cc-by-sa 4.0
|
240
luger.lua
@ -1,192 +1,78 @@
|
||||
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.75 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:luger_rld" then
|
||||
player:set_wielded_item("rangedweapons:luger")
|
||||
minetest.sound_play("", {player})
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:luger_rld", {
|
||||
------------reload--------------------
|
||||
minetest.register_tool("rangedweapons:luger_r", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=0.9,y=0.9,z=1.0},
|
||||
description = "***RELOADING LUGER P08***",
|
||||
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: 3-6\n")..core.colorize("#FFFFFF", "Accuracy: 85%\n") ..core.colorize("#FFFFFF", "Mob knockback: 3\n") ..core.colorize("#FFFFFF", "Critical chance: 10%\n") ..core.colorize("#FFFFFF", "Critical damage: 7-11\n") ..core.colorize("#FFFFFF", "Ammunition: 9mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.75\n") ..core.colorize("#FFFFFF", "Gun type: Handgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
|
||||
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_icon = "rangedweapons_luger_icon.png",
|
||||
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)
|
||||
timer = 0
|
||||
local inv = user:get_inventory()
|
||||
if not inv:contains_item("main", "rangedweapons:9mm 1") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=user})
|
||||
return itemstack
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
inv:remove_item("main", "rangedweapons:9mm")
|
||||
end
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:lugershot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_makarov", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
|
||||
obj:setacceleration({x=dir.x * math.random(-1.5,1.5), y=math.random(-1.5,1.5), z=dir.z * math.random(-1.5,1.5)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.75,
|
||||
size = 5,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:luger_rld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
rangedweapons_shoot_gun(itemstack, user)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:luger',
|
||||
recipe = {
|
||||
{'', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'', '', 'default:tree'},
|
||||
{'', '', ''},
|
||||
}
|
||||
})
|
||||
|
||||
local rangedweapons_lugershot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_lugershot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.165 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:lugershot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 10 then
|
||||
local damage = math.random(7,11)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 6},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(3,6)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 3},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 10 then
|
||||
local damage = math.random(7,11)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(3,6)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:lugershot", rangedweapons_lugershot )
|
||||
|
||||
|
||||
|
230
m16.lua
@ -1,177 +1,73 @@
|
||||
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_craftitem("rangedweapons:m16", {
|
||||
|
||||
minetest.register_tool("rangedweapons:m16_r", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=1.75,y=1.75,z=1.3},
|
||||
description = "" ..core.colorize("#35cdff","Colt M16\n") ..core.colorize("#FFFFFF", "Ranged damage: 4-10\n") ..core.colorize("#FFFFFF", "Accuracy: 80%\n") ..core.colorize("#FFFFFF", "Mob knockback: 3\n")..core.colorize("#FFFFFF", "Critical chance: 9%\n") ..core.colorize("#FFFFFF", "Critical damage: 9-19\n") ..core.colorize("#FFFFFF", "Ammunition: 5.56mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.125\n") ..core.colorize("#FFFFFF", "Gun type: Assault rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 35"),
|
||||
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",
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.125 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:m16" then
|
||||
if not inv:contains_item("main", "rangedweapons:556mm") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:m16" then
|
||||
inv:remove_item("main", "rangedweapons:556mm")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:m16shot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_smg", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 35, y=dir.y * 35, z=dir.z * 35})
|
||||
obj:setacceleration({x=dir.x * math.random(-2.0,2.0), y=math.random(-2.0,2.0), z=dir.z * math.random(-2.0,2.0)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.5,
|
||||
size = 4,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_m16shot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_m16shot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.085 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:m16shot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 9 then
|
||||
local damage = math.random(9,19)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=6},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(4,10)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 3},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 9 then
|
||||
local damage = math.random(9,19)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(4,10)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.register_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_icon = "rangedweapons_m16_icon.png",
|
||||
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,
|
||||
|
||||
minetest.register_entity("rangedweapons:m16shot", rangedweapons_m16shot )
|
||||
inventory_image = "rangedweapons_m16.png",
|
||||
})
|
78
m1991.lua
Normal file
@ -0,0 +1,78 @@
|
||||
|
||||
|
||||
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_icon = "rangedweapons_m1991_icon.png",
|
||||
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,
|
||||
})
|
||||
|
268
m200.lua
@ -1,219 +1,103 @@
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:m200_uld',
|
||||
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_craftitem("rangedweapons:m200_uld", {
|
||||
|
||||
minetest.register_tool("rangedweapons:m200_uld", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=2.1,y=2.1,z=1.4},
|
||||
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: 150/sec of bullet lifetime\n") ..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "Mob knockback: 20\n") ..core.colorize("#FFFFFF", "Critical chance: 50%\n") ..core.colorize("#FFFFFF", "Critical damage: 400/sec of bullet lifetime\n") ..core.colorize("#FFFFFF", "Ammunition: 308.Winchester rounds\n") ..core.colorize("#FFFFFF", "Reload time: 1.75\n") ..core.colorize("#be0d00", "The gun is NOT loaded! (Right-click to load)\n")..core.colorize("#FFFFFF", "Gun type: Rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 64"),
|
||||
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(user)
|
||||
minetest.sound_play("rangedweapons_empty", {user})
|
||||
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,
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.001 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:m200_uld"
|
||||
and inv:contains_item("main", "rangedweapons:308winchester")then
|
||||
if controls.RMB then
|
||||
inv:remove_item("main", "rangedweapons:308winchester")
|
||||
player:set_wielded_item("rangedweapons:m200_rld")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_a", {player})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if timer >= 1.75 and
|
||||
player:get_wielded_item():get_name() == "rangedweapons:m200_rld" then
|
||||
player:set_wielded_item("rangedweapons:m200")
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_b", {player})
|
||||
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",
|
||||
})
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:m200_rld", {
|
||||
minetest.register_tool("rangedweapons:m200_rld", {
|
||||
stack_max= 1,
|
||||
range = 0,
|
||||
wield_scale = {x=2.1,y=2.1,z=1.4},
|
||||
description = "**RELOADING M200 INTERVENTION**",
|
||||
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: 150/sec of bullet lifetime\n")..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "Mob knockback: 20\n") ..core.colorize("#FFFFFF", "Critical chance: 50%\n") ..core.colorize("#FFFFFF", "Critical damage: 400/sec of bullet lifetime\n") ..core.colorize("#FFFFFF", "Ammunition: 308.Winchester rounds\n") ..core.colorize("#FFFFFF", "Reload time: 1.75\n") ..core.colorize("#27a600", "The gun is loaded!\n")..core.colorize("#FFFFFF", "Gun type: Rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 64"),
|
||||
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,
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
wield_scale = {x=2.1,y=2.1,z=1.4},
|
||||
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_icon = "rangedweapons_m200_icon.png",
|
||||
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)
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:m200shot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_rifle_a", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 64, y=dir.y * 64, z=dir.z * 64})
|
||||
obj:setacceleration({x=dir.x * 0, y=0, z=dir.z * 0})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 1.5,
|
||||
size = 8,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:m200_uld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
rangedweapons_shoot_gun(itemstack, user)
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
local rangedweapons_m200shot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_m200shot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.05 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1.6)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:m200shot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 50 then
|
||||
local damage = 400 * self.timer
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 40},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = 150 * self.timer
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 20},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 50 then
|
||||
local damage = 400 * self.timer
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = 150 * self.timer
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:m200shot", rangedweapons_m200shot )
|
||||
|
||||
|
||||
|
209
m60.lua
@ -1,176 +1,53 @@
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:m60',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:steel_ingot', 'default:mese'},
|
||||
{'default:steel_ingot', 'default:steelblock', 'default:steelblock'},
|
||||
{'dye:black', 'default:diamond', 'default:steel_ingot'},
|
||||
}
|
||||
|
||||
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_craftitem("rangedweapons:m60", {
|
||||
minetest.register_tool("rangedweapons:m60", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=2.5,y=2.5,z=1.5},
|
||||
description = "" ..core.colorize("#35cdff","M60\n") ..core.colorize("#FFFFFF", "Ranged damage: 2-6\n") ..core.colorize("#FFFFFF", "Accuracy: 55%\n") ..core.colorize("#FFFFFF", "Mob knockback: 2\n") ..core.colorize("#FFFFFF", "Critical chance: 8%\n") ..core.colorize("#FFFFFF", "Critical damage: 5-10\n") ..core.colorize("#FFFFFF", "Ammunition: 7.26mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.04\n") ..core.colorize("#FFFFFF", "Gun type: heavy machinegun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 30"),
|
||||
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_icon = "rangedweapons_m60_icon.png",
|
||||
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",
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.04 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:m60" then
|
||||
if not inv:contains_item("main", "rangedweapons:726mm") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:m60" then
|
||||
inv:remove_item("main", "rangedweapons:726mm")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:m60shot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_machinegun", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 30, y=dir.y * 30, z=dir.z * 30})
|
||||
obj:setacceleration({x=dir.x * math.random(-4.5,4.5), y=math.random(-4.5,4.5), z=dir.z * math.random(-4.5,4.5)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.25,
|
||||
size = 4,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_m60shot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_m60shot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.11 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:m60shot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 8 then
|
||||
local damage = math.random(5,10)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=4},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(2,6)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 2},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 8 then
|
||||
local damage = math.random(5,10)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(2,6)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:m60shot", rangedweapons_m60shot )
|
133
m79.lua
@ -1,117 +1,48 @@
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:m79_uld',
|
||||
recipe = {
|
||||
{'default:steel_ingot', '', 'default:mese_crystal'},
|
||||
{'default:steelblock', 'default:steelblock', 'default:tree'},
|
||||
{'default:tree', 'default:tree', 'default:tree'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("rangedweapons:m79_uld", {
|
||||
minetest.register_tool("rangedweapons:m79_r", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=2.0,y=2.0,z=2.5},
|
||||
range = 0,
|
||||
description = "" ..core.colorize("#35cdff","M79\n") ..core.colorize("#FFFFFF", "Explosion radius: 2\n") ..core.colorize("#FFFFFF", "Bullet gravitational pull: 5\n") ..core.colorize("#FFFFFF", "Ammunition: 40mm grenades\n") ..core.colorize("#FFFFFF", "Reload time: 1.25\n") ..core.colorize("#be0d00", "The gun is NOT loaded! (Right-click to load)\n")..core.colorize("#FFFFFF", "Gun type:Grenade launcher\n") ..core.colorize("#FFFFFF", "Bullet velocity: 15"),
|
||||
inventory_image = "rangedweapons_m79.png",
|
||||
on_use = function(user)
|
||||
minetest.sound_play("rangedweapons_empty", {user})
|
||||
end,
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.001 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:m79_uld"
|
||||
and inv:contains_item("main", "rangedweapons:40mm")then
|
||||
if controls.RMB then
|
||||
inv:remove_item("main", "rangedweapons:40mm")
|
||||
player:set_wielded_item("rangedweapons:m79_rld")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell_grenade")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_a", {player})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if timer >= 1.25 and
|
||||
player:get_wielded_item():get_name() == "rangedweapons:m79_rld" then
|
||||
player:set_wielded_item("rangedweapons:m79")
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_b", {player})
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:m79_rld", {
|
||||
stack_max= 1,
|
||||
range = 0,
|
||||
wield_scale = {x=2.0,y=2.0,z=2.5},
|
||||
description = "**RELOADING M79**",
|
||||
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", "Explosion radius: 2\n") ..core.colorize("#FFFFFF", "Bullet gravitational pull: 5\n") ..core.colorize("#FFFFFF", "Ammunition: 40mm grenades\n") ..core.colorize("#FFFFFF", "Reload time: 1.25\n") ..core.colorize("#27a600", "The gun is loaded!\n")..core.colorize("#FFFFFF", "Gun type:Grenade launcher\n") ..core.colorize("#FFFFFF", "Bullet velocity: 15"),
|
||||
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,
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
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_icon = "rangedweapons_m79_icon.png",
|
||||
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)
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:he_grenade")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_rocket", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 15, y=dir.y * 15, z=dir.z * 15})
|
||||
obj:setacceleration({x=dir.x * -1, y=-5, z=dir.z * -1})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 1.5,
|
||||
size = 10,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:m79_uld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
rangedweapons_shoot_gun(itemstack, user)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
|
236
makarov.lua
@ -1,192 +1,82 @@
|
||||
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.5 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:makarov_rld" then
|
||||
player:set_wielded_item("rangedweapons:makarov")
|
||||
minetest.sound_play("", {player})
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:makarov_rld", {
|
||||
minetest.register_tool("rangedweapons:makarov_rld", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=0.9,y=0.9,z=1.0},
|
||||
description = "***RELOADING MAKAROV PISTOL***",
|
||||
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", "Ranged damage: 4-6\n")..core.colorize("#FFFFFF", "Accuracy: 90%\n") ..core.colorize("#FFFFFF", "Mob knockback: 3\n") ..core.colorize("#FFFFFF", "Critical chance: 12%\n") ..core.colorize("#FFFFFF", "Critical damage: 8-12\n") ..core.colorize("#FFFFFF", "Ammunition: 9mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.5\n") ..core.colorize("#FFFFFF", "Gun type: Handgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
|
||||
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_icon = "rangedweapons_makarov_icon.png",
|
||||
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)
|
||||
timer = 0
|
||||
local inv = user:get_inventory()
|
||||
if not inv:contains_item("main", "rangedweapons:9mm 1") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=user})
|
||||
return itemstack
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
inv:remove_item("main", "rangedweapons:9mm")
|
||||
end
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:makarovshot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_makarov", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
|
||||
obj:setacceleration({x=dir.x * math.random(-1.0,1.0), y=math.random(-1.0,1.0), z=dir.z * math.random(-1.0,1.0)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.75,
|
||||
size = 5,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:makarov_rld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
rangedweapons_shoot_gun(itemstack, user)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:makarov',
|
||||
recipe = {
|
||||
{'', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'', 'default:mese_crystal_fragment', 'default:tree'},
|
||||
{'', '', 'dye:black'},
|
||||
}
|
||||
})
|
||||
|
||||
local rangedweapons_makarovshot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_makarovshot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.165 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:makarovshot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 12 then
|
||||
local damage = math.random(8,12)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 6},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(4,6)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 3},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 12 then
|
||||
local damage = math.random(8,12)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(4,6)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:makarovshot", rangedweapons_makarovshot )
|
||||
|
||||
|
||||
|
136
milkor.lua
@ -1,121 +1,47 @@
|
||||
minetest.register_craft({
|
||||
output = "rangedweapons:milkor_uld",
|
||||
recipe = {
|
||||
{"default:diamond", "default:steel_ingot", "default:diamond"},
|
||||
{"default:steel_ingot", "default:steelblock", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:steelblock", "default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("rangedweapons:milkor_uld", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=1.75,y=1.75,z=2.0},
|
||||
range = 0,
|
||||
description = "" ..core.colorize("#35cdff","Milkor\n") ..core.colorize("#FFFFFF", "Explosion radius: 2\n") ..core.colorize("#FFFFFF", "Bullet gravitational pull: 5\n") ..core.colorize("#FFFFFF", "Ammunition: 40mm grenades\n") ..core.colorize("#FFFFFF", "Reload time: 0.70\n") ..core.colorize("#be0d00", "The gun is NOT loaded! (Right-click to load)\n")..core.colorize("#FFFFFF", "Gun type:Grenade launcher\n") ..core.colorize("#FFFFFF", "Bullet velocity: 15"),
|
||||
inventory_image = "rangedweapons_milkor.png",
|
||||
on_use = function(user)
|
||||
minetest.sound_play("rangedweapons_empty", {user})
|
||||
end,
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.001 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:milkor_uld"
|
||||
and inv:contains_item("main", "rangedweapons:40mm")then
|
||||
if controls.RMB then
|
||||
inv:remove_item("main", "rangedweapons:40mm")
|
||||
player:set_wielded_item("rangedweapons:milkor_rld")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell_grenade")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_a", {player})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if timer >= 0.70 and
|
||||
player:get_wielded_item():get_name() == "rangedweapons:milkor_rld" then
|
||||
player:set_wielded_item("rangedweapons:milkor")
|
||||
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_b", {player})
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:milkor_rld", {
|
||||
minetest.register_tool("rangedweapons:milkor_rld", {
|
||||
stack_max= 1,
|
||||
range = 0,
|
||||
wield_scale = {x=1.75,y=1.75,z=2.0},
|
||||
description = "**RELOADING MILKOR MGL**",
|
||||
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", "Explosion radius: 2\n") ..core.colorize("#FFFFFF", "Bullet gravitational pull: 4\n") ..core.colorize("#FFFFFF", "Ammunition: 40mm grenades\n") ..core.colorize("#FFFFFF", "Reload time: 0.70\n") ..core.colorize("#27a600", "The gun is loaded!\n")..core.colorize("#FFFFFF", "Gun type:Grenade launcher\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
|
||||
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,
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
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_icon = "rangedweapons_milkor_icon.png",
|
||||
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)
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:he_grenade")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_rocket", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
|
||||
obj:setacceleration({x=dir.x * -1, y=-4, z=dir.z * -1})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 1.5,
|
||||
size = 10,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:milkor_uld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
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,
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
216
minigun.lua
@ -1,182 +1,52 @@
|
||||
if minigun_aswell == true then
|
||||
if minetest.settings:get_bool("minigun_aswell") then
|
||||
|
||||
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_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_craftitem("rangedweapons:minigun", {
|
||||
minetest.register_tool("rangedweapons:minigun", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=4.0,y=4.0,z=4.0},
|
||||
description = "" ..core.colorize("#35cdff","MINI-GUN\n") ..core.colorize("#FFFFFF", "Ranged damage: 5-13\n") ..core.colorize("#FFFFFF", "Accuracy: 50%\n") ..core.colorize("#FFFFFF", "Mob knockback: 3\n") ..core.colorize("#FFFFFF", "Critical chance: 12%\n") ..core.colorize("#FFFFFF", "Critical damage: 12-25\n") ..core.colorize("#FFFFFF", "Ammunition: 7.26mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.025\n") ..core.colorize("#FFFFFF", "Gun type: heavy machinegun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 30"),
|
||||
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_icon = "rangedweapons_minigun_icon.png",
|
||||
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",
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.025 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:minigun" then
|
||||
if not inv:contains_item("main", "rangedweapons:726mm") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:minigun" then
|
||||
inv:remove_item("main", "rangedweapons:726mm")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:minigunshot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_machinegun", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 30, y=dir.y * 30, z=dir.z * 30})
|
||||
obj:setacceleration({x=dir.x * math.random(-5.0,5.0), y=math.random(-5.0,5.0), z=dir.z * math.random(-5.0,5.0)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.15,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_minigunshot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_minigunshot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.11 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:minigunshot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 12 then
|
||||
local damage = math.random(12,25)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=6},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(5,13)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 3},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 12 then
|
||||
local damage = math.random(12,25)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(5,13)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if self.timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.04,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "doors:door_wood_a" or
|
||||
node.name == "doors:door_wood_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:minigunshot", rangedweapons_minigunshot )
|
||||
|
||||
end
|
54
misc.lua
@ -29,72 +29,22 @@ 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_craft({
|
||||
output = "rangedweapons:gunsteel_ingot",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:tin_ingot", "default:coal_lump"},
|
||||
}
|
||||
})
|
||||
|
||||
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_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 = {
|
||||
{"default:tree", "default:coal_lump", "default:tree"},
|
||||
{"default:coal_lump", "default:tree", "default:coal_lump"},
|
||||
}
|
||||
})
|
||||
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_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"},
|
||||
}
|
||||
})
|
||||
|
||||
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",
|
||||
})
|
||||
|
||||
local rangedweapons_smoke = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.5, y=0.5},
|
||||
textures = {"tnt_smoke.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_smoke.on_step = function(self, dtime, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
if self.lastpos.x ~= nil then
|
||||
if self.timer > 0.30 then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:smoke", rangedweapons_smoke )
|
||||
|
||||
|
4
mod.conf
Normal file
@ -0,0 +1,4 @@
|
||||
name = rangedweapons
|
||||
description = A mod that adds guns and throwable weapons
|
||||
depends = default, tnt
|
||||
optional_depends = doors, xpanes, vessels, moreores, 3d_armor
|
226
mp40.lua
@ -1,177 +1,63 @@
|
||||
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_craftitem("rangedweapons:mp40", {
|
||||
stack_max= 1,
|
||||
minetest.register_tool("rangedweapons:mp40_r", {
|
||||
wield_scale = {x=1.75,y=1.75,z=1.5},
|
||||
description = "" ..core.colorize("#35cdff","MP-40\n") ..core.colorize("#FFFFFF", "Ranged damage: 3-6\n") ..core.colorize("#FFFFFF", "accuracy: 70%\n") ..core.colorize("#FFFFFF", "Mob knockback: 0\n") ..core.colorize("#FFFFFF", "Critical chance: 8%\n") ..core.colorize("#FFFFFF", "Critical damage: 5-11\n") ..core.colorize("#FFFFFF", "Ammunition: 9mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.14\n") ..core.colorize("#FFFFFF", "Gun type: sub-machinegun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
|
||||
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},
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.14 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:mp40" then
|
||||
if not inv:contains_item("main", "rangedweapons:9mm") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:mp40" then
|
||||
inv:remove_item("main", "rangedweapons:9mm")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:mp40shot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_beretta", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 25, y=dir.y * 25, z=dir.z * 25})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.0,3.0), y=math.random(-3.0,3.0), z=dir.z * math.random(-3.0,3.0)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.30,
|
||||
size = 4,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
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_icon = "rangedweapons_mp40_icon.png",
|
||||
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,
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_mp40shot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_mp40shot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.16 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:mp40shot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 8 then
|
||||
local damage = math.random(5,11)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=0},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(3,6)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 0},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 8 then
|
||||
local damage = math.random(5,11)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(3,6)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:mp40shot", rangedweapons_mp40shot )
|
||||
})
|
||||
|
228
mp5.lua
@ -1,178 +1,68 @@
|
||||
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_craftitem("rangedweapons:mp5", {
|
||||
minetest.register_tool("rangedweapons:mp5_r", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=1.75,y=1.75,z=1.20},
|
||||
description = "" ..core.colorize("#35cdff","MP5\n") ..core.colorize("#FFFFFF", "Ranged damage: 3-7\n") ..core.colorize("#FFFFFF", "Accuracy: 74%\n") ..core.colorize("#FFFFFF", "Mob knockback: 1\n") ..core.colorize("#FFFFFF", "Critical chance: 7%\n") ..core.colorize("#FFFFFF", "Critical damage: 7-13\n") ..core.colorize("#FFFFFF", "Ammunition: 10mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.10\n") ..core.colorize("#FFFFFF", "Gun type: Sub-machinegun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
|
||||
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",
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.10 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:mp5" then
|
||||
if not inv:contains_item("main", "rangedweapons:10mm") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:mp5" then
|
||||
inv:remove_item("main", "rangedweapons:10mm")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:mp5shot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_machine_pistol", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 25, y=dir.y * 25, z=dir.z * 25})
|
||||
obj:setacceleration({x=dir.x * math.random(-2.6,2.6), y=math.random(-2.6,2.6), z=dir.z * math.random(-2.6,2.6)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell_white")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.35,
|
||||
size = 4,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_mp5shot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_mp5shot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.12 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:mp5shot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 7 then
|
||||
local damage = math.random(7,13)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=2},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(3,7)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 1},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 7 then
|
||||
local damage = math.random(7,13)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(3,7)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.register_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_entity("rangedweapons:mp5shot", rangedweapons_mp5shot )
|
||||
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_icon = "rangedweapons_mp5_icon.png",
|
||||
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,
|
||||
})
|
||||
|
240
python.lua
@ -1,228 +1,52 @@
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:python_uld',
|
||||
recipe = {
|
||||
{'rangedweapons:gunsteel_ingot', 'default:diamond', 'default:mese_crystal_fragment'},
|
||||
{'rangedweapons:gunsteel_ingot', 'default:diamond', 'rangedweapons:gunsteel_ingot'},
|
||||
{'', 'default:mese_crystal', 'default:tree'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:python_uld',
|
||||
recipe = {
|
||||
{'moreores:silver_ingot', 'default:diamond', 'default:mese_crystal_fragment'},
|
||||
{'moreores:silver_ingot', 'default:diamond', 'moreores:silver_ingot'},
|
||||
{'', 'default:mese_crystal', 'default:tree'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("rangedweapons:python_uld", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=1.25,y=1.25,z=1.1},
|
||||
range = 0,
|
||||
description = "" ..core.colorize("#35cdff","Colt Python \n") ..core.colorize("#FFFFFF", "Ranged damage: 10-15\n") ..core.colorize("#FFFFFF", "Accuracy: 95%\n") ..core.colorize("#FFFFFF", "Mob knockback: 8\n") ..core.colorize("#FFFFFF", "Critical chance: 32%\n") ..core.colorize("#FFFFFF", "Critical damage: 20-35\n") ..core.colorize("#FFFFFF", "Ammunition: .357 Magnum rounds\n") ..core.colorize("#FFFFFF", "Reload time: 0.3\n") ..core.colorize("#be0d00", "The gun is NOT loaded! (Right-click to load)\n")..core.colorize("#FFFFFF", "Gun type: Revolver\n") ..core.colorize("#FFFFFF", "Bullet velocity: 50"),
|
||||
inventory_image = "rangedweapons_python.png",
|
||||
on_use = function(user)
|
||||
minetest.sound_play("rangedweapons_empty", {user})
|
||||
end,
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.001 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:python_uld"
|
||||
and inv:contains_item("main", "rangedweapons:357")then
|
||||
if controls.RMB then
|
||||
inv:remove_item("main", "rangedweapons:357")
|
||||
player:set_wielded_item("rangedweapons:python_rld")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_b", {player})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if timer >= 0.3 and
|
||||
player:get_wielded_item():get_name() == "rangedweapons:python_rld" then
|
||||
player:set_wielded_item("rangedweapons:python")
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_a", {player})
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:python_rld", {
|
||||
minetest.register_tool("rangedweapons:python_rld", {
|
||||
stack_max= 1,
|
||||
range = 0,
|
||||
wield_scale = {x=1.25,y=1.25,z=1.1},
|
||||
description = "**RELOADING COLT PYTHON**",
|
||||
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-15\n")..core.colorize("#FFFFFF", "Accuracy: 95%\n") ..core.colorize("#FFFFFF", "Mob knockback: 8\n") ..core.colorize("#FFFFFF", "Critical chance: 32%\n") ..core.colorize("#FFFFFF", "Critical damage: 20-35\n") ..core.colorize("#FFFFFF", "Ammunition: .357 Magnum rounds\n") ..core.colorize("#FFFFFF", "Reload time: 0.3\n") ..core.colorize("#27a600", "The gun is loaded!\n")..core.colorize("#FFFFFF", "Gun type: Revolver\n") ..core.colorize("#FFFFFF", "Bullet velocity: 50"),
|
||||
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,
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
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_icon = "rangedweapons_python_icon.png",
|
||||
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)
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:pythonshot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_revolver", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 50, y=dir.y * 50, z=dir.z * 50})
|
||||
obj:setacceleration({x=dir.x * math.random(-0.5,0.5), y=math.random(-0.5,0.5), z=dir.z * math.random(-0.5,0.5)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 1.5,
|
||||
size = 8,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:python_uld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
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,
|
||||
})
|
||||
|
||||
local rangedweapons_pythonshot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_pythonshot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.065 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:pythonshot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 32 then
|
||||
local damage = math.random(20,35)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 16},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(10,15)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 8},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 32 then
|
||||
local damage = math.random(20,35)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(10,15)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:pythonshot", rangedweapons_pythonshot )
|
||||
|
||||
|
||||
|
269
remington.lua
@ -1,237 +1,64 @@
|
||||
minetest.register_craft({
|
||||
output = "rangedweapons:remington_uld",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||
{"default:tree", "default:mese_crystal", "default:tree"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("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: 2-7 X 9\n") ..core.colorize("#FFFFFF", "Accuracy: 60%\n") ..core.colorize("#FFFFFF", "Mob knockback: 5\n") ..core.colorize("#FFFFFF", "Critical chance: 3%\n") ..core.colorize("#FFFFFF", "Critical damage: 6-15 X 9\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Reload time: 0.8\n") ..core.colorize("#be0d00", "The gun is NOT loaded! (Right-click to load)\n")..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 15"),
|
||||
inventory_image = "rangedweapons_remington.png",
|
||||
on_use = function(user)
|
||||
minetest.sound_play("rangedweapons_empty", {user})
|
||||
end,
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.001 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:remington_uld"
|
||||
and inv:contains_item("main", "rangedweapons:shell")then
|
||||
if controls.RMB then
|
||||
inv:remove_item("main", "rangedweapons:shell")
|
||||
player:set_wielded_item("rangedweapons:remington_rld")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell_shotgun")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_shotgun_reload_a", {player})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if timer >= 0.8 and
|
||||
player:get_wielded_item():get_name() == "rangedweapons:remington_rld" then
|
||||
player:set_wielded_item("rangedweapons:remington")
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_shotgun_reload_b", {player})
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:remington_rld", {
|
||||
minetest.register_tool("rangedweapons:remington_rld", {
|
||||
stack_max= 1,
|
||||
range = 0,
|
||||
wield_scale = {x=1.9,y=1.9,z=1.1},
|
||||
description = "**RELOADING REMINGTON870**",
|
||||
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: 2-7 X 9\n") ..core.colorize("#FFFFFF", "Accuracy: 60%\n")..core.colorize("#FFFFFF", "Mob knockback: 5\n") ..core.colorize("#FFFFFF", "Critical chance: 3%\n") ..core.colorize("#FFFFFF", "Critical damage: 6-15 X 9\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Reload time: 0.8\n") ..core.colorize("#27a600", "The gun is loaded!\n")..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 15"),
|
||||
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,
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
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_icon = "rangedweapons_remington_icon.png",
|
||||
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)
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:remingtonshot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_shotgun_shot", {object=obj})
|
||||
obj:setvelocity({x=dir.x * math.random(13,17), y=dir.y * math.random(13,17), z=dir.z * math.random(13,17)})
|
||||
obj:setacceleration({x=dir.x * math.random(-4.0,4.0), y=math.random(-4.0,4.0), z=dir.z * math.random(-4.0,4.0)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:remingtonshot")
|
||||
obj:setvelocity({x=dir.x * math.random(13,17), y=dir.y * math.random(13,17), z=dir.z * math.random(13,17)})
|
||||
obj:setacceleration({x=dir.x * math.random(-4.0,4.0), y=math.random(-4.0,4.0), z=dir.z * math.random(-4.0,4.0)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:remingtonshot")
|
||||
obj:setvelocity({x=dir.x * math.random(13,17), y=dir.y * math.random(13,17), z=dir.z * math.random(13,17)})
|
||||
obj:setacceleration({x=dir.x * math.random(-4.0,4.0), y=math.random(-4.0,4.0), z=dir.z * math.random(-4.0,4.0)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:remingtonshot")
|
||||
obj:setvelocity({x=dir.x * math.random(13,17), y=dir.y * math.random(13,17), z=dir.z * math.random(13,17)})
|
||||
obj:setacceleration({x=dir.x * math.random(-4.0,4.0), y=math.random(-4.0,4.0), z=dir.z * math.random(-4.0,4.0)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:remingtonshot")
|
||||
obj:setvelocity({x=dir.x * math.random(13,17), y=dir.y * math.random(13,17), z=dir.z * math.random(13,17)})
|
||||
obj:setacceleration({x=dir.x * math.random(-4.0,4.0), y=math.random(-4.0,4.0), z=dir.z * math.random(-4.0,4.0)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:remingtonshot")
|
||||
obj:setvelocity({x=dir.x * math.random(13,17), y=dir.y * math.random(13,17), z=dir.z * math.random(13,17)})
|
||||
obj:setacceleration({x=dir.x * math.random(-4.0,4.0), y=math.random(-4.0,4.0), z=dir.z * math.random(-4.0,4.0)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:remingtonshot")
|
||||
obj:setvelocity({x=dir.x * math.random(13,17), y=dir.y * math.random(13,17), z=dir.z * math.random(13,17)})
|
||||
obj:setacceleration({x=dir.x * math.random(-4.0,4.0), y=math.random(-4.0,4.0), z=dir.z * math.random(-4.0,4.0)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:remingtonshot")
|
||||
obj:setvelocity({x=dir.x * math.random(13,17), y=dir.y * math.random(13,17), z=dir.z * math.random(13,17)})
|
||||
obj:setacceleration({x=dir.x * math.random(-4.0,4.0), y=math.random(-4.0,4.0), z=dir.z * math.random(-4.0,4.0)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:remingtonshot")
|
||||
obj:setvelocity({x=dir.x * math.random(13,17), y=dir.y * math.random(13,17), z=dir.z * math.random(13,17)})
|
||||
obj:setacceleration({x=dir.x * math.random(-4.0,4.0), y=math.random(-4.0,4.0), z=dir.z * math.random(-4.0,4.0)})
|
||||
-----------------------------------------------------
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 1.25,
|
||||
size = 10,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:remington_uld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
rangedweapons_shoot_gun(itemstack, user)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
local rangedweapons_remingtonshot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.1, y=0.1},
|
||||
textures = {"rangedweapons_buckball.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_remingtonshot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.3 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1.25)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:remingtonshot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 3 then
|
||||
local damage = math.random(6,15)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 10},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(2,7)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 5},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 3 then
|
||||
local damage = math.random(6,15)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(2,7)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_wood_a" or
|
||||
node.name == "doors:door_wood_b" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:remingtonshot", rangedweapons_remingtonshot )
|
||||
|
||||
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,
|
||||
})
|
||||
|
||||
|
152
rpg.lua
@ -1,106 +1,74 @@
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:rpg_uld',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:steel_ingot', ''},
|
||||
{'default:steelblock', 'default:tree', 'default:diamondblock'},
|
||||
{'default:diamond', 'default:tree', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("rangedweapons:rpg_uld", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=2.5,y=2.5,z=3.75},
|
||||
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,
|
||||
description = "" ..core.colorize("#35cdff","rpg\n") ..core.colorize("#FFFFFF", "Explosion radius: 3\n") ..core.colorize("#FFFFFF", "Ammunition: rockets\n") ..core.colorize("#FFFFFF", "Reload time: 1.0\n") ..core.colorize("#be0d00", "The gun is NOT loaded! (Right-click to load)\n")..core.colorize("#FFFFFF", "Gun type:Rocket launcher\n") ..core.colorize("#FFFFFF", "Bullet velocity: 15"),
|
||||
inventory_image = "rangedweapons_rpg.png",
|
||||
on_use = function(user)
|
||||
minetest.sound_play("rangedweapons_empty", {user})
|
||||
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_icon = "rangedweapons_rpg_icon.png",
|
||||
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,
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.001 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:rpg_uld"
|
||||
and inv:contains_item("main", "rangedweapons:rocket")then
|
||||
if controls.RMB then
|
||||
inv:remove_item("main", "rangedweapons:rocket")
|
||||
player:set_wielded_item("rangedweapons:rpg_rld")
|
||||
end
|
||||
timer = 0
|
||||
minetest.sound_play("", {player})
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
if timer >= 1.25 and
|
||||
player:get_wielded_item():get_name() == "rangedweapons:rpg_rld" then
|
||||
player:set_wielded_item("rangedweapons:rpg")
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_b", {player})
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:rpg_rld", {
|
||||
stack_max= 1,
|
||||
range = 0,
|
||||
wield_scale = {x=2.5,y=2.5,z=3.75},
|
||||
description = "**RELOADING rpg**",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
inventory_image = "rangedweapons_rpg.png",
|
||||
})
|
||||
|
||||
|
||||
minetest.register_tool("rangedweapons:rpg", {
|
||||
description = "" ..core.colorize("#35cdff","rpg\n") ..core.colorize("#FFFFFF", "Explosion radius: 3\n") ..core.colorize("#FFFFFF", "Ammunition: rockets\n") ..core.colorize("#FFFFFF", "Reload time: 1.0\n") ..core.colorize("#27a600", "The gun is loaded!\n")..core.colorize("#FFFFFF", "Gun type:Rocket launcher\n") ..core.colorize("#FFFFFF", "Bullet velocity: 15"),
|
||||
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,
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
wield_scale = {x=2.5,y=2.5,z=3.75},
|
||||
inventory_image = "rangedweapons_rpg_rld.png",
|
||||
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_icon = "rangedweapons_rpg_icon.png",
|
||||
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)
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:rocket")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_rocket", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 15, y=dir.y * 15, z=dir.z * 15})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 1.5,
|
||||
size = 10,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:rpg_uld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
rangedweapons_shoot_gun(itemstack, user)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
226
rpk.lua
@ -1,176 +1,76 @@
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:rpk',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:mese', ''},
|
||||
{'default:steel_ingot', 'default:steelblock', 'default:tree'},
|
||||
{'', 'default:diamond', 'default:steel_ingot'},
|
||||
}
|
||||
|
||||
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_craftitem("rangedweapons:rpk", {
|
||||
minetest.register_tool("rangedweapons:rpk_rr", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=2.5,y=2.5,z=1.5},
|
||||
description = "" ..core.colorize("#35cdff","RPK\n") ..core.colorize("#FFFFFF", "Ranged damage: 2-5\n") ..core.colorize("#FFFFFF", "Accuracy: 55%\n") ..core.colorize("#FFFFFF", "Mob knockback: 2\n") ..core.colorize("#FFFFFF", "Critical chance: 8%\n") ..core.colorize("#FFFFFF", "Critical damage: 4-9\n") ..core.colorize("#FFFFFF", "Ammunition: 7.26mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.05\n") ..core.colorize("#FFFFFF", "Gun type: heavy machinegun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 30"),
|
||||
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",
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.05 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:rpk" then
|
||||
if not inv:contains_item("main", "rangedweapons:726mm") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:rpk" then
|
||||
inv:remove_item("main", "rangedweapons:726mm")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:rpkshot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_machinegun", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 30, y=dir.y * 30, z=dir.z * 30})
|
||||
obj:setacceleration({x=dir.x * math.random(-4.5,4.5), y=math.random(-4.5,4.5), z=dir.z * math.random(-4.5,4.5)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.25,
|
||||
size = 4,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
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",
|
||||
})
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_rpkshot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_rpkshot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
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_icon = "rangedweapons_rpk_icon.png",
|
||||
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,
|
||||
|
||||
if self.timer > 0.11 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:rpkshot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 8 then
|
||||
local damage = math.random(4,9)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=4},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(2,5)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 2},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 8 then
|
||||
local damage = math.random(4,9)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(2,5)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
inventory_image = "rangedweapons_rpk.png",
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:rpkshot", rangedweapons_rpkshot )
|
230
scar.lua
@ -1,177 +1,75 @@
|
||||
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_craftitem("rangedweapons:scar", {
|
||||
minetest.register_tool("rangedweapons:scar_r", {
|
||||
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-24\n") ..core.colorize("#FFFFFF", "Accuracy: 85%\n") ..core.colorize("#FFFFFF", "Mob knockback: 6\n")..core.colorize("#FFFFFF", "Critical chance: 14%\n") ..core.colorize("#FFFFFF", "Critical damage: 20-42\n") ..core.colorize("#FFFFFF", "Ammunition: 7.26mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.15\n") ..core.colorize("#FFFFFF", "Gun type: Assault rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 45"),
|
||||
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",
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.15 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:scar" then
|
||||
if not inv:contains_item("main", "rangedweapons:726mm") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:scar" then
|
||||
inv:remove_item("main", "rangedweapons:726mm")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:scarshot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_ak", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 45, y=dir.y * 45, z=dir.z * 45})
|
||||
obj:setacceleration({x=dir.x * math.random(-1.5,1.5), y=math.random(-1.5,1.5), z=dir.z * math.random(-1.5,1.5)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.5,
|
||||
size = 4,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
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_icon = "rangedweapons_scar_icon.png",
|
||||
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",
|
||||
})
|
||||
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_scarshot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_scarshot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.06 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:scarshot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 14 then
|
||||
local damage = math.random(20,42)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=12},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(9,24)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 6},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 14 then
|
||||
local damage = math.random(20,42)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(9,24)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:scarshot", rangedweapons_scarshot )
|
45
settings.lua
@ -1,20 +1,29 @@
|
||||
-- change "true" to "false" in order to disable a feature, or
|
||||
-- "false" to "true" to enable it
|
||||
|
||||
explosives = true
|
||||
javelins = true
|
||||
shurikens = true
|
||||
handguns = true
|
||||
shotguns = true
|
||||
rifles = true
|
||||
magnums_and_revolvers = true
|
||||
machine_pistols = true
|
||||
sub_machineguns = true
|
||||
assault_rifles = true
|
||||
power_weapons = true
|
||||
glass_breaking = true
|
||||
door_breaking = true
|
||||
heavy_machineguns = true
|
||||
minigun_aswell = true
|
||||
rweapons_player_dmg_multiplier = 1.0
|
||||
rweapons_mob_dmg_multiplier = 1.0
|
||||
rweapons_headshot_dmg_multiplier = 1.75
|
||||
rweapons_max_gun_efficiency = 300
|
||||
rweapons_min_gun_efficiency = 40
|
||||
rweapons_bloodyness = 10
|
||||
|
||||
|
||||
rweapons_gun_crafting = "true"
|
||||
rweapons_gun_durability = "true"
|
||||
rweapons_shurikens = "true"
|
||||
rweapons_handguns = "true"
|
||||
rweapons_forceguns = "true"
|
||||
rweapons_javelins = "true"
|
||||
rweapons_power_weapons = "true"
|
||||
rweapons_machine_pistols = "true"
|
||||
rweapons_shotguns = "true"
|
||||
rweapons_auto_shotguns = "true"
|
||||
rweapons_smgs = "true"
|
||||
rweapons_rifles = "true"
|
||||
rweapons_assault_rifles = "true"
|
||||
rweapons_heavy_machineguns = "true"
|
||||
rweapons_revolvers = "true"
|
||||
rweapons_explosives = "true"
|
||||
rweapons_glass_breaking = "true"
|
||||
rweapons_door_breaking = "true"
|
||||
rweapons_other_weapon_crafting = "true"
|
||||
rweapons_ammo_crafting = "true"
|
||||
rweapons_item_crafting = "true"
|
||||
|
1040
shurikens.lua
154
skills.lua
Normal file
@ -0,0 +1,154 @@
|
||||
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 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 > rweapons_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 > rweapons_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 > rweapons_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 > rweapons_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 > rweapons_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 > rweapons_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 > rweapons_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 > rweapons_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 > rweapons_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/hit.ogg
Normal file
BIN
sounds/rangedweapons_handgun_mag_in.ogg
Normal file
BIN
sounds/rangedweapons_handgun_mag_out.ogg
Normal file
BIN
sounds/rangedweapons_rifle_clip_in.ogg
Normal file
BIN
sounds/rangedweapons_rifle_clip_out.ogg
Normal file
BIN
sounds/rangedweapons_rifle_reload_a.ogg
Normal file
BIN
sounds/rangedweapons_rifle_reload_b.ogg
Normal file
BIN
sounds/rangedweapons_shell_insert.ogg
Normal file
BIN
sounds/rengedweapons_ricochet.ogg
Normal file
287
spas12.lua
@ -1,250 +1,63 @@
|
||||
minetest.register_craft({
|
||||
output = "rangedweapons:spas12_uld",
|
||||
recipe = {
|
||||
{"", "default:steel_ingot", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:mese", "default:diamond"},
|
||||
{"rangedweapons:plastic_sheet", "default:diamond", "default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("rangedweapons:spas12_uld", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=2.1,y=2.1,z=1.25},
|
||||
range = 0,
|
||||
description = "" ..core.colorize("#35cdff","Franchi SPAS-12\n") ..core.colorize("#FFFFFF", "Ranged damage: 4-10 X 12\n") ..core.colorize("#FFFFFF", "Accuracy: 67%\n") ..core.colorize("#FFFFFF", "Mob knockback: 7\n") ..core.colorize("#FFFFFF", "Critical chance: 5%\n") ..core.colorize("#FFFFFF", "Critical damage: 10-22 X 12\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Reload time: 0.45\n") ..core.colorize("#be0d00", "The gun is NOT loaded! (Right-click to load)\n")..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
|
||||
inventory_image = "rangedweapons_spas12.png",
|
||||
on_use = function(user)
|
||||
minetest.sound_play("rangedweapons_empty", {user})
|
||||
end,
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.001 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:spas12_uld"
|
||||
and inv:contains_item("main", "rangedweapons:shell")then
|
||||
if controls.RMB then
|
||||
inv:remove_item("main", "rangedweapons:shell")
|
||||
player:set_wielded_item("rangedweapons:spas12_rld")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell_shotgun")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_shotgun_reload_a", {player})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if timer >= 0.45 and
|
||||
player:get_wielded_item():get_name() == "rangedweapons:spas12_rld" then
|
||||
player:set_wielded_item("rangedweapons:spas12")
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_shotgun_reload_b", {player})
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:spas12_rld", {
|
||||
minetest.register_tool("rangedweapons:spas12_rld", {
|
||||
stack_max= 1,
|
||||
range = 0,
|
||||
wield_scale = {x=2.1,y=2.1,z=1.25},
|
||||
description = "**RELOADING FRANCHI SPAS-12**",
|
||||
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","Franchi SPAS-12\n") ..core.colorize("#FFFFFF", "Ranged damage: 4-10 X 12\n") ..core.colorize("#FFFFFF", "Accuracy: 67%\n")..core.colorize("#FFFFFF", "Mob knockback: 7\n") ..core.colorize("#FFFFFF", "Critical chance: 5%\n") ..core.colorize("#FFFFFF", "Critical damage: 10-22 X 12\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Reload time: 0.45\n") ..core.colorize("#27a600", "The gun is loaded!\n")..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
|
||||
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,
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
wield_scale = {x=2.1,y=2.1,z=1.25},
|
||||
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_icon = "rangedweapons_spas12_icon.png",
|
||||
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)
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:spas12shot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_shotgun_shot", {object=obj})
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.3,3.3), y=math.random(-3.3,3.3), z=dir.z * math.random(-3.3,3.3)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:spas12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.3,3.3), y=math.random(-3.3,3.3), z=dir.z * math.random(-3.3,3.3)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:spas12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.3,3.3), y=math.random(-3.3,3.3), z=dir.z * math.random(-3.3,3.3)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:spas12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.3,3.3), y=math.random(-3.3,3.3), z=dir.z * math.random(-3.3,3.3)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:spas12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.3,3.3), y=math.random(-3.3,3.3), z=dir.z * math.random(-3.3,3.3)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:spas12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.3,3.3), y=math.random(-3.3,3.3), z=dir.z * math.random(-3.3,3.3)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:spas12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.3,3.3), y=math.random(-3.3,3.3), z=dir.z * math.random(-3.3,3.3)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:spas12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.3,3.3), y=math.random(-3.3,3.3), z=dir.z * math.random(-3.3,3.3)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:spas12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.3,3.3), y=math.random(-3.3,3.3), z=dir.z * math.random(-3.3,3.3)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:spas12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.3,3.3), y=math.random(-3.3,3.3), z=dir.z * math.random(-3.3,3.3)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:spas12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.3,3.3), y=math.random(-3.3,3.3), z=dir.z * math.random(-3.3,3.3)})
|
||||
-----------------------------------------------------
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:spas12shot")
|
||||
obj:setvelocity({x=dir.x * math.random(18,22), y=dir.y * math.random(18,22), z=dir.z * math.random(18,22)})
|
||||
obj:setacceleration({x=dir.x * math.random(-3.3,3.3), y=math.random(-3.3,3.3), z=dir.z * math.random(-3.3,3.3)})
|
||||
-----------------------------------------------------
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 1.25,
|
||||
size = 10,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:spas12_uld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
rangedweapons_shoot_gun(itemstack, user)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
local rangedweapons_spas12shot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.1, y=0.1},
|
||||
textures = {"rangedweapons_buckball.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_spas12shot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.225 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1.25)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:spas12shot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 5 then
|
||||
local damage = math.random(10,22)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 14},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(4,10)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 7},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 5 then
|
||||
local damage = math.random(10,22)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(4,10)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_wood_a" or
|
||||
node.name == "doors:door_wood_b" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:spas12shot", rangedweapons_spas12shot )
|
||||
|
||||
|
||||
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(user)
|
||||
minetest.sound_play("rangedweapons_empty", {user})
|
||||
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,
|
||||
})
|
||||
|
262
svd.lua
@ -1,219 +1,103 @@
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:svd_uld',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:diamondblock', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'default:tree', 'default:diamond', 'default:tree'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("rangedweapons:svd_uld", {
|
||||
|
||||
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: 80/sec of bullet lifetime\n") ..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "Mob knockback: 14\n") ..core.colorize("#FFFFFF", "Critical chance: 42%\n") ..core.colorize("#FFFFFF", "Critical damage: 200/sec of bullet lifetime\n") ..core.colorize("#FFFFFF", "Ammunition: 308.Winchester rounds\n") ..core.colorize("#FFFFFF", "Reload time: 1.15\n") ..core.colorize("#be0d00", "The gun is NOT loaded! (Right-click to load)\n")..core.colorize("#FFFFFF", "Gun type: Rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 60"),
|
||||
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(user)
|
||||
minetest.sound_play("rangedweapons_empty", {user})
|
||||
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,
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.001 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:svd_uld"
|
||||
and inv:contains_item("main", "rangedweapons:308winchester")then
|
||||
if controls.RMB then
|
||||
inv:remove_item("main", "rangedweapons:308winchester")
|
||||
player:set_wielded_item("rangedweapons:svd_rld")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_a", {player})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if timer >= 1.15 and
|
||||
player:get_wielded_item():get_name() == "rangedweapons:svd_rld" then
|
||||
player:set_wielded_item("rangedweapons:svd")
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_b", {player})
|
||||
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",
|
||||
})
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:svd_rld", {
|
||||
minetest.register_tool("rangedweapons:svd_rld", {
|
||||
stack_max= 1,
|
||||
range = 0,
|
||||
wield_scale = {x=1.9,y=1.9,z=1.1},
|
||||
description = "**RELOADING S.V.D.**",
|
||||
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: 80/sec of bullet lifetime\n")..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "Mob knockback: 14\n") ..core.colorize("#FFFFFF", "Critical chance: 42%\n") ..core.colorize("#FFFFFF", "Critical damage: 200/sec of bullet lifetime\n") ..core.colorize("#FFFFFF", "Ammunition: 308.Winchester rounds\n") ..core.colorize("#FFFFFF", "Reload time: 1.15\n") ..core.colorize("#27a600", "The gun is loaded!\n")..core.colorize("#FFFFFF", "Gun type: Rifle\n") ..core.colorize("#FFFFFF", "Bullet velocity: 60"),
|
||||
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,
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
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_icon = "rangedweapons_svd_icon.png",
|
||||
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)
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:svdshot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_rifle_a", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 60, y=dir.y * 60, z=dir.z * 60})
|
||||
obj:setacceleration({x=dir.x * 0, y=0, z=dir.z * 0})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 1.5,
|
||||
size = 8,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:svd_uld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
rangedweapons_shoot_gun(itemstack, user)
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
local rangedweapons_svdshot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_svdshot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.05 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:svdshot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 80) <= 42 then
|
||||
local damage = 200 * self.timer
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 28},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = 80 * self.timer
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 14},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 42 then
|
||||
local damage = 200 * self.timer
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = 80 * self.timer
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:svdshot", rangedweapons_svdshot )
|
||||
|
||||
|
||||
|
242
taurus.lua
@ -1,228 +1,50 @@
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:taurus_uld',
|
||||
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_uld',
|
||||
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_craftitem("rangedweapons:taurus_uld", {
|
||||
stack_max= 1,
|
||||
wield_scale = {x=1.25,y=1.25,z=1.1},
|
||||
range = 0,
|
||||
description = "" ..core.colorize("#35cdff","Taurus\n") ..core.colorize("#FFFFFF", "Ranged damage: 14-24\n") ..core.colorize("#FFFFFF", "Accuracy: 95%\n") ..core.colorize("#FFFFFF", "Mob knockback: 10\n") ..core.colorize("#FFFFFF", "Critical chance: 36%\n") ..core.colorize("#FFFFFF", "Critical damage: 30-50\n") ..core.colorize("#FFFFFF", "Ammunition: .357 Magnum rounds\n") ..core.colorize("#FFFFFF", "Reload time: 0.35\n") ..core.colorize("#be0d00", "The gun is NOT loaded! (Right-click to load)\n")..core.colorize("#FFFFFF", "Gun type: Revolver\n") ..core.colorize("#FFFFFF", "Bullet velocity: 55"),
|
||||
inventory_image = "rangedweapons_taurus.png",
|
||||
on_use = function(user)
|
||||
minetest.sound_play("rangedweapons_empty", {user})
|
||||
end,
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.001 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if player:get_wielded_item():get_name() == "rangedweapons:taurus_uld"
|
||||
and inv:contains_item("main", "rangedweapons:357")then
|
||||
if controls.RMB then
|
||||
inv:remove_item("main", "rangedweapons:357")
|
||||
player:set_wielded_item("rangedweapons:taurus_rld")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
end
|
||||
end
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_b", {player})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if timer >= 0.35 and
|
||||
player:get_wielded_item():get_name() == "rangedweapons:taurus_rld" then
|
||||
player:set_wielded_item("rangedweapons:taurus")
|
||||
timer = 0
|
||||
minetest.sound_play("rangedweapons_reload_a", {player})
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:taurus_rld", {
|
||||
minetest.register_tool("rangedweapons:taurus_rld", {
|
||||
stack_max= 1,
|
||||
range = 0,
|
||||
wield_scale = {x=1.25,y=1.25,z=1.1},
|
||||
description = "**RELOADING COLT taurus**",
|
||||
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 \n") ..core.colorize("#FFFFFF", "Ranged damage: 14-24\n")..core.colorize("#FFFFFF", "Accuracy: 95%\n") ..core.colorize("#FFFFFF", "Mob knockback: 10\n") ..core.colorize("#FFFFFF", "Critical chance: 36%\n") ..core.colorize("#FFFFFF", "Critical damage: 30-50\n") ..core.colorize("#FFFFFF", "Ammunition: .357 Magnum rounds\n") ..core.colorize("#FFFFFF", "Reload time: 0.35\n") ..core.colorize("#27a600", "The gun is loaded!\n")..core.colorize("#FFFFFF", "Gun type: Revolver\n") ..core.colorize("#FFFFFF", "Bullet velocity: 55"),
|
||||
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,
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
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_icon = "rangedweapons_taurus_icon.png",
|
||||
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)
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:taurusshot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_revolver", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 55, y=dir.y * 55, z=dir.z * 55})
|
||||
obj:setacceleration({x=dir.x * math.random(-0.5,0.5), y=math.random(-0.5,0.5), z=dir.z * math.random(-0.5,0.5)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 1.5,
|
||||
size = 8,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or user
|
||||
itemstack = "rangedweapons:taurus_uld"
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
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,
|
||||
})
|
||||
|
||||
local rangedweapons_taurusshot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_taurusshot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.06 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:taurusshot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 36 then
|
||||
local damage = math.random(30,50)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 20},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(14,24)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 10},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 36 then
|
||||
local damage = math.random(30,50)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(14,24)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:taurusshot", rangedweapons_taurusshot )
|
||||
|
||||
|
||||
|
231
tec9.lua
@ -1,177 +1,72 @@
|
||||
minetest.register_craft({
|
||||
output = 'rangedweapons:tec9',
|
||||
recipe = {
|
||||
{'rangedweapons:plastic_sheet', 'rangedweapons:plastic_sheet', 'rangedweapons:plastic_sheet'},
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:mese_crystal_fragment', 'default:steel_ingot'},
|
||||
}
|
||||
|
||||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:tec9_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", "Ranged damage: 2-4\n") ..core.colorize("#FFFFFF", "accuracy: 75%\n") ..core.colorize("#FFFFFF", "Mob knockback: 0\n") ..core.colorize("#FFFFFF", "Critical chance: 10%\n") ..core.colorize("#FFFFFF", "Critical damage: 4-7\n") ..core.colorize("#FFFFFF", "Ammunition: 9mm rounds\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.2\n") ..core.colorize("#FFFFFF", "Gun type: machine pistol\n") ..core.colorize("#FFFFFF", "Bullet velocity: 20"),
|
||||
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_icon = "rangedweapons_tec9_icon.png",
|
||||
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,
|
||||
})
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime, player)
|
||||
timer = timer + dtime;
|
||||
if timer >= 0.2 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local controls = player:get_player_control()
|
||||
if controls.LMB then
|
||||
timer = 0
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if wielded_item == "rangedweapons:tec9" then
|
||||
if not inv:contains_item("main", "rangedweapons:9mm") then
|
||||
minetest.sound_play("rangedweapons_empty", {object=player})
|
||||
else
|
||||
if wielded_item == "rangedweapons:tec9" then
|
||||
inv:remove_item("main", "rangedweapons:9mm")
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.6
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:tec9shot")
|
||||
if obj then
|
||||
minetest.sound_play("rangedweapons_machine_pistol", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
|
||||
obj:setacceleration({x=dir.x * math.random(-2.5,2.5), y=math.random(-2.5,2.5), z=dir.z * math.random(-2.5,2.5)})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
pos.y = pos.y + 0
|
||||
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
|
||||
minetest.sound_play("", {object=obj})
|
||||
obj:setvelocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
|
||||
obj:setacceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
|
||||
obj:setyaw(yaw + math.pi)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=dir.x * 3, y=dir.y * 3, z=dir.z * 3} ,
|
||||
acceleration = {x=dir.x * -4, y=2, z=dir.z * -4},
|
||||
expirationtime = 0.30,
|
||||
size = 4,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "tnt_smoke.png",
|
||||
glow = 5,
|
||||
})
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
ent.player = ent.player or player
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local rangedweapons_tec9shot = {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.3, y=0.3},
|
||||
textures = {"rangedweapons_invisible.png"},
|
||||
lastpos= {},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
rangedweapons_tec9shot.on_step = function(self, dtime, node, pos)
|
||||
self.timer = self.timer + dtime
|
||||
local tiem = 0.002
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if self.timer > 0.17 then
|
||||
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "rangedweapons:tec9shot" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if math.random(1, 100) <= 10 then
|
||||
local damage = math.random(4,7)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback=0},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(2,4)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage, knockback = 0},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.random(1, 100) <= 10 then
|
||||
local damage = math.random(4,7)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
else
|
||||
local damage = math.random(2,4)
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups= {fleshy = damage},
|
||||
}, nil)
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
if timer >= 0.002 + tiem then
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = 0,
|
||||
acceleration = {x=0, y=0, z=0},
|
||||
expirationtime = 0.06,
|
||||
size = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "rangedweapons_bullet_fly.png",
|
||||
glow = 15,
|
||||
})
|
||||
tiem = tiem + 0.002
|
||||
end
|
||||
if self.timer >= 4.0 then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.lastpos.x ~= nil then
|
||||
if minetest.registered_nodes[node.name].walkable then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
end
|
||||
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
|
||||
if node.name == "rangedweapons:barrel" or
|
||||
node.name == "doors:door_glass_a" or
|
||||
node.name == "doors:door_glass_b" or
|
||||
node.name == "xpanes:pane" or
|
||||
node.name == "xpanes:pane_flat" or
|
||||
node.name == "vessels:drinking_glass" or
|
||||
node.name == "vessels:glass_bottle" or
|
||||
node.name == "default:glass" then
|
||||
minetest.get_node_timer(pos):start(0)
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("rangedweapons:tec9shot", rangedweapons_tec9shot )
|
BIN
textures/rangedweapons_408cheytac.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
textures/rangedweapons_44.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
textures/rangedweapons_45acp.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
textures/rangedweapons_50ae.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
textures/rangedweapons_aa12_icon.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
textures/rangedweapons_aa12_rld.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
textures/rangedweapons_ak47_icon.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
textures/rangedweapons_ak47_rld.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
textures/rangedweapons_antigun_block.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
textures/rangedweapons_arifle_img.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
textures/rangedweapons_assaultrifle_mag.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
textures/rangedweapons_awp_icon.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
textures/rangedweapons_awp_noclip.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
textures/rangedweapons_benelli_icon.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
textures/rangedweapons_beretta_icon.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
textures/rangedweapons_blood.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
textures/rangedweapons_blood_alt.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
textures/rangedweapons_blue_ray.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
textures/rangedweapons_boltaction_img.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.8 KiB |
BIN
textures/rangedweapons_bullethole.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
textures/rangedweapons_bulletshot.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
textures/rangedweapons_crit.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
textures/rangedweapons_crithit.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
textures/rangedweapons_deagle_icon.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
textures/rangedweapons_drum_mag.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
textures/rangedweapons_emergency_ammo_icon.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
textures/rangedweapons_emergency_gun_icon.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
textures/rangedweapons_empty_icon.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
textures/rangedweapons_fire_particle.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
textures/rangedweapons_force_blast.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
textures/rangedweapons_force_bullet.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
textures/rangedweapons_forcegun.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
textures/rangedweapons_g36_icon.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
textures/rangedweapons_g36_rld.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
textures/rangedweapons_glock17_icon.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
textures/rangedweapons_golden_deagle.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
textures/rangedweapons_golden_deagle_icon.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
textures/rangedweapons_golden_deagle_rld.png
Normal file
After Width: | Height: | Size: 3.0 KiB |