Add the game

This commit is contained in:
a-bad-dev 2025-12-06 11:37:08 -04:00
commit 38caa29558
863 changed files with 36331 additions and 0 deletions

View 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)

View 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

View 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")

View file

@ -0,0 +1,3 @@
name = ctf_ranged
depends = ctf_core, rawf, controls, grenades
optional_depends=mobs_mc, mcl_core, mcl_copper

View file

View 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

View 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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Some files were not shown because too many files have changed in this diff Show more