diff options
| -rw-r--r-- | lua/zones.lua | 14 | ||||
| -rw-r--r-- | zone_example.lua | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/lua/zones.lua b/lua/zones.lua index 7f67e43..876131e 100644 --- a/lua/zones.lua +++ b/lua/zones.lua @@ -1,5 +1,5 @@ -local version = 1.12 -- Older versions will not run if a newer version is used in another script. +local version = 1.13 -- Older versions will not run if a newer version is used in another script. --[[ ZONES - by Bobbleheadbob WARNING: If you edit any of these files, make them use a different namespace. Multiple scripts may depend on this library so modifying it can break other scripts. @@ -199,9 +199,10 @@ if SERVER then zones.CalcBounds(zone) zones.List[id] = zone + hook.Run("OnZoneCreated",zone,zone.class,id) + zones.Sync() - hook.Run("OnZoneCreated",zone,zone.class,id) return zone, id @@ -222,6 +223,7 @@ if SERVER then end function zones.Remove(id) + hook.Run("OnZoneRemoved",zones.List[id],zones.List[id].class,id) zones.List[id] = nil zones.Sync() end @@ -280,6 +282,8 @@ if SERVER then zones.Remove(from) + hook.Run("OnZoneChanged",zto,zto.class,to) + zones.Sync() end @@ -304,6 +308,8 @@ if SERVER then local id = table.maxn(zones.List)+1 zones.List[id] = new + hook.Run("OnZoneSplit",new,new.class,id,zone,id) + zones.Sync() return new,id @@ -324,10 +330,10 @@ if SERVER then zones.Sync() end - hook.Add("Initialize","claim_load",function() + hook.Add("InitPostEntity","zones_load",function() zones.LoadZones() end) - hook.Add("PlayerInitialSpawn","claim_sync",function(ply) + hook.Add("PlayerInitialSpawn","zones_sync",function(ply) zones.Sync(ply) end) diff --git a/zone_example.lua b/zone_example.lua index c2540ca..59527b8 100644 --- a/zone_example.lua +++ b/zone_example.lua @@ -146,7 +146,7 @@ end) end) -- Example of the OnZoneLoaded hook. - -- This hook is called as a zone is loaded into the game, typically on map startup. Only called serverside. + -- This hook is called as a zone is loaded into the game, typically on map startup. Good for things like converting ents.GetMapCreatedEntity() to Entity() Only called serverside. -- Arguments are: -- zone - The full zone table of the zone we are editing. -- class - The class of the zone. |
