forked from FAForever/fa
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGlobalBuilderGroup.lua
More file actions
67 lines (59 loc) · 2.06 KB
/
GlobalBuilderGroup.lua
File metadata and controls
67 lines (59 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
----------------------------------------------------------------------------
--
-- File : /lua/system/GlobalBuilderGroup.lua
--
-- Summary : Global builder group table and blueprint methods
--
-- Copyright © 2008 Gas Powered Games, Inc. All rights reserved.
----------------------------------------------------------------------------
-- Global list of all buffs found in the system.
BuilderGroups = {}
-- Buff blueprints are created by invoking BuffBlueprint() with a table
-- as the buff data. Buffs can be defined in any module at any time.
-- e.g.
--
-- BuffBlueprint {
-- Name = HealingOverTime1,
-- DisplayName = 'Healing Over Time',
-- [...]
-- Affects = {
-- Health = {
-- Add = 10,
-- },
-- },
-- }
--
--
--
BuilderGroup = {}
BuilderGroupDefMeta = {}
BuilderGroupDefMeta.__index = BuilderGroupDefMeta
BuilderGroupDefMeta.__call = function(...)
if type(arg[2]) ~= 'table' then
LOG('Invalid BuilderGroup: ', repr(arg))
return
end
if not arg[2].BuilderGroupName then
WARN('Missing BuilderGroupName for BuilderGroup definition: ',repr(arg))
return
end
if not arg[2].BuildersType then
WARN('Missing BuildersType for BuilderGroup definition - BuilderGroupName = ' .. arg[2].BuilderGroupName)
return
end
if arg[2].BuildersType ~= 'EngineerBuilder' and arg[2].BuildersType ~= 'FactoryBuilder' and arg[2].BuildersType ~= 'PlatoonFormBuilder' and arg[2].BuildersType ~= 'StrategyBuilder' then
WARN('Invalid BuildersType for BuilderGroup definition - BuilderGroupName = ' .. arg[2].BuilderGroupName)
return
end
if BuilderGroups[arg[2].BuilderGroupName] then
LOG('Hooked PlatoonTemplate: ', arg[2].BuilderGroupName)
for k,v in arg[2] do
BuilderGroups[arg[2].BuilderGroupName][k] = v
end
else
BuilderGroups[arg[2].BuilderGroupName] = arg[2]
end
--SPEW('BuilderGroup Registered: ', arg[2].BuilderGroupName)
return arg[2].BuilderGroupName
end
setmetatable(BuilderGroup, BuilderGroupDefMeta)