diff options
-rw-r--r-- | craftitems.lua | 97 | ||||
-rw-r--r-- | modpack.txt | 0 | ||||
-rwxr-xr-x | pacmine/aliases.lua | 11 | ||||
-rw-r--r-- | pacmine/blocks.lua (renamed from blocks.lua) | 25 | ||||
-rw-r--r-- | pacmine/fruit.lua (renamed from fruit.lua) | 10 | ||||
-rwxr-xr-x | pacmine/gamestate.lua (renamed from gamestate.lua) | 130 | ||||
-rw-r--r-- | pacmine/ghost.lua (renamed from ghost.lua) | 30 | ||||
-rwxr-xr-x | pacmine/hud.lua (renamed from hud.lua) | 8 | ||||
-rw-r--r-- | pacmine/init.lua (renamed from init.lua) | 55 | ||||
-rw-r--r-- | pacmine/models/mypacman_strawberry.obj (renamed from models/mypacman_strawberry.obj) | 0 | ||||
-rw-r--r-- | pacmine/models/pacmine_apple.obj (renamed from models/mypacman_apple.obj) | 0 | ||||
-rw-r--r-- | pacmine/models/pacmine_cherrys.obj (renamed from models/mypacman_cherrys.obj) | 0 | ||||
-rw-r--r-- | pacmine/models/pacmine_orange.obj (renamed from models/mypacman_orange.obj) | 0 | ||||
-rw-r--r-- | pacmine/models/xmypacman_orange.obj (renamed from models/xmypacman_orange.obj) | 0 | ||||
-rw-r--r-- | pacmine/portals.lua (renamed from portals.lua) | 18 | ||||
-rw-r--r-- | pacmine/schems/pacmine_3.mts (renamed from schems/mypacman_3.mts) | bin | 1156 -> 1156 bytes | |||
-rw-r--r-- | pacmine/sounds/pacmine_beginning.ogg (renamed from sounds/mypacman_beginning.ogg) | bin | 17153 -> 17153 bytes | |||
-rw-r--r-- | pacmine/sounds/pacmine_chomp.ogg (renamed from sounds/mypacman_chomp.ogg) | bin | 7014 -> 7014 bytes | |||
-rw-r--r-- | pacmine/sounds/pacmine_death.ogg (renamed from sounds/mypacman_death.ogg) | bin | 7619 -> 7619 bytes | |||
-rw-r--r-- | pacmine/sounds/pacmine_eatfruit.ogg (renamed from sounds/mypacman_eatfruit.ogg) | bin | 4343 -> 4343 bytes | |||
-rw-r--r-- | pacmine/sounds/pacmine_eatghost.ogg (renamed from sounds/mypacman_eatghost.ogg) | bin | 4687 -> 4687 bytes | |||
-rw-r--r-- | pacmine/sounds/pacmine_extrapac.ogg (renamed from sounds/mypacman_extrapac.ogg) | bin | 7594 -> 7594 bytes | |||
-rw-r--r-- | pacmine/sounds/pacmine_powerup.ogg (renamed from sounds/mypacman_powerup.ogg) | bin | 20591 -> 20591 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_1.png (renamed from textures/mypacman_1.png) | bin | 473 -> 473 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_apple.png (renamed from textures/mypacman_apple.png) | bin | 313 -> 313 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_blinkyf.png (renamed from textures/mypacman_blinkyf.png) | bin | 155 -> 155 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_blinkys.png (renamed from textures/mypacman_blinkys.png) | bin | 126 -> 126 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_cherrys.png (renamed from textures/mypacman_cherrys.png) | bin | 296 -> 296 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_clydef.png (renamed from textures/mypacman_clydef.png) | bin | 157 -> 157 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_clydes.png (renamed from textures/mypacman_clydes.png) | bin | 126 -> 126 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_door.png (renamed from textures/mypacman_door.png) | bin | 126 -> 126 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_egg.png (renamed from textures/mypacman_egg.png) | bin | 198 -> 198 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_floor.png (renamed from textures/mypacman_floor.png) | bin | 556 -> 556 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_glass.png (renamed from textures/mypacman_glass.png) | bin | 431 -> 431 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_inkyf.png (renamed from textures/mypacman_inkyf.png) | bin | 158 -> 158 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_inkys.png (renamed from textures/mypacman_inkys.png) | bin | 126 -> 126 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_inv.png (renamed from textures/mypacman_inv.png) | bin | 274 -> 274 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_orange.png (renamed from textures/mypacman_orange.png) | bin | 377 -> 377 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_pinkyf.png (renamed from textures/mypacman_pinkyf.png) | bin | 158 -> 158 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_pinkys.png (renamed from textures/mypacman_pinkys.png) | bin | 127 -> 127 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_portal.png (renamed from textures/mypacman_portal.png) | bin | 144 -> 144 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_powerpellet.png (renamed from textures/mypacman_powerpellet.png) | bin | 238 -> 238 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_strawberry.png (renamed from textures/mypacman_strawberry.png) | bin | 386 -> 386 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_wall.png (renamed from textures/mypacman_wall.png) | bin | 498 -> 498 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_wallc.png (renamed from textures/mypacman_wallc.png) | bin | 500 -> 500 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_walle.png (renamed from textures/mypacman_walle.png) | bin | 465 -> 465 bytes | |||
-rw-r--r-- | pacmine/textures/pacmine_walls.png (renamed from textures/mypacman_walls.png) | bin | 467 -> 467 bytes |
47 files changed, 149 insertions, 235 deletions
diff --git a/craftitems.lua b/craftitems.lua deleted file mode 100644 index 8648363..0000000 --- a/craftitems.lua +++ /dev/null @@ -1,97 +0,0 @@ -local cherry_box = { - type = "fixed", - fixed = { - {0, -0.375, -0.0625, 0.25, 0, 0.0625}, - {-0.0625, -0.3125, -0.0625, 0.3125, -0.0625, 0.0625}, - {-0.3125, -0.25, -0.0625, -0.125, 0.125, 0.0625}, - {-0.375, -0.1875, -0.0625, -0.125, 0.0625, 0.0625}, - {-0.125, -0.0625, -0.0625, -0.0625, 0.125, 0.0625}, - {-0.0625, 0, -0.0625, 0, 0.0625, 0.0625}, - {-0.0625, 0.125, -0.0625, 0, 0.1875, 0.0625}, - {0, 0.1875, -0.0625, 0.125, 0.25, 0.0625}, - {0.125, 0.25, -0.0625, 0.375, 0.3125, 0.0625}, - {0.25, 0.3125, -0.0625, 0.375, 0.375, 0.0625}, - {0.1875, 0.125, -0.0625, 0.25, 0.25, 0.0625}, - {0.125, 0.0625, -0.0625, 0.1875, 0.125, 0.0625}, - {0.0625, 0, -0.0625, 0.125, 0.0625, 0.0625}, - } - } -local strawberry_box = { - type = "fixed", - fixed = { - {-0.0625, 0.3125, -0.0625, 0, 0.375, 0.0625}, - {-0.25, 0.25, -0.0625, 0.1875, 0.3125, 0.0625}, - {-0.3125, 0.1875, -0.0625, 0.25, 0.25, 0.0625}, - {-0.375, -0.0625, -0.0625, 0.3125, 0.1875, 0.0625}, - {-0.3125, -0.1875, -0.0625, 0.25, -0.0625, 0.0625}, - {-0.25, -0.25, -0.0625, 0.1875, -0.1875, 0.0625}, - {-0.1875, -0.3125, -0.0625, 0.125, -0.25, 0.0625}, - {-0.0625, -0.375, -0.0625, 0, -0.3125, 0.0625}, - } - } -local apple_box = { - type = "fixed", - fixed = { - {-0.3125, -0.125, -0.0625, 0.375, 0.25, 0.0625}, - {-0.375, -0.125, -0.0625, -0.3125, 0.1875, 0.0625}, - {-0.3125, -0.25, -0.0625, 0.3125, -0.125, 0.0625}, - {-0.25, -0.3125, -0.0625, 0.25, -0.25, 0.0625}, - {0.0625, -0.375, -0.0625, 0.1875, -0.3125, 0.0625}, - {-0.1875, -0.375, -0.0625, 0, -0.3125, 0.0625}, - {0.125, 0.25, -0.0625, 0.3125, 0.3125, 0.0625}, - {0, 0.25, -0.0625, 0.0625, 0.3125, 0.0625}, - {-0.25, 0.25, -0.0625, -0.0625, 0.3125, 0.0625}, - {-0.0625, 0.3125, -0.0625, 0, 0.375, 0.0625}, - } - } -local orange_box = { - type = "fixed", - fixed = { - {-0.375, -0.125, -0.0625, 0.375, 0.125, 0.0625}, - {-0.3125, -0.25, -0.0625, 0.3125, 0.1875, 0.0625}, - {-0.25, -0.3125, -0.0625, 0.25, 0.25, 0.0625}, - {0.0625, -0.375, -0.0625, 0.1875, -0.3125, 0.0625}, - {-0.1875, -0.375, -0.0625, 0, -0.3125, 0.0625}, - {0, 0.25, -0.0625, 0.0625, 0.375, 0.0625}, - {-0.25, 0.3125, -0.0625, 0.0625, 0.375, 0.0625}, - {-0.1875, 0.25, -0.0625, -0.0625, 0.4375, 0.0625}, - {-0.25, 0.25, -0.0625, -0.1875, 0.3125, 0.0625}, - } - } - -local pelletitems = { - {"cherrys", "Cherrys","2",cherry_box}, - {"apple", "Apple","3",apple_box}, - {"orange", "Orange","4",orange_box}, - {"strawberry", "Strawberry","2",strawberry_box}, - } -for i in ipairs (pelletitems) do - local itm = pelletitems[i][1] - local desc = pelletitems[i][2] - local hlth = pelletitems[i][3] - local cbox = pelletitems[i][4] - -minetest.register_node("mypacman:"..itm,{ - description = desc, - inventory_image = "mypacman_"..itm..".png", - tiles = { - "mypacman_"..itm..".png", - "mypacman_"..itm..".png", - "mypacman_"..itm..".png", - "mypacman_"..itm..".png", - "mypacman_"..itm..".png", - "mypacman_"..itm..".png^[transformFX", - }, - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - walkable = false, - light_source = 14, - groups = {cracky=3,not_in_creative_inventory = 0}, - node_box = cbox, - collision_box = cbox, - after_destruct = function(pos, oldnode) - mypacman.on_player_got_fruit() - end, -}) -end diff --git a/modpack.txt b/modpack.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/modpack.txt diff --git a/pacmine/aliases.lua b/pacmine/aliases.lua new file mode 100755 index 0000000..236901c --- /dev/null +++ b/pacmine/aliases.lua @@ -0,0 +1,11 @@ + + +local nodes = { + "wall", "floor", "wallc", "walle", "walk_wall","glass","glassw", + "cherrys","apple","orange","strawberry", + "pellet_1","pellet_2","block2", +} + +for _,itm in pairs(nodes) do + minetest.register_alias("mypacman:"..itm, "pacmine:"..itm) +end diff --git a/blocks.lua b/pacmine/blocks.lua index 3f6b223..2773142 100644 --- a/blocks.lua +++ b/pacmine/blocks.lua @@ -25,15 +25,15 @@ local i2 = blocks[i][4] local lit = blocks[i][5] local tf = blocks[i][6] -minetest.register_node("mypacman:"..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 +47,9 @@ minetest.register_node("mypacman:"..itm, { }) end --Glass -minetest.register_node("mypacman:glass", { +minetest.register_node("pacmine:glass", { description = "glass", - tiles = {"mypacman_glass.png"}, + tiles = {"pacmine_glass.png"}, drawtype = "glasslike", paramtype = "light", paramtype2 = "facedir", @@ -58,9 +58,9 @@ minetest.register_node("mypacman:glass", { collision_box = cbox, }) -minetest.register_node("mypacman:glassw", { +minetest.register_node("pacmine:glassw", { description = "glassw", - tiles = {"mypacman_glass.png"}, + tiles = {"pacmine_glass.png"}, drawtype = "glasslike", paramtype = "light", paramtype2 = "facedir", @@ -70,6 +70,3 @@ minetest.register_node("mypacman:glassw", { colision_box = cbox, }) - - - diff --git a/fruit.lua b/pacmine/fruit.lua index 34bcdd3..29389a8 100644 --- a/fruit.lua +++ b/pacmine/fruit.lua @@ -14,12 +14,12 @@ for i in ipairs (pelletitems) do local desc = pelletitems[i][2] local hlth = pelletitems[i][3] -minetest.register_node("mypacman:"..itm,{ +minetest.register_node("pacmine:"..itm,{ description = desc, - inventory_image = "mypacman_"..itm..".png", - tiles = {"mypacman_"..itm..".png",}, + inventory_image = "pacmine_"..itm..".png", + tiles = {"pacmine_"..itm..".png",}, drawtype = "mesh", - mesh = "mypacman_"..itm..".obj", + mesh = "pacmine_"..itm..".obj", paramtype = "light", paramtype2 = "facedir", walkable = false, @@ -29,7 +29,7 @@ minetest.register_node("mypacman:"..itm,{ selection_box = cbox, collision_box = cbox, after_destruct = function(pos, oldnode) - mypacman.on_player_got_fruit() + pacmine.on_player_got_fruit() end, }) end diff --git a/gamestate.lua b/pacmine/gamestate.lua index 1cad7f4..6c27d04 100755 --- a/gamestate.lua +++ b/pacmine/gamestate.lua @@ -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) + minetest.log("action","New pacmine 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() @@ -204,7 +204,7 @@ local function gamestate_load() end end --- Called every 0.5 seconds for each player that is currently playing pacman +-- Called every 0.5 seconds for each player that is currently playing local function on_player_gamestep(player, gameid) local player_pos = player:getpos() local positions = { @@ -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,41 +256,41 @@ 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") + minetest.chat_send_player(name, "You are no longer playing pacmine") else - minetest.chat_send_player(name, "You are not currently in a pacman game") + minetest.chat_send_player(name, "You are not currently in a pacmine game") end end }) minetest.register_on_shutdown(function() - minetest.log("action", "Server shuts down. Saving pacman data") + minetest.log("action", "Server shuts down. Saving pacmine data") gamestate_save() end) diff --git a/ghost.lua b/pacmine/ghost.lua index 1c9e47e..7c7c374 100644 --- a/ghost.lua +++ b/pacmine/ghost.lua @@ -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} diff --git a/hud.lua b/pacmine/hud.lua index a20e767..1598a2b 100755 --- a/hud.lua +++ b/pacmine/hud.lua @@ -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 local pellets_left = 252 - game.pellet_count @@ -34,7 +34,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 diff --git a/init.lua b/pacmine/init.lua index b6a6e99..6689cc7 100644 --- a/init.lua +++ b/pacmine/init.lua @@ -1,18 +1,19 @@ -- This variable will be exported to other mods when they "depend" on this mod -mypacman = {} +pacmine = {} +dofile(minetest.get_modpath("pacmine").."/fruit.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") +dofile(minetest.get_modpath("pacmine").."/aliases.lua") -dofile(minetest.get_modpath("mypacman").."/fruit.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") --Yellow Pellets -minetest.register_node("mypacman:pellet_1", { +minetest.register_node("pacmine:pellet_1", { description = "Pellet 1", tiles = {"wool_yellow.png"}, drawtype = "nodebox", @@ -29,31 +30,31 @@ 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 = {{name="mypacman_powerpellet.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.8}},}, + tiles = {{name="pacmine_powerpellet.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.8}},}, drawtype = "nodebox", paramtype = "light", paramtype2 = "facedir", 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 +67,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 +78,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 +95,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, }) diff --git a/models/mypacman_strawberry.obj b/pacmine/models/mypacman_strawberry.obj index 768a9a5..768a9a5 100644 --- a/models/mypacman_strawberry.obj +++ b/pacmine/models/mypacman_strawberry.obj diff --git a/models/mypacman_apple.obj b/pacmine/models/pacmine_apple.obj index 1f1365a..1f1365a 100644 --- a/models/mypacman_apple.obj +++ b/pacmine/models/pacmine_apple.obj diff --git a/models/mypacman_cherrys.obj b/pacmine/models/pacmine_cherrys.obj index 83a5ae2..83a5ae2 100644 --- a/models/mypacman_cherrys.obj +++ b/pacmine/models/pacmine_cherrys.obj diff --git a/models/mypacman_orange.obj b/pacmine/models/pacmine_orange.obj index af98cf2..af98cf2 100644 --- a/models/mypacman_orange.obj +++ b/pacmine/models/pacmine_orange.obj diff --git a/models/xmypacman_orange.obj b/pacmine/models/xmypacman_orange.obj index 4a06d4c..4a06d4c 100644 --- a/models/xmypacman_orange.obj +++ b/pacmine/models/xmypacman_orange.obj diff --git a/portals.lua b/pacmine/portals.lua index cf90712..e086704 100644 --- a/portals.lua +++ b/pacmine/portals.lua @@ -12,10 +12,11 @@ local cbox = { } --Portals -minetest.register_node("mypacman:portalr", { +minetest.register_alias("pacmine:portalr", "pacmine:portalr") +minetest.register_node("pacmine:portalr", { description = "Portalr ", drawtype = "glasslike", - tiles = {"mypacman_portal.png"}, + tiles = {"pacmine_portal.png"}, paramtype = "light", sunlight_propagates = true, light_source = 14, @@ -27,10 +28,11 @@ minetest.register_node("mypacman:portalr", { selection_box = sbox, }) -minetest.register_node("mypacman:portall", { +minetest.register_alias("pacmine:portall", "pacmine:portall") +minetest.register_node("pacmine:portall", { description = "Portall ", drawtype = "glasslike", - tiles = {"mypacman_portal.png"}, + tiles = {"pacmine_portal.png"}, paramtype = "light", sunlight_propagates = true, light_source = 14, @@ -44,13 +46,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 @@ -58,13 +60,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 diff --git a/schems/mypacman_3.mts b/pacmine/schems/pacmine_3.mts Binary files differindex a3124f9..a3124f9 100644 --- a/schems/mypacman_3.mts +++ b/pacmine/schems/pacmine_3.mts diff --git a/sounds/mypacman_beginning.ogg b/pacmine/sounds/pacmine_beginning.ogg Binary files differindex 2188e55..2188e55 100644 --- a/sounds/mypacman_beginning.ogg +++ b/pacmine/sounds/pacmine_beginning.ogg diff --git a/sounds/mypacman_chomp.ogg b/pacmine/sounds/pacmine_chomp.ogg Binary files differindex 1d14e93..1d14e93 100644 --- a/sounds/mypacman_chomp.ogg +++ b/pacmine/sounds/pacmine_chomp.ogg diff --git a/sounds/mypacman_death.ogg b/pacmine/sounds/pacmine_death.ogg Binary files differindex 277acb2..277acb2 100644 --- a/sounds/mypacman_death.ogg +++ b/pacmine/sounds/pacmine_death.ogg diff --git a/sounds/mypacman_eatfruit.ogg b/pacmine/sounds/pacmine_eatfruit.ogg Binary files differindex 212782f..212782f 100644 --- a/sounds/mypacman_eatfruit.ogg +++ b/pacmine/sounds/pacmine_eatfruit.ogg diff --git a/sounds/mypacman_eatghost.ogg b/pacmine/sounds/pacmine_eatghost.ogg Binary files differindex f628395..f628395 100644 --- a/sounds/mypacman_eatghost.ogg +++ b/pacmine/sounds/pacmine_eatghost.ogg diff --git a/sounds/mypacman_extrapac.ogg b/pacmine/sounds/pacmine_extrapac.ogg Binary files differindex 3be1dff..3be1dff 100644 --- a/sounds/mypacman_extrapac.ogg +++ b/pacmine/sounds/pacmine_extrapac.ogg diff --git a/sounds/mypacman_powerup.ogg b/pacmine/sounds/pacmine_powerup.ogg Binary files differindex 23b2854..23b2854 100644 --- a/sounds/mypacman_powerup.ogg +++ b/pacmine/sounds/pacmine_powerup.ogg diff --git a/textures/mypacman_1.png b/pacmine/textures/pacmine_1.png Binary files differindex fac4af2..fac4af2 100644 --- a/textures/mypacman_1.png +++ b/pacmine/textures/pacmine_1.png diff --git a/textures/mypacman_apple.png b/pacmine/textures/pacmine_apple.png Binary files differindex 22e060f..22e060f 100644 --- a/textures/mypacman_apple.png +++ b/pacmine/textures/pacmine_apple.png diff --git a/textures/mypacman_blinkyf.png b/pacmine/textures/pacmine_blinkyf.png Binary files differindex fb1a17d..fb1a17d 100644 --- a/textures/mypacman_blinkyf.png +++ b/pacmine/textures/pacmine_blinkyf.png diff --git a/textures/mypacman_blinkys.png b/pacmine/textures/pacmine_blinkys.png Binary files differindex 79bb09d..79bb09d 100644 --- a/textures/mypacman_blinkys.png +++ b/pacmine/textures/pacmine_blinkys.png diff --git a/textures/mypacman_cherrys.png b/pacmine/textures/pacmine_cherrys.png Binary files differindex 0009e27..0009e27 100644 --- a/textures/mypacman_cherrys.png +++ b/pacmine/textures/pacmine_cherrys.png diff --git a/textures/mypacman_clydef.png b/pacmine/textures/pacmine_clydef.png Binary files differindex e041375..e041375 100644 --- a/textures/mypacman_clydef.png +++ b/pacmine/textures/pacmine_clydef.png diff --git a/textures/mypacman_clydes.png b/pacmine/textures/pacmine_clydes.png Binary files differindex 14803e7..14803e7 100644 --- a/textures/mypacman_clydes.png +++ b/pacmine/textures/pacmine_clydes.png diff --git a/textures/mypacman_door.png b/pacmine/textures/pacmine_door.png Binary files differindex ec92f9e..ec92f9e 100644 --- a/textures/mypacman_door.png +++ b/pacmine/textures/pacmine_door.png diff --git a/textures/mypacman_egg.png b/pacmine/textures/pacmine_egg.png Binary files differindex fbee286..fbee286 100644 --- a/textures/mypacman_egg.png +++ b/pacmine/textures/pacmine_egg.png diff --git a/textures/mypacman_floor.png b/pacmine/textures/pacmine_floor.png Binary files differindex 8e4adc8..8e4adc8 100644 --- a/textures/mypacman_floor.png +++ b/pacmine/textures/pacmine_floor.png diff --git a/textures/mypacman_glass.png b/pacmine/textures/pacmine_glass.png Binary files differindex 2c6dee9..2c6dee9 100644 --- a/textures/mypacman_glass.png +++ b/pacmine/textures/pacmine_glass.png diff --git a/textures/mypacman_inkyf.png b/pacmine/textures/pacmine_inkyf.png Binary files differindex aba85e3..aba85e3 100644 --- a/textures/mypacman_inkyf.png +++ b/pacmine/textures/pacmine_inkyf.png diff --git a/textures/mypacman_inkys.png b/pacmine/textures/pacmine_inkys.png Binary files differindex c94a44c..c94a44c 100644 --- a/textures/mypacman_inkys.png +++ b/pacmine/textures/pacmine_inkys.png diff --git a/textures/mypacman_inv.png b/pacmine/textures/pacmine_inv.png Binary files differindex 244894a..244894a 100644 --- a/textures/mypacman_inv.png +++ b/pacmine/textures/pacmine_inv.png diff --git a/textures/mypacman_orange.png b/pacmine/textures/pacmine_orange.png Binary files differindex 68793e6..68793e6 100644 --- a/textures/mypacman_orange.png +++ b/pacmine/textures/pacmine_orange.png diff --git a/textures/mypacman_pinkyf.png b/pacmine/textures/pacmine_pinkyf.png Binary files differindex e31a81b..e31a81b 100644 --- a/textures/mypacman_pinkyf.png +++ b/pacmine/textures/pacmine_pinkyf.png diff --git a/textures/mypacman_pinkys.png b/pacmine/textures/pacmine_pinkys.png Binary files differindex 1731cf8..1731cf8 100644 --- a/textures/mypacman_pinkys.png +++ b/pacmine/textures/pacmine_pinkys.png diff --git a/textures/mypacman_portal.png b/pacmine/textures/pacmine_portal.png Binary files differindex e491268..e491268 100644 --- a/textures/mypacman_portal.png +++ b/pacmine/textures/pacmine_portal.png diff --git a/textures/mypacman_powerpellet.png b/pacmine/textures/pacmine_powerpellet.png Binary files differindex 880b628..880b628 100644 --- a/textures/mypacman_powerpellet.png +++ b/pacmine/textures/pacmine_powerpellet.png diff --git a/textures/mypacman_strawberry.png b/pacmine/textures/pacmine_strawberry.png Binary files differindex dcedbe6..dcedbe6 100644 --- a/textures/mypacman_strawberry.png +++ b/pacmine/textures/pacmine_strawberry.png diff --git a/textures/mypacman_wall.png b/pacmine/textures/pacmine_wall.png Binary files differindex 4f6d2c0..4f6d2c0 100644 --- a/textures/mypacman_wall.png +++ b/pacmine/textures/pacmine_wall.png diff --git a/textures/mypacman_wallc.png b/pacmine/textures/pacmine_wallc.png Binary files differindex 548b32f..548b32f 100644 --- a/textures/mypacman_wallc.png +++ b/pacmine/textures/pacmine_wallc.png diff --git a/textures/mypacman_walle.png b/pacmine/textures/pacmine_walle.png Binary files differindex 7f65702..7f65702 100644 --- a/textures/mypacman_walle.png +++ b/pacmine/textures/pacmine_walle.png diff --git a/textures/mypacman_walls.png b/pacmine/textures/pacmine_walls.png Binary files differindex a7c4012..a7c4012 100644 --- a/textures/mypacman_walls.png +++ b/pacmine/textures/pacmine_walls.png |