shit counter added
This commit is contained in:
parent
81d6b8962c
commit
8eafe69469
@ -1,3 +1,74 @@
|
|||||||
|
|
||||||
|
is_game_started = false
|
||||||
|
is_game_finished = false
|
||||||
|
|
||||||
|
function ending()
|
||||||
|
|
||||||
|
end
|
||||||
|
function begining()
|
||||||
|
--- Teleport player to 0,0,0
|
||||||
|
-- create 4 page dialog using formspec
|
||||||
|
-- 1st page: welcome
|
||||||
|
-- 2nd page: Story about eating pickles with milk and beans
|
||||||
|
-- 3rd page: Started pooping on the center of the park!
|
||||||
|
-- 4th page: Teleport player to 10 9.5 18
|
||||||
|
|
||||||
|
-- set is_game_started to true
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
destruction_counter = {}
|
||||||
|
destruction_counter.nodesDestroyed = 0
|
||||||
|
local nodesDestroyedByHand = 0
|
||||||
|
|
||||||
|
local idText
|
||||||
|
local idMeter
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
meta = player:get_meta()
|
||||||
|
|
||||||
|
|
||||||
|
idText = player:hud_add({
|
||||||
|
hud_elem_type = "text",
|
||||||
|
position = {x = .5, y = .5},
|
||||||
|
offset = {x = 0, y = 0},
|
||||||
|
text = nodesDestroyed,
|
||||||
|
alignment = {x = 0, y = 0}, -- center aligned
|
||||||
|
scale = {x = 100, y = 100}, -- covered later
|
||||||
|
})
|
||||||
|
|
||||||
|
player:hud_add({
|
||||||
|
hud_elem_type = "image",
|
||||||
|
position = {x = 1, y = .5},
|
||||||
|
offset = {x = -515, y = 23},
|
||||||
|
text = "destruction_counter_meter_empty.png",
|
||||||
|
scale = {x = 4, y = 4},
|
||||||
|
alignment = {x = 1, y = 0},
|
||||||
|
})
|
||||||
|
|
||||||
|
idMeter = player:hud_add({
|
||||||
|
hud_elem_type = "image",
|
||||||
|
position = {x = 1, y = .5},
|
||||||
|
offset = {x = -510, y = 23},
|
||||||
|
text = "destruction_counter_meter_full.png",
|
||||||
|
scale = {x = 0, y = 4},
|
||||||
|
alignment = {x = 1, y = 0},
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
|
||||||
|
function destruction_counter.updateCounter(player)
|
||||||
|
if not player then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local totalDestruction = destruction_counter.nodesDestroyed + math.floor(nodesDestroyedByHand / 10)
|
||||||
|
local percentage = (totalDestruction / 100 * 4)
|
||||||
|
if percentage > 100 then
|
||||||
|
percentage = 100
|
||||||
|
end
|
||||||
|
player:hud_change(idText, "text", "Shitting & Packing Meter: " .. totalDestruction)
|
||||||
|
player:hud_change(idMeter, "scale", {x = percentage, y = 4})
|
||||||
|
end
|
||||||
|
|
||||||
function sraj_dzwiek()
|
function sraj_dzwiek()
|
||||||
--make random sound
|
--make random sound
|
||||||
local sounds = {
|
local sounds = {
|
||||||
@ -18,7 +89,7 @@ function pakuj_guwno()
|
|||||||
end
|
end
|
||||||
minetest.register_node("poop:box", {
|
minetest.register_node("poop:box", {
|
||||||
description = "cardboard box",
|
description = "cardboard box",
|
||||||
tiles = {"BOX.png"},
|
tiles = {"box_top_closed.png","box_top_closed.png", "box_long_side.png", "box_long_side.png", "box_long_side.png", "box_long_side.png"},
|
||||||
|
|
||||||
drop = 'poop:box',
|
drop = 'poop:box',
|
||||||
legacy_mineral = true,
|
legacy_mineral = true,
|
||||||
@ -160,29 +231,31 @@ minetest.register_craftitem("poop:plumba", {
|
|||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if pooped_things >= 100 then
|
||||||
|
is_game_finished = true
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
-- get node at pointed thing position
|
-- get node at pointed thing position
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
-- check if node is poop
|
-- check if node is poop
|
||||||
if node.name == "poop:Poop" then
|
if node.name == "poop:Poop" then
|
||||||
minetest.remove_node(pointed_thing.under)
|
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
|
minetest.add_node(pointed_thing.under, {name="poop:box"})
|
||||||
formspec = "size[8,8]"..
|
minetest.chat_send_player(user:get_player_name(), "You packed "..pooped_things.." shits!")
|
||||||
"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
|
pooped_things = pooped_things + 1
|
||||||
|
destruction_counter.nodesDestroyed = pooped_things
|
||||||
|
destruction_counter.updateCounter(user)
|
||||||
pakuj_guwno()
|
pakuj_guwno()
|
||||||
return itemstack
|
return itemstack
|
||||||
else if node.name == "poop:Poop2" then
|
else if node.name == "poop:Poop2" then
|
||||||
minetest.remove_node(pointed_thing.under)
|
minetest.remove_node(pointed_thing.under)
|
||||||
minetest.add_node(pointed_thing.under, {name="poop:box"})
|
minetest.add_node(pointed_thing.under, {name="poop:box"})
|
||||||
-- display GUI that tells user how much poop he has pooped
|
minetest.chat_send_player(user:get_player_name(), "You packed "..pooped_things.." shits!")
|
||||||
formspec = "size[8,8]"..
|
pakuj_guwno()
|
||||||
"label[0,0;You packed "..pooped_things.." shits!]"..
|
pooped_things = pooped_things + 1
|
||||||
"button_exit[0,1;2,2;exit;Exit]"
|
destruction_counter.nodesDestroyed = pooped_things
|
||||||
minetest.show_formspec(user:get_player_name(), "poop:gui", formspec)
|
destruction_counter.updateCounter(user)
|
||||||
pooped_things = pooped_things + 1
|
|
||||||
pakuj_guwno()
|
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -234,19 +307,6 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
})
|
})
|
||||||
player:get_inventory():add_item("main", "poop:plumba")
|
player:get_inventory():add_item("main", "poop:plumba")
|
||||||
player:get_inventory():add_item("main", "poop:pooper")
|
player:get_inventory():add_item("main", "poop:pooper")
|
||||||
player:get_inventory():add_item("main", "poop:flashlight")
|
|
||||||
player:get_inventory():add_item("main", "poop:tool")
|
begining()
|
||||||
-- give the player all the possible nodes in this mod 2000 times
|
|
||||||
for i = 1, 2000 do
|
|
||||||
player:get_inventory():add_item("main", "poop:floor")
|
|
||||||
player:get_inventory():add_item("main", "poop:tv")
|
|
||||||
player:get_inventory():add_item("main", "poop:bricks")
|
|
||||||
player:get_inventory():add_item("main", "poop:grey_bricks")
|
|
||||||
player:get_inventory():add_item("main", "poop:planks")
|
|
||||||
player:get_inventory():add_item("main", "poop:purpleblock")
|
|
||||||
player:get_inventory():add_item("main", "poop:redblock")
|
|
||||||
player:get_inventory():add_item("main", "poop:aquablock")
|
|
||||||
player:get_inventory():add_item("main", "poop:glass")
|
|
||||||
player:get_inventory():add_item("main", "poop:flux_capacitor")
|
|
||||||
end
|
|
||||||
end)
|
end)
|
Loading…
Reference in New Issue
Block a user