Skip to content

Commit

Permalink
[luadefs-server] Clean up Ped
Browse files Browse the repository at this point in the history
  • Loading branch information
qaisjp committed Sep 9, 2015
1 parent 71cd272 commit eff201f
Show file tree
Hide file tree
Showing 14 changed files with 2,311 additions and 2,290 deletions.
2 changes: 1 addition & 1 deletion MTA10_Server/mods/deathmatch/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ LOGIC = \
./logic/lua/CLuaFunctionDefs.Misc.cpp \
./logic/lua/CLuaFunctionDefs.Object.cpp \
./logic/lua/CLuaFunctionDefs.Ped.cpp \
./logic/lua/CLuaFunctionDefs.Player.cpp \
./logic/lua/CLuaFunctionDefs.PREG.cpp \
./logic/lua/CLuaFunctionDefs.RadarArea.cpp \
./logic/lua/CLuaFunctionDefs.Server.cpp \
Expand Down Expand Up @@ -239,6 +238,7 @@ LOGIC = \
./logic/luadefs/CLuaMatrixDefs.cpp \
./logic/luadefs/CLuaMarkerDefs.cpp \
./logic/luadefs/CLuaPickupDefs.cpp \
./logic/luadefs/CLuaPlayerDefs.cpp \
./logic/luadefs/CLuaResourceDefs.cpp \
./logic/luadefs/CLuaTextDefs.cpp \
./logic/luadefs/CLuaVector2Defs.cpp \
Expand Down
1 change: 1 addition & 0 deletions MTA10_Server/mods/deathmatch/StdInc.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ struct SAclRequest;
#include "luadefs/CLuaHandlingDefs.h"
#include "luadefs/CLuaMarkerDefs.h"
#include "luadefs/CLuaPickupDefs.h"
#include "luadefs/CLuaPlayerDefs.h"
#include "luadefs/CLuaResourceDefs.h"
#include "luadefs/CLuaTextDefs.h"
#include "luadefs/CLuaWorldDefs.h"
Expand Down
3 changes: 2 additions & 1 deletion MTA10_Server/mods/deathmatch/_ServerDeathmatch 2008.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@
<ClCompile Include="logic\CPerfStat.PlayerPacketUsage.cpp" />
<ClCompile Include="logic\luadefs\CLuaMarkerDefs.cpp" />
<ClCompile Include="logic\luadefs\CLuaMatrixDefs.cpp" />
<ClCompile Include="logic\luadefs\CLuaPlayerDefs.cpp" />
<ClCompile Include="logic\luadefs\CLuaVector2Defs.cpp" />
<ClCompile Include="logic\luadefs\CLuaVector3Defs.cpp" />
<ClCompile Include="logic\luadefs\CLuaVector4Defs.cpp" />
Expand All @@ -467,7 +468,6 @@
<ClCompile Include="logic\lua\CLuaFunctionDefs.Misc.cpp" />
<ClCompile Include="logic\lua\CLuaFunctionDefs.Object.cpp" />
<ClCompile Include="logic\lua\CLuaFunctionDefs.Ped.cpp" />
<ClCompile Include="logic\lua\CLuaFunctionDefs.Player.cpp" />
<ClCompile Include="logic\lua\CLuaFunctionDefs.PREG.cpp" />
<ClCompile Include="logic\lua\CLuaFunctionDefs.RadarArea.cpp" />
<ClCompile Include="logic\lua\CLuaFunctionDefs.Server.cpp" />
Expand Down Expand Up @@ -883,6 +883,7 @@
<ClInclude Include="CServer.h" />
<ClInclude Include="logic\luadefs\CLuaMarkerDefs.h" />
<ClInclude Include="logic\luadefs\CLuaMatrixDefs.h" />
<ClInclude Include="logic\luadefs\CLuaPlayerDefs.h" />
<ClInclude Include="logic\luadefs\CLuaVector2Defs.h" />
<ClInclude Include="logic\luadefs\CLuaVector3Defs.h" />
<ClInclude Include="logic\luadefs\CLuaVector4Defs.h" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -930,9 +930,6 @@
<ClCompile Include="logic\lua\CLuaFunctionDefs.Event.cpp">
<Filter>Source Files\logic\lua</Filter>
</ClCompile>
<ClCompile Include="logic\lua\CLuaFunctionDefs.Player.cpp">
<Filter>Source Files\logic\lua</Filter>
</ClCompile>
<ClCompile Include="logic\lua\CLuaFunctionDefs.Team.cpp">
<Filter>Source Files\logic\lua</Filter>
</ClCompile>
Expand Down Expand Up @@ -996,6 +993,9 @@
<ClCompile Include="logic\luadefs\CLuaMarkerDefs.cpp">
<Filter>Source Files\logic\luadefs</Filter>
</ClCompile>
<ClCompile Include="logic\luadefs\CLuaPlayerDefs.cpp">
<Filter>Source Files\logic\luadefs</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="logic\CLightsyncManager.h">
Expand Down Expand Up @@ -1865,6 +1865,9 @@
<ClInclude Include="logic\luadefs\CLuaMarkerDefs.h">
<Filter>Header Files\logic\luadefs</Filter>
</ClInclude>
<ClInclude Include="logic\luadefs\CLuaPlayerDefs.h">
<Filter>Header Files\logic\luadefs</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Xml Include="acl.xml">
Expand Down
66 changes: 0 additions & 66 deletions MTA10_Server/mods/deathmatch/logic/lua/CLuaFunctionDefs.Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,72 +85,6 @@ int CLuaFunctionDefs::CreateFire ( lua_State* luaVM )
return 1;
}

int CLuaFunctionDefs::PlayMissionAudio ( lua_State* luaVM )
{
CElement* pElement;
CVector vecPosition;
unsigned short usSlot;

CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pElement );
argStream.ReadNumber ( usSlot );

if ( argStream.NextCouldBeNumber () )
{
argStream.ReadVector3D ( vecPosition );

if ( !argStream.HasErrors () )
{
if ( CStaticFunctionDefinitions::PlayMissionAudio ( pElement, &vecPosition, usSlot ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
}
else if ( !argStream.HasErrors () )
{
if ( CStaticFunctionDefinitions::PlayMissionAudio ( pElement, NULL, usSlot ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );


lua_pushboolean ( luaVM, false );
return 1;
}

int CLuaFunctionDefs::PreloadMissionAudio ( lua_State* luaVM )
{
CElement* pElement;
unsigned short usSound;
unsigned short usSlot;

CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pElement );
argStream.ReadNumber ( usSound );
argStream.ReadNumber ( usSlot );

if ( !argStream.HasErrors () )
{
if ( CStaticFunctionDefinitions::PreloadMissionAudio ( pElement, usSound, usSlot ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

lua_pushboolean ( luaVM, false );
return 1;
}

int CLuaFunctionDefs::GetRootElement ( lua_State* luaVM )
{
Expand Down
39 changes: 39 additions & 0 deletions MTA10_Server/mods/deathmatch/logic/lua/CLuaFunctionDefs.Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,45 @@ int CLuaFunctionDefs::RemoveCommandHandler ( lua_State* luaVM )
}


int CLuaFunctionDefs::ExecuteCommandHandler ( lua_State* luaVM )
{
// bool executeCommandHandler ( string commandName, player thePlayer, [ string args ] )
SString strKey; CElement* pElement; SString strArgs;

CScriptArgReader argStream ( luaVM );
argStream.ReadString ( strKey );
argStream.ReadUserData ( pElement );
argStream.ReadString ( strArgs, "" );

if ( !argStream.HasErrors () )
{

// Grab our VM
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
CClient* pClient = NULL;
if ( pElement->GetType () == CElement::PLAYER )
pClient = static_cast <CClient*> ( static_cast <CPlayer*> ( pElement ) );

if ( pClient )
{

// Call it
if ( m_pRegisteredCommands->ProcessCommand ( strKey, strArgs, pClient ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

lua_pushboolean ( luaVM, false );
return 1;
}

int CLuaFunctionDefs::OutputServerLog ( lua_State* luaVM )
{
Expand Down
24 changes: 24 additions & 0 deletions MTA10_Server/mods/deathmatch/logic/lua/CLuaFunctionDefs.Team.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@
#include "StdInc.h"


int CLuaFunctionDefs::SetPlayerTeam ( lua_State* luaVM )
{
CPlayer* pPlayer;
CTeam* pTeam;

CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pPlayer );
argStream.ReadUserData ( pTeam, NULL );

if ( !argStream.HasErrors () )
{
if ( CStaticFunctionDefinitions::SetPlayerTeam ( pPlayer, pTeam ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

lua_pushboolean ( luaVM, false );
return 1;
}

int CLuaFunctionDefs::CreateTeam ( lua_State* luaVM )
{
SString strName;
Expand Down
86 changes: 3 additions & 83 deletions MTA10_Server/mods/deathmatch/logic/lua/CLuaFunctionDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,55 +70,6 @@ class CLuaFunctionDefs
LUA_DECLARE ( AddDebugHook );
LUA_DECLARE ( RemoveDebugHook );

// Player get functions
LUA_DECLARE ( GetPlayerCount );
LUA_DECLARE ( GetPedAmmoInClip );
LUA_DECLARE ( GetPedTotalAmmo );
LUA_DECLARE ( SetPlayerAmmo );
LUA_DECLARE ( GetPlayerFromName );
LUA_DECLARE ( GetPlayerMoney );
LUA_DECLARE ( GetPlayerPing );
LUA_DECLARE ( GetRandomPlayer );
LUA_DECLARE ( IsPlayerMuted );
LUA_DECLARE ( GetPlayerTeam );
LUA_DECLARE ( CanPlayerUseFunction );
LUA_DECLARE ( GetPlayerWantedLevel );
LUA_DECLARE ( GetAlivePlayers );
LUA_DECLARE ( GetDeadPlayers );
LUA_DECLARE ( GetPlayerIdleTime );
LUA_DECLARE ( IsPlayerScoreboardForced );
LUA_DECLARE ( IsPlayerMapForced );
LUA_DECLARE ( GetPlayerNametagText );
LUA_DECLARE ( GetPlayerNametagColor );
LUA_DECLARE ( IsPlayerNametagShowing );
LUA_DECLARE ( GetPlayerSerial );
LUA_DECLARE ( GetPlayerCommunityID ); // deprecate me
LUA_DECLARE ( GetPlayerUserName ); // deprecate me
LUA_DECLARE ( GetPlayerBlurLevel );
LUA_DECLARE ( GetPlayerName );
LUA_DECLARE ( GetPlayerIP );
LUA_DECLARE ( GetPlayerAccount );
LUA_DECLARE ( GetPlayerVersion );
LUA_DECLARE ( GetPlayerACInfo );

// Player set functions
LUA_DECLARE ( SetPlayerMoney );
LUA_DECLARE ( GivePlayerMoney );
LUA_DECLARE ( TakePlayerMoney );
LUA_DECLARE ( SpawnPlayer );
LUA_DECLARE ( ShowPlayerHudComponent );
LUA_DECLARE ( SetPlayerWantedLevel );
LUA_DECLARE ( ForcePlayerMap );
LUA_DECLARE ( SetPlayerNametagText );
LUA_DECLARE ( SetPlayerNametagColor );
LUA_DECLARE ( SetPlayerNametagShowing );
LUA_DECLARE ( SetPlayerMuted );
LUA_DECLARE ( SetPlayerBlurLevel );
LUA_DECLARE ( RedirectPlayer );
LUA_DECLARE ( SetPlayerName );
LUA_DECLARE ( DetonateSatchels );
LUA_DECLARE ( TakePlayerScreenShot );

// Ped get functions
LUA_DECLARE ( CreatePed );
LUA_DECLARE ( GetPedArmor );
Expand Down Expand Up @@ -146,8 +97,10 @@ class CLuaFunctionDefs
LUA_DECLARE ( IsPedInVehicle );
LUA_DECLARE ( GetWeaponProperty );
LUA_DECLARE ( GetOriginalWeaponProperty );
LUA_DECLARE ( GetPedAmmoInClip );
LUA_DECLARE ( GetPedTotalAmmo );

// Player set functions
// Ped set functions
LUA_DECLARE ( SetPedArmor );
LUA_DECLARE ( KillPed );
LUA_DECLARE ( SetPedRotation );
Expand Down Expand Up @@ -232,30 +185,12 @@ class CLuaFunctionDefs
// Fire funcs
LUA_DECLARE ( CreateFire );

// Audio funcs
LUA_DECLARE ( PlaySoundFrontEnd );
LUA_DECLARE ( PlayMissionAudio );
LUA_DECLARE ( PreloadMissionAudio );

// Ped body funcs?
LUA_DECLARE ( GetBodyPartName );
LUA_DECLARE ( GetClothesByTypeIndex );
LUA_DECLARE ( GetTypeIndexFromClothes );
LUA_DECLARE ( GetClothesTypeName );

// Key bind funcs
LUA_DECLARE ( BindKey );
LUA_DECLARE ( UnbindKey );
LUA_DECLARE ( IsKeyBound );
LUA_DECLARE ( GetFunctionsBoundToKey );
LUA_DECLARE ( GetKeyBoundToFunction );
LUA_DECLARE ( GetControlState );
LUA_DECLARE ( IsControlEnabled );

LUA_DECLARE ( SetControlState );
LUA_DECLARE ( ToggleControl );
LUA_DECLARE ( ToggleAllControls );

// Shape create funcs
LUA_DECLARE ( CreateColCircle );
LUA_DECLARE ( CreateColCuboid );
Expand Down Expand Up @@ -384,9 +319,6 @@ class CLuaFunctionDefs
LUA_DECLARE ( GetRuleValue );
LUA_DECLARE ( SetRuleValue );
LUA_DECLARE ( RemoveRuleValue );
LUA_DECLARE ( GetPlayerAnnounceValue );
LUA_DECLARE ( SetPlayerAnnounceValue );
LUA_DECLARE ( ResendPlayerModInfo );

// Database funcs
static void DbQueryCallback ( CDbJobData* pJobData, void* pContext );
Expand Down Expand Up @@ -429,9 +361,6 @@ class CLuaFunctionDefs
LUA_DECLARE ( LogOut );

// Admin funcs
LUA_DECLARE ( KickPlayer );
LUA_DECLARE ( BanPlayer );

LUA_DECLARE ( AddBan );
LUA_DECLARE ( RemoveBan );

Expand All @@ -453,15 +382,6 @@ class CLuaFunctionDefs
LUA_DECLARE ( SetBanNick );
LUA_DECLARE ( IsBan );

// Cursor get funcs
LUA_DECLARE ( IsCursorShowing );

// Cursor set funcs
LUA_DECLARE ( ShowCursor );

// Chat funcs
LUA_DECLARE ( ShowChat );

// Misc funcs
LUA_DECLARE ( ResetMapInfo );
LUA_DECLARE ( GetServerPort );
Expand Down

1 comment on commit eff201f

@qaisjp
Copy link
Contributor Author

@qaisjp qaisjp commented on eff201f Sep 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*Player

Please sign in to comment.