Slot Machine 1.0

This commit is contained in:
Alex Carroll 2016-04-27 17:26:47 -04:00
commit 7db8ff30d9
5 changed files with 56 additions and 0 deletions

17
README.txt Normal file
View File

@ -0,0 +1,17 @@
===Slot Machine Mod for MineTest===
by Alex Carroll and Andres Lucca
This mod adds a slot machine block and the recipe to create it.
Recipe:
S S S
S G S
S S S
S = Steel Ingot G = Gold Ingot
License: WTFPL (Use it, modify it, redistribute it, do whatever you want with our code.)
See also:
http://minetest.net/

39
init.lua Normal file
View File

@ -0,0 +1,39 @@
math.randomseed(os.time())
minetest.register_node("slot_machine:slotmachine", {
tiles = {
"side.png",
"side.png",
"lever.png",
"side.png",
"side.png",
"front.png"
},
groups = {cracky=1},
})
minetest.register_craft({
output = 'slot_machine:slotmachine 1',
recipe = {
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:steel_ingot', 'default:gold_ingot', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
}
})
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
if node.name == "slot_machine:slotmachine" then
local puncher_name = puncher:get_player_name()
local num = math.random(0,20)
if num <= 15 then
minetest.chat_send_player(puncher_name, "You lose, you receive 5 dirt")
puncher:get_inventory():add_item("main", "default:dirt 5")
elseif num > 15 and num < 20 then
minetest.chat_send_player(puncher_name, "Success! You receive 3 steel ingots!")
puncher:get_inventory():add_item("main", "default:steel_ingot 3")
elseif num == 20 then
minetest.chat_send_player(puncher_name, "Lucky duck! You receive 5 gold ingots!")
puncher:get_inventory():add_item("main", "default:gold_ingot 5")
end
end
end)

BIN
textures/front.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

BIN
textures/lever.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

BIN
textures/side.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B