From 949157e0872d7e0c8fafe1f6207646f503a9ddb8 Mon Sep 17 00:00:00 2001 From: Wouters Dorian Date: Fri, 31 Jul 2015 12:06:47 +0200 Subject: [PATCH] [pclasses] Don't use globalstep (temporary, until we implement better class-assign logic) --- mods/pclasses/api.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mods/pclasses/api.lua b/mods/pclasses/api.lua index 64beca08..6a0d5d81 100755 --- a/mods/pclasses/api.lua +++ b/mods/pclasses/api.lua @@ -103,14 +103,6 @@ function pclasses.api.assign_class(player) end end -minetest.register_globalstep(function(dtime) - for id, ref in ipairs(minetest.get_connected_players()) do - pclasses.api.assign_class(ref) - end -end) - - - ------------------- -- Reserved items -- @@ -118,9 +110,14 @@ function pclasses.api.reserve_item(cname, itemstring) pclasses.data.reserved_items[itemstring] = pclasses.data.reserved_items[itemstring] or {} table.insert(pclasses.data.reserved_items[itemstring], 1, cname) end +------------------------------------------- +-- Determination and reserved items tick -- +------------------------------------------- -minetest.register_globalstep(function(dtime) +local function tick() for id, ref in ipairs(minetest.get_connected_players()) do + pclasses.api.assign_class(ref) + local name = ref:get_player_name() local inv = minetest.get_inventory({type="player", name = name}) for i = 1, inv:get_size("main") do @@ -148,4 +145,7 @@ minetest.register_globalstep(function(dtime) end end end -end) + minetest.after(2, tick) +end + +tick() \ No newline at end of file