Nicer time setting logging
[oweals/minetest.git] / builtin / game / misc.lua
index a392386f13cd53fba257b47f63d264b411174db1..a71d5d02a7a3157eb70ff149b336c4e0410c9cff 100644 (file)
@@ -93,30 +93,6 @@ function core.get_node_group(name, group)
        return core.get_item_group(name, group)
 end
 
-function core.string_to_pos(value)
-       local p = {}
-       p.x, p.y, p.z = string.match(value, "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
-       if p.x and p.y and p.z then
-               p.x = tonumber(p.x)
-               p.y = tonumber(p.y)
-               p.z = tonumber(p.z)
-               return p
-       end
-       local p = {}
-       p.x, p.y, p.z = string.match(value, "^%( *([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+) *%)$")
-       if p.x and p.y and p.z then
-               p.x = tonumber(p.x)
-               p.y = tonumber(p.y)
-               p.z = tonumber(p.z)
-               return p
-       end
-       return nil
-end
-
-assert(core.string_to_pos("10.0, 5, -2").x == 10)
-assert(core.string_to_pos("( 10.0, 5, -2)").z == -2)
-assert(core.string_to_pos("asd, 5, -2)") == nil)
-
 function core.setting_get_pos(name)
        local value = core.setting_get(name)
        if not value then
@@ -136,3 +112,14 @@ function core.record_protection_violation(pos, name)
        end
 end
 
+local raillike_ids = {}
+local raillike_cur_id = 0
+function core.raillike_group(name)
+       local id = raillike_ids[name]
+       if not id then
+               raillike_cur_id = raillike_cur_id + 1
+               raillike_ids[name] = raillike_cur_id
+               id = raillike_cur_id
+       end
+       return id
+end