First commit
13
ontime_clocks/LICENSE.txt
Normal file
@ -0,0 +1,13 @@
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
47
ontime_clocks/README.md
Normal file
@ -0,0 +1,47 @@
|
||||
# Ontime Clocks
|
||||
|
||||
This mod provides clocks that display real ingame time.
|
||||
|
||||
**Dependancies**: display_lib, default
|
||||
|
||||
**License**: WTFPL
|
||||
|
||||
## Recipes
|
||||
|
||||
**Green and red digital clocks**
|
||||
|
||||
- D -
|
||||
G M G
|
||||
- - -
|
||||
|
||||
G = Glass, D = Dye, M = Mese Crystal, - = Empty
|
||||
|
||||
Green dye for green clock, red dye for red clock
|
||||
|
||||
**White clock**
|
||||
|
||||
S P S
|
||||
- M -
|
||||
- - -
|
||||
|
||||
P = Paper, S = Steel Ingot, M = Mese Crystal, - = Empty
|
||||
|
||||
|
||||
**Frameless clock**
|
||||
|
||||
S D S
|
||||
- M -
|
||||
- - -
|
||||
|
||||
D = Dye, S = Steel Ingot, M = Mese Crystal, - = Empty
|
||||
|
||||
Black dye for black clock, White dye for white clock
|
||||
|
||||
**Gold frameless clock**
|
||||
|
||||
G - G
|
||||
- M -
|
||||
- - -
|
||||
|
||||
G = Gold Ingot, M = Mese Crystal, - = Empty
|
||||
|
41
ontime_clocks/common.lua
Normal file
@ -0,0 +1,41 @@
|
||||
-- Entity for time display
|
||||
display_lib.register_display_entity("ontime_clocks:display")
|
||||
|
||||
function ontime_clocks.get_h24()
|
||||
return math.floor(minetest.get_timeofday()*24)%24
|
||||
end
|
||||
|
||||
function ontime_clocks.get_h12()
|
||||
return math.floor(minetest.get_timeofday()*24)%12
|
||||
end
|
||||
|
||||
function ontime_clocks.get_m12()
|
||||
return math.floor(minetest.get_timeofday()*288)%12
|
||||
end
|
||||
|
||||
function ontime_clocks.get_digital_properties(color_off, color_on, hour, minute)
|
||||
return
|
||||
{
|
||||
textures={"ontime_clocks_digital_background.png^[colorize:"..color_off
|
||||
.."^([combine:21x7"
|
||||
..":0,"..(-7*(math.floor(hour/10))).."=ontime_clocks_digital_digit.png"
|
||||
..":5,"..(-7*(hour%10)).."=ontime_clocks_digital_digit.png"
|
||||
..":9,-70=ontime_clocks_digital_digit.png"
|
||||
..":12,"..(-7*(math.floor(minute/2))).."=ontime_clocks_digital_digit.png"
|
||||
..":17,"..(-35*(minute%2)).."=ontime_clocks_digital_digit.png"
|
||||
.."^[colorize:"..color_on..")"},
|
||||
visual_size = {x=21/32, y=7/32}
|
||||
}
|
||||
end
|
||||
|
||||
function ontime_clocks.get_needles_properties(color, size, hour, minute)
|
||||
return
|
||||
{
|
||||
textures={"[combine:"..size.."x"..size
|
||||
..":0,"..(-size*hour).."=ontime_clocks_needle_h"..size..".png"
|
||||
..":0,"..(-size*minute).."=ontime_clocks_needle_m"..size..".png"
|
||||
.."^[colorize:"..color},
|
||||
visual_size = {x=size/64, y=size/64}
|
||||
}
|
||||
end
|
||||
|
56
ontime_clocks/crafts.lua
Normal file
@ -0,0 +1,56 @@
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ontime_clocks:green_digital',
|
||||
recipe = {
|
||||
{'', 'dye:green', ''},
|
||||
{'default:glass', 'default:mese_crystal', 'default:glass'},
|
||||
{'', '', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ontime_clocks:red_digital',
|
||||
recipe = {
|
||||
{'', 'dye:red', ''},
|
||||
{'default:glass', 'default:mese_crystal', 'default:glass'},
|
||||
{'', '', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ontime_clocks:white',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:paper', 'default:steel_ingot'},
|
||||
{'', 'default:mese_crystal', ''},
|
||||
{'', '', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ontime_clocks:frameless_black',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'dye:black', 'default:steel_ingot'},
|
||||
{'', 'default:mese_crystal', ''},
|
||||
{'', '', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ontime_clocks:frameless_gold',
|
||||
recipe = {
|
||||
{'default:gold_ingot', '', 'default:gold_ingot'},
|
||||
{'', 'default:mese_crystal', ''},
|
||||
{'', '', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ontime_clocks:frameless_white',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'dye:white', 'default:steel_ingot'},
|
||||
{'', 'default:mese_crystal', ''},
|
||||
{'', '', ''},
|
||||
}
|
||||
})
|
||||
|
||||
|
3
ontime_clocks/depends.txt
Normal file
@ -0,0 +1,3 @@
|
||||
default
|
||||
display_lib
|
||||
|
14
ontime_clocks/init.lua
Normal file
@ -0,0 +1,14 @@
|
||||
-- On time clocks mod by P.Y. Rollo
|
||||
--
|
||||
-- License: WTFPL
|
||||
|
||||
ontime_clocks = {}
|
||||
ontime_clocks.path = minetest.get_modpath("ontime_clocks")
|
||||
|
||||
dofile(ontime_clocks.path.."/common.lua")
|
||||
dofile(ontime_clocks.path.."/nodes.lua")
|
||||
dofile(ontime_clocks.path.."/crafts.lua")
|
||||
|
||||
|
||||
|
||||
|
224
ontime_clocks/nodes.lua
Normal file
@ -0,0 +1,224 @@
|
||||
-- Green digital clock
|
||||
minetest.register_node("ontime_clocks:green_digital", {
|
||||
description = "Green digital clock",
|
||||
inventory_image = "ontime_clocks_green_digital_inventory.png",
|
||||
wield_image = "ontime_clocks_green_digital_inventory.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 7/16 },
|
||||
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
|
||||
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||
},
|
||||
tiles = {"ontime_clocks_digital.png"},
|
||||
groups = {oddly_breakable_by_hand=1},
|
||||
display_entities = {
|
||||
["ontime_clocks:display"] = {
|
||||
depth = -13/32 + 0.01,
|
||||
on_display_update = function(pos, objref)
|
||||
objref:set_properties(
|
||||
ontime_clocks.get_digital_properties(
|
||||
"#040", "#0F0", ontime_clocks.get_h24(), ontime_clocks.get_m12()))
|
||||
end },
|
||||
},
|
||||
on_place = display_lib.on_place,
|
||||
on_construct = display_lib.on_construct,
|
||||
on_destruct = display_lib.on_destruct,
|
||||
on_rotate = display_lib.on_rotate,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"ontime_clocks:green_digital"},
|
||||
interval = 5,
|
||||
chance = 1,
|
||||
action = display_lib.update_entities,
|
||||
})
|
||||
|
||||
-- Red digital clock
|
||||
minetest.register_node("ontime_clocks:red_digital", {
|
||||
description = "Red digital clock",
|
||||
inventory_image = "ontime_clocks_red_digital_inventory.png",
|
||||
wield_image = "ontime_clocks_red_digital_inventory.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 7/16 },
|
||||
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
|
||||
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||
},
|
||||
tiles = {"ontime_clocks_digital.png"},
|
||||
groups = {oddly_breakable_by_hand=1},
|
||||
display_entities = {
|
||||
["ontime_clocks:display"] = {
|
||||
depth = -13/32 + 0.01,
|
||||
on_display_update = function(pos, objref)
|
||||
objref:set_properties(
|
||||
ontime_clocks.get_digital_properties(
|
||||
"#400", "#F00", ontime_clocks.get_h24(), ontime_clocks.get_m12()))
|
||||
end },
|
||||
},
|
||||
on_place = display_lib.on_place,
|
||||
on_construct = display_lib.on_construct,
|
||||
on_destruct = display_lib.on_destruct,
|
||||
on_rotate = display_lib.on_rotate,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"ontime_clocks:red_digital"},
|
||||
interval = 5,
|
||||
chance = 1,
|
||||
action = display_lib.update_entities,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("ontime_clocks:white", {
|
||||
description = "White clock",
|
||||
inventory_image = "ontime_clocks_white_inventory.png",
|
||||
wield_image = "ontime_clocks_white_inventory.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
wall_side = { -0.5, -7/16, -7/16, -6/16, 7/16, 7/16},
|
||||
wall_bottom = { -7/16, -0.5, -7/16, 7/16, -7/16, 7/16},
|
||||
wall_top = { -7/16, 0.5, -7/16, 7/16, 7/16, 7/16},
|
||||
},
|
||||
tiles = {"ontime_clocks_white.png"},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=1},
|
||||
display_entities = {
|
||||
["ontime_clocks:display"] = {
|
||||
depth = -6/16+0.01,
|
||||
on_display_update = function(pos, objref)
|
||||
objref:set_properties(
|
||||
ontime_clocks.get_needles_properties(
|
||||
"#000", 36, ontime_clocks.get_h12(), ontime_clocks.get_m12()))
|
||||
end },
|
||||
},
|
||||
on_place = display_lib.on_place,
|
||||
on_construct = display_lib.on_construct,
|
||||
on_destruct = display_lib.on_destruct,
|
||||
on_rotate = display_lib.on_rotate,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"ontime_clocks:white"},
|
||||
interval = 5,
|
||||
chance = 1,
|
||||
action = display_lib.update_entities,
|
||||
})
|
||||
|
||||
minetest.register_node("ontime_clocks:frameless_black", {
|
||||
description = "Frameless clock",
|
||||
inventory_image = "ontime_clocks_frameless_inventory.png",
|
||||
wield_image = "ontime_clocks_frameless_inventory.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
|
||||
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
|
||||
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||
},
|
||||
tiles = {"ontime_clocks_frameless.png"},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=1},
|
||||
display_entities = {
|
||||
["ontime_clocks:display"] = {
|
||||
depth = -7/16,
|
||||
on_display_update = function(pos, objref)
|
||||
objref:set_properties(
|
||||
ontime_clocks.get_needles_properties(
|
||||
"#000", 48, ontime_clocks.get_h12(), ontime_clocks.get_m12()))
|
||||
end },
|
||||
},
|
||||
on_place = display_lib.on_place,
|
||||
on_construct = display_lib.on_construct,
|
||||
on_destruct = display_lib.on_destruct,
|
||||
on_rotate = display_lib.on_rotate,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"ontime_clocks:frameless_black"},
|
||||
interval = 5,
|
||||
chance = 1,
|
||||
action = display_lib.update_entities,
|
||||
})
|
||||
|
||||
minetest.register_node("ontime_clocks:frameless_gold", {
|
||||
description = "Frameless gold clock",
|
||||
inventory_image = "ontime_clocks_frameless_inventory.png^[colorize:#FF0",
|
||||
wield_image = "ontime_clocks_frameless_inventory.png^[colorize:#FF0",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
|
||||
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
|
||||
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||
},
|
||||
tiles = {"ontime_clocks_frameless.png^[colorize:#FF0"},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=1},
|
||||
display_entities = {
|
||||
["ontime_clocks:display"] = {
|
||||
depth = -7/16,
|
||||
on_display_update = function(pos, objref)
|
||||
objref:set_properties(
|
||||
ontime_clocks.get_needles_properties(
|
||||
"#FF0", 48, ontime_clocks.get_h12(), ontime_clocks.get_m12()))
|
||||
end },
|
||||
},
|
||||
on_place = display_lib.on_place,
|
||||
on_construct = display_lib.on_construct,
|
||||
on_destruct = display_lib.on_destruct,
|
||||
on_rotate = display_lib.on_rotate,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"ontime_clocks:frameless_gold"},
|
||||
interval = 5,
|
||||
chance = 1,
|
||||
action = display_lib.update_entities,
|
||||
})
|
||||
|
||||
minetest.register_node("ontime_clocks:frameless_white", {
|
||||
description = "Frameless white clock",
|
||||
inventory_image = "ontime_clocks_frameless_inventory.png^[colorize:#FFF",
|
||||
wield_image = "ontime_clocks_frameless_inventory.png^[colorize:#FFF",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
|
||||
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
|
||||
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||
},
|
||||
tiles = {"ontime_clocks_frameless.png^[colorize:#FFF"},
|
||||
groups = {choppy=1,oddly_breakable_by_hand=1},
|
||||
display_entities = {
|
||||
["ontime_clocks:display"] = {
|
||||
depth = -7/16,
|
||||
on_display_update = function(pos, objref)
|
||||
objref:set_properties(
|
||||
ontime_clocks.get_needles_properties(
|
||||
"#FFF", 48, ontime_clocks.get_h12(), ontime_clocks.get_m12()))
|
||||
end },
|
||||
},
|
||||
on_place = display_lib.on_place,
|
||||
on_construct = display_lib.on_construct,
|
||||
on_destruct = display_lib.on_destruct,
|
||||
on_rotate = display_lib.on_rotate,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"ontime_clocks:frameless_white"},
|
||||
interval = 5,
|
||||
chance = 1,
|
||||
action = display_lib.update_entities,
|
||||
})
|
BIN
ontime_clocks/textures/ontime_clocks_digital.png
Normal file
After Width: | Height: | Size: 208 B |
BIN
ontime_clocks/textures/ontime_clocks_digital_background.png
Normal file
After Width: | Height: | Size: 197 B |
BIN
ontime_clocks/textures/ontime_clocks_digital_digit.png
Normal file
After Width: | Height: | Size: 223 B |
BIN
ontime_clocks/textures/ontime_clocks_frameless.png
Normal file
After Width: | Height: | Size: 241 B |
BIN
ontime_clocks/textures/ontime_clocks_frameless_inventory.png
Normal file
After Width: | Height: | Size: 426 B |
BIN
ontime_clocks/textures/ontime_clocks_green_digital_inventory.png
Normal file
After Width: | Height: | Size: 300 B |
BIN
ontime_clocks/textures/ontime_clocks_needle_h36.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
ontime_clocks/textures/ontime_clocks_needle_h48.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
ontime_clocks/textures/ontime_clocks_needle_m36.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
ontime_clocks/textures/ontime_clocks_needle_m48.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
ontime_clocks/textures/ontime_clocks_red_digital_inventory.png
Normal file
After Width: | Height: | Size: 315 B |
BIN
ontime_clocks/textures/ontime_clocks_white.png
Normal file
After Width: | Height: | Size: 285 B |
BIN
ontime_clocks/textures/ontime_clocks_white_inventory.png
Normal file
After Width: | Height: | Size: 534 B |