Moved and renamed to pacmine
|
@ -25,15 +25,17 @@ local i2 = blocks[i][4]
|
|||
local lit = blocks[i][5]
|
||||
local tf = blocks[i][6]
|
||||
|
||||
minetest.register_node("mypacman:"..itm, {
|
||||
minetest.register_alias("mypacman:"..itm, "pacmine:"..itm)
|
||||
|
||||
minetest.register_node("pacmine:"..itm, {
|
||||
description = des,
|
||||
tiles = {
|
||||
"mypacman_"..i1..".png",
|
||||
"mypacman_"..i2..".png",
|
||||
"mypacman_walls.png",
|
||||
"mypacman_walls.png",
|
||||
"mypacman_walls.png",
|
||||
"mypacman_walls.png",
|
||||
"pacmine_"..i1..".png",
|
||||
"pacmine_"..i2..".png",
|
||||
"pacmine_walls.png",
|
||||
"pacmine_walls.png",
|
||||
"pacmine_walls.png",
|
||||
"pacmine_walls.png",
|
||||
},
|
||||
drawtype = "normal",
|
||||
paramtype = "light",
|
||||
|
@ -47,9 +49,10 @@ minetest.register_node("mypacman:"..itm, {
|
|||
})
|
||||
end
|
||||
--Glass
|
||||
minetest.register_node("mypacman:glass", {
|
||||
minetest.register_alias("mypacman:glass", "pacmine:glass")
|
||||
minetest.register_node("pacmine:glass", {
|
||||
description = "glass",
|
||||
tiles = {"mypacman_glass.png"},
|
||||
tiles = {"pacmine_glass.png"},
|
||||
drawtype = "glasslike",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
|
@ -58,9 +61,10 @@ minetest.register_node("mypacman:glass", {
|
|||
collision_box = cbox,
|
||||
|
||||
})
|
||||
minetest.register_node("mypacman:glassw", {
|
||||
minetest.register_alias("mypacman:glassw", "pacmine:glassw")
|
||||
minetest.register_node("pacmine:glassw", {
|
||||
description = "glassw",
|
||||
tiles = {"mypacman_glass.png"},
|
||||
tiles = {"pacmine_glass.png"},
|
||||
drawtype = "glasslike",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
|
@ -70,6 +74,3 @@ minetest.register_node("mypacman:glassw", {
|
|||
colision_box = cbox,
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
|
@ -71,16 +71,16 @@ for i in ipairs (pelletitems) do
|
|||
local hlth = pelletitems[i][3]
|
||||
local cbox = pelletitems[i][4]
|
||||
|
||||
minetest.register_node("mypacman:"..itm,{
|
||||
minetest.register_node("pacmine:"..itm,{
|
||||
description = desc,
|
||||
inventory_image = "mypacman_"..itm..".png",
|
||||
inventory_image = "pacmine_"..itm..".png",
|
||||
tiles = {
|
||||
"mypacman_"..itm..".png",
|
||||
"mypacman_"..itm..".png",
|
||||
"mypacman_"..itm..".png",
|
||||
"mypacman_"..itm..".png",
|
||||
"mypacman_"..itm..".png",
|
||||
"mypacman_"..itm..".png^[transformFX",
|
||||
"pacmine_"..itm..".png",
|
||||
"pacmine_"..itm..".png",
|
||||
"pacmine_"..itm..".png",
|
||||
"pacmine_"..itm..".png",
|
||||
"pacmine_"..itm..".png",
|
||||
"pacmine_"..itm..".png^[transformFX",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
|
@ -91,7 +91,7 @@ minetest.register_node("mypacman:"..itm,{
|
|||
node_box = cbox,
|
||||
collision_box = cbox,
|
||||
after_destruct = function(pos, oldnode)
|
||||
mypacman.on_player_got_fruit()
|
||||
pacmine.on_player_got_fruit()
|
||||
end,
|
||||
})
|
||||
end
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
-- Array to hold all the running game states
|
||||
mypacman.games = {}
|
||||
pacmine.games = {}
|
||||
|
||||
-- Store all the currently playing players
|
||||
mypacman.players = {}
|
||||
pacmine.players = {}
|
||||
|
||||
-- Duration of the power pellet effect (in seconds)
|
||||
local power_pellet_duration = 10
|
||||
|
@ -12,13 +12,13 @@ local power_pellet_duration = 10
|
|||
-- Public functions (these can be called from any other place)
|
||||
|
||||
-- Start the game from the spawn block at position "pos" activated by "player"
|
||||
function mypacman.game_start(pos, player)
|
||||
function pacmine.game_start(pos, player)
|
||||
-- create an id unique for the given position
|
||||
local id = minetest.pos_to_string(pos)
|
||||
|
||||
-- make sure any previous game with the same id has ended
|
||||
if mypacman.games[id] then
|
||||
mypacman.game_end(id)
|
||||
if pacmine.games[id] then
|
||||
pacmine.game_end(id)
|
||||
end
|
||||
|
||||
-- Create a new game state with that id and add it to the game list
|
||||
|
@ -33,33 +33,33 @@ function mypacman.game_start(pos, player)
|
|||
lives = 3,
|
||||
score = 0,
|
||||
}
|
||||
mypacman.games[id] = gamestate
|
||||
mypacman.players[id] = player
|
||||
pacmine.games[id] = gamestate
|
||||
pacmine.players[id] = player
|
||||
|
||||
minetest.log("action","New pacman game started at " .. id .. " by " .. gamestate.player_name)
|
||||
|
||||
-- place schematic
|
||||
local schem = minetest.get_modpath("mypacman").."/schems/mypacman_3.mts"
|
||||
local schem = minetest.get_modpath("pacmine").."/schems/pacmine_3.mts"
|
||||
minetest.place_schematic({x=pos.x,y=pos.y-1,z=pos.z-2},schem,0, "air", true)
|
||||
|
||||
-- Set start positions
|
||||
mypacman.game_reset(id, player)
|
||||
mypacman.update_hud(id, player)
|
||||
minetest.sound_play("mypacman_beginning", {pos = pos,max_hear_distance = 40,gain = 10.0,})
|
||||
pacmine.game_reset(id, player)
|
||||
pacmine.update_hud(id, player)
|
||||
minetest.sound_play("pacmine_beginning", {pos = pos,max_hear_distance = 40,gain = 10.0,})
|
||||
end
|
||||
|
||||
-- Finish the game with the given id
|
||||
function mypacman.game_end(id)
|
||||
mypacman.remove_ghosts(id)
|
||||
mypacman.remove_hud(mypacman.players[id], mypacman.games[id].player_name)
|
||||
function pacmine.game_end(id)
|
||||
pacmine.remove_ghosts(id)
|
||||
pacmine.remove_hud(pacmine.players[id], pacmine.games[id].player_name)
|
||||
-- Clear the data
|
||||
mypacman.games[id] = nil
|
||||
mypacman.players[id] = nil
|
||||
pacmine.games[id] = nil
|
||||
pacmine.players[id] = nil
|
||||
end
|
||||
|
||||
-- Resets the game to the start positions
|
||||
function mypacman.game_reset(id, player)
|
||||
local gamestate = mypacman.games[id]
|
||||
function pacmine.game_reset(id, player)
|
||||
local gamestate = pacmine.games[id]
|
||||
minetest.log("action", "resetting game " .. id)
|
||||
|
||||
-- Save the time when the game was last resetted (to solve timing issues)
|
||||
|
@ -74,38 +74,38 @@ function mypacman.game_reset(id, player)
|
|||
|
||||
-- Spawn the ghosts and assign the game id to each ghost
|
||||
minetest.after(2, function()
|
||||
if mypacman.games[id] and last_reset == mypacman.games[id].last_reset then
|
||||
if pacmine.games[id] and last_reset == pacmine.games[id].last_reset then
|
||||
local pos = vector.add(gamestate.pos, {x=13,y=0.5,z=19})
|
||||
local ghost = minetest.add_entity(pos, "mypacman:inky")
|
||||
local ghost = minetest.add_entity(pos, "pacmine:inky")
|
||||
ghost:get_luaentity().gameid = id
|
||||
end
|
||||
end)
|
||||
minetest.after(12, function()
|
||||
if mypacman.games[id] and last_reset == mypacman.games[id].last_reset then
|
||||
if pacmine.games[id] and last_reset == pacmine.games[id].last_reset then
|
||||
local pos = vector.add(gamestate.pos, {x=15,y=0.5,z=19})
|
||||
local ghost = minetest.add_entity(pos, "mypacman:pinky")
|
||||
local ghost = minetest.add_entity(pos, "pacmine:pinky")
|
||||
ghost:get_luaentity().gameid = id
|
||||
end
|
||||
end)
|
||||
minetest.after(22, function()
|
||||
if mypacman.games[id] and last_reset == mypacman.games[id].last_reset then
|
||||
if pacmine.games[id] and last_reset == pacmine.games[id].last_reset then
|
||||
local pos = vector.add(gamestate.pos, {x=13,y=0.5,z=18})
|
||||
local ghost = minetest.add_entity(pos, "mypacman:blinky")
|
||||
local ghost = minetest.add_entity(pos, "pacmine:blinky")
|
||||
ghost:get_luaentity().gameid = id
|
||||
end
|
||||
end)
|
||||
minetest.after(32, function()
|
||||
if mypacman.games[id] and last_reset == mypacman.games[id].last_reset then
|
||||
if pacmine.games[id] and last_reset == pacmine.games[id].last_reset then
|
||||
local pos = vector.add(gamestate.pos, {x=15,y=0.5,z=18})
|
||||
local ghost = minetest.add_entity(pos, "mypacman:clyde")
|
||||
local ghost = minetest.add_entity(pos, "pacmine:clyde")
|
||||
ghost:get_luaentity().gameid = id
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Remove all the ghosts from the board with the given id
|
||||
function mypacman.remove_ghosts(id)
|
||||
local gamestate = mypacman.games[id]
|
||||
function pacmine.remove_ghosts(id)
|
||||
local gamestate = pacmine.games[id]
|
||||
if not gamestate then return end
|
||||
|
||||
-- Remove all non-players (ghosts!)
|
||||
|
@ -118,19 +118,19 @@ function mypacman.remove_ghosts(id)
|
|||
end
|
||||
|
||||
-- A player got a pellet, update the state
|
||||
function mypacman.on_player_got_pellet(player)
|
||||
function pacmine.on_player_got_pellet(player)
|
||||
local name = player:get_player_name()
|
||||
local gamestate = mypacman.get_game_by_player(name)
|
||||
local gamestate = pacmine.get_game_by_player(name)
|
||||
if not gamestate then return end
|
||||
|
||||
gamestate.pellet_count = gamestate.pellet_count + 1
|
||||
gamestate.score = gamestate.score + 10
|
||||
mypacman.update_hud(gamestate.id, player)
|
||||
pacmine.update_hud(gamestate.id, player)
|
||||
|
||||
if gamestate.pellet_count >= 252 then -- 252
|
||||
minetest.chat_send_player(name, "You cleared the board!")
|
||||
|
||||
mypacman.remove_ghosts(gamestate.id)
|
||||
pacmine.remove_ghosts(gamestate.id)
|
||||
gamestate.pellet_count = 0
|
||||
gamestate.level = gamestate.level + 1
|
||||
gamestate.speed = gamestate.level + 1
|
||||
|
@ -138,29 +138,29 @@ function mypacman.on_player_got_pellet(player)
|
|||
minetest.after(3.0, function()
|
||||
minetest.chat_send_player(name, "Starting Level "..gamestate.level)
|
||||
-- place schematic
|
||||
local schem = minetest.get_modpath("mypacman").."/schems/mypacman_3.mts"
|
||||
local schem = minetest.get_modpath("pacmine").."/schems/pacmine_3.mts"
|
||||
minetest.place_schematic(vector.add(gamestate.pos, {x=0,y=-1,z=-2}),schem,0, "air", true)
|
||||
|
||||
-- Set start positions
|
||||
mypacman.game_reset(gamestate.id, player)
|
||||
minetest.sound_play("mypacman_beginning", {pos = pos,max_hear_distance = 40,gain = 10.0,})
|
||||
pacmine.game_reset(gamestate.id, player)
|
||||
minetest.sound_play("pacmine_beginning", {pos = pos,max_hear_distance = 40,gain = 10.0,})
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
-- A player got a power pellet, update the state
|
||||
function mypacman.on_player_got_power_pellet(player)
|
||||
function pacmine.on_player_got_power_pellet(player)
|
||||
local name = player:get_player_name()
|
||||
local gamestate = mypacman.get_game_by_player(name)
|
||||
local gamestate = pacmine.get_game_by_player(name)
|
||||
if not gamestate then return end
|
||||
|
||||
minetest.chat_send_player(name, "You got a POWER PELLET")
|
||||
gamestate.power_pellet = os.time() + power_pellet_duration
|
||||
gamestate.score = gamestate.score + 50
|
||||
mypacman.update_hud(gamestate.id, player)
|
||||
pacmine.update_hud(gamestate.id, player)
|
||||
|
||||
local boardcenter = vector.add(gamestate.pos, {x=13,y=0.5,z=15})
|
||||
local powersound = minetest.sound_play("mypacman_powerup", {pos = boardcenter,max_hear_distance = 20, object=player, loop=true})
|
||||
local powersound = minetest.sound_play("pacmine_powerup", {pos = boardcenter,max_hear_distance = 20, object=player, loop=true})
|
||||
|
||||
minetest.after(power_pellet_duration, function()
|
||||
minetest.sound_stop(powersound)
|
||||
|
@ -172,8 +172,8 @@ function mypacman.on_player_got_power_pellet(player)
|
|||
end
|
||||
|
||||
-- Get the game that the given player is playing
|
||||
function mypacman.get_game_by_player(player_name)
|
||||
for _,gamestate in pairs(mypacman.games) do
|
||||
function pacmine.get_game_by_player(player_name)
|
||||
for _,gamestate in pairs(pacmine.games) do
|
||||
if gamestate.player_name == player_name then
|
||||
return gamestate
|
||||
end
|
||||
|
@ -185,8 +185,8 @@ end
|
|||
|
||||
-- Save Table
|
||||
local function gamestate_save()
|
||||
local data = mypacman.games
|
||||
local f, err = io.open(minetest.get_worldpath().."/mypacman_data", "w")
|
||||
local data = pacmine.games
|
||||
local f, err = io.open(minetest.get_worldpath().."/pacmine_data", "w")
|
||||
if err then return err end
|
||||
f:write(minetest.serialize(data))
|
||||
f:close()
|
||||
|
@ -194,7 +194,7 @@ end
|
|||
|
||||
--Read Table
|
||||
local function gamestate_load()
|
||||
local f, err = io.open(minetest.get_worldpath().."/mypacman_data", "r")
|
||||
local f, err = io.open(minetest.get_worldpath().."/pacmine_data", "r")
|
||||
if f then
|
||||
local data = minetest.deserialize(f:read("*a"))
|
||||
f:close()
|
||||
|
@ -214,14 +214,14 @@ local function on_player_gamestep(player, gameid)
|
|||
for _,pos in pairs(positions) do
|
||||
pos = vector.add(player_pos, pos)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == "mypacman:pellet_1" then
|
||||
if node.name == "pacmine:pellet_1" then
|
||||
minetest.remove_node(pos)
|
||||
mypacman.on_player_got_pellet(player)
|
||||
elseif node.name == "mypacman:pellet_2" then
|
||||
pacmine.on_player_got_pellet(player)
|
||||
elseif node.name == "pacmine:pellet_2" then
|
||||
minetest.remove_node(pos)
|
||||
mypacman.on_player_got_power_pellet(player)
|
||||
pacmine.on_player_got_power_pellet(player)
|
||||
|
||||
minetest.sound_play("mypacman_eatfruit", {
|
||||
minetest.sound_play("pacmine_eatfruit", {
|
||||
pos = pos,
|
||||
max_hear_distance = 100,
|
||||
gain = 10.0,
|
||||
|
@ -234,7 +234,7 @@ end
|
|||
--- Execution code
|
||||
|
||||
-- load the gamestate from disk
|
||||
mypacman.games = gamestate_load() or {}
|
||||
pacmine.games = gamestate_load() or {}
|
||||
|
||||
-- Time counters
|
||||
local tmr_gamestep = 0
|
||||
|
@ -242,7 +242,7 @@ local tmr_savestep = 0
|
|||
minetest.register_globalstep(function(dtime)
|
||||
tmr_gamestep = tmr_gamestep + dtime;
|
||||
if tmr_gamestep > 0.2 then
|
||||
for id,player in pairs(mypacman.players) do
|
||||
for id,player in pairs(pacmine.players) do
|
||||
on_player_gamestep(player, id)
|
||||
end
|
||||
tmr_savestep = tmr_savestep + tmr_gamestep
|
||||
|
@ -256,32 +256,32 @@ end)
|
|||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
for id,game in pairs(mypacman.games) do
|
||||
for id,game in pairs(pacmine.games) do
|
||||
if game.player_name == name then
|
||||
mypacman.players[id] = player
|
||||
mypacman.update_hud(id, player)
|
||||
pacmine.players[id] = player
|
||||
pacmine.update_hud(id, player)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
for id,game in pairs(mypacman.games) do
|
||||
for id,game in pairs(pacmine.games) do
|
||||
if game.player_name == name then
|
||||
mypacman.players[id] = nil
|
||||
mypacman.remove_hud(player, name)
|
||||
pacmine.players[id] = nil
|
||||
pacmine.remove_hud(player, name)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Chatcommand to end the game for the current player
|
||||
minetest.register_chatcommand("mypacman_exit", {
|
||||
minetest.register_chatcommand("pacmine_exit", {
|
||||
params = "",
|
||||
description = "Loads and saves all rooms",
|
||||
func = function(name, param)
|
||||
local gamestate = mypacman.get_game_by_player(name)
|
||||
local gamestate = pacmine.get_game_by_player(name)
|
||||
if gamestate then
|
||||
mypacman.game_end(gamestate.id)
|
||||
pacmine.game_end(gamestate.id)
|
||||
minetest.get_player_by_name(name):moveto(vector.add(gamestate.pos,{x=0.5,y=0.5,z=-1.5}))
|
||||
minetest.chat_send_player(name, "You are no longer playing pacman")
|
||||
else
|
|
@ -12,19 +12,19 @@ for i in ipairs(ghosts) do
|
|||
local itm = ghosts[i][1]
|
||||
local desc = ghosts[i][2]
|
||||
|
||||
minetest.register_entity("mypacman:"..itm, {
|
||||
minetest.register_entity("pacmine:"..itm, {
|
||||
hp_max = 1,
|
||||
physical = true,
|
||||
collide_with_objects = true,
|
||||
visual = "cube",
|
||||
visual_size = {x = 0.6, y = 1},
|
||||
textures = {
|
||||
"mypacman_"..itm.."s.png",
|
||||
"mypacman_"..itm.."s.png",
|
||||
"mypacman_"..itm.."s.png",
|
||||
"mypacman_"..itm.."s.png",
|
||||
"mypacman_"..itm.."f.png",
|
||||
"mypacman_"..itm.."s.png",
|
||||
"pacmine_"..itm.."s.png",
|
||||
"pacmine_"..itm.."s.png",
|
||||
"pacmine_"..itm.."s.png",
|
||||
"pacmine_"..itm.."s.png",
|
||||
"pacmine_"..itm.."f.png",
|
||||
"pacmine_"..itm.."s.png",
|
||||
},
|
||||
velocity = {x=math.random(-1,1), y=0, z=math.random(-1,1)},
|
||||
collisionbox = {-0.25, -1.0, -0.25, 0.25, 0.48, 0.25},
|
||||
|
@ -46,7 +46,7 @@ for i in ipairs(ghosts) do
|
|||
self.timer = 0
|
||||
|
||||
-- Do we have game state? if not just die
|
||||
local gamestate = mypacman.games[self.gameid]
|
||||
local gamestate = pacmine.games[self.gameid]
|
||||
if not gamestate then
|
||||
minetest.log("action", "Removing pacman ghost without game assigned")
|
||||
self.object:remove()
|
||||
|
@ -90,26 +90,26 @@ for i in ipairs(ghosts) do
|
|||
-- set the timer negative so it'll have to wait extra time
|
||||
self.timer = -ghosts_death_delay
|
||||
-- play sound and reward player
|
||||
minetest.sound_play("mypacman_eatghost", {pos = boardcenter,max_hear_distance = 6, object=player, loop=false})
|
||||
player:get_inventory():add_item('main', 'mypacman:cherrys')
|
||||
minetest.sound_play("pacmine_eatghost", {pos = boardcenter,max_hear_distance = 6, object=player, loop=false})
|
||||
player:get_inventory():add_item('main', 'pacmine:cherrys')
|
||||
else
|
||||
-- Ghost catches the player!
|
||||
gamestate.lives = gamestate.lives - 1
|
||||
if gamestate.lives < 1 then
|
||||
minetest.chat_send_player(gamestate.player_name,"Game Over")
|
||||
player:moveto(vector.add(gamestate.pos,{x=0.5,y=0.5,z=-1.5}))
|
||||
mypacman.game_end(self.gameid)
|
||||
minetest.sound_play("mypacman_death", {pos = boardcenter,max_hear_distance = 20, object=player, loop=false})
|
||||
pacmine.game_end(self.gameid)
|
||||
minetest.sound_play("pacmine_death", {pos = boardcenter,max_hear_distance = 20, object=player, loop=false})
|
||||
|
||||
elseif gamestate.lives == 1 then
|
||||
minetest.chat_send_player(gamestate.player_name,"This is your last life")
|
||||
mypacman.game_reset(self.gameid, player)
|
||||
pacmine.game_reset(self.gameid, player)
|
||||
else
|
||||
minetest.chat_send_player(gamestate.player_name,"You have ".. gamestate.lives .." lives left")
|
||||
mypacman.game_reset(self.gameid, player)
|
||||
pacmine.game_reset(self.gameid, player)
|
||||
end
|
||||
end
|
||||
mypacman.update_hud(self.gameid, player)
|
||||
pacmine.update_hud(self.gameid, player)
|
||||
|
||||
else
|
||||
local vec = {x=p.x-s.x, y=p.y-s.y, z=p.z-s.z}
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
local hud_table = {}
|
||||
|
||||
function mypacman.update_hud(id, player)
|
||||
local game = mypacman.games[id]
|
||||
function pacmine.update_hud(id, player)
|
||||
local game = pacmine.games[id]
|
||||
player = player or minetest.get_player_by_name(game.player_name)
|
||||
if not player then
|
||||
return
|
||||
elseif not game then
|
||||
mypacman.remove_hud(player)
|
||||
pacmine.remove_hud(player)
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ function mypacman.update_hud(id, player)
|
|||
end
|
||||
|
||||
|
||||
function mypacman.remove_hud(player, playername)
|
||||
function pacmine.remove_hud(player, playername)
|
||||
local name = playername or player:get_player_name()
|
||||
local hud = hud_table[name]
|
||||
if hud then
|
|
@ -1,18 +1,21 @@
|
|||
|
||||
-- This variable will be exported to other mods when they "depend" on this mod
|
||||
mypacman = {}
|
||||
pacmine = {}
|
||||
|
||||
|
||||
dofile(minetest.get_modpath("mypacman").."/craftitems.lua")
|
||||
dofile(minetest.get_modpath("mypacman").."/ghost.lua")
|
||||
dofile(minetest.get_modpath("mypacman").."/blocks.lua")
|
||||
dofile(minetest.get_modpath("mypacman").."/portals.lua")
|
||||
dofile(minetest.get_modpath("mypacman").."/gamestate.lua")
|
||||
dofile(minetest.get_modpath("mypacman").."/hud.lua")
|
||||
dofile(minetest.get_modpath("pacmine").."/craftitems.lua")
|
||||
dofile(minetest.get_modpath("pacmine").."/ghost.lua")
|
||||
dofile(minetest.get_modpath("pacmine").."/blocks.lua")
|
||||
dofile(minetest.get_modpath("pacmine").."/portals.lua")
|
||||
dofile(minetest.get_modpath("pacmine").."/gamestate.lua")
|
||||
dofile(minetest.get_modpath("pacmine").."/hud.lua")
|
||||
|
||||
|
||||
--Yellow Pellets
|
||||
minetest.register_node("mypacman:pellet_1", {
|
||||
minetest.register_alias("mypacman:pellet_1", "pacmine:pellet_1")
|
||||
minetest.register_alias("mypacman:pellet_2", "pacmine:pellet_2")
|
||||
minetest.register_alias("mypacman:block2", "pacmine:block2")
|
||||
minetest.register_node("pacmine:pellet_1", {
|
||||
description = "Pellet 1",
|
||||
tiles = {"wool_yellow.png"},
|
||||
drawtype = "nodebox",
|
||||
|
@ -29,19 +32,19 @@ minetest.register_node("mypacman:pellet_1", {
|
|||
}
|
||||
},
|
||||
on_destruct = function(pos)
|
||||
minetest.sound_play("mypacman_chomp", {
|
||||
minetest.sound_play("pacmine_chomp", {
|
||||
pos = pos,
|
||||
max_hear_distance = 100,
|
||||
gain = 10.0,
|
||||
})
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
mypacman.on_player_got_pellet(digger)
|
||||
pacmine.on_player_got_pellet(digger)
|
||||
end,
|
||||
})
|
||||
|
||||
--Power Pellets. Need to make these do something
|
||||
minetest.register_node("mypacman:pellet_2", {
|
||||
minetest.register_node("pacmine:pellet_2", {
|
||||
description = "Pellet 2",
|
||||
tiles = {"wool_yellow.png^[colorize:white:140"},
|
||||
drawtype = "nodebox",
|
||||
|
@ -50,10 +53,10 @@ minetest.register_node("mypacman:pellet_2", {
|
|||
walkable = false,
|
||||
light_source = 11,
|
||||
drop = {max_items = 1,items = {
|
||||
{items = {"mypacman:cherrys"},rarity = 4,},
|
||||
{items = {"mypacman:apple"},rarity = 4,},
|
||||
{items = {"mypacman:peach"},rarity = 4,},
|
||||
{items = {"mypacman:strawberry"},rarity = 4,},},
|
||||
{items = {"pacmine:cherrys"},rarity = 4,},
|
||||
{items = {"pacmine:apple"},rarity = 4,},
|
||||
{items = {"pacmine:peach"},rarity = 4,},
|
||||
{items = {"pacmine:strawberry"},rarity = 4,},},
|
||||
},
|
||||
groups = {dig_immediate = 3, not_in_creative_inventory = 0},
|
||||
node_box = {
|
||||
|
@ -66,9 +69,9 @@ minetest.register_node("mypacman:pellet_2", {
|
|||
}
|
||||
},
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
mypacman.on_player_got_power_pellet(digger)
|
||||
pacmine.on_player_got_power_pellet(digger)
|
||||
|
||||
minetest.sound_play("mypacman_eatfruit", {
|
||||
minetest.sound_play("pacmine_eatfruit", {
|
||||
pos = pos,
|
||||
max_hear_distance = 100,
|
||||
gain = 10.0,
|
||||
|
@ -77,16 +80,16 @@ minetest.register_node("mypacman:pellet_2", {
|
|||
})
|
||||
|
||||
--The placer block
|
||||
minetest.register_node("mypacman:block2",{
|
||||
minetest.register_node("pacmine:block2",{
|
||||
description = "Pacman",
|
||||
inventory_image = "mypacman_1.png",
|
||||
inventory_image = "pacmine_1.png",
|
||||
tiles = {
|
||||
"mypacman_wallc.png",
|
||||
"mypacman_1.png",
|
||||
"mypacman_1.png",
|
||||
"mypacman_1.png",
|
||||
"mypacman_1.png",
|
||||
"mypacman_1.png",
|
||||
"pacmine_wallc.png",
|
||||
"pacmine_1.png",
|
||||
"pacmine_1.png",
|
||||
"pacmine_1.png",
|
||||
"pacmine_1.png",
|
||||
"pacmine_1.png",
|
||||
},
|
||||
drawtype = "normal",
|
||||
paramtype = "light",
|
||||
|
@ -94,6 +97,6 @@ minetest.register_node("mypacman:block2",{
|
|||
light_source = 8,
|
||||
groups = {cracky = 1},
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
mypacman.game_start(pos, player)
|
||||
pacmine.game_start(pos, player)
|
||||
end,
|
||||
})
|
|
@ -12,10 +12,11 @@ local cbox = {
|
|||
}
|
||||
|
||||
--Portals
|
||||
minetest.register_node("mypacman:portalr", {
|
||||
minetest.register_alias("mypacman:portalr", "pacmine:portalr")
|
||||
minetest.register_node("pacmine:portalr", {
|
||||
description = "Portalr ",
|
||||
drawtype = "allfaces",
|
||||
tiles = {"mypacman_portal.png"},
|
||||
tiles = {"pacmine_portal.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
light_source = 14,
|
||||
|
@ -26,10 +27,11 @@ minetest.register_node("mypacman:portalr", {
|
|||
selection_box = sbox,
|
||||
|
||||
})
|
||||
minetest.register_node("mypacman:portall", {
|
||||
minetest.register_alias("mypacman:portall", "pacmine:portall")
|
||||
minetest.register_node("pacmine:portall", {
|
||||
description = "Portall ",
|
||||
drawtype = "allfaces",
|
||||
tiles = {"mypacman_portal.png"},
|
||||
tiles = {"pacmine_portal.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
light_source = 14,
|
||||
|
@ -42,13 +44,13 @@ minetest.register_node("mypacman:portall", {
|
|||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"mypacman:portall"},
|
||||
nodenames = {"pacmine:portall"},
|
||||
interval = 0.5,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local objs = minetest.env:get_objects_inside_radius(pos, 1)
|
||||
for k, player in pairs(objs) do
|
||||
if player:get_player_name() then
|
||||
if player:get_player_name() then
|
||||
|
||||
player:setpos({x=pos.x-23,y=pos.y+0.5,z=pos.z})
|
||||
end
|
||||
|
@ -56,13 +58,13 @@ minetest.register_abm({
|
|||
end
|
||||
})
|
||||
minetest.register_abm({
|
||||
nodenames = {"mypacman:portalr"},
|
||||
nodenames = {"pacmine:portalr"},
|
||||
interval = 0.5,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local objs = minetest.env:get_objects_inside_radius(pos, 1)
|
||||
for k, player in pairs(objs) do
|
||||
if player:get_player_name() then
|
||||
if player:get_player_name() then
|
||||
|
||||
player:setpos({x=pos.x+23,y=pos.y+0.5,z=pos.z})
|
||||
end
|
Before Width: | Height: | Size: 473 B After Width: | Height: | Size: 473 B |
Before Width: | Height: | Size: 313 B After Width: | Height: | Size: 313 B |
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 296 B After Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 157 B After Width: | Height: | Size: 157 B |
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 556 B After Width: | Height: | Size: 556 B |
Before Width: | Height: | Size: 431 B After Width: | Height: | Size: 431 B |
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 377 B |
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 127 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 450 B |
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 498 B After Width: | Height: | Size: 498 B |
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 465 B After Width: | Height: | Size: 465 B |
Before Width: | Height: | Size: 467 B After Width: | Height: | Size: 467 B |