From ab9dec4944ec23ec45f0e57a26393bea2081543e Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 2 Aug 2023 19:21:32 +0000 Subject: [PATCH] Overall cleanup --- LICENSE_MEDIA.txt | 47 ++++++++++++------ README.md | 26 +++++++--- api.lua | 27 +++++++--- auto.lua | 4 +- entities.lua | 2 +- hud.lua | 22 ++++---- init.lua | 14 +++--- locale/template.txt | 9 ++-- locale/tnttag.de.tr | 11 ++-- locale/tnttag.hu.tr | 16 ++++-- mod.conf | 6 ++- settingtypes.txt | 16 +++--- sounds/LICENSE.txt | 8 ++- .../{new_round.ogg => tnttag_new_round.ogg} | Bin ...tnt_explode.ogg => tnttag_tnt_explode.ogg} | Bin textures/hud_tnttag_celebrate.png | Bin 0 -> 658 bytes 16 files changed, 138 insertions(+), 70 deletions(-) rename sounds/{new_round.ogg => tnttag_new_round.ogg} (100%) rename sounds/{tnt_explode.ogg => tnttag_tnt_explode.ogg} (100%) create mode 100644 textures/hud_tnttag_celebrate.png diff --git a/LICENSE_MEDIA.txt b/LICENSE_MEDIA.txt index 04f4504..e915e78 100644 --- a/LICENSE_MEDIA.txt +++ b/LICENSE_MEDIA.txt @@ -1,18 +1,35 @@ -CC BY-SA 4.0 +The media is licensed under CC 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 diff --git a/README.md b/README.md index 69aad7d..1f9c0ae 100644 --- a/README.md +++ b/README.md @@ -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 ` +`/arenas create tnttag ` + +Then edit the arena using: + +`/arenas edit tnttag ` + +### 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`. diff --git a/api.lua b/api.lua index c18d2cc..0ae0fe6 100644 --- a/api.lua +++ b/api.lua @@ -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 diff --git a/auto.lua b/auto.lua index be6d99a..60f356d 100644 --- a/auto.lua +++ b/auto.lua @@ -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) diff --git a/entities.lua b/entities.lua index 5c50a30..85ca45a 100644 --- a/entities.lua +++ b/entities.lua @@ -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) diff --git a/hud.lua b/hud.lua index e3ff0f7..ca6bf2d 100644 --- a/hud.lua +++ b/hud.lua @@ -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 diff --git a/init.lua b/init.lua index 8e7823c..2d2fbc0 100644 --- a/init.lua +++ b/init.lua @@ -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", }) diff --git a/locale/template.txt b/locale/template.txt index ef8492e..4ae77b1 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -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= diff --git a/locale/tnttag.de.tr b/locale/tnttag.de.tr index 852c75c..960deb9 100644 --- a/locale/tnttag.de.tr +++ b/locale/tnttag.de.tr @@ -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! diff --git a/locale/tnttag.hu.tr b/locale/tnttag.hu.tr index f925fd7..091b66a 100644 --- a/locale/tnttag.hu.tr +++ b/locale/tnttag.hu.tr @@ -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! diff --git a/mod.conf b/mod.conf index d3bfd38..b542ae5 100644 --- a/mod.conf +++ b/mod.conf @@ -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 diff --git a/settingtypes.txt b/settingtypes.txt index c1e92ff..9dcc526 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -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 diff --git a/sounds/LICENSE.txt b/sounds/LICENSE.txt index 4e0cc61..7c0f852 100644 --- a/sounds/LICENSE.txt +++ b/sounds/LICENSE.txt @@ -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) @@ -28,3 +28,9 @@ based on 'Beep warning' by SamsterBirdies edited by Wuzzy + +--------------------- + +tnttag_new_round.ogg +CC BY-SA 4.0 +by debiankaios diff --git a/sounds/new_round.ogg b/sounds/tnttag_new_round.ogg similarity index 100% rename from sounds/new_round.ogg rename to sounds/tnttag_new_round.ogg diff --git a/sounds/tnt_explode.ogg b/sounds/tnttag_tnt_explode.ogg similarity index 100% rename from sounds/tnt_explode.ogg rename to sounds/tnttag_tnt_explode.ogg diff --git a/textures/hud_tnttag_celebrate.png b/textures/hud_tnttag_celebrate.png new file mode 100644 index 0000000000000000000000000000000000000000..f36ce42266a777e7e5727eecb52b07a5bca9b804 GIT binary patch literal 658 zcmV;D0&V??P)_8o00076NklEyz*>ib2(~wr;1CCM=e@g2VzA;{?%wzAd;dTG_rC9c4ot&4 zFj(Usj?(Uq!#H=Df!DW+d@tpMq^X%X09IELwwtD3yut160iaSj#O>~(QaNnIp=KoF z(7>Ak&v!}yEFP->T)#GIyK^S1v{XRL&14lyyE_hD0VB8u{Q8m>QR~k-kvfo(NG7YW zzE$Mi{X5*c{a%l67i0hqKL23&=^8h$_=P-|cVMt)ly+)n&HyY9S+Wu_tC1}4(|cLQ z7s&DT>PLL^vt5u$miHO9Dp7NqCC@*bZ7HKHsmPMbe5WMH{^{|(rg?VjPIKTSwgkZW z_-xxZ+!x5Tz3y!E@kwlnYPx8 zi*Nh&_wZ03!AO_o&baJYEqi`_^l(qn)i46T>h1<0WK&|vtO8}o2Yy$Z53EuNigJaO3Dm0AD;-ZROQ^ zLvk(AvPJ7&VD5%uD@M44%{(EKRmea2W{I0Cz~TiLyt3{G8kw;+&BzG$r^8{kV>`>$ s6bV1LtH(6EZDG9)k4LcM|M^4m6S?91ordOhPyhe`07*qoM6N<$f=@~|sQ>@~ literal 0 HcmV?d00001