Skip to content

Commit 41eb04d

Browse files
committed
Clean up client Element luadefs
(cherry picked from commit f31bd62) Conflicts: MTA10/mods/shared_logic/lua/CLuaMain.cpp MTA10_Server/mods/deathmatch/logic/lua/LuaCommon.cpp
1 parent d141dfb commit 41eb04d

File tree

11 files changed

+2847
-2842
lines changed

11 files changed

+2847
-2842
lines changed

MTA10/mods/deathmatch/StdInc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
#include <luadefs/CLuaBlipDefs.h>
111111
#include <luadefs/CLuaBrowserDefs.h>
112112
#include <luadefs/CLuaClassDefs.h>
113+
#include <luadefs/CLuaElementDefs.h>
113114
#include <luadefs/CLuaMarkerDefs.h>
114115
#include <luadefs/CLuaObjectDefs.h>
115116
#include <luadefs/CLuaPointLightDefs.h>

MTA10/mods/deathmatch/_Deathmatch 2008.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@
369369
<ClCompile Include="..\shared_logic\luadefs\CLuaBitDefs.cpp" />
370370
<ClCompile Include="..\shared_logic\luadefs\CLuaBlipDefs.cpp" />
371371
<ClCompile Include="..\shared_logic\luadefs\CLuaBrowserDefs.cpp" />
372+
<ClCompile Include="..\shared_logic\luadefs\CLuaElementDefs.cpp" />
372373
<ClCompile Include="..\shared_logic\luadefs\CLuaMarkerDefs.cpp" />
373374
<ClCompile Include="..\shared_logic\luadefs\CLuaObjectDefs.cpp" />
374375
<ClCompile Include="..\shared_logic\luadefs\CLuaPlayerDefs.cpp" />
@@ -571,7 +572,6 @@
571572
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Commands.cpp" />
572573
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.cpp" />
573574
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Drawing.cpp" />
574-
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Element.cpp" />
575575
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Engine.cpp" />
576576
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Event.cpp" />
577577
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.GUI.cpp" />
@@ -597,7 +597,6 @@
597597
<ClCompile Include="..\shared_logic\lua\CLuaTimerManager.cpp" />
598598
<ClCompile Include="..\shared_logic\lua\LuaCommon.cpp" />
599599
<ClCompile Include="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.Camera.cpp" />
600-
<ClCompile Include="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.Element.cpp" />
601600
<ClCompile Include="..\..\..\vendor\bochs\bochs_internal\crc32.cpp" />
602601
<ClCompile Include="..\shared_logic\luadefs\CLuaClassDefs.cpp" />
603602
<ClCompile Include="..\shared_logic\luadefs\CLuaDefs.cpp" />
@@ -763,6 +762,7 @@
763762
<ClInclude Include="..\shared_logic\luadefs\CLuaBitDefs.h" />
764763
<ClInclude Include="..\shared_logic\luadefs\CLuaBlipDefs.h" />
765764
<ClInclude Include="..\shared_logic\luadefs\CLuaBrowserDefs.h" />
765+
<ClInclude Include="..\shared_logic\luadefs\CLuaElementDefs.h" />
766766
<ClInclude Include="..\shared_logic\luadefs\CLuaMarkerDefs.h" />
767767
<ClInclude Include="..\shared_logic\luadefs\CLuaObjectDefs.h" />
768768
<ClInclude Include="..\shared_logic\luadefs\CLuaPlayerDefs.h" />

MTA10/mods/deathmatch/_Deathmatch 2008.vcxproj.filters

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -581,9 +581,6 @@
581581
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Drawing.cpp">
582582
<Filter>Source Files\shared_logic\lua</Filter>
583583
</ClCompile>
584-
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Element.cpp">
585-
<Filter>Source Files\shared_logic\lua</Filter>
586-
</ClCompile>
587584
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Engine.cpp">
588585
<Filter>Source Files\shared_logic\lua</Filter>
589586
</ClCompile>
@@ -659,9 +656,6 @@
659656
<ClCompile Include="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.Camera.cpp">
660657
<Filter>Source Files\shared_logic\lua\oopdefs</Filter>
661658
</ClCompile>
662-
<ClCompile Include="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.Element.cpp">
663-
<Filter>Source Files\shared_logic\lua\oopdefs</Filter>
664-
</ClCompile>
665659
<ClCompile Include="..\..\..\vendor\bochs\bochs_internal\crc32.cpp">
666660
<Filter>Source Files\shared_logic\utils</Filter>
667661
</ClCompile>
@@ -935,6 +929,9 @@
935929
<ClCompile Include="..\shared_logic\luadefs\CLuaObjectDefs.cpp">
936930
<Filter>Source Files\shared_logic\luadefs</Filter>
937931
</ClCompile>
932+
<ClCompile Include="..\shared_logic\luadefs\CLuaElementDefs.cpp">
933+
<Filter>Source Files\shared_logic\luadefs</Filter>
934+
</ClCompile>
938935
</ItemGroup>
939936
<ItemGroup>
940937
<ClInclude Include="CClient.h">
@@ -1690,5 +1687,8 @@
16901687
<ClInclude Include="..\shared_logic\luadefs\CLuaObjectDefs.h">
16911688
<Filter>Header Files\shared_logic\luadefs</Filter>
16921689
</ClInclude>
1690+
<ClInclude Include="..\shared_logic\luadefs\CLuaElementDefs.h">
1691+
<Filter>Header Files\shared_logic\luadefs</Filter>
1692+
</ClInclude>
16931693
</ItemGroup>
16941694
</Project>

MTA10/mods/shared_logic/lua/CLuaFunctionDefs.h

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -83,82 +83,6 @@ class CLuaFunctionDefs
8383
LUA_DECLARE ( GetClipboard );
8484
LUA_DECLARE ( SetWindowFlashing );
8585

86-
// Element get functions
87-
LUA_DECLARE ( GetRootElement );
88-
LUA_DECLARE ( IsElement );
89-
LUA_DECLARE ( GetElementChildren );
90-
LUA_DECLARE ( GetElementChild );
91-
LUA_DECLARE ( GetElementChildrenCount );
92-
LUA_DECLARE ( GetElementID );
93-
LUA_DECLARE ( GetElementByID );
94-
LUA_DECLARE ( GetElementByIndex );
95-
LUA_DECLARE ( GetElementData );
96-
LUA_DECLARE ( GetElementParent );
97-
LUA_DECLARE ( GetElementMatrix );
98-
LUA_DECLARE ( GetElementPosition );
99-
LUA_DECLARE ( GetElementRotation );
100-
LUA_DECLARE ( GetElementVelocity );
101-
LUA_DECLARE ( GetElementType );
102-
LUA_DECLARE ( GetElementsByType );
103-
LUA_DECLARE ( GetElementInterior );
104-
LUA_DECLARE ( IsElementWithinColShape );
105-
LUA_DECLARE ( IsElementWithinMarker );
106-
LUA_DECLARE ( GetElementsWithinColShape );
107-
LUA_DECLARE ( GetElementDimension );
108-
LUA_DECLARE ( GetElementZoneName );
109-
LUA_DECLARE ( GetElementBoundingBox );
110-
LUA_DECLARE ( GetElementRadius );
111-
LUA_DECLARE ( IsElementAttached );
112-
LUA_DECLARE ( GetElementAttachedTo );
113-
LUA_DECLARE ( GetAttachedElements );
114-
LUA_DECLARE ( GetElementDistanceFromCentreOfMassToBaseOfModel );
115-
LUA_DECLARE ( IsElementLocal );
116-
LUA_DECLARE ( GetElementAttachedOffsets );
117-
LUA_DECLARE ( GetElementAlpha );
118-
LUA_DECLARE ( IsElementOnScreen );
119-
LUA_DECLARE ( GetElementHealth );
120-
LUA_DECLARE ( IsElementStreamedIn );
121-
LUA_DECLARE ( IsElementStreamable );
122-
LUA_DECLARE ( GetElementModel );
123-
LUA_DECLARE ( GetElementColShape );
124-
LUA_DECLARE ( IsElementInWater );
125-
LUA_DECLARE ( IsElementSyncer );
126-
LUA_DECLARE ( IsElementCollidableWith );
127-
LUA_DECLARE ( IsElementDoubleSided );
128-
LUA_DECLARE ( GetElementCollisionsEnabled );
129-
LUA_DECLARE ( IsElementFrozen );
130-
LUA_DECLARE ( GetLowLodElement );
131-
LUA_DECLARE ( IsElementLowLod );
132-
LUA_DECLARE ( IsElementCallPropagationEnabled );
133-
LUA_DECLARE ( IsElementWaitingForGroundToLoad );
134-
135-
// Element set funcs
136-
LUA_DECLARE ( CreateElement );
137-
LUA_DECLARE ( DestroyElement );
138-
LUA_DECLARE ( SetElementID );
139-
LUA_DECLARE ( SetElementData );
140-
LUA_DECLARE ( RemoveElementData );
141-
LUA_DECLARE ( SetElementMatrix );
142-
LUA_DECLARE ( SetElementPosition );
143-
LUA_DECLARE ( SetElementRotation );
144-
LUA_DECLARE ( SetElementVelocity );
145-
LUA_DECLARE ( SetElementParent );
146-
LUA_DECLARE ( SetElementInterior );
147-
LUA_DECLARE ( SetElementDimension );
148-
LUA_DECLARE ( AttachElements );
149-
LUA_DECLARE ( DetachElements );
150-
LUA_DECLARE ( SetElementAttachedOffsets );
151-
LUA_DECLARE ( SetElementCollisionsEnabled );
152-
LUA_DECLARE ( SetElementAlpha );
153-
LUA_DECLARE ( SetElementHealth );
154-
LUA_DECLARE ( SetElementStreamable );
155-
LUA_DECLARE ( SetElementModel );
156-
LUA_DECLARE ( SetElementCollidableWith );
157-
LUA_DECLARE ( SetElementDoubleSided );
158-
LUA_DECLARE ( SetElementFrozen );
159-
LUA_DECLARE ( SetLowLodElement );
160-
LUA_DECLARE ( SetElementCallPropagationEnabled );
161-
16286
// Clothes and body functions
16387
LUA_DECLARE ( GetBodyPartName );
16488
LUA_DECLARE ( GetClothesByTypeIndex );
@@ -691,4 +615,4 @@ class CLuaFunctionDefs
691615
static CClientDFFManager* m_pDFFManager;
692616
static CClientColModelManager* m_pColModelManager;
693617
static CRegisteredCommands* m_pRegisteredCommands;
694-
};
618+
};

MTA10/mods/shared_logic/lua/CLuaMain.cpp

Lines changed: 1 addition & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -136,131 +136,6 @@ void CLuaMain::InitSecurity ( void )
136136
lua_register ( m_luaVM, "newproxy", CLuaFunctionDefs::DisabledFunction );
137137
}
138138

139-
140-
// TODO: specials
141-
void CLuaMain::AddElementClass ( lua_State* luaVM )
142-
{
143-
lua_newclass ( luaVM );
144-
145-
// Class functions
146-
lua_classfunction ( luaVM, "getByID", "getElementByID" );
147-
lua_classfunction ( luaVM, "getAllByType", "getElementsByType" );
148-
149-
// Action functions
150-
lua_classfunction ( luaVM, "create", "createElement" );
151-
lua_classfunction ( luaVM, "clone", "cloneElement" );
152-
lua_classfunction ( luaVM, "attach", "attachElements" );
153-
lua_classfunction ( luaVM, "detach", "detachElements" );
154-
lua_classfunction ( luaVM, "destroy", "destroyElement" );
155-
lua_classfunction ( luaVM, "removeData", "removeElementData" );
156-
lua_classfunction ( luaVM, "clearVisibleTo", "clearElementVisibleTo" );
157-
158-
// Get functions
159-
lua_classfunction ( luaVM, "areCollisionsEnabled", "areElementCollisionsEnabled" );
160-
lua_classfunction ( luaVM, "isWithinColShape", "isElementWithinColShape" );
161-
lua_classfunction ( luaVM, "isWithinMarker", "isElementWithinMarker" );
162-
lua_classfunction ( luaVM, "isInWater", "isElementInWater" );
163-
lua_classfunction ( luaVM, "isFrozen", "isElementFrozen" );
164-
lua_classfunction ( luaVM, "isLowLOD", "isElementLowLOD" );
165-
lua_classfunction ( luaVM, "isDoubleSided", "isElementDoubleSided" );
166-
lua_classfunction ( luaVM, "isVisibleTo", "isElementVisibleTo" );
167-
lua_classfunction ( luaVM, "isCollidableWith", "isElementCollidableWith" );
168-
lua_classfunction ( luaVM, "isAttached", "isElementAttached" );
169-
lua_classfunction ( luaVM, "isCallPropagationEnabled", "isElementCallPropagationEnabled" );
170-
lua_classfunction ( luaVM, "isWaitingForGroundToLoad", "isElementWaitingForGroundToLoad" );
171-
lua_classfunction ( luaVM, "isOnScreen", "isElementOnScreen" );
172-
lua_classfunction ( luaVM, "isStreamedIn", "isElementStreamedIn" );
173-
lua_classfunction ( luaVM, "isStreamable", "isElementStreamable" );
174-
lua_classfunction ( luaVM, "isLocal", "isElementLocal" );
175-
lua_classfunction ( luaVM, "isSyncer", "isElementSyncer" );
176-
lua_classfunction ( luaVM, "getChildren", "getElementChildren" );
177-
lua_classfunction ( luaVM, "getChild", "getElementChild" );
178-
lua_classfunction ( luaVM, "getChildrenCount", "getElementChildrenCount" );
179-
lua_classfunction ( luaVM, "getAllData", "getAllElementData" );
180-
lua_classfunction ( luaVM, "getID", "getElementID" );
181-
lua_classfunction ( luaVM, "getParent", "getElementParent" );
182-
lua_classfunction ( luaVM, "getBoundingBox", "getElementBoundingBox" );
183-
lua_classfunction ( luaVM, "getPosition", CLuaOOPDefs::GetElementPosition );
184-
lua_classfunction ( luaVM, "getRotation", CLuaOOPDefs::GetElementRotation );
185-
lua_classfunction ( luaVM, "getMatrix", CLuaOOPDefs::GetElementMatrix );
186-
lua_classfunction ( luaVM, "getVelocity", CLuaOOPDefs::GetElementVelocity );
187-
lua_classfunction ( luaVM, "getByType", "getElementsByType" );
188-
lua_classfunction ( luaVM, "getDistanceFromCentreOfMassToBaseOfModel", "getElementDistanceFromCentreOfMassToBaseOfModel" );
189-
lua_classfunction ( luaVM, "getRadius", "getElementRadius" );
190-
lua_classfunction ( luaVM, "getType", "getElementType" );
191-
lua_classfunction ( luaVM, "getInterior", "getElementInterior" );
192-
lua_classfunction ( luaVM, "getWithinColShape", "getElementsWithinColShape" );
193-
lua_classfunction ( luaVM, "getDimension", "getElementDimension" );
194-
lua_classfunction ( luaVM, "getZoneName", "getElementZoneName" );
195-
lua_classfunction ( luaVM, "getColShape", "getElementColShape" );
196-
lua_classfunction ( luaVM, "getAlpha", "getElementAlpha" );
197-
lua_classfunction ( luaVM, "getHealth", "getElementHealth" );
198-
lua_classfunction ( luaVM, "getModel", "getElementModel" );
199-
lua_classfunction ( luaVM, "getLowLOD", "getLowLODElement" );
200-
lua_classfunction ( luaVM, "getAttachedElements", "getAttachedElements" );
201-
lua_classfunction ( luaVM, "getAttachedTo", "getElementAttachedTo" );
202-
lua_classfunction ( luaVM, "getAttachedOffsets", "getElementAttachedOffsets" );
203-
lua_classfunction ( luaVM, "getData", "getElementData" );
204-
205-
lua_classfunction ( luaVM, "setAttachedOffsets", "setElementAttachedOffsets" );
206-
lua_classfunction ( luaVM, "setData", "setElementData" );
207-
lua_classfunction ( luaVM, "setID", "setElementID" );
208-
lua_classfunction ( luaVM, "setParent", "setElementParent" );
209-
lua_classfunction ( luaVM, "setPosition", "setElementPosition" );
210-
lua_classfunction ( luaVM, "setRotation", CLuaOOPDefs::SetElementRotation );
211-
lua_classfunction ( luaVM, "setMatrix", "setElementMatrix" );
212-
lua_classfunction ( luaVM, "setVelocity", "setElementVelocity" );
213-
lua_classfunction ( luaVM, "setVisibleTo", "setElementVisibleTo" );
214-
lua_classfunction ( luaVM, "setInterior", "setElementInterior" );
215-
lua_classfunction ( luaVM, "setDimension", "setElementDimension" );
216-
lua_classfunction ( luaVM, "setAlpha", "setElementAlpha" );
217-
lua_classfunction ( luaVM, "setDoubleSided", "setElementDoubleSided" );
218-
lua_classfunction ( luaVM, "setHealth", "setElementHealth" );
219-
lua_classfunction ( luaVM, "setModel", "setElementModel" );
220-
lua_classfunction ( luaVM, "setCollisionsEnabled", "setElementCollisionsEnabled" );
221-
lua_classfunction ( luaVM, "setCollidableWith", "setElementCollidableWith" );
222-
lua_classfunction ( luaVM, "setFrozen", "setElementFrozen" );
223-
lua_classfunction ( luaVM, "setLowLOD", "setLowLODElement" );
224-
lua_classfunction ( luaVM, "setCallPropagationEnabled", "setElementCallPropagationEnabled" );
225-
lua_classfunction ( luaVM, "setStreamable", "setElementStreamable" );
226-
227-
lua_classvariable ( luaVM, "callPropagationEnabled", "setElementCallPropagationEnabled", "isElementCallPropagationEnabled" );
228-
lua_classvariable ( luaVM, "waitingForGroundToLoad", NULL, "isElementWaitingForGroundToLoad" );
229-
lua_classvariable ( luaVM, "onScreen", NULL, "isElementOnScreen" );
230-
lua_classvariable ( luaVM, "streamedIn", NULL, "isElementStreamedIn" );
231-
lua_classvariable ( luaVM, "streamable", "setElementStreamable", "isElementStreamable" );
232-
lua_classvariable ( luaVM, "localElement", NULL, "isElementLocal" );
233-
lua_classvariable ( luaVM, "id", "setElementID", "getElementID" );
234-
lua_classvariable ( luaVM, "type", NULL, "getElementType" );
235-
lua_classvariable ( luaVM, "colShape", NULL, "getElementColShape" );
236-
lua_classvariable ( luaVM, "parent", "setElementParent", "getElementParent" );
237-
lua_classvariable ( luaVM, "attachedTo", "attachElements", "getElementAttachedTo" );
238-
lua_classvariable ( luaVM, "attached", NULL, "isElementAttached" );
239-
lua_classvariable ( luaVM, "health", "setElementHealth", "getElementHealth" );
240-
lua_classvariable ( luaVM, "alpha", "setElementAlpha", "getElementAlpha" );
241-
lua_classvariable ( luaVM, "doubleSided", "setElementDoubleSided", "isElementDoubleSided" );
242-
lua_classvariable ( luaVM, "model", "setElementModel", "getElementModel" );
243-
lua_classvariable ( luaVM, "syncedByLocalPlayer", NULL, "isElementSyncer" );
244-
lua_classvariable ( luaVM, "collisions", "setElementCollisionsEnabled", "getElementCollisionsEnabled" );
245-
lua_classvariable ( luaVM, "frozen", "setElementFrozen", "isElementFrozen" );
246-
lua_classvariable ( luaVM, "inWater", NULL, "isElementInWater" );
247-
lua_classvariable ( luaVM, "lowLOD", "setLowLODElement", "getLowLODElement" );
248-
lua_classvariable ( luaVM, "dimension", "setElementDimension", "getElementDimension" );
249-
lua_classvariable ( luaVM, "interior", "setElementInterior", "getElementInterior" );
250-
lua_classvariable ( luaVM, "distanceFromCentreOfMassToBaseOfModel", NULL, "getElementDistanceFromCentreOfMassToBaseOfModel" );
251-
lua_classvariable ( luaVM, "radius", NULL, "getElementRadius" );
252-
lua_classvariable ( luaVM, "childrenCount", NULL, "getElementChildrenCount" );
253-
lua_classvariable ( luaVM, "position", CLuaFunctionDefs::SetElementPosition, CLuaOOPDefs::GetElementPosition );
254-
lua_classvariable ( luaVM, "rotation", CLuaOOPDefs::SetElementRotation, CLuaOOPDefs::GetElementRotation );
255-
lua_classvariable ( luaVM, "matrix", CLuaFunctionDefs::SetElementMatrix, CLuaOOPDefs::GetElementMatrix );
256-
lua_classvariable ( luaVM, "velocity", CLuaFunctionDefs::SetElementVelocity, CLuaOOPDefs::GetElementVelocity );
257-
lua_classvariable ( luaVM, "isElement", NULL, "isElement" );
258-
lua_classvariable ( luaVM, "data", NULL, "getAllElementData" ); // TODO: .data["age"] = 1337;
259-
260-
lua_registerclass ( luaVM, "Element" );
261-
}
262-
263-
264139
void CLuaMain::AddPickupClass ( lua_State* luaVM )
265140
{
266141
lua_newclass ( luaVM );
@@ -1119,7 +994,7 @@ void CLuaMain::InitClasses ( lua_State* luaVM )
1119994
if ( !m_bEnableOOP )
1120995
return;
1121996

1122-
AddElementClass ( luaVM );
997+
CLuaElementDefs::AddClass ( luaVM );
1123998
AddPickupClass ( luaVM );
1124999
AddColShapeClass ( luaVM );
11251000
AddProjectileClass ( luaVM );

MTA10/mods/shared_logic/lua/CLuaMain.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ class CLuaMain //: public CClient
7676
unsigned long GetTimerCount ( void ) const { return m_pLuaTimerManager ? m_pLuaTimerManager->GetTimerCount () : 0; };
7777
unsigned long GetElementCount ( void ) const;
7878

79-
void AddElementClass ( lua_State* luaVM );
8079
void AddPickupClass ( lua_State* luaVM );
8180
void AddColShapeClass ( lua_State* luaVM );
8281
void AddProjectileClass ( lua_State* luaVM );
@@ -153,4 +152,4 @@ class CLuaMain //: public CClient
153152
public:
154153
CFastHashMap < const void*, CRefInfo > m_CallbackTable;
155154
std::map < int, SString > m_FunctionTagMap;
156-
};
155+
};

0 commit comments

Comments
 (0)