Add 'get_gametime' function
This commit is contained in:
parent
c4e431b46e
commit
947f4c56e5
@ -1349,7 +1349,7 @@ techage.manual_DE.aText = {
|
|||||||
" - Über 'stacks = $read_data(<num>\\, \"stacks\")' kann der Inhalt der Kiste ausgelesen werden. Siehe dazu: https://github.com/joe7575/techage/blob/master/manuals/ta4_lua_controller_EN.md#sensor-chest\n"..
|
" - Über 'stacks = $read_data(<num>\\, \"stacks\")' kann der Inhalt der Kiste ausgelesen werden. Siehe dazu: https://github.com/joe7575/techage/blob/master/manuals/ta4_lua_controller_EN.md#sensor-chest\n"..
|
||||||
" - Über '$send_cmnd(<num>\\, \"text\"\\, \"press both buttons andnput something into the chest\")' kann der Text im Menü der Sensor Kiste gesetzt werden.\n"..
|
" - Über '$send_cmnd(<num>\\, \"text\"\\, \"press both buttons andnput something into the chest\")' kann der Text im Menü der Sensor Kiste gesetzt werden.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"Über die Checkbox \"Erlaube öffentlichen Zugriff\" kann eingestellt werden\\, ob die Kiste von jedem genutzt werden darf\\, oder nur vom Spielern die hier Zugriffsrechte haben.\n"..
|
"Über die Checkbox \"Erlaube öffentlichen Zugriff\" kann eingestellt werden\\, ob die Kiste von jedem genutzt werden darf\\, oder nur von Spielern die hier Zugriffsrechte haben.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -120,10 +120,18 @@ techage.lua_ctlr.register_function("get_ms_time", {
|
|||||||
cmnd = function(self)
|
cmnd = function(self)
|
||||||
return math.floor(minetest.get_us_time() / 1000)
|
return math.floor(minetest.get_us_time() / 1000)
|
||||||
end,
|
end,
|
||||||
help = "$get_ms_time()\n"..
|
help = " ms = $get_ms_time()\n"..
|
||||||
" returns time with millisecond precision."
|
" returns time with millisecond precision."
|
||||||
})
|
})
|
||||||
|
|
||||||
|
techage.lua_ctlr.register_function("get_gametime", {
|
||||||
|
cmnd = function(self)
|
||||||
|
return minetest.get_gametime()
|
||||||
|
end,
|
||||||
|
help = " t = $get_gametime()\n"..
|
||||||
|
" returns the time, in seconds, since the world was created."
|
||||||
|
})
|
||||||
|
|
||||||
techage.lua_ctlr.register_function("position", {
|
techage.lua_ctlr.register_function("position", {
|
||||||
cmnd = function(self, number)
|
cmnd = function(self, number)
|
||||||
local info = techage.get_node_info(number)
|
local info = techage.get_node_info(number)
|
||||||
@ -132,7 +140,7 @@ techage.lua_ctlr.register_function("position", {
|
|||||||
end
|
end
|
||||||
return "(-,-,-)"
|
return "(-,-,-)"
|
||||||
end,
|
end,
|
||||||
help = "$position(number)\n"..
|
help = " pos = $position(number)\n"..
|
||||||
" returns the position '(x,y,z)' of the device\n with given number."
|
" returns the position '(x,y,z)' of the device\n with given number."
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -144,7 +152,7 @@ techage.lua_ctlr.register_action("battery", {
|
|||||||
local val = (BATTERY_CAPA - math.min(batmeta:get_int("content") or 0, BATTERY_CAPA))
|
local val = (BATTERY_CAPA - math.min(batmeta:get_int("content") or 0, BATTERY_CAPA))
|
||||||
return 100 - math.floor((val * 100.0 / BATTERY_CAPA))
|
return 100 - math.floor((val * 100.0 / BATTERY_CAPA))
|
||||||
end,
|
end,
|
||||||
help = " $battery()\n"..
|
help = " lvl = $battery()\n"..
|
||||||
" Get charge level of battery connected to Controller.\n"..
|
" Get charge level of battery connected to Controller.\n"..
|
||||||
" Function returns percent number (0-100) where 100 means full.\n"..
|
" Function returns percent number (0-100) where 100 means full.\n"..
|
||||||
" example: battery_percent = $battery()"
|
" example: battery_percent = $battery()"
|
||||||
|
@ -330,7 +330,8 @@ In addition to Lua standard function the Lua Controller provides the following f
|
|||||||
E.g.: `$print("Hello "..name)`
|
E.g.: `$print("Hello "..name)`
|
||||||
- `$loopcycle(seconds)` - This function allows to change the call frequency of the controller loop() function, witch is per default one second. For more info, see "Cyclic Task"
|
- `$loopcycle(seconds)` - This function allows to change the call frequency of the controller loop() function, witch is per default one second. For more info, see "Cyclic Task"
|
||||||
- `$events(bool)` - Enable/disable event handling. For more info, see "Events"
|
- `$events(bool)` - Enable/disable event handling. For more info, see "Events"
|
||||||
- `$get_ms_time()` - Returns time with millisecond precision
|
- `$get_ms_time()` - Returns the time with millisecond precision
|
||||||
|
- `get_gametime()` - Returns the time, in seconds, since the world was created
|
||||||
- `$time_as_str()` - Read the time of day (ingame) as text string in 24h format, like "18:45"
|
- `$time_as_str()` - Read the time of day (ingame) as text string in 24h format, like "18:45"
|
||||||
- `$time_as_num()` - Read the time of day (ingame) as integer number in 24h format, like 1845
|
- `$time_as_num()` - Read the time of day (ingame) as integer number in 24h format, like 1845
|
||||||
- `$get_input(num)` - Read an input value provided by an external block with the given number _num_. The block has to be configured with the number of the controller to be able to send status messages (on/off commands) to the controller. _num_ is the number of the remote block, like "1234".
|
- `$get_input(num)` - Read an input value provided by an external block with the given number _num_. The block has to be configured with the number of the controller to be able to send status messages (on/off commands) to the controller. _num_ is the number of the remote block, like "1234".
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user