From 0f00140d6c553729e596f52219d8e44d89321d62 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Tue, 28 Jul 2015 18:05:01 +0200 Subject: [PATCH] Added globalstep to assign classes - 3d_armor doesn't depend anymore on pclasses (#159) --- mods/3d_armor/3d_armor/armor.lua | 3 --- mods/pclasses/api.lua | 10 +++++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mods/3d_armor/3d_armor/armor.lua b/mods/3d_armor/3d_armor/armor.lua index 33caec1b..932bfa0e 100755 --- a/mods/3d_armor/3d_armor/armor.lua +++ b/mods/3d_armor/3d_armor/armor.lua @@ -452,13 +452,11 @@ minetest.register_on_joinplayer(function(player) player:get_inventory():set_stack(listname, index, stack) armor:set_player_armor(player) armor:update_inventory(player) - pclasses.api.assign_class(player) -- //MFF (Mg|07/18/2015) end, on_take = function(inv, listname, index, stack, player) player:get_inventory():set_stack(listname, index, nil) armor:set_player_armor(player) armor:update_inventory(player) - pclasses.api.assign_class(player) -- //MFF (Mg|07/18/2015) end, on_move = function(inv, from_list, from_index, to_list, to_index, count, player) local plaver_inv = player:get_inventory() @@ -467,7 +465,6 @@ minetest.register_on_joinplayer(function(player) player_inv:set_stack(from_list, from_index, nil) armor:set_player_armor(player) armor:update_inventory(player) - pclasses.api.assign_class(player) -- //MFF (Mg|07/18/2015) end, allow_put = function(inv, listname, index, stack, player) --DEBUT modif MFF (crabman/24/06/2015) diff --git a/mods/pclasses/api.lua b/mods/pclasses/api.lua index 5ab461cb..76769d80 100755 --- a/mods/pclasses/api.lua +++ b/mods/pclasses/api.lua @@ -120,9 +120,13 @@ function pclasses.api.assign_class(player) end end -minetest.register_on_respawnplayer(pclasses.api.assign_class) -minetest.register_on_joinplayer(function(player) minetest.after(1, pclasses.api.assign_class, player) end) -minetest.register_on_leaveplayer(pclasses.api.assign_class) +minetest.register_globalstep(function(dtime) + for id, ref in ipairs(minetest.get_connected_players()) do + pclasses.api.assign_class(ref) + end +end) + + ------------------- -- Reserved items