Compare commits

...

5 Commits

Author SHA1 Message Date
NathanSalapat f8f59964dd added privs 2016-02-14 18:06:16 -06:00
Fernando Carmona Varo b78980a5b7 some logging to keep track on which players started/ended a game from the server log 2015-11-29 11:51:44 +01:00
Fernando Carmona Varo f76be45635 fix crash when someone manages to get to press the exit block when no game is running 2015-11-29 11:51:00 +01:00
Fernando Carmona Varo 3849c52ba2 cleanup 2015-11-29 11:32:06 +01:00
Fernando Carmona Varo 42b950af22 Fix rounding issue with the collision detection that could cause problems with the portals 2015-11-29 11:28:25 +01:00
6 changed files with 51 additions and 10 deletions

View File

@ -23,3 +23,6 @@ If your score makes it into the highscore of the server your name will be regist
* [DonBatman](https://github.com/DonBatman/)
* [Ferk](https://github.com/Ferk/)
### Note
This forked version is specifically designed for servers. A privilege is required to place the nodes, by default singleplayer doesn't get it. If you aren't using this mod on a server just use the original version by Ferk. ~Nathan.S

View File

@ -90,6 +90,7 @@ function mario.game_end(id)
if ranking then
minetest.chat_send_player(gamestate.player_name, "You made it to the highscores! Your Ranking: " .. ranking)
end
minetest.log("action", gamestate.player_name .. " ended mario game with ".. (gamestate.score or "no") .." score at " .. minetest.pos_to_string(gamestate.pos))
end
-- Restore normal physics
player:set_physics_override(1,1,1,true,false)
@ -102,7 +103,7 @@ end
function mario.game_reset(id, player)
local gamestate = mario.games[id]
if not gamestate then return end
minetest.log("action", "resetting game " .. id)
minetest.log("action", "resetting game " .. id .. " by " .. gamestate.player_name)
-- Save the time when the game was last resetted (to solve timing issues)
local last_reset = os.time()
@ -268,7 +269,7 @@ local function on_player_gamestep(player, gameid)
{x=-0.5,y=0.5,z=-0.25},
}
for _,pos in pairs(positions) do
pos = vector.add(player_pos, pos)
pos = vector.round(vector.add(player_pos, pos))
local node = minetest.get_node(pos)
local nodedef = minetest.registered_nodes[node.name]

View File

@ -7,6 +7,10 @@ dofile(minetest.get_modpath("mario").."/turtle.lua")
dofile(minetest.get_modpath("mario").."/gamestate.lua")
dofile(minetest.get_modpath("mario").."/hud.lua")
minetest.register_privilege("myarcade", {
description = "Place arcade games",
give_to_singleplayer = false
})
minetest.register_node("mario:placer",{
description = "Mario",
@ -24,8 +28,14 @@ minetest.register_node("mario:placer",{
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
mario.game_start(pos, player, {
schematic = minetest.get_modpath("mario").."/schems/mario.mts",
scorename = "mario:classic_board",
})
scorename = "mario:classic_board",})
end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myarcade = true}) then
else
minetest.remove_node(pos)
return true
end
end,
})
minetest.register_node("mario:placer2",{
@ -45,6 +55,13 @@ minetest.register_node("mario:placer2",{
local schem = minetest.get_modpath("mario").."/schems/mario.mts"
minetest.place_schematic({x=pos.x-1,y=pos.y-1,z=pos.z-2},schem,0, "air", true)
end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myarcade = true}) then
else
minetest.remove_node(pos)
return true
end
end,
})
minetest.register_node("mario:exit",{
@ -61,8 +78,15 @@ minetest.register_node("mario:exit",{
paramtype = "light",
groups = {cracky = 1,not_in_creative_inventory=1},
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local game = mario.get_game_by_player(player:get_player_name())
mario.game_end(game.id)
local name = player:get_player_name()
local game = mario.get_game_by_player(name)
if not game then
minetest.chat_send_player(name, "You aren't running a game at the moment")
pos.z = pos.z - 3
player:moveto(pos)
else
mario.game_end(game.id)
end
end,
})

View File

@ -80,7 +80,6 @@ minetest.register_node("myhighscore:score_board", {
local playername = sender:get_player_name()
if fields.gameid then
local event = minetest.explode_textlist_event(fields.gameid)
print(dump(fields) .. " " .. dump(event))
-- find which game it is
local i, game = 0, nil
repeat

View File

@ -270,7 +270,7 @@ local function on_player_gamestep(player, gameid)
{x=-0.5,y=0.5,z=-0.5},
}
for _,pos in pairs(positions) do
pos = vector.add(player_pos, pos)
pos = vector.round(vector.add(player_pos, pos))
local node = minetest.get_node(pos)
local nodedef = minetest.registered_nodes[node.name]

View File

@ -101,7 +101,15 @@ minetest.register_node("pacmine:classic_board",{
scorename = "pacmine:classic_board",
})
end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myarcade = true}) then
else
minetest.remove_node(pos)
return true
end
end,
})
--The placer block for pacmine mini
minetest.register_node("pacmine:mini_board",{
description = "Pacman Mini",
@ -127,8 +135,14 @@ minetest.register_node("pacmine:mini_board",{
ghost_amount = 2,
speed = 1,
pellet_total = 91,
scorename = "pacmine:mini_board",
})
scorename = "pacmine:mini_board",})
end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
if placer and minetest.check_player_privs(placer:get_player_name(), {myarcade = true}) then
else
minetest.remove_node(pos)
return true
end
end,
})