Advertisement
Rochet2

Lua extension for collision proofing

Apr 14th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. --[[
  2. Set variables:
  3. creature:GetData().escorted = true
  4.  
  5. Check variables:
  6. if(creature:GetData().escorted) then
  7.     print("Has been escorted")
  8. end
  9.  
  10. Remove variables (on death, logout etc)
  11. creature:RemoveData()
  12. ]]
  13.  
  14. local T = {}
  15. function Object:GetData(instance)
  16.     if(instance and not self:GetInstanceId()) then
  17.         error("instance is true and object is not worldobject", 2)
  18.     end
  19.     local ID = instance and -self:GetInstanceId() or self:GetGUID()
  20.     if(not T[ID]) then
  21.         T[ID] = {}
  22.     end
  23.     return T[ID]
  24. end
  25. function Object:RemoveData(instance)
  26.     if(instance and not self:GetInstanceId()) then
  27.         error("instance is true and object is not worldobject", 2)
  28.     end
  29.     local ID = instance and -self:GetInstanceId() or self:GetGUID()
  30.     T[ID] = nil
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement