Add on_fire knockback and a few tweaks to guns
This commit is contained in:
parent
f74ea4e0be
commit
748711b073
2 changed files with 15 additions and 2 deletions
|
@ -386,6 +386,15 @@ local function fire_weapon(player, itemstack, spec, extended)
|
|||
if not dir or not pos then
|
||||
return
|
||||
end
|
||||
|
||||
if spec.user_knockback then
|
||||
if vector.distance(player:get_velocity(), vector.new()) < 10 then
|
||||
local vel = vector.multiply(minetest.yaw_to_dir(player:get_look_horizontal()), -spec.user_knockback)
|
||||
vel.y = spec.user_knockback/2
|
||||
player:add_player_velocity(vel)
|
||||
end
|
||||
end
|
||||
|
||||
pos.y = pos.y + player:get_properties().eye_height
|
||||
spec.origin = pos
|
||||
local interval = spec.tool_caps.full_punch_interval
|
||||
|
@ -449,6 +458,7 @@ shooter.fire_weapon = function(player, itemstack, spec)
|
|||
end
|
||||
shooting[name] = true
|
||||
end
|
||||
|
||||
spec.user = name
|
||||
spec.name = itemstack:get_name()
|
||||
spec.wield_idx = player:get_wield_index()
|
||||
|
|
|
@ -42,6 +42,7 @@ shooter.register_weapon("shooter_guns:rifle", {
|
|||
description = "Rifle",
|
||||
inventory_image = "shooter_rifle.png",
|
||||
spec = {
|
||||
user_knockback = 4,
|
||||
rounds = 100,
|
||||
range = 240,
|
||||
step = 30,
|
||||
|
@ -64,12 +65,13 @@ shooter.register_weapon("shooter_guns:shotgun", {
|
|||
description = "Shotgun",
|
||||
inventory_image = "shooter_shotgun.png",
|
||||
spec = {
|
||||
user_knockback = 12,
|
||||
rounds = 12,
|
||||
range = 30,
|
||||
step = 15,
|
||||
shots = 15,
|
||||
spread = 10,
|
||||
tool_caps = {full_punch_interval=1, damage_groups={fleshy=2, ranged=1}},
|
||||
tool_caps = {full_punch_interval=1.5, damage_groups={fleshy=2, ranged=1}},
|
||||
groups = {snappy=3, fleshy=3, oddly_breakable_by_hand=3},
|
||||
sounds = {
|
||||
shot = "shooter_shotgun",
|
||||
|
@ -88,7 +90,8 @@ shooter.register_weapon("shooter_guns:machine_gun", {
|
|||
inventory_image = "shooter_smgun.png",
|
||||
spec = {
|
||||
automatic = true,
|
||||
rounds = 32,
|
||||
user_knockback = 2,
|
||||
rounds = 42,
|
||||
range = 160,
|
||||
step = 20,
|
||||
tool_caps = {full_punch_interval=0.1, damage_groups={fleshy=2, ranged=1}},
|
||||
|
|
Loading…
Reference in a new issue