Yak shaving
|
@ -0,0 +1,9 @@
|
|||
if minetest.global_exists("armor") and armor.attributes then
|
||||
table.insert(armor.attributes, "bullet_res")
|
||||
end
|
||||
if minetest.global_exists("armor") and armor.attributes then
|
||||
table.insert(armor.attributes, "ammo_save")
|
||||
end
|
||||
if minetest.global_exists("armor") and armor.attributes then
|
||||
table.insert(armor.attributes, "ranged_dmg")
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
minetest.register_node("rangedweapons:antigun_block", {
|
||||
description = "" ..core.colorize("#35cdff","Anti-gun block\n")..core.colorize("#FFFFFF", "Prevents people from using guns, in 10 node radius to each side from this block"),
|
||||
tiles = {"textures/blocks/antigun_block.png"},
|
||||
groups = {choppy = 3, oddly_breakable_by_hand = 3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
minetest.register_craftitem("rangedweapons:308shot", {
|
||||
wield_scale = {x=1.0,y=1.0,z=1.0},
|
||||
inventory_image = "rangedweapons_308_shot.png",
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
local color = {}
|
||||
|
||||
color.white = "#FFFFFF"
|
||||
|
||||
|
||||
return color
|
|
@ -0,0 +1,5 @@
|
|||
local constants = {}
|
||||
|
||||
constants.mod_name = "rangedweapons"
|
||||
|
||||
return constants
|
|
@ -0,0 +1,6 @@
|
|||
local item = {}
|
||||
|
||||
item.title_color = "#35cdff"
|
||||
|
||||
|
||||
return item
|
31
settings.lua
|
@ -1,4 +1,3 @@
|
|||
|
||||
rweapons_player_dmg_multiplier = 1.0
|
||||
rweapons_mob_dmg_multiplier = 1.0
|
||||
rweapons_headshot_dmg_multiplier = 1.75
|
||||
|
@ -8,20 +7,22 @@ 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"
|
||||
|
||||
-- Enable/Disable types of weapons
|
||||
rweapons_allow_throwables = "true"
|
||||
rweapons_allow_handguns = "true"
|
||||
rweapons_allow_revolvers = "true"
|
||||
rweapons_allow_sub_machine_gun = "true"
|
||||
rweapons_allow_machine_pistols = "true"
|
||||
rweapons_allow_machineguns = "true"
|
||||
rweapons_allow_shotguns = "true"
|
||||
rweapons_allow_auto_shotguns = "true"
|
||||
rweapons_allow_rifles = "true"
|
||||
rweapons_allow_auto_rifles = "true"
|
||||
rweapons_allow_explosives = "true"
|
||||
rweapons_allow_power_weapons = "true"
|
||||
rweapons_allow_forceguns = "true"
|
||||
|
||||
rweapons_glass_breaking = "true"
|
||||
rweapons_door_breaking = "true"
|
||||
rweapons_other_weapon_crafting = "true"
|
||||
|
|
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
@ -0,0 +1,66 @@
|
|||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
local colors = dofile(modpath.."/colors.lua")
|
||||
local constants = dofile(modpath.."/constants.lua")
|
||||
|
||||
local weapon = {}
|
||||
|
||||
weapon.weapons = {
|
||||
handgun = {'glock17', 'luger', 'makarov', 'deagle', 'beretta', 'm1991'},
|
||||
revolver = {'python', 'taurus'},
|
||||
rifle = {},
|
||||
auto_rifle = {'ak47', 'g36', 'm16', 'scar'},
|
||||
sniper_rifle = {'awp', 'm200'},
|
||||
shotgun = {'remington', 'spas12', 'benelli'},
|
||||
auto_shotgun = {'aa12', 'jackhammer'},
|
||||
machine_gun = {'rpk', 'm60', 'minigun'},
|
||||
machine_pistol = {'tmp', 'uzi', 'tec9'},
|
||||
sub_machine_gun = {'mp40', 'mp5', 'kriss_sv', 'ump', 'thompson'},
|
||||
force_weapon = {'forcegun'},
|
||||
power_weapon = {'laser_blaster', 'laser_rifle', 'laser_shotgun'},
|
||||
throwable = {'shuriken', 'javelin'},
|
||||
explosive = {'m79', 'milkor', 'rpg', 'hand_grenade'}
|
||||
}
|
||||
|
||||
weapon.weapons_directory = "weapons"
|
||||
|
||||
function weapon.get_weapon_path(modpath, weapon_type, weapon_name)
|
||||
return modpath .. "/" .. weapon.weapons_directory .. "/" .. weapon_type .. "/" .. weapon_name .. ".lua"
|
||||
end
|
||||
|
||||
|
||||
function weapon.get_texture_name(weapon_type, weapon_name, texture_name)
|
||||
return constants.mod_name .. "_" .. weapon_type .. "_" .. weapon_name .. "_" .. texture_name
|
||||
end
|
||||
|
||||
|
||||
function weapon.generate_description(weapon_data)
|
||||
local description = ""
|
||||
local text = {
|
||||
string.format("%s", weapon_data["name"]),
|
||||
string.format("Damage: %d", weapon_data["damage"]),
|
||||
string.format("Accuracy: %d", weapon_data["accuracy"]).."%",
|
||||
string.format("Velocity: %d", weapon_data["velocity"]),
|
||||
string.format("Knockback: %d", weapon_data["knock_back"]),
|
||||
string.format("Critical chance: %d", weapon_data["critical_chance"]).."%",
|
||||
string.format("Critical efficiency: %d", weapon_data["critical_efficiency"]),
|
||||
string.format("Reload delay: %.2f", weapon_data["reload_delay"]),
|
||||
string.format("Capacity: %d", weapon_data["capacity"]),
|
||||
string.format("Ammunition: %s", weapon_data["ammunition_string"]),
|
||||
string.format("Rate of fire: %.2f", weapon_data["fire_rate"]),
|
||||
}
|
||||
|
||||
for i,v in ipairs(text) do
|
||||
if i == 0 then
|
||||
color_text = core.colorize(item.title_color, v)
|
||||
else
|
||||
color_text = core.colorize(colors.white, v)
|
||||
end
|
||||
|
||||
description = description .. color_text
|
||||
end
|
||||
|
||||
return description
|
||||
|
||||
end
|
||||
|
||||
return weapon
|
|
@ -1,3 +1,42 @@
|
|||
local weapon_type = "handgun"
|
||||
local weapon_name = "beretta"
|
||||
|
||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
local item = dofile(modpath.."/item.lua")
|
||||
local weapon = dofile(modpath.."/weapon.lua")
|
||||
local handgun = dofile(modpath.."/weapons".."/handgun".."/handgun.lua")
|
||||
local colors = dofile(modpath.."/colors.lua")
|
||||
local constants = dofile(modpath.."/constants.lua")
|
||||
|
||||
local beretta_data = {
|
||||
name = "Beretta 92",
|
||||
damage = handgun["damage"],
|
||||
accuracy = handgun["accuracy"],
|
||||
velocity = handgun["velocity"],
|
||||
knock_back = handgun["knockback"],
|
||||
critical_chance = handgun["critical_chance"],
|
||||
critical_efficiency = handgun.critical_efficiency,
|
||||
gun_skill = {"handgun_skill",43},
|
||||
capacity = 15,
|
||||
suitable_ammo = {{"rangedweapons:9mm",capacity}},
|
||||
reload_delay = handgun.reload_delay,
|
||||
cool_down = handgun.cool_down,
|
||||
ammunition_string = "9mm Ammo",
|
||||
fire_rate = handgun.fire_rate,
|
||||
magazine = handgun.magazine,
|
||||
icon = weapon.get_texture_name(weapon_type, weapon_name, "icon.png"),
|
||||
texture = weapon.get_texture_name(weapon_type, weapon_name, "texture.png"),
|
||||
reload_icon = weapon.get_texture_name(weapon_type, weapon_name, "reload.png"),
|
||||
unloaded = constants.mod_name .. ":beretta_r",
|
||||
cooling = constants.mod_name .. ":beretta_rld",
|
||||
fire_sound = "rangedweapons_beretta",
|
||||
unload_sound = handgun.unload_sound,
|
||||
gun_projectiles = 1,
|
||||
has_shell = 1,
|
||||
gun_durability = 1150,
|
||||
gun_smokeSize = 5,
|
||||
}
|
||||
|
||||
|
||||
minetest.register_tool("rangedweapons:beretta_rld", {
|
||||
|
@ -7,45 +46,26 @@ minetest.register_tool("rangedweapons:beretta_rld", {
|
|||
range = 0,
|
||||
loaded_gun = "rangedweapons:beretta",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
inventory_image = "rangedweapons_beretta_rld.png",
|
||||
inventory_image = beretta_data["reload_icon"]
|
||||
})
|
||||
|
||||
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",
|
||||
load_sound = handgun["load_sound"],
|
||||
range = 0,
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
inventory_image = "rangedweapons_beretta_rld.png",
|
||||
inventory_image = beretta_data["reload_icon"]
|
||||
})
|
||||
|
||||
minetest.register_tool("rangedweapons:beretta", {
|
||||
description = "" ..core.colorize("#35cdff","Beretta M9\n") ..core.colorize("#FFFFFF", "Gun damage: 4\n")..core.colorize("#FFFFFF", "Accuracy: 94%\n") ..core.colorize("#FFFFFF", "gun knockback: 4\n") ..core.colorize("#FFFFFF", "Gun crit chance: 13%\n")..core.colorize("#FFFFFF", "Critical efficiency: 2.1x\n") ..core.colorize("#FFFFFF", "Reload delay: 0.5\n")..core.colorize("#FFFFFF", "Clip size: 15\n") ..core.colorize("#FFFFFF", "Ammunition: 9x19mm Parabellum\n") ..core.colorize("#FFFFFF", "Rate of fire: 0.4\n") ..core.colorize("#FFFFFF", "Gun type: Handgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
|
||||
description = weapon.generate_description(beretta_data),
|
||||
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",
|
||||
},
|
||||
inventory_image = beretta_data.texture,
|
||||
RW_gun_capabilities = beretta_data,
|
||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||
rangedweapons_reload_gun(itemstack, user)
|
||||
return itemstack
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
-- General defaults for a handgun.
|
||||
|
||||
local handgun = {
|
||||
damage = 4,
|
||||
knockback=4,
|
||||
critical_chance = 15,
|
||||
critical_efficiency = 2,
|
||||
velocity = 25,
|
||||
skill = {"handgun_skill",43},
|
||||
magazine = "rangedweapons:handgun_mag_black",
|
||||
accuracy = 94,
|
||||
fire_rate = 0.9,
|
||||
cool_down = 0.4,
|
||||
reload_delay = 0.5,
|
||||
projectiles = 1,
|
||||
has_shell = 1,
|
||||
durability = 1150,
|
||||
smoke_size = 5,
|
||||
unload_sound = "rangedweapons_handgun_mag_out",
|
||||
}
|
||||
|
||||
return handgun
|