[Mod] Real Clocks [realclocks]

User avatar
jp
Member
 
Posts: 705
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith

[Mod] Real Clocks [realclocks]

by jp » Tue Mar 03, 2015 17:21

Game-time based, functional clocks. Updated every hour.
Video Review (by Nathan Salapat) : https://www.youtube.com/watch?v=qs5Va7QzJvM

License : WTFPL (textures and model by VanessaE)

[Download]

Image Image
Attachments
realclocks.zip
(17.4 KiB) Downloaded 463 times
Last edited by jp on Mon Mar 09, 2015 19:57, edited 1 time in total.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: [Mod] Real Clocks [realclocks]

by Krock » Tue Mar 03, 2015 18:31

With a better texture resolution, you could add numbers :)
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
jp
Member
 
Posts: 705
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith

Re: [Mod] Real Clocks [realclocks]

by jp » Tue Mar 03, 2015 18:37

I know but won't because of laziness.
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Real Clocks [realclocks]

by Nathan.S » Wed Mar 04, 2015 20:21

Really nice, but at the moment I see no way to tell if it is am or pm? could such a feature be added, maybe changing the background color of the clock?
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
jp
Member
 
Posts: 705
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith

Re: [Mod] Real Clocks [realclocks]

by jp » Wed Mar 04, 2015 20:33

Sorry, don't expect any work on that mod in the future ;)
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod] Real Clocks [realclocks]

by Nathan.S » Wed Mar 04, 2015 20:56

Would you mind if I tried to add such a feature. I'll just put a zip file here with my version?
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
jp
Member
 
Posts: 705
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith

Re: [Mod] Real Clocks [realclocks]

by jp » Wed Mar 04, 2015 21:06

No problem, you're totally free to do what you want.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: [Mod] Real Clocks [realclocks]

by Hybrid Dog » Fri Mar 06, 2015 20:29

l could change this mod that you can change the time by clicking on a specific position of the clock…
 

User avatar
jp
Member
 
Posts: 705
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith

Re: [Mod] Real Clocks [realclocks]

by jp » Fri Mar 06, 2015 21:37

Hybrid Dog wrote:l could change this mod that you can change the time by clicking on a specific position of the clock…

I guess you would use an entity, right ? All initiatives are welcome.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: [Mod] Real Clocks [realclocks]

by Hybrid Dog » Sat Mar 07, 2015 07:06

jp wrote:
Hybrid Dog wrote:l could change this mod that you can change the time by clicking on a specific position of the clock…

I guess you would use an entity, right ?

no
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: [Mod] Real Clocks [realclocks]

by Hybrid Dog » Sat Mar 07, 2015 09:08

l wanted to do something like this
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local clock_cbox = {
   type = "fixed",
   fixed = {
      { -1/4, -3/32, 7/16, 1/4, 3/32, .5 },
      { -7/32, -5/32, 7/16, 7/32, 5/32, .5 },
      { -3/16, -3/16, 7/16, 3/16, 3/16, .5 },
      { -5/32, -7/32, 7/16, 5/32, 7/32, .5 },
      { -3/32, -1/4, 7/16, 3/32, 1/4, .5 }
   }
}

local clock_sbox = {
   type = "fixed",
   fixed = { -1/4, -1/4, 7/16, 1/4, 1/4, .5 }
}

local materials = {"plastic", "wood"}

for _,m in ipairs(materials) do

minetest.register_node("realclocks:analog_clock_"..m.."_12", {
   drawtype = "mesh",
   description = "Analog "..m.." clock",
   mesh = "realclocks_analog_clock.obj",
   paramtype = "light",
   paramtype2 = "facedir",
   sunlight_propagates = true,
   tiles = { "realclocks_analog_clock_"..m..".png^clock_12.png" },
   inventory_image = "realclocks_analog_clock_"..m.."_inv.png",
   wield_image = "realclocks_analog_clock_"..m.."_inv.png",
   collision_box = clock_cbox,
   selection_box = clock_sbox,
   groups = {snappy=3},
})

minetest.register_craft({
    output = "realclocks:analog_clock_"..m.."_12",
    recipe = {
      { "", "dye:black", "" },
      { "", "default:stick", "" },
      { "", "dye:black", "" },
    },
})

for i = 1,11 do

   minetest.register_node("realclocks:analog_clock_"..m.."_"..i, {
      drawtype = "mesh",
      mesh = "realclocks_analog_clock.obj",
      paramtype = "light",
      paramtype2 = "facedir",
      sunlight_propagates = true,
      tiles = { "realclocks_analog_clock_"..m..".png^clock_"..i..".png" },
      collision_box = clock_cbox,
      selection_box = clock_sbox,
      groups = {snappy=3, not_in_creative_inventory=1},
      drop = "realclocks:analog_clock_"..m.."_12",
      on_punch = function(pos, node, puncher, pt)
         minetest.chat_send_all("k…")
         local dir = puncher:get_look_dir()
         local dist = vector.new(dir)

         local plpos = puncher:getpos()
         plpos.y = plpos.y+1.625

         if node.param2 == 0 then
            local shpos = {x=pos.x, y=pos.y, z=pos.z+7/16}

            dist.z = shpos.z-plpos.z
            local m = dist.z/dir.z
            dist.x = dist.x*m
            dist.y = dist.y*m
            local newp = vector.add(plpos, dist)
            local tp = vector.subtract(newp, shpos)
            local newtime = 0.25+math.acos(-tp.y/math.hypot(tp.x, tp.y))/(4*math.pi)
            local oldtime = minetest.get_timeofday()
            if oldtime < 0.25
            or oldtime > 0.75
            or oldtime > newtime then
               newtime = (0.5+newtime)%1
            end
            minetest.chat_send_all("time "..newtime*24)
            minetest.set_timeofday(newtime)
         end
         minetest.chat_send_all("it works again")
      end,
   })

end

for n = 1,12 do

   minetest.register_abm({
      nodenames = { "realclocks:analog_clock_"..m.."_"..n },
      interval = math.min(60, (3600 / (tonumber(minetest.setting_get("time_speed")))) / 3),
      chance = 1,
      action = function(pos, node, active_object_count, active_object_count_wider)
         local hour = minetest.get_timeofday() * 24
         if hour > 12 then
            hour = hour - 12
         end
         hour = math.ceil(hour)
         if hour < 1 then
            hour = 1
         elseif hour > 12 then
            hour = 12
         end
         if node.name ~= "realclocks:analog_clock_"..m.."_"..hour then
            local fdir = minetest.get_node(pos).param2
            minetest.set_node(pos, {name="realclocks:analog_clock_"..m.."_"..hour, param2=fdir})
         end
      end
   })
   
end
end

But the code is unfinished because suddenly on_punch stopped working for me.
l tried to let it say chat messages and punched it the whole time but no message appeared.
But the on_punch of other nodes worked without problems.

EDIT: sorry, my mistake, l forgot 2 (1 of each material) nodes
Last edited by Hybrid Dog on Fri Mar 13, 2015 15:28, edited 2 times in total.
 

User avatar
jp
Member
 
Posts: 705
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith

Re: [Mod] Real Clocks [realclocks]

by jp » Sat Mar 07, 2015 11:11

As improvement, I'm further expecting an animated entity, with 12 frames (= one per hour), with commands to switch the hours - instead of using 22 nodes.

If someone do that, his work will get merged and credited in Home Decor ;)
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: [Mod] Real Clocks [realclocks]

by Hybrid Dog » Fri Mar 13, 2015 15:56

I made it possible to change time with the clock(s). Someone with settime priv needs to punch it holding aux1 (the fast key)
https://github.com/HybridDog/realclocks
 


Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 32 guests

cron