-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeyorder.lua
More file actions
151 lines (114 loc) · 4.8 KB
/
keyorder.lua
File metadata and controls
151 lines (114 loc) · 4.8 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
local json_keyorder = { 'SaveName', 'EpochTime', 'Date', 'VersionNumber',
'GameMode', 'GameType', 'GameComplexity', 'PlayingTime', 'PlayerCounts', 'Tags',
'Gravity', 'PlayArea', 'Table', 'Sky', 'SkyURL', 'Note', 'TabStates',
'MusicPlayer', 'GUID', 'Name', 'Transform', 'Nickname', 'Description',
'GMNotes', 'AltLookAngle', 'ColorDiffuse', 'LayoutGroupSortIndex', 'Value',
'Locked', 'Grid', 'Snap', 'IgnoreFoW', 'MeasureMovement', 'DragSelectable',
'Autoraise', 'Sticky', 'Tooltip', 'GridProjection', 'HideWhenFaceDown',
'Lighting', 'Hands', 'CardID', 'SidwaysCard', 'DeckIDs', 'CustomDeck', 'Text',
'CustomImage', 'ComponentTags', 'Turns', 'CameraStates', 'DecalPallet',
'FogColor', 'FogHidePointers', 'FogReverseHiding', 'FogSeethrough',
-- global and most objects
'x', 'y', 'z', 'r', 'g', 'b',
'CustomDecal',
'ImageURL', 'ImageSecondaryURL', 'ImageScalar', 'WidthScale', 'CustomToken',
'Thickness', 'MergeDistancePixels', 'StandUp', 'Stackable',
'title', 'body', 'color', 'visibleColor', 'id', -- TabStates
'FaceURL', 'BackURL', 'NumWidth', 'NumHeight', 'BackIsHidden', 'UniqueBack',
-- Deck
'Enable', 'Type', 'TurnOrder', 'Reverse', 'SkipEmpty', 'DisableInteractions',
'PassTurns', 'TurnColor', -- Turns
'Lines', 'Color', 'Opacity', 'ThickLines', 'Snapping', 'Offset', 'BothSnapping',
'xSize', 'ySize', 'PosOffset', -- Grid
'LightIntensity', 'LightColor', 'AmbientIntensity', 'AmbientType',
'AmbientSkyColor', 'AmbientEquatorColor', 'AmbientGroundColor',
'ReflectionIntensity', 'LutIndex', 'LutContribution', -- Lighting
'RepeatSont', 'PlaylistEntry', 'CurrentAudioTitle', 'CurrentAudioURL',
'AudioLibrary', -- MusicPlayer
'Item1','Item2',
'displayed', 'normalized', -- ComponentTags.labels
'Position', 'Rotation', 'Distance', 'Zoomed', 'AbsolutePosition', -- CameraStates
'MeshURL', 'DiffuseURL', 'NormalURL', 'ColliderURL', 'Convex', -- CustomMesh
'AssetbundleURL', 'AssetbundleSecondaryURL', 'MaterialIndex', 'MeshIndex', 'TypeIndex',
'LoopingEffectIndex', --CustomAssetbundle
'Number',
'CustomMesh', 'CustomShader', 'CastShadows', -- CustomMesh
'SpecularColor', 'SpecularIntensity', 'SpecularSharpness', 'FresnelStrength',
-- CustomShader
'StaticFriction', 'DynamicFriction', 'Bounciness', 'FrictionCombine',
'BounceCombine', -- PhysicsMaterial
'Mass', 'Drag', 'AngularDrag', 'UseGravity', -- Rigidbody
'DisableUnused', 'Hiding', -- Hands
'colorstate', 'fontSize', -- Text
'PDFUrl', 'PDFPassword', 'PDFPage', 'PDFPageOffset', --CustomPDF
'Bag', 'CustomPDF',
'LuaScript', 'LuaScriptState', 'XmlUI', 'AttachedDecals', 'CustomUIAssets',
'Decals', 'SnapPoints', 'ObjectStates', 'States', 'ContainedObjects',
'PhysicsMaterial', 'Rigidbody',
'posX', 'posY', 'posZ', 'rotX', 'rotY', 'rotZ', 'scaleX', 'scaleY', 'scaleZ',
'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'
}
local sorted_keys = {}
for i,key in ipairs(json_keyorder) do
sorted_keys[#sorted_keys + 1] = key
end
table.sort(sorted_keys)
local dup = {}
for i=2,#sorted_keys do
if sorted_keys[i] == sorted_keys[i-1] then
dup[#dup + 1] = sorted_keys[i]
end
end
if #dup > 0 then
local err = 'duplicate keys: '
for i, key in ipairs(dup) do
err = err .. key .. ' '
end
error(err)
end
function keyorder_for_CustomDeck(CustomDeck)
local keys = sorted_keys_for_obj(CustomDeck)
return keys
end
function keyorder_for_placement_bag_state(state)
local uniq = {}
local keys = {}
local function merge(new_keys)
if new_keys then
for i,k in ipairs(new_keys) do
if not uniq[k] then
uniq[k] = true
keys[#keys + 1] = k
end
end
end
end
local fixed_keys = {'lock', 'pos', 'position', 'rot', 'rotation', 'x', 'y',
'z', 'private', 'loadNewest', 'investigators', 'playVis', 'fullVis',
'cameras', 'Red', 'redDeck', 'Orange', 'orangeDeck', 'White', 'whiteDeck',
'Green', 'greenDeck', 'position', 'distance', 'pitch', 'yaw', 'cd', 'tid',
'name', 'url', 'scale', 'move', 'counter', 'textbox', 'checkbox', 'size',
'state', 'pos', 'value', 'rows', 'alignment', 'width', 'label', 'font_size',
'tracking', 'tokens', 'auto_update', 'Skull', 'skull', 'Cultist', 'cultist',
'Tablet', 'tablet', 'Elder Thing', 'elder_thing', 'Auto-fail', 'autofail',
'Elder Sign', 'elder_sign', 'Bless', 'bless', 'Curse', 'curse', 'Frost',
'frost', 'unnamed'}
merge(fixed_keys)
merge(sorted_keys_for_obj(state))
merge(sorted_keys_for_obj(state.ml))
return keys
end
function sorted_keys_for_obj(obj)
if not obj then return nil end
if #obj > 0 then return nil end
local keys = {}
for k,_ in pairs(obj) do
keys[#keys + 1] = k
end
table.sort(keys)
return keys
end
return json_keyorder