Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Parties Feature #1337

Merged
merged 30 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3b82a3b
Add basic parties
Silvager Jul 29, 2024
b70e441
Basic parties working
Silvager Jul 29, 2024
72e7198
Add in full draft of parties
Silvager Jul 30, 2024
681c2e4
fix maxpartysize glitch
Silvager Jul 30, 2024
0181496
Party allocation fix
Silvager Aug 3, 2024
ae78c87
Add better allocator for parties
Silvager Aug 4, 2024
8793c46
fix typos
Silvager Aug 4, 2024
f9772bd
Merge branch 'MT-CTF:master' into master
Silvager Aug 4, 2024
473f5ce
Add max party size as a setting you can change
Silvager Aug 5, 2024
406e4ba
Merge branch 'MT-CTF:master' into master
Silvager Aug 6, 2024
ebb2dea
Clean up code
Silvager Aug 7, 2024
6fd54a4
Merge branch 'MT-CTF:master' into master
Silvager Aug 8, 2024
3c3fff2
Merge branch 'MT-CTF:master' into master
Silvager Aug 16, 2024
8aa11e9
Try and fix merge conflicts
Silvager Aug 18, 2024
06e8a71
Try and fix merge conflict in features.lua
Silvager Aug 19, 2024
97e1ca6
Try again to fix merge conflict in features.lua
Silvager Aug 19, 2024
4a5cbf5
Merge branch 'MT-CTF:master' into master
Silvager Aug 19, 2024
7e33433
More info when player is not allowed to join invite
Silvager Aug 19, 2024
4560f3a
Merge branch 'MT-CTF:master' into master
Silvager Aug 19, 2024
6c56a9c
Merge branch 'MT-CTF:master' into master
Silvager Aug 19, 2024
149e234
Delete an invite if player tries to accept and party is too big
Silvager Aug 19, 2024
4edec5b
Merge branch 'MT-CTF:master' into master
Silvager Aug 21, 2024
77ef7cb
Merge branch 'MT-CTF:master' into master
Silvager Aug 22, 2024
ce227c2
Merge branch 'MT-CTF:master' into master
Silvager Aug 27, 2024
0d86866
Try and fix merge conflict with ctf_map/maps
Silvager Sep 17, 2024
5ffe6c5
Fix difference between files
Silvager Sep 17, 2024
b4ec3d1
Add newline at end of parties.lua
Silvager Sep 17, 2024
5d0223e
Merge branch 'merge-conflict-fix'
Silvager Sep 17, 2024
f8cc35f
Merge branch 'MT-CTF:master' into master
Silvager Oct 12, 2024
ec53acf
Merge branch 'master' into master
LoneWolfHT Jan 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions minetest.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ctf.allocate_mode = 4
ctf.players_can_change_team = false
ctf.friendly_fire = false
ctf.autoalloc_on_joinplayer = true
ctf.max_party_size = 4

ctf.match = true
ctf.match.teams = 2
Expand Down
15 changes: 12 additions & 3 deletions mods/ctf/ctf_teams/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ end

local tpos = 1
function ctf_teams.default_team_allocator(player)
print("default team allocator ran")
if #ctf_teams.current_team_list <= 0 then return end -- No teams initialized yet
player = PlayerName(player)

Expand Down Expand Up @@ -100,9 +101,17 @@ function ctf_teams.allocate_teams(teams)
table.insert(ctf_teams.current_team_list, teamname)
end

local players = minetest.get_connected_players()
table.shuffle(players)
for _, player in ipairs(players) do
local unallocatedPlayers = minetest.get_connected_players()
if #ctf_teams.parties ~= 0 then
-- Remove any parties that are too big
ctf_teams.deleteOversizedParties()
-- This function will allocate party players into teams
-- and also remove players in parties who have been allocated from the table
unallocatedPlayers = ctf_teams.allocate_parties(unallocatedPlayers)
end
table.shuffle(unallocatedPlayers)

for _, player in ipairs(unallocatedPlayers) do
ctf_teams.allocate_player(player)
end
end
Expand Down
6 changes: 5 additions & 1 deletion mods/ctf/ctf_teams/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ ctf_core.include_files(
"commands.lua",
"register.lua",
"team_chest.lua",
"team_door.lua"
"team_door.lua",
"parties.lua"
)

minetest.register_on_mods_loaded(function()
Expand Down Expand Up @@ -103,6 +104,9 @@ minetest.register_on_mods_loaded(function()
end)

minetest.register_on_leaveplayer(function(player, timed_out, ...)

ctf_teams.checkAndClearAllPartyInfo(player:get_player_name())

local pteam = ctf_teams.get(player)

if not pteam then
Expand Down
Loading
Loading