Massive update (#6)
* Refactor some of the code, multiple bug fixes * Fix something stupid * More bug fixes * LOTS OF STUFF * Make the sniper alot stronger and other changes * Prevent Players from respawning in the middle of a match * Fix stupid mistake * Small update * More updates * Remove minimap access.. and downgrade the sniper class
60
mods/game/ctf_guns/ctf_ranged/custom_controls.lua
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
-- ctf_range/custom_controls.lua
|
||||
|
||||
local player_scope_huds = {}
|
||||
local player_nominal_zooms = {}
|
||||
|
||||
local old_binoculars_update
|
||||
|
||||
local function binoculars_override(player)
|
||||
local new_zoom_fov = 0
|
||||
local w_item = player:get_wielded_item()
|
||||
local scope_zoom = w_item:get_definition().ctf_guns_scope_zoom
|
||||
|
||||
if scope_zoom == nil then
|
||||
-- No gun equipped? check for binoculars
|
||||
if old_binoculars_update ~= nil then
|
||||
old_binoculars_update(player)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
-- Only set property if necessary to avoid player mesh reload
|
||||
if player:get_properties().zoom_fov ~= scope_zoom then
|
||||
player:set_properties({zoom_fov = scope_zoom})
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
if minetest.get_modpath("binoculars") then
|
||||
old_binoculars_update = binoculars.update_player_property
|
||||
binoculars.update_player_property = binoculars_override
|
||||
end
|
||||
|
||||
controls.register_on_press(function(player, control_name)
|
||||
if control_name ~= "zoom" then
|
||||
return
|
||||
end
|
||||
binoculars_override(player)
|
||||
end)
|
||||
controls.register_on_release(function(player, control_name, time)
|
||||
if control_name ~= "zoom" then
|
||||
return
|
||||
end
|
||||
binoculars_override(player)
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
player_scope_huds[player:get_player_name()] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
alignment = { x=0.0, y=0.0 },
|
||||
position = {x = 0.5, y = 0.5},
|
||||
scale = { x=2, y=2 },
|
||||
text = "rangedweapons_empty_icon.png",
|
||||
})
|
||||
end)
|
||||
|
||||
88
mods/game/ctf_guns/ctf_ranged/energy_gen.lua
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
|
||||
local side = "rangedweapons_generator_side.png"
|
||||
|
||||
minetest.register_node("ctf_ranged:energy_gen", {
|
||||
short_description = "Energy Generator",
|
||||
description = "Energy Generator\nPunch to collect Energy Charges",
|
||||
tiles = {
|
||||
"rangedweapons_generator_top.png", -- y+
|
||||
"rangedweapons_generator_bottom.png", -- y-
|
||||
side, -- x+
|
||||
side, -- x-
|
||||
side, -- z+
|
||||
side, -- z-
|
||||
},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 3, oddly_breakable_by_hand = 3},
|
||||
drop = "ctf_ranged:energy_gen",
|
||||
on_construct = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Energy Generator")
|
||||
meta:set_string("formspec", "")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 1)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(3.0)
|
||||
end,
|
||||
on_timer = function (pos, elapsed)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", "ctf_ranged:echarge") then
|
||||
inv:add_item("main", ItemStack("ctf_ranged:echarge 1"))
|
||||
end
|
||||
|
||||
local size = 0
|
||||
if inv:contains_item("main", "ctf_ranged:echarge") then
|
||||
local s = inv:remove_item("main", "ctf_ranged:echarge 99")
|
||||
if s then
|
||||
size = s:get_count()
|
||||
--minetest.log("action", "[ctf_ranged] "..s:get_name().." "..tostring(s:get_count()))
|
||||
inv:add_item("main", ItemStack(s:get_name().." "..tostring(s:get_count())))
|
||||
end
|
||||
end
|
||||
|
||||
if size ~= 0 then
|
||||
meta:set_string("infotext", "Energy Generator ("..tostring(size)..")")
|
||||
else
|
||||
meta:set_string("infotext", "Energy Generator")
|
||||
end
|
||||
|
||||
return true
|
||||
end,
|
||||
on_punch = function (pos, node, puncher, pointed_thing)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
local size = 0
|
||||
|
||||
if inv:contains_item("main", "ctf_ranged:echarge") then
|
||||
local s = inv:remove_item("main", "ctf_ranged:echarge 99")
|
||||
if s then
|
||||
size = s:get_count()
|
||||
end
|
||||
end
|
||||
|
||||
if size ~= 0 then
|
||||
meta:set_string("infotext", "Energy Generator ("..tostring(size)..")")
|
||||
else
|
||||
meta:set_string("infotext", "Energy Generator")
|
||||
end
|
||||
|
||||
if size ~= 0 then
|
||||
local pinv = puncher:get_inventory()
|
||||
pinv:add_item("main", ItemStack("ctf_ranged:echarge "..tostring(size)))
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
if ctf_ranged.settings.craft_energy_weapons == true then
|
||||
minetest.register_craft({
|
||||
output = "ctf_ranged:energy_gen",
|
||||
recipe = {
|
||||
{"", "default:diamond", ""},
|
||||
{"default:diamond", "", "default:diamond"},
|
||||
{"ctf_ranged:gunparte", "default:diamond", "ctf_ranged:gunparte"}
|
||||
}
|
||||
})
|
||||
end
|
||||
12
mods/game/ctf_guns/ctf_ranged/init.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
-- ctf_ranged/init.lua
|
||||
|
||||
local modpath = minetest.get_modpath("ctf_ranged")
|
||||
|
||||
ctf_ranged = {}
|
||||
|
||||
dofile(modpath.."/settings.lua")
|
||||
dofile(modpath.."/wep_logic.lua")
|
||||
dofile(modpath.."/wep_defns.lua")
|
||||
dofile(modpath.."/wep_recipes.lua")
|
||||
dofile(modpath.."/custom_controls.lua")
|
||||
dofile(modpath.."/energy_gen.lua")
|
||||
3
mods/game/ctf_guns/ctf_ranged/mod.conf
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
name = ctf_ranged
|
||||
depends = ctf_core, rawf, controls, grenades
|
||||
optional_depends=mobs_mc, mcl_core, mcl_copper
|
||||
0
mods/game/ctf_guns/ctf_ranged/readme.md
Normal file
45
mods/game/ctf_guns/ctf_ranged/settings.lua
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
ctf_ranged.settings = {}
|
||||
local settings = ctf_ranged.settings
|
||||
|
||||
--[[
|
||||
Settings via `minetest.conf`
|
||||
Includes if it doesn't exist then make it exist
|
||||
]]
|
||||
|
||||
-- Crafting
|
||||
settings.craft_gunparts = minetest.settings:get_bool("ctf_guns.craft_gunparts")
|
||||
if settings.craft_gunparts == nil then
|
||||
settings.craft_gunparts = true
|
||||
-- Allow it to be changed in 1 spot
|
||||
minetest.settings:set_bool("ctf_guns.craft_gunparts", settings.craft_gunparts)
|
||||
end
|
||||
|
||||
settings.craft_ammo = minetest.settings:get_bool("ctf_guns.craft_ammo")
|
||||
if settings.craft_ammo == nil then
|
||||
settings.craft_ammo = true
|
||||
minetest.settings:set_bool("ctf_guns.craft_ammo", settings.craft_ammo)
|
||||
end
|
||||
|
||||
settings.craft_tier1_weapons = minetest.settings:get_bool("ctf_guns.craft_tier1_weapons")
|
||||
if settings.craft_tier1_weapons == nil then
|
||||
settings.craft_tier1_weapons = true
|
||||
minetest.settings:set_bool("ctf_guns.craft_tier1_weapons", settings.craft_tier1_weapons)
|
||||
end
|
||||
|
||||
settings.craft_tier2_weapons = minetest.settings:get_bool("ctf_guns.craft_tier2_weapons")
|
||||
if settings.craft_tier2_weapons == nil then
|
||||
settings.craft_tier2_weapons = true
|
||||
minetest.settings:set_bool("ctf_guns.craft_tier2_weapons", settings.craft_tier2_weapons)
|
||||
end
|
||||
|
||||
settings.craft_tier3_weapons = minetest.settings:get_bool("ctf_guns.craft_tier3_weapons")
|
||||
if settings.craft_tier3_weapons == nil then
|
||||
settings.craft_tier3_weapons = true
|
||||
minetest.settings:set_bool("ctf_guns.craft_tier3_weapons", settings.craft_tier3_weapons)
|
||||
end
|
||||
|
||||
settings.craft_energy_weapons = minetest.settings:get_bool("ctf_guns.craft_energy_weapons")
|
||||
if settings.craft_energy_weapons == nil then
|
||||
settings.craft_energy_weapons = true
|
||||
minetest.settings:set_bool("ctf_guns.craft_energy_weapons", settings.craft_energy_weapons)
|
||||
end
|
||||
14
mods/game/ctf_guns/ctf_ranged/settingtypes.txt
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
[Crafting]
|
||||
|
||||
ctf_guns.craft_gunparts (Craft Gunparts) bool true
|
||||
|
||||
ctf_guns.craft_ammo (Craft Ammo) bool true
|
||||
|
||||
ctf_guns.craft_tier1_weapons (Craft Tier 1 Weapons) bool true
|
||||
|
||||
ctf_guns.craft_tier2_weapons (Craft Tier 2 Weapons) bool true
|
||||
|
||||
ctf_guns.craft_tier3_weapons (Craft Tier 3 Weapons) bool true
|
||||
|
||||
ctf_guns.craft_energy_weapons (Craft Energy Weapons) bool true
|
||||
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_ashotfir.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_click.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_deagle.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_dzap.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_explode.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_m16fire.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_m60fire.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_mk23fire.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_mp5fire.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_pdudegun.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_pistol.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_plasma.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_reload.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_rifle.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_rocket_fire.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_shotgun.ogg
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_terrgun.wav
Normal file
BIN
mods/game/ctf_guns/ctf_ranged/sounds/ctf_ranged_throw.ogg
Normal file
21
mods/game/ctf_guns/ctf_ranged/sounds/license.txt
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
Sounds were taken from the shooter mod. Relevant section from its license.txt:
|
||||
|
||||
License Sounds: freesound.org
|
||||
|
||||
flobert1_20070728.wav by Nonoo - Attribution 3.0 Unported (CC BY 3.0)
|
||||
|
||||
shot.wav by Sergenious - Attribution 3.0 Unported (CC BY 3.0)
|
||||
|
||||
GUNSHOT.WAV by erkanozan - CC0 1.0 Universal (CC0 1.0)
|
||||
|
||||
winchester-rifle-cock-reload.wav by MentalSanityOff - CC0 1.0 Universal (CC0 1.0)
|
||||
|
||||
trigger-with-hammer-fall.wav by Nanashi - CC0 1.0 Universal (CC0 1.0)
|
||||
|
||||
woosh.wav by ReadeOnly - CC0 1.0 Universal (CC0 1.0)
|
||||
|
||||
AGM-114 Hellfire Rocket Missile Launch.flac by qubodup - CC0 1.0 Universal (CC0 1.0)
|
||||
|
||||
Sparkler.aif by Ned Bouhalassa - CC0 1.0 Universal (CC0 1.0)
|
||||
|
||||
explosion10.wav by V-ktor - CC0 1.0 Universal (CC0 1.0)
|
||||
BIN
mods/game/ctf_guns/ctf_ranged/textures/ctf_ranged_ammo.png
Normal file
|
After Width: | Height: | Size: 268 B |
BIN
mods/game/ctf_guns/ctf_ranged/textures/ctf_ranged_bullet.png
Normal file
|
After Width: | Height: | Size: 601 B |
BIN
mods/game/ctf_guns/ctf_ranged/textures/ctf_ranged_bullethole.png
Normal file
|
After Width: | Height: | Size: 596 B |
BIN
mods/game/ctf_guns/ctf_ranged/textures/ctf_ranged_eammo.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/ctf_ranged_ebullet.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/ctf_ranged_echarge.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/ctf_ranged_mini14.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
6
mods/game/ctf_guns/ctf_ranged/textures/license.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
LoneWolfHT, CC-BY 4.0
|
||||
* ctf_ranged_bullethole.png
|
||||
* ctf_ranged_bullet.png
|
||||
|
||||
Stuart Jones - CC0 1.0 Universal (CC0 1.0)
|
||||
* All the other textures in the folder
|
||||
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_10mm.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
|
After Width: | Height: | Size: 3 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_357.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_40mm.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_44.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_45acp.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_50ae.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_556mm.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_762mm.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_9mm.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_aa12.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_ak47.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_awp.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_awp_rld.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_benelli.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_beretta.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
|
After Width: | Height: | Size: 3 KiB |
|
After Width: | Height: | Size: 3 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_blood.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_crit.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_crithit.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_deagle.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3 KiB |
|
After Width: | Height: | Size: 3 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_g11.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_g36.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
BIN
mods/game/ctf_guns/ctf_ranged/textures/rangedweapons_g36_rld.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 2.9 KiB |