diff --git a/game.conf b/game.conf index b14f619..2d53d6d 100644 --- a/game.conf +++ b/game.conf @@ -1,3 +1,4 @@ name = Pooping Simulator author = kacperks, lubek.net, Looki2000, KacpereK, MCL description = Stupid game made in one day for mtgj2022 +allowed_mapgens = flat \ No newline at end of file diff --git a/mods/poop/init.lua b/mods/poop/init.lua index 19379db..5c71b5c 100644 --- a/mods/poop/init.lua +++ b/mods/poop/init.lua @@ -1,14 +1,18 @@ --- add item called plumba --- and let it destroy only the poop to change it to box - minetest.register_node("poop:box", { description = "cardboard box", tiles = {"BOX.png"}, drop = 'poop:box', legacy_mineral = true, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + {-0.3125, -0.5, -0.375, 0.3125, -0.0625, 0.375}, -- NodeBox1 + } + } }) - minetest.register_node("poop:floor", { description = "Floor", tiles = {"floor.png"}, @@ -104,17 +108,34 @@ minetest.register_craftitem("poop:plumba", { if pointed_thing.type ~= "node" then return end - minetest.add_node(pointed_thing.under, {name="poop:box"}) - pooped_things = pooped_things + 1 - -- make a GUI box that shows how many poops you have changed to boxes with button to escape - local formspec = "size[8,8]".. - "button_exit[0,0;8,8;exit;You have changed "..pooped_things.." poops to boxes!]" - minetest.show_formspec(user:get_player_name(), "poop:plumba", formspec) - return itemstack - end, -}) + -- get node at pointed thing position + local node = minetest.get_node(pointed_thing.under) + -- check if node is poop + if node.name == "poop:Poop" then + minetest.remove_node(pointed_thing.under) + minetest.add_node(pointed_thing.under, {name="poop:box"}) -- display GUI that tells user how much poop he has pooped + formspec = "size[8,8]".. + "label[0,0;You packed "..pooped_things.." shits!]".. + "button_exit[0,1;2,2;exit;Exit]" + minetest.show_formspec(user:get_player_name(), "poop:gui", formspec) + pooped_things = pooped_things + 1 + return itemstack + else if node.name == "poop:Poop2" then + minetest.remove_node(pointed_thing.under) + minetest.add_node(pointed_thing.under, {name="poop:box"}) + -- display GUI that tells user how much poop he has pooped + formspec = "size[8,8]".. + "label[0,0;You packed "..pooped_things.." shits!]".. + "button_exit[0,1;2,2;exit;Exit]" + minetest.show_formspec(user:get_player_name(), "poop:gui", formspec) + pooped_things = pooped_things + 1 + return itemstack + end + + end + end + }) --- add item called pooper minetest.register_craftitem("poop:pooper", { description = "Pooper", @@ -127,19 +148,25 @@ minetest.register_craftitem("poop:pooper", { -- make a random number between 1 and 10 local random_number = math.random(1, 10) if random_number < 5 then - minetest.add_node(pointed_thing.under, {name="poop:Poop"}) + local node = minetest.get_node(pointed_thing.above) + if node.name == "air" then + minetest.add_node(pointed_thing.above, {name="poop:Poop"}) + else + minetest.add_node(pointed_thing.under, {name="poop:Poop"}) + end else - minetest.add_node(pointed_thing.under, {name="poop:Poop2"}) + local node = minetest.get_node(pointed_thing.above) + if node.name == "air" then + minetest.add_node(pointed_thing.above, {name="poop:Poop2"}) + else + minetest.add_node(pointed_thing.under, {name="poop:Poop2"}) + end end return itemstack end, }) minetest.register_on_joinplayer(function(player) - -- make a GUI box that tells you how to play the game - local formspec = "size[8,8]".. - "button_exit[0,0;8,8;exit;Welcome to Poop Simulator! To play, poop on the ground using pooper and then use the plumba to change it to a box!]" - minetest.show_formspec(player:get_player_name(), "poop:welcome", formspec) player:get_inventory():set_list("main", {}) player:setpos({x=0, y=10, z=0})