Just a little suggestion: I'm a person who dislikes any way of using Thinks, especially when it's looping through many entities.
How I see in CDS_Think() (ok it's more a timer :)), you are only updating the values for HP, armor and heat so you can get the specific values by doing the_entity.health.
Well, why not to edit the metatable of the Entity class instead? Pros: No need to update all entities values every second even when you don't need them. And you have always the latest values, not only after a second. Cons: None so far :)
local enttable = FindMetaTable("Entity");
if(enttable) then
local meta = getmetatable(enttable);
local old__index = meta.__index; -- I'm sure, garry uses a function for __index
meta.__index = function(t,k)
if(k == "health") then
if(t:IsNPC() or t:IsPlayer()) then
return t:Health();
else
return math.Clamp(rawget(t,k),0,t.maxhealth);
end
-- And so on :)
else
return old__index(t,k);
end
end
endNote, I haven't tested the code above, but maybe you are getting the idea :)