Initial commit: Version 1.1
|
@ -0,0 +1,37 @@
|
|||
# Dice v1.1
|
||||
## Description
|
||||
This Minetest mod adds a red and a white dice to the game, each in form of
|
||||
a full placable block. The dice can also be rolled with a nice dice rolling sound.
|
||||
|
||||
## Crafting
|
||||
### Basic crafting
|
||||
To craft a dice, you have to place *any* kind of wood like this:
|
||||
|
||||
w.w
|
||||
.w.
|
||||
w.w
|
||||
|
||||
* `w` = any kind of wood (group "wood")
|
||||
* `.` = nothing
|
||||
|
||||
The result is 5 white dice.
|
||||
|
||||
### Coloring
|
||||
If you use Minetest Game or a similar subgame which has a mod called “dye”,
|
||||
the following additional shapeless recipes are available:
|
||||
|
||||
* 1 white dice: 1 red dice, 1 white dye and 1 black dye
|
||||
* 1 red dice: 1 white dice, 1 red dye and 1 white dye
|
||||
|
||||
## How to use
|
||||
If you place a dice, it will face a random direction and turned randomly.
|
||||
|
||||
You can mine dice in half a second without any tool, but it can be faster
|
||||
with “choppy” tools (e.g. axes).
|
||||
|
||||
To roll the dice, press the use key (right click) while pointing to it. So you
|
||||
don’t have to mine and place it again.
|
||||
If you don’t want to throw the dice but want to build something to it, you have
|
||||
to rightclick it while you hold the sneak key (usually Shift).
|
||||
|
||||
Careful: The dice are flammable!
|
|
@ -0,0 +1,2 @@
|
|||
dye?
|
||||
intllib?
|
|
@ -0,0 +1 @@
|
|||
Decorational dice blocks. They are facing a random direction when placed and change their facing direction when rightclicked.
|
|
@ -0,0 +1,80 @@
|
|||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
dice2 = {}
|
||||
dice2.colors = { "white", "red" }
|
||||
dice2.descriptions = { S("white dice"), S("red dice") }
|
||||
|
||||
--[[ throw dice (randomly change facedir and play sound ]]
|
||||
function dice2.throw(pos, node, clicker, itemstack, pointed_thing)
|
||||
local newnode = node
|
||||
|
||||
--[[ Why math.random(0,23), you ask?
|
||||
This includes the facing direction (1 out of 6) and the rotation (1 out of 4).
|
||||
This is basically the same as
|
||||
math.random(0,5) + math.random(0,4)*6
|
||||
.
|
||||
Don’t worry, the probability is still 1/6 for each facing direction. ]]
|
||||
newnode.param2 = math.random(0,23)
|
||||
minetest.swap_node(pos,newnode)
|
||||
minetest.sound_play( {name="dice2_dice_throw", gain=1 }, {pos=pos, loop=false})
|
||||
return itemstack
|
||||
end
|
||||
|
||||
--[[ place dice and use a random facedir ]]
|
||||
function dice2.construct(pos) --, placer, itemstack, pointed_thing)
|
||||
local newnode = minetest.get_node(pos)
|
||||
newnode.param2 = math.random(0,23)
|
||||
minetest.swap_node(pos,newnode)
|
||||
end
|
||||
|
||||
for i=1,#dice2.colors do
|
||||
c = dice2.colors[i]
|
||||
minetest.register_node("dice2:dice_"..c,
|
||||
{
|
||||
description = dice2.descriptions[i],
|
||||
tiles = {
|
||||
"dice2_dice_"..c.."_6.png", "dice2_dice_"..c.."_1.png",
|
||||
"dice2_dice_"..c.."_5.png", "dice2_dice_"..c.."_2.png",
|
||||
"dice2_dice_"..c.."_4.png", "dice2_dice_"..c.."_3.png" },
|
||||
groups = { choppy=2, flammable=1, dig_immediate=2 },
|
||||
paramtype2 = "facedir",
|
||||
sounds = {
|
||||
footstep = { name="dice2_dice_punchstep", gain = 0.75 },
|
||||
dig = { name="dice2_dice_punchstep", gain = 0.8325 },
|
||||
dug = { name="dice2_dice_punchstep", gain = 1 },
|
||||
place = { name="dice2_dice_place", gain = 1 }, },
|
||||
on_rightclick = dice2.throw,
|
||||
on_construct = dice2.construct
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dice2:dice_white 5",
|
||||
recipe = {
|
||||
{ "group:wood", "", "group:wood" },
|
||||
{ "", "group:wood", ""} ,
|
||||
{ "group:wood", "", "group:wood" }
|
||||
}
|
||||
})
|
||||
|
||||
if minetest.get_modpath("dye") ~= nil then
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "dice2:dice_white",
|
||||
recipe = { "dice2:dice_red", "dye:white", "dye:black" }
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "dice2:dice_red",
|
||||
recipe = { "dice2:dice_white", "dye:red", "dye:white" }
|
||||
})
|
||||
end
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
white dice = weißer Spielwürfel
|
||||
red dice = roter Spielwürfel
|
|
@ -0,0 +1,2 @@
|
|||
white dice
|
||||
red dice
|
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 268 B |
After Width: | Height: | Size: 277 B |
After Width: | Height: | Size: 305 B |
After Width: | Height: | Size: 293 B |
After Width: | Height: | Size: 325 B |
After Width: | Height: | Size: 280 B |
After Width: | Height: | Size: 245 B |
After Width: | Height: | Size: 250 B |
After Width: | Height: | Size: 269 B |
After Width: | Height: | Size: 254 B |
After Width: | Height: | Size: 278 B |
After Width: | Height: | Size: 262 B |