This commit is contained in:
lifestorm
2024-08-04 22:55:00 +03:00
parent 8064ba84d8
commit 73479cff9e
7338 changed files with 1718883 additions and 14 deletions

View File

@@ -0,0 +1,68 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
--
-- The baseclass module uses upvalues to give the impression of inheritence.
--
-- At the top of your class file add
--
-- DEFINE_BASECLASS( "base_class_name" )
--
-- Now the local variable BaseClass will be available.
-- ( in engine DEFINE_BASECLASS is replaced with "local BaseClass = baseclass.Get" )
--
-- Baseclasses are added using baseclass.Set - this is done automatically for:
--
-- > widgets
-- > panels
-- > drive modes
-- > entities
-- > weapons
--
-- Classes don't have to be created in any particular order. The system is
-- designed to work with whatever order the classes are defined.
--
-- The only caveat is that classnames must be unique.
-- eg Creating a panel and widget with the same name will cause problems.
--
module( "baseclass", package.seeall )
local BaseClassTable = {}
function Get( name )
if ( ENT ) then ENT.Base = name end
if ( SWEP ) then SWEP.Base = name end
BaseClassTable[name] = BaseClassTable[name] or {}
return BaseClassTable[name]
end
function Set( name, tab )
if ( !BaseClassTable[name] ) then
BaseClassTable[name] = tab
else
table.Merge( BaseClassTable[name], tab )
setmetatable( BaseClassTable[name], getmetatable(tab) )
end
BaseClassTable[name].ThisClass = name
end