From 46f6d895599c5c23b5fa80c5a1d4eff753262db0 Mon Sep 17 00:00:00 2001 From: Bob Blackmon Date: Mon, 3 Apr 2017 10:05:12 -0400 Subject: Added zones.ChangeClass --- lua/zones.lua | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'lua/zones.lua') diff --git a/lua/zones.lua b/lua/zones.lua index bf380ca..7f67e43 100644 --- a/lua/zones.lua +++ b/lua/zones.lua @@ -310,6 +310,20 @@ if SERVER then end + function zones.ChangeClass(id,class) + local zone,new = zones.List[id],{} + new.points = zone.points + new.height = zone.height + new.bounds = zone.bounds + new.class = class + + zones.List[id] = new + + hook.Run("OnZoneCreated",new,class,id) + + zones.Sync() + end + hook.Add("Initialize","claim_load",function() zones.LoadZones() end) @@ -328,17 +342,8 @@ if SERVER then end end - local zone,new = zones.List[id],{} - new.points = zone.points - new.height = zone.height - new.bounds = zone.bounds - new.class = class + zones.ChangeClass(id,class) - zones.List[id] = new - - hook.Run("OnZoneCreated",new,class,id) - - zones.Sync() end) else -- cgit v1.2.3-70-g09d2