diff --git a/menu/icon.png b/menu/icon.png index 2b18a95..b857d75 100644 Binary files a/menu/icon.png and b/menu/icon.png differ diff --git a/mods/decals/textures/decals_blood_splatter_06.png b/mods/decals/textures/decals_blood_splatter_06.png index ab64ae0..d4eca87 100644 Binary files a/mods/decals/textures/decals_blood_splatter_06.png and b/mods/decals/textures/decals_blood_splatter_06.png differ diff --git a/mods/lobby/buttons.lua b/mods/lobby/buttons.lua index e087cd9..54ee89d 100644 --- a/mods/lobby/buttons.lua +++ b/mods/lobby/buttons.lua @@ -55,7 +55,8 @@ local function button_display(id, name, owner, player_count, xp, pos, desc) 'textarea[0.5,3;4,.5;;Required XP:;'..esc(xp)..']'.. 'textarea[0.5,3.75;11,4;;Description of map:;'..esc(desc)..']'.. 'textarea[5,.5;6.5,3;;;Sneak punch to visit without starting a game. Return with /lobby.\n'.. - 'Be sure all interested parties are standing within three nodes of the button before punching.]' + 'Be sure all interested parties are standing within three nodes of the button before punching.]'.. + 'button[9.5,6.5;2,1;stats;Stats]' return formspec end @@ -99,6 +100,7 @@ minetest.register_node('lobby:button_0', { meta:set_string('formspec', button_create(id, name, player_count, xp, pos, desc, builders, solo)) else minetest.show_formspec(player_name, 'lobby:button_display', button_display(id, name, owner, player_count, xp, pos, desc)) + lobby.stat[player_name] = id end end, on_punch = function(pos, node, puncher, pointed_thing) @@ -247,6 +249,7 @@ minetest.register_node('lobby:button_1', { local desc = meta:get_string('desc') local owner = meta:get_string('owner') minetest.show_formspec(player_name, 'lobby:button_display', button_display(id, name, owner, player_count, xp, pos, desc)) + lobby.stat[player_name] = id end end, on_punch = function(pos, node, puncher, pointed_thing) @@ -303,6 +306,7 @@ minetest.register_node('lobby:button_1', { local privs = minetest.get_player_privs(map_players[i]) local player_inv = player:get_inventory() player_inv:set_list('main', {}) + player_inv:set_size('main', 16) lobby.game[map_players[i]] = map_id player:set_pos({x=game_pos.x+(math.random(-2,2)),y=game_pos.y,z=game_pos.z+(math.random(-2,2))}) privs.fly = nil @@ -328,6 +332,7 @@ minetest.register_node('lobby:button_1', { local privs = minetest.get_player_privs(name) local player_inv = puncher:get_inventory() player_inv:set_list('main', {}) + player_inv:set_size('main', 16) privs.fly = nil privs.fast = nil privs.creative = nil @@ -345,3 +350,13 @@ minetest.register_node('lobby:button_1', { end end, }) + +minetest.register_on_player_receive_fields(function(player, formname, fields) + local name = player:get_player_name() + if formname == 'lobby:button_display' then + if fields.stats then + local map_id = lobby.stat[name] + minetest.show_formspec(name, 'lobby:stats', lobby.retrieve_stats(map_id)) + end + end +end) diff --git a/mods/lobby/functions.lua b/mods/lobby/functions.lua index 629d016..97af0a7 100644 --- a/mods/lobby/functions.lua +++ b/mods/lobby/functions.lua @@ -136,11 +136,13 @@ function lobby.vote(map_id, force) elseif kick ~= '' then lobby.message_to_level(map_id, 'The votes are in, '..kick..' will be kicked.') local player = minetest.get_player_by_name(kick) + local player_attributes = player:get_meta() gamer.player_set_textures(player,{'lobby_ghost.png'}) player:set_nametag_attributes({ color = {a = 0, r = 255, g = 255, b = 255} }) player:set_properties({visual_size = {x = 0, y = 0}, collisionbox = {-0.3, 0.0, -0.3, 0.3, .2, 0.3}}) + player:set_physics_override({speed=1}) player_attributes:set_string('mode', 'ghost') minetest.chat_send_player(kick, 'You were kicked, and are now a ghost. Return to the lobby with the /lobby chat command.') lobby.game[kick] = map_id..'_ghost' diff --git a/mods/lobby/init.lua b/mods/lobby/init.lua index 65f797c..c6d9d02 100644 --- a/mods/lobby/init.lua +++ b/mods/lobby/init.lua @@ -9,6 +9,7 @@ lobby.traitors = {} -- lobby.corpses = {} lobby.vote_timer = {} lobby.spawn_pos = {x=29996, y=-4.5, z=30041.5} +lobby.stat = {} --Yes I know these table names are not very clear. --[[ diff --git a/mods/lobby/player_callbacks.lua b/mods/lobby/player_callbacks.lua index 118abd2..b3052d0 100644 --- a/mods/lobby/player_callbacks.lua +++ b/mods/lobby/player_callbacks.lua @@ -115,8 +115,9 @@ end) minetest.register_on_leaveplayer(function(player, timed_out) local name = player:get_player_name() local map_id = lobby.game[name] - print (map_id) - if map_id ~= 'lobby' and not string.find(map_id, 'ghost') then + local player_attributes = player:get_meta() + local mode = player_attributes:get_string('mode') + if map_id ~= 'lobby' and mode == 'player' then local game_data = lobby.savedata.data[map_id] local map_name = game_data['map_name'] or map_id local traitor = lobby.traitors[map_id] diff --git a/mods/lobby/stats.lua b/mods/lobby/stats.lua index ff5b228..981f519 100644 --- a/mods/lobby/stats.lua +++ b/mods/lobby/stats.lua @@ -5,6 +5,7 @@ function lobby.update_stats(map_id, mode, win, player_count) stats.winner_traitor = stats.winner_traitor or 0 stats.winner_team = stats.winner_team or 0 stats.player_count = stats.player_count or 0 + stats.max_players = stats.max_players or 0 if mode == 'solo' then --Solo sessions played. stats.solo_play = stats.solo_play + 1 elseif mode == 'player' then --Team sessions played. @@ -16,11 +17,14 @@ function lobby.update_stats(map_id, mode, win, player_count) stats.winner_team = stats.winner_team + 1 end if player_count then --takes an integer as input - local count = stats.solo_play + stats.multi_play + local count = stats.multi_play local avg = stats.player_count local total = count * avg - local player_count_avg = (total + player_count) / count + local player_count_avg = (total + player_count) / (count + 1) stats.player_count = player_count_avg + if player_count > stats.max_players then + stats.max_players = player_count + end end lobby.savedata.stats[map_id] = stats end @@ -36,25 +40,27 @@ function lobby.retrieve_stats(map_id) local traitor = stats.winner_traitor local team = stats.winner_team local avg_players = stats.player_count - local count = solo + player + --local max = stats.max_players formspec = 'formspec_version[3]'.. 'size[16,9]'.. 'label[.5,.5;Viewing stats for '..map_name..', ('..map_id..')]'.. 'textarea[.5,1;7.5,5;;; This level has been played '..player..' times.'.. - ' The average number of players in a session is '..avg_players..'.\n'.. + ' On average '..avg_players..' players join a session.\n'.. + --The most ever recorded was '..max..'! ' The traitor has won '..traitor..' games, whereas '..team..' have been team wins.\n'.. ' This level has been visited by single players '..solo..' times.]'.. 'textarea[8.5,.5;7,5;;; What does this all mean and why should you care?\n'.. ' If you find that your level\'s wins strongly favor one party you might want to tweak the number of tasks,'.. - ' the granted XP, or the required XP. People are more likely to play your level when the chances of winning are fairly even.]'.. + ' the granted XP, or the required XP. People are more likely to play your level when the chances of winning are fairly even.'.. + ' You may find that the wins don\'t add up to the times played, that is due to crashes. :()]'.. 'label[.5,5.5;This space reserved for eventual charts and tables.]' else formspec = - 'formspec_version[3]'.. - 'size[16,9]'.. - 'label[.5,2;No data on this level yet! Get some friends and play a round.]'.. - 'label[.5,5.5;This space reserved for eventual charts and tables.]' + 'formspec_version[3]'.. + 'size[16,9]'.. + 'label[.5,2;No data on this level yet! Get some friends and play a round.]'.. + 'label[.5,5.5;This space reserved for eventual charts and tables.]' end return formspec end diff --git a/mods/signs/basic_signs.lua b/mods/signs/basic_signs.lua index d1730f3..b8f440c 100644 --- a/mods/signs/basic_signs.lua +++ b/mods/signs/basic_signs.lua @@ -86,7 +86,7 @@ minetest.register_node('signs:1_metal', { on_receive_fields = signs.on_receive_fields }) -for i = 1, 3 do +for i = 1, 6 do minetest.register_node('signs:poster_'..i, { description = 'Poster', drawtype = 'mesh', diff --git a/mods/signs/textures/signs_poster_4.png b/mods/signs/textures/signs_poster_4.png new file mode 100644 index 0000000..73fe0b7 Binary files /dev/null and b/mods/signs/textures/signs_poster_4.png differ diff --git a/mods/signs/textures/signs_poster_5.png b/mods/signs/textures/signs_poster_5.png new file mode 100644 index 0000000..cab2457 Binary files /dev/null and b/mods/signs/textures/signs_poster_5.png differ diff --git a/mods/signs/textures/signs_poster_6.png b/mods/signs/textures/signs_poster_6.png new file mode 100644 index 0000000..eee110e Binary files /dev/null and b/mods/signs/textures/signs_poster_6.png differ diff --git a/mods/tasks/functions.lua b/mods/tasks/functions.lua index 6e95d87..9130b7a 100644 --- a/mods/tasks/functions.lua +++ b/mods/tasks/functions.lua @@ -14,8 +14,8 @@ function tasks.add_xp(pos, node, puncher, swap_to) --This function shouldn't be if wield_name ~= 'creative:tool_breaking' then local name = puncher:get_player_name() local timer = minetest.get_node_timer(pos) - local min = meta:get_int('time_min') or 30 - local max = meta:get_int('time_max') or 60 + local min = math.max(meta:get_int('time_min'), 5) + local max = math.max(meta:get_int('time_max'), 20) local random_number = math.random(min,max) timer:start(random_number) local map_id = lobby.game[name]