This commit is contained in:
IonicCheese 2025-12-09 14:10:37 -08:00
commit 109fdd3a70
758 changed files with 9158 additions and 38 deletions

View file

@ -1,4 +1,4 @@
# simple-shooter-game
A FPS game for the Luanti Game Engine. Currently very WIP
A FPS game for the [Luanti Game Engine](https://luanti.org). Currently very WIP
PRs welcome!

View file

@ -1,17 +1,12 @@
Lines starting with "!" are high priority
TODO:
- Non-hardcoded maps
- More maps
- GUIs to do everything
- Inventory
- Put privilege restrictions on chatcommands
- Fix the alive_players variable not working right
- A bigger and better map, ideally with hills, few trees, no caves, some rivers, big villages here and there, and 500x500 size
- Random loot spawning in chests in predefined places (inside houses)
- Add a proper licence and give credit to the creators of the mods used
- Make guns zoom in with a crosshair while rightclick is held
- Header, screenshot, and icon
- Polish the game
- Rewrite the main mod from scratch (less than 100 lines, should be easy)
- A scoring system with leaderboards
- Don't override every node's groups, instead just add `fall_damage_add_percent = -100`
-- GUIs to do everything
-- Improve the maps by adding structures
-- Random loot spawning in chests in predefined places (inside houses)
!- Add a proper licence and give credit to the creators of the mods used
!- Make guns zoom in with a crosshair while rightclick is held
-- Header, screenshot, and icon
-- Polish the game
-- Rewrite the main mod from scratch with higher code standards
-- A scoring system with leaderboards

View file

@ -124,12 +124,20 @@ core.register_on_mods_loaded(function()
end
end)
core.register_on_joinplayer(function(player)
core.place_schematic({x = 0, y = 0, z = 0}, core.get_modpath("main") .. "/schematics/map1.mts", 0, nil, false)
player:set_pos({x = 20, y = 26.5, z = 17})
core.register_on_joinplayer(function(player)
core.place_schematic({x=0, y=-10, z=0}, core.get_modpath("main") .. "/schems/spawn.mts", 0, nil, true)
player:set_pos({x=5, y=-9.6, z=8})
player:get_inventory():set_list("main", {})
player:set_inventory_formspec([[
size[8,4]
list[current_player;main;0,0;8,1;]
list[current_player;main;0,1.25;8,3;8]
listring[current_player;main]
]])
local player_name = player:get_player_name()
player_data[player_name] = {
size = player:get_properties().visual_size,
skin = player:get_properties().textures,
@ -157,7 +165,7 @@ core.register_on_respawnplayer(function(player)
local player_name = player:get_player_name()
player:set_pos({x = 20, y = 26.5, z = 17})
player:set_pos({x = map_data.spawn_x, y = map_data.spawn_y, z = map_data.spawn_z})
player:get_inventory():set_list("main", {})
@ -168,33 +176,40 @@ end)
core.register_privilege("match_manager", {description = "Can manage the match", give_to_singleplayer = true})
core.register_chatcommand("load", {
params = "<map>",
privs = {match_manager = true},
description = "Load a map",
func = function(_, param)
map_data = place_map(param)
for _, player in pairs(core.get_connected_players()) do
local player_name = player:get_player_name()
set_player_mode(player, "normal")
player:set_nametag_attributes({color = {a = 0}})
player:set_hp(20)
player:set_pos({x=map_data.spawn_x, y=map_data.spawn_y, z=map_data.spawn_z})
end
end
})
core.register_chatcommand("start", {
params = "",
privs = {match_manager = true},
description = "Start the match",
func = function()
for x = 1, 39 do
for z = 1, 36 do
core.set_node({x = x, y = 25, z = z}, {name = "air"})
end
end
remove_barrier(map_data.size_x, map_data.barrier_level, map_data.size_z)
core.chat_send_all(core.colorize("green", "Match started!"))
alive_players = {}
for _, player in pairs(core.get_connected_players()) do
local player_name = player:get_player_name()
set_player_mode(player, "normal")
player:set_nametag_attributes({color = {a = 0}})
player:set_hp(20)
player:set_properties({
pointable = true, -- allow players to be killable after the match starts
})
inv = player:get_inventory()
inv:add_item("main", "ctf_ranged:ak47_loaded")
inv:add_item("main", "ctf_ranged:ammo 3")
player:set_properties({
pointable = true, -- allow players to be killable after the match starts
})
alive_players[player_name] = "alive"
end
return ""
@ -206,12 +221,10 @@ core.register_chatcommand("reset", {
privs = {match_manager = true},
description = "Reset map",
func = function()
core.place_schematic({x = 0, y = 0, z = 0}, core.get_modpath("main") .. "/schematics/map1.mts", 0, nil, false)
for _, player in pairs(core.get_connected_players()) do
local player_name = player:get_player_name()
player:set_nametag_attributes({color = {a = 255, r = 255, g = 255, b = 255}})
player:set_pos({x = 20, y = 26.5, z = 17})
player:set_pos({x = map_data.spawn_x, y = map_data.spawn_y, z = map_data.spawn_z})
set_player_mode(player, "normal")
player:get_inventory():set_list("main", {})
player:set_properties({

Binary file not shown.

BIN
mods/main/schems/spawn.mts Normal file

Binary file not shown.

25
mods/maps/init.lua Normal file
View file

@ -0,0 +1,25 @@
function place_map(map)
local map_path = core.get_modpath("maps") .. "/maps/"
local map_data = dofile(map_path .. map .. "/map.lua")
local barrier_nodes = {}
core.place_schematic({x=0, y=0, z=0}, map_path .. map .. "/map.mts", 0, nil, true)
if map_data.spawn_x == nil or map_data.spawn_y == nil or map_data.spawn_z == nil then -- set a default spawnpoint if not set
map_data.spawn_x = map_data.size_x / 2
map_data.spawn_y = map_data.barrier_level + 1
map_data.spawn_z = map_data.size_z / 2
end
return map_data
end
function remove_barrier(x, y, z)
for node_x = 1, x - 2 do
for node_z = 1, z - 2 do
core.set_node({x = node_x, y = y - 1, z = node_z}, {name = "air"}) -- account for the fact that lua counts starting at 1... i think.... whatever, it works \_('_')_/
end
end
return ""
end

View file

@ -0,0 +1,13 @@
local map_data = {
size_x = 155,
size_y = 53,
size_z = 147,
barrier_level = 49, -- <- Y level of the barrier
spawn_x = nil,
spawn_y = nil,
spawn_z = nil
}
return map_data

Binary file not shown.

View file

@ -0,0 +1,13 @@
local map_data = {
size_x = 111,
size_y = 64,
size_z = 107,
barrier_level = 60, -- <- Y level of the barrier
spawn_x = nil,
spawn_y = nil,
spawn_z = nil
}
return map_data

BIN
mods/maps/maps/pine/map.mts Normal file

Binary file not shown.

View file

@ -0,0 +1,13 @@
local map_data = {
size_x = 341,
size_y = 83,
size_z = 188,
barrier_level = 79, -- <- Y level of the barrier
spawn_x = nil,
spawn_y = nil,
spawn_z = nil
}
return map_data

Binary file not shown.

3
mods/maps/mod.conf Normal file
View file

@ -0,0 +1,3 @@
name = maps
description = Maps mod for simple-shooter-game
depends = main

View file

@ -0,0 +1,14 @@
Minetest Game mod: Butterflies
==============================
Adds butterflies to the world on mapgen, which can be caught in a net if the
fireflies mod is also enabled.
Authors of source code
----------------------
Shara RedCat (MIT)
Authors of media (textures)
---------------------------
Shara RedCat (CC BY-SA 3.0):
butterflies_butterfly_*.png
butterflies_butterfly_*_animated.png

View file

@ -0,0 +1,121 @@
-- butterflies/init.lua
-- Load support for MT game translation.
local S = minetest.get_translator("butterflies")
-- Legacy compatibility, when pointabilities don't exist, pointable is set to true.
local pointable_compat = not minetest.features.item_specific_pointabilities
-- register butterflies
local butter_list = {
{"white", S("White Butterfly")},
{"red", S("Red Butterfly")},
{"violet", S("Violet Butterfly")}
}
for i in ipairs (butter_list) do
local name = butter_list[i][1]
local desc = butter_list[i][2]
minetest.register_node("butterflies:butterfly_"..name, {
description = desc,
drawtype = "plantlike",
tiles = {{
name = "butterflies_butterfly_"..name.."_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 3
},
}},
inventory_image = "butterflies_butterfly_"..name..".png",
wield_image = "butterflies_butterfly_"..name..".png",
waving = 1,
paramtype = "light",
sunlight_propagates = true,
buildable_to = true,
walkable = false,
pointable = pointable_compat,
groups = {catchable = 1},
selection_box = {
type = "fixed",
fixed = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
},
floodable = true,
on_construct = function(pos)
minetest.get_node_timer(pos):start(1)
end,
on_timer = function(pos, elapsed)
if minetest.get_node_light(pos) < 11 then
minetest.set_node(pos, {name = "butterflies:hidden_butterfly_"..name})
end
minetest.get_node_timer(pos):start(30)
end
})
minetest.register_node("butterflies:hidden_butterfly_"..name, {
drawtype = "airlike",
inventory_image = "butterflies_butterfly_"..name..".png^default_invisible_node_overlay.png",
wield_image = "butterflies_butterfly_"..name..".png^default_invisible_node_overlay.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
pointable = false,
diggable = false,
drop = "",
groups = {not_in_creative_inventory = 1},
floodable = true,
on_construct = function(pos)
minetest.get_node_timer(pos):start(1)
end,
on_timer = function(pos, elapsed)
if minetest.get_node_light(pos) >= 11 then
minetest.set_node(pos, {name = "butterflies:butterfly_"..name})
end
minetest.get_node_timer(pos):start(30)
end
})
end
-- register decoration
minetest.register_decoration({
name = "butterflies:butterfly",
deco_type = "simple",
place_on = {"default:dirt_with_grass"},
place_offset_y = 2,
sidelen = 80,
fill_ratio = 0.005,
biomes = {"grassland", "deciduous_forest"},
y_max = 31000,
y_min = 1,
decoration = {
"butterflies:butterfly_white",
"butterflies:butterfly_red",
"butterflies:butterfly_violet"
},
spawn_by = "group:flower",
num_spawn_by = 1
})
-- get decoration ID
local butterflies = minetest.get_decoration_id("butterflies:butterfly")
minetest.set_gen_notify({decoration = true}, {butterflies})
-- start nodetimers
minetest.register_on_generated(function(minp, maxp, blockseed)
local gennotify = minetest.get_mapgen_object("gennotify")
local poslist = {}
for _, pos in ipairs(gennotify["decoration#"..butterflies] or {}) do
local deco_pos = {x = pos.x, y = pos.y + 3, z = pos.z}
table.insert(poslist, deco_pos)
end
if #poslist ~= 0 then
for i = 1, #poslist do
local pos = poslist[i]
minetest.get_node_timer(pos):start(1)
end
end
end)

View file

@ -0,0 +1,58 @@
License of source code
----------------------
The MIT License (MIT)
Copyright (c) 2018 Shara RedCat
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
For more details:
https://opensource.org/licenses/MIT
Licenses of media (textures)
----------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2018 Shara RedCat
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.
For more details:
http://creativecommons.org/licenses/by-sa/3.0/

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Бяла пеперуда
Red Butterfly=Червена пеперуда
Violet Butterfly=Лилава пеперуда

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Hvid sommerfugl
Red Butterfly=Rød sommerfugl
Violet Butterfly=Violet sommerfugl

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Weißer Schmetterling
Red Butterfly=Roter Schmetterling
Violet Butterfly=Violetter Schmetterling

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Blanka papilio
Red Butterfly=Ruĝa papilio
Violet Butterfly=Violkolora papilio

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Mariposa blanca
Red Butterfly=Mariposa roja
Violet Butterfly=Mariposa violeta

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Tximeleta zuria
Red Butterfly=Tximeleta gorria
Violet Butterfly=Tximeleta morea

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Papillon blanc
Red Butterfly=Papillon rouge
Violet Butterfly=Papillon violet

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Fehér pillangó
Red Butterfly=Vörös pillangó
Violet Butterfly=Lila pillangó

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Kupu-Kupu Putih
Red Butterfly=Kupu-Kupu Merah
Violet Butterfly=Kupu-Kupu Ungu

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Farfalla bianca
Red Butterfly=Farfalla rossa
Violet Butterfly=Farfalla viola

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=白色の蝶
Red Butterfly=赤色の蝶
Violet Butterfly=紫色の蝶

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=lo blabi toldi
Red Butterfly=lo xunre toldi
Violet Butterfly=lo zirpu toldi

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Balts taurenis
Red Butterfly=Sarkans taurenis
Violet Butterfly=Violets taurenis

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Rama-Rama Putih
Red Butterfly=Rama-Rama Merah
Violet Butterfly=Rama-Rama Ungu

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Biały motyl
Red Butterfly=Czerwony motyl
Violet Butterfly=Fioletowy motyl

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Borboleta Branca
Red Butterfly=Borboleta Vermelha
Violet Butterfly=Borboleta Violeta

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Белая бабочка
Red Butterfly=Красная бабочка
Violet Butterfly=Фиолетовая бабочка

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Biely motýlik
Red Butterfly=Červený motýlik
Violet Butterfly=Fialový motýlik

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Vit fjäril
Red Butterfly=Röd fjäril
Violet Butterfly=Violett fjäril

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=Білий метелик
Red Butterfly=Червоний метелик
Violet Butterfly=Фіолетовий метелик

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=白蝴蝶
Red Butterfly=红蝴蝶
Violet Butterfly=紫蝴蝶

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=白蝴蝶
Red Butterfly=紅蝴蝶
Violet Butterfly=紫蝴蝶

View file

@ -0,0 +1,4 @@
# textdomain: butterflies
White Butterfly=
Red Butterfly=
Violet Butterfly=

View file

@ -0,0 +1,3 @@
name = butterflies
description = Minetest Game mod: Butterflies
depends = default, flowers

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

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