Add a weapon mod

master
LoneWolfHT 2019-06-04 18:03:20 -07:00
parent 02117ab3fa
commit 5d08be8a13
6 changed files with 49 additions and 0 deletions

4
mods/vc_weapons/init.lua Normal file
View File

@ -0,0 +1,4 @@
local modpath = minetest.get_modpath("vc_weapons")
dofile(modpath.."/ranged.lua")
dofile(modpath.."/melee.lua")

23
mods/vc_weapons/melee.lua Normal file
View File

@ -0,0 +1,23 @@
minetest.register_tool("vc_weapons:knife", {
description = "Knife",
inventory_image = "weapons_knife.png",
range = 2,
wield_scale = {x = 0.7, y = 0.7, z = 0.7},
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level=0,
damage_groups = {fleshy=4},
},
})
minetest.register_tool("vc_weapons:sword", {
description = "Sword",
inventory_image = "weapons_sword.png",
wield_scale = {x = 1.3, y = 1.5, z = 1},
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
damage_groups = {fleshy=6},
},
sound = {breaks = "default_tool_breaks"},
})

2
mods/vc_weapons/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = vc_weapons
depends = shooter, shooter_guns, default, tnt

View File

@ -0,0 +1,20 @@
for gun, def in pairs(shooter.registered_weapons) do
if gun == "shooter_guns:pistol" then
def.spec.rounds = 10
def.spec.tool_caps = {full_punch_interval=0.25, damage_groups={fleshy=1}}
elseif gun == "shooter_guns:rifle" then
def.spec.rounds = 20
def.spec.tool_caps = {full_punch_interval=0.9, damage_groups={fleshy=4}}
elseif gun == "shooter_guns:shotgun" then
def.spec.rounds = 4
def.spec.spread = 20
def.spec.tool_caps = {full_punch_interval=1.5, damage_groups={fleshy=2}}
elseif gun == "shooter_guns:machine_gun" then
def.spec.rounds = 27
def.spec.tool_caps = {full_punch_interval=0.15, damage_groups={fleshy=1}}
end
def.spec.wear = math.ceil(65535 / def.spec.rounds)
shooter.registered_weapons[gun] = def
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B