Overall cleanup

This commit is contained in:
Wuzzy 2023-08-02 19:21:32 +00:00 committed by Zughy
parent a517d92859
commit ab9dec4944
16 changed files with 138 additions and 70 deletions

View File

@ -1,18 +1,35 @@
CC BY-SA 4.0
The media is licensed under CC BY-SA 4.0 <https://creativecommons.org/licenses/by-sa/4.0/>.
debiankaios
sounds/new_round.ogg
textures/tnttag_gui_hotbar.png
textures/hud_tntag_waves_big.png
textures/hud_tntag_waves_old.png
## Credits
Giov4
textures/hud_tntag_pause.png
textures/hud_tntag_player.png
textures/hud_tntag_progress.png
textures/hud_tntag_timer.png
textures/hud_tntag_wave.png
textures/tnttag.png
### debiankaios
* sounds/tnttag_new_round.ogg
* textures/tnttag_gui_hotbar.png
* textures/hud_tnttag_waves_big.png
* textures/hud_tnttag_waves_old.png
Zughy (derived by BlockMen)
tnt textures
### Giov4
* textures/hud_tntag_pause.png
* textures/hud_tntag_player.png
* textures/hud_tntag_progress.png
* textures/hud_tntag_timer.png
* textures/hud_tntag_wave.png
* textures/tnttag.png
### Giov4, Zughy, Wuzzy
* textures/hud_tntag_celebrate.png
### Zughy (derived by BlockMen)
* tnt textures
### steveygos93, Wuzzy
* sounds/tnttag_tnt_explode.ogg
### Kenney Vleugels, Wuzzy
* tnttag_tag_given.ogg
### ani_music, Wuzzy
* tnttag_tag_gotten.ogg
### SamsterBirdies, Wuzzy
* tnttag_timer.ogg

View File

@ -24,11 +24,12 @@ Heads-Up Display (HUD) showing info about the game.
From left to right:
1. Status: Shows whether there is an active TNT in the game
("play" icon) or if it's in pause mode ("pause" icon).
1. Status: Shows the current game status:
* Play icon: Active TNT in the game, it will blow up soon!
* Pause icon: A short break before the next wave begins
* Trophy icon: We have a winner!
2. Player count: Shows the number of remaining and total players
3. TNT timer: How many seconds remain on the TNT timer.
Shows "-" during a pause.
3. TNT timer: How many seconds remain on the TNT timer or of the current pause
4. Wave: Shows the current and final wave (i.e. round)
## Setting up
@ -37,7 +38,18 @@ From left to right:
Use this chat command:
`/arenas create tnttag <arena> <minplayers:int> <maxplayers:int>`
`/arenas create tnttag <arena name> <min. players> <max. players>`
Then edit the arena using:
`/arenas edit tnttag <arena name>`
### Arena properties
The following arena properties exist:
* `wavetimer`: Time in seconds for a single wave (until the TNT explodes) (default: 30)
* `pause_length`: Length of a pause between waves, in seconds. Set to 0 to disable pauses (default: 5)
### Schematics for your arenas
@ -52,5 +64,5 @@ the arena settings instead for the time of each wave.
## Licensing / Credits
Main license: See `LICENSE.txt`
Media license: See `LICENSE_MEDIA.txt`, `textures/license.txt` and `sounds/LICENSE.txt`
Main license: See `LICENSE.txt`.
Media license: See `LICENSE_MEDIA.txt` and `sounds/LICENSE.txt`.

27
api.lua
View File

@ -125,7 +125,18 @@ function tnttag.add_tnthead(p_name)
local player = minetest.get_player_by_name(p_name)
if player then
local tnthead = minetest.add_entity(minetest.get_player_by_name(p_name):get_pos(), "tnttag:tnt_if_tagged", nil)
tnthead:set_attach(minetest.get_player_by_name(p_name), "Head", {x=0, y=10, z=0})
-- Find a position to attach the TNT head entity to
if minetest.get_modpath("player_api") or minetest.get_modpath("default") then
-- Relative to Head bone if player_api / default mod found
tnthead:set_attach(player, "Head", {x=0, y=10, z=0})
else
-- If we can't make assumptions about the model bones,
-- the offset is based on the selection box height
local props = player:get_properties()
local selbox = props.selbox or { -0.3, 0, -0.3, 0.3, 1.77, 0.3 }
local offset = selbox[2] + selbox[5] + 0.8
tnthead:set_attach(player, "", {x=0, y=offset * 10, z=0})
end
end
end
-- removes the tnt entity
@ -215,7 +226,7 @@ end
function tnttag.explode_player(p_name, arena)
local player = minetest.get_player_by_name(p_name)
minetest.sound_play("tnt_explode", {object = player, gain = 1.0, max_hear_distance = 128, loop = false,}, true)
minetest.sound_play("tnttag_tnt_explode", {object = player, gain = 1.0, max_hear_distance = 128, loop = false,}, true)
-- explosion particles
local ppos = player:get_pos()
@ -229,7 +240,7 @@ function tnttag.explode_player(p_name, arena)
arena_lib.HUD_send_msg("title", p_name, S("You exploded!"),1, nil--[[sound↑]], 0xFF3300)
for pl_name,_ in pairs(arena.players) do
minetest.chat_send_player(pl_name,p_name.." "..S("exploded!"))
minetest.chat_send_player(pl_name, S("@1 exploded!", p_name))
end
end
@ -257,12 +268,14 @@ function tnttag.newwave(arena)
end
end
for p_name in pairs(arena.players_and_spectators) do
local message = S("The new tagger is").." "
-- list separator for tagger list
local taggerlist = table.concat(real_new_tagger, S(", "))
local message = S("The new tagger is @1!", taggerlist)
if #real_new_tagger > 1 then
message = S("The new taggers are").." "
message = S("The new taggers are @1!", taggerlist)
end
minetest.chat_send_player(p_name, message .. table.concat(real_new_tagger,", ").."!")
minetest.sound_play("new_round", {to_player = p_name, gain = 1.0, loop = false,}, true)
minetest.chat_send_player(p_name, message)
minetest.sound_play("tnttag_new_round", {to_player = p_name, gain = 1.0, loop = false,}, true)
if #real_new_tagger == 1 then
message = S("You're the tagger!")
else

View File

@ -4,11 +4,9 @@ local COUNTDOWN_SECONDS = 10
arena_lib.on_load("tnttag", function(arena)
arena.original_player_amount = arena.players_amount
if arena.autochoosewaves then arena.waves = math.ceil((arena.players_amount - 1)/arena.max_players_in_autochoose) end
arena.waves = arena.players_amount - 1
for p_name, stats in pairs(arena.players) do
tnttag.generate_HUD(arena, p_name)
--[[ arena.players[p_name].tnt_if_tagged = minetest.add_entity(minetest.get_player_by_name(p_name):get_pos(), "tnttag:tnt_if_tagged", nil)
arena.players[p_name].tnt_if_tagged:set_attach(minetest.get_player_by_name(p_name), "Head", {x=0, y=10, z=0})]]
end
end)

View File

@ -1,5 +1,6 @@
minetest.register_entity("tnttag:tnt_if_tagged", {
initial_properties = {
static_save = false,
collide_with_objects = false,
pointable = false,
collisionbox = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
@ -7,7 +8,6 @@ minetest.register_entity("tnttag:tnt_if_tagged", {
visual = "cube",
visual_size = {x = .5, y = .5, z = .5},
textures = {"tnttag_tnt_top_burning.png", "tnttag_tnt_bottom.png", "tnttag_tnt_side.png", "tnttag_tnt_side.png", "tnttag_tnt_side.png", "tnttag_tnt_side.png"},
--is_visible = false,
},
_timer = 0,
on_step = function(self, dtime, moveresult)

22
hud.lua
View File

@ -134,15 +134,19 @@ function tnttag.update_wave_counter_hud(arena)
end
function tnttag.update_pause_hud(arena)
if arena.pause then
for p_name in pairs(arena.players_and_spectators) do
local player = minetest.get_player_by_name(p_name)
player:hud_change(tnttag.saved_huds[p_name].hud_pause, "text", "hud_tnttag_pause.png")
end
local image
if arena.in_celebration and arena.players_amount > 0 then
-- game over and we have a winner
image = "hud_tnttag_celebrate.png"
elseif arena.pause then
-- pause mode
image = "hud_tnttag_pause.png"
else
for p_name in pairs(arena.players_and_spectators) do
local player = minetest.get_player_by_name(p_name)
player:hud_change(tnttag.saved_huds[p_name].hud_pause, "text", "hud_tnttag_progress.png")
end
-- active game
image = "hud_tnttag_progress.png"
end
for p_name in pairs(arena.players_and_spectators) do
local player = minetest.get_player_by_name(p_name)
player:hud_change(tnttag.saved_huds[p_name].hud_pause, "text", image)
end
end

View File

@ -9,17 +9,16 @@ tnttag.player_speed_tagged = minetest.settings:get("tnttag.player_speed_tagged")
tnttag.player_jump_tagged = minetest.settings:get("tnttag.player_jump_tagged") or 1.2
arena_lib.register_minigame("tnttag", {
prefix = "[tnttag] ",
name = S("TNTTag"),
prefix = "["..S("TNTTag").."] ",
min_players = 2,
icon = "tnttag.png",
show_minimap = true,
properties = {
autochoosewaves = false, -- If true let waves be
max_players_in_autochoose = 1,--only important for autochoosewaves
waves = 5, --How many waves needed. Warning at least one more player then waves are needed. Don't work if autochoosewaves is true!
wavetime = 30,
pause_length = 5, -- set to 0 for none
wavetime = 30, -- time in seconds per wave
pause_length = 5, -- time in seconds for a pause, set to 0 for none
},
temp_properties = {
waves = 1,
current_wave = 0,
original_player_amount = 0,
pause = true,
@ -37,6 +36,7 @@ arena_lib.register_minigame("tnttag", {
background_image = "tnttag_gui_hotbar.png"
},
disabled_damage_types = {"fall", "punch"},--drown? node_damage?
disabled_huds = {"minimap"},
celebration_time = 10,
time_mode = "decremental",
})

View File

@ -1,10 +1,13 @@
# textdomain: tnttag
You exploded!=
exploded!=
The new tagger is=
The new taggers are=
@1 exploded!=
The new tagger is @1!=
The new taggers are @1!=
# list separator
, =
You're the tagger!=
You're a tagger!=
TNTTag=
Needed for tnttag=
TNTTagger - Tag other players=
@1 tagged @2=

View File

@ -1,12 +1,15 @@
# textdomain: tnttag
You exploded!=Sie sind explodiert!
exploded!=ist explodiert!
The new tagger is=Der neue Fänger ist
The new taggers are=Die neuen Fänger sind
@1 exploded!=@1 ist explodiert!
The new tagger is @1!=Der neue Fänger ist @1!
The new taggers are @1!=Die neuen Fänger sind @1!
# list separator
, =,
You're the tagger!=Sie sind der Fänger!
You're a tagger!=Sie sind ein Fänger!
TNTTag=TNTTag
Needed for tnttag=Benötigt für tnttag
TNTTagger - Tag other players=TNTTagger Fangen Sie andere Spieler
@1 tagged @2=@1 hat @2 gefangen
You have been tagged by @1!=Sie wurden von @1 gefangen
You have been tagged by @1!=Sie wurden von @1 gefangen!
You tagged @1!=Sie haben @1 gefangen!

View File

@ -1,12 +1,22 @@
# textdomain: tnttag
You exploded!=Felrobbantál!
exploded!=Felrobbant!
The new tagger is=Az új célpont
The new taggers are=Az új célpontok
@1 exploded!=
The new tagger is @1!=
The new taggers are @1!=
# list separator
, =
You're the tagger!=
You're a tagger!=
TNTTag=
Needed for tnttag=Sükséges a tnttag-hez
TNTTagger - Tag other players=TNTTagger Jelölj meg más játékosokat
@1 tagged @2=@1 megjelölte @2
You have been tagged by @1!=Megjelölt @1!
You tagged @1!=megjelölted @1-et!
##### not used anymore #####
exploded!=Felrobbant!
The new tagger is=Az új célpont!
The new taggers are=Az új célpontok!

View File

@ -1,3 +1,5 @@
name = tnttag
depends = arena_lib, default
description = TNTTag in minetest using arena_lib
title = TNTTag
depends = arena_lib
optional_depends = player_api,default
description = A player is holding TNT which is about to explode and must tag other players to get rid of it

View File

@ -1,11 +1,11 @@
# Player Speed in TNTTag
tnttag.player_speed (Player Speed in TNTTag) float 3
# Movement speed of players who don't currently carry TNT in TNTTag
tnttag.player_speed (Speed of untagged players) float 3 0
# Player Jump in TNTTag
tnttag.player_jump (Player Jump in TNTTag) float 1.2
# Jump strength of players who don't currently carry TNT in TNTTag
tnttag.player_jump (Jump strength of untagged players) float 1.2 0
# Isn't working now
tnttag.player_speed_tagged (Player Speed in TNTTag if you are tagged) float 3
# Movement speed of players who currently carry TNT in TNTTag
tnttag.player_speed_tagged (Speed of tagged players) float 3 0
# Isn't working now
tnttag.player_jump_tagged (Player Jump in TNTTag if you are tagged) float 1.2
# Jump strength of players who currently carry TNT in TNTTag
tnttag.player_jump_tagged (Jump strength of tagged players) float 1.2 0

View File

@ -1,5 +1,5 @@
TumeniNodes (CC0 1.0)
tnt_explode.ogg
tnttag_tnt_explode.ogg
renamed, edited, and converted to .ogg from Explosion2.wav
by steveygos93 (CC0 1.0)
<https://freesound.org/s/80401/>
@ -28,3 +28,9 @@ based on 'Beep warning'
by SamsterBirdies
edited by Wuzzy
<https://freesound.org/people/SamsterBirdies/sounds/467882/>
---------------------
tnttag_new_round.ogg
CC BY-SA 4.0
by debiankaios

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B