https://wiki.multitheftauto.com/api.php?action=feedcontributions&user=The+GTA&feedformat=atomMulti Theft Auto: Wiki - User contributions [en]2024-03-29T12:21:18ZUser contributionsMediaWiki 1.39.3https://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineGetGamePoolLimits&diff=39347MTA:Eir/functions/engineGetGamePoolLimits2014-04-12T00:20:17Z<p>The GTA: </p>
<hr />
<div>{{*Client_function}}<br />
__NOTOC__ <br />
This function returns a table of game resource allocation limits. In GTA:SA resources are allocated on statically-sized pools. Pool information returned may look like this:<br />
<syntaxhighlight lang="lua"><br />
{<br />
{ name = "Buildings", usedCount = 1132, maxCount = 13000 },<br />
{ name = "Peds", usedCount = 2, maxCount = 110 },<br />
{ name = "Objects", usedCount = 44, maxCount = 800 },<br />
{ name = "Dummies", usedCount = 2199, maxCount = 8000 },<br />
{ name = "Vehicles", usedCount = 2, maxCount = 110 },<br />
{ name = "ColModels", usedCount = 2268, maxCount = 20000 },<br />
{ name = "Tasks", usedCount = 7, maxCount = 9000 },<br />
{ name = "Events", usedCount = 0, maxCount = 5000 },<br />
{ name = "TaskAllocators", usedCount = 2, maxCount = 800 },<br />
{ name = "PedIntelligence", usedCount = 2, maxCount = 110 },<br />
{ name = "PedAttractors", usedCount = 0, maxCount = 400 },<br />
{ name = "EntryInfoNodes", usedCount = 104, maxCount = 10000 },<br />
{ name = "NodeRoutes", usedCount = 181, maxCount = 8000 },<br />
{ name = "PatrolRoutes", usedCount = 23, maxCount = 6000 },<br />
{ name = "PointRoutes", usedCount = 273, maxCount = 7000 },<br />
{ name = "PointerNodeDoubleLinks", usedCount = 48, maxCount = 20000 },<br />
{ name = "PointerNodeSingleLinks", usedCount = 3379, maxCount = 20000 },<br />
{ name = "EnvMapMaterials", usedCount = 61, maxCount = 5000 },<br />
{ name = "EnvMapAtomics", usedCount = 98, maxCount = 5000 },<br />
{ name = "SpecMapMaterials", usedCount = 56, maxCount = 5000 },<br />
{ name = "COLSectors", usedCount = 81, maxCount = 256 },<br />
{ name = "IPLSectors", usedCount = 76, maxCount = 255 }<br />
}<br />
</syntaxhighlight><br />
When certain limits (such as the "PointerNodeSingleLinks") are reached within the engine, the game will crash. Hence retrieving pool information during testing is important.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
table engineGetGamePoolLimits ()<br />
</syntaxhighlight><br />
<br />
===Returns===<br />
Returns a '''table''' holding internal engine pool limit info.<br />
<br />
===Useful Media===<br />
* https://dl.dropboxusercontent.com/u/55896914/eir_resources/game_pools.zip - resource to draw engine pool limits onto the screen<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This snippet prints out the engine pool information to the client console.<br />
<syntaxhighlight lang="lua"><br />
addCommandHandler( "debug_pools",<br />
function()<br />
local poolInfo = engineGetGamePoolLimits();<br />
<br />
outputConsole( "-- GAME POOL INFO --" );<br />
<br />
for m,n in ipairs( poolInfo ) do<br />
outputConsole( n.name .. ": " .. n.usedCount .. " / " .. n.maxCount );<br />
end<br />
end<br />
);<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineSetWorldRenderMode&diff=39346MTA:Eir/functions/engineSetWorldRenderMode2014-04-12T00:18:52Z<p>The GTA: </p>
<hr />
<div>__NOTOC__ <br />
This function modifies the rendering order, the rendering complexity and the render-states assigned to world entity rendering. It allows you to switch between rendering modes. Each has unique properties as to how entities are ordered for rendering and how their alpha is treated. This function has been created to fight rendering artifacts on the GTA:SA world.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool engineSetWorldRenderMode( string mode )<br />
</syntaxhighlight><br />
<br />
===Arguments===<br />
*'''mode''': can be either '''original''', '''meshlocal_alphafix''' or '''scene_alphafix'''<br />
<br />
===Returns===<br />
Returns '''true''' if a valid mode has been passed, '''false''' otherwise.<br />
<br />
===Useful Media===<br />
* https://dl.dropboxusercontent.com/u/55896914/eir_resources/rendermode.zip - resource to easily switch between render modes<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This snippet allows you to switch between rendering modes using the F3 key.<br />
<syntaxhighlight lang="lua"><br />
local renderModeSwitch =<br />
{<br />
original = "meshlocal_alphafix",<br />
meshlocal_alphafix = "scene_alphafix",<br />
scene_alphafix = "original"<br />
};<br />
<br />
addEventHandler( "onClientRender", root,<br />
function()<br />
local screenWidth, screenHeight = guiGetScreenSize();<br />
<br />
local currentMode = engineGetWorldRenderMode();<br />
<br />
dxDrawText( "Current RenderMode: " .. currentMode, screenWidth - 300, 5 );<br />
end<br />
);<br />
<br />
addEventHandler( "onClientKey", root,<br />
function( key, state )<br />
if ( key == "F3" ) and ( state == true ) then<br />
engineSetWorldRenderMode( renderModeSwitch[ engineGetWorldRenderMode() ] );<br />
end<br />
end<br />
);<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/New_Scripting_Functions&diff=39329MTA:Eir/New Scripting Functions2014-04-10T18:18:45Z<p>The GTA: </p>
<hr />
<div><pageclass class="client"></pageclass><br />
This page contains new scripting functions that should make their way into the Eir fork. Currently, this page is heavily work-in-progress. I am focusing on client-side scripting functions. Feel free to discuss them in the "discussion" tab of each page.<br />
<br />
'''These functions are added in Phase 4, which is now. Join #mta.recore at irc.multitheftauto.com to share your opinion.'''<br />
<br />
'''Some functions have been temporarily removed to reduce development pressure. They will make their way on the list once they are implemented or are in reachable distance.'''<br />
<br />
==Engine==<br />
* [[MTA:Eir/functions/engineStreamingSetProperty|engineStreamingSetProperty]] (implemented)<br />
* [[MTA:Eir/functions/engineStreamingGetProperty|engineStreamingGetProperty]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntityCount|engineGetActiveStreamingEntityCount]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingFreeSlotCount|engineGetActiveStreamingFreeSlotCount]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntities|engineGetActiveStreamingEntities]] (implemented)<br />
* [[MTA:Eir/functions/engineGetStreamingFocusEntity|engineGetStreamingFocusEntity]]<br />
* [[MTA:Eir/functions/engineSetWorldStreamingEnabled|engineSetWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineIsWorldStreamingEnabled|engineIsWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineGetRemovedWorldModels|engineGetRemovedWorldModels]]<br />
* [[MTA:Eir/functions/engineClearWorldEntityRemovals|engineClearWorldEntityRemovals]]<br />
* [[MTA:Eir/functions/engineGetGamePoolLimits|engineGetGamePoolLimits]] (implemented)<br />
* [[MTA:Eir/functions/engineGetStreamingInfo|engineGetStreamingInfo]] (implemented)<br />
* [[MTA:Eir/functions/engineStreamingIsElementManaged|engineStreamingIsElementManaged]]<br />
<br />
==Rendering==<br />
* [[MTA:Eir/functions/getEntitiesInRenderQueue|getEntitiesInRenderQueue]]<br />
* [[MTA:Eir/functions/setVehicleLODRenderingEnabled|setVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/isVehicleLODRenderingEnabled|isVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/engineSetWorldRenderMode|engineSetWorldRenderMode]] (implemented)<br />
* [[MTA:Eir/functions/engineGetWorldRenderMode|engineGetWorldRenderMode]] (implemented)<br />
* [[MTA:Eir/functions/setElementRenderMode|setElementRenderMode]] (implemented)<br />
* [[MTA:Eir/functions/getElementRenderMode|getElementRenderMode]] (implemented)<br />
* [[MTA:Eir/functions/resetElementRenderMode|resetElementRenderMode]] (implemented)<br />
<br />
==World==<br />
* [[MTA:Eir/functions/createLoadingDummy|createLoadingDummy]]<br />
* [[MTA:Eir/functions/garbageCollectWorldEntities|garbageCollectWorldEntities]]<br />
<br />
==Utilities==<br />
* [[MTA:Eir/functions/getFrameTimestep|getFrameTimestep]]<br />
* [[MTA:Eir/functions/getPerformanceTimer|getPerformanceTimer]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/New_Scripting_Functions&diff=39314MTA:Eir/New Scripting Functions2014-04-09T20:50:50Z<p>The GTA: </p>
<hr />
<div><pageclass class="client"></pageclass><br />
This page contains new scripting functions that should make their way into the Eir fork. Currently, this page is heavily work-in-progress. I am focusing on client-side scripting functions. Feel free to discuss them in the "discussion" tab of each page.<br />
<br />
'''These functions are added in Phase 4, which is now. Join #mta.recore at irc.multitheftauto.com to share your opinion.'''<br />
<br />
'''Some functions have been temporarily removed to reduce development pressure. They will make their way on the list once they are implemented or are in reachable distance.'''<br />
<br />
==Engine==<br />
* [[MTA:Eir/functions/engineStreamingSetProperty|engineStreamingSetProperty]] (implemented)<br />
* [[MTA:Eir/functions/engineStreamingGetProperty|engineStreamingGetProperty]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntityCount|engineGetActiveStreamingEntityCount]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingFreeSlotCount|engineGetActiveStreamingFreeSlotCount]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntities|engineGetActiveStreamingEntities]] (implemented)<br />
* [[MTA:Eir/functions/engineGetStreamingFocusEntity|engineGetStreamingFocusEntity]]<br />
* [[MTA:Eir/functions/engineSetWorldStreamingEnabled|engineSetWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineIsWorldStreamingEnabled|engineIsWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineGetRemovedWorldModels|engineGetRemovedWorldModels]]<br />
* [[MTA:Eir/functions/engineClearWorldEntityRemovals|engineClearWorldEntityRemovals]]<br />
* [[MTA:Eir/functions/engineGetGamePoolLimits|engineGetGamePoolLimits]] (implemented)<br />
* [[MTA:Eir/functions/engineGetStreamingInfo|engineGetStreamingInfo]] (implemented)<br />
* [[MTA:Eir/functions/engineStreamingIsElementManaged|engineStreamingIsElementManaged]]<br />
<br />
==Rendering==<br />
* [[MTA:Eir/functions/getEntitiesInRenderQueue|getEntitiesInRenderQueue]]<br />
* [[MTA:Eir/functions/setVehicleLODRenderingEnabled|setVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/isVehicleLODRenderingEnabled|isVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/engineSetWorldRenderMode|engineSetWorldRenderMode]]<br />
* [[MTA:Eir/functions/engineGetWorldRenderMode|engineGetWorldRenderMode]]<br />
* [[MTA:Eir/functions/setElementRenderMode|setElementRenderMode]] (implemented)<br />
* [[MTA:Eir/functions/getElementRenderMode|getElementRenderMode]] (implemented)<br />
* [[MTA:Eir/functions/resetElementRenderMode|resetElementRenderMode]] (implemented)<br />
<br />
==World==<br />
* [[MTA:Eir/functions/createLoadingDummy|createLoadingDummy]]<br />
* [[MTA:Eir/functions/garbageCollectWorldEntities|garbageCollectWorldEntities]]<br />
<br />
==Utilities==<br />
* [[MTA:Eir/functions/getFrameTimestep|getFrameTimestep]]<br />
* [[MTA:Eir/functions/getPerformanceTimer|getPerformanceTimer]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/setElementRenderMode/validProps&diff=39313MTA:Eir/functions/setElementRenderMode/validProps2014-04-09T19:20:42Z<p>The GTA: </p>
<hr />
<div>{| class="wikitable"<br />
|-<br />
! Name<br />
! Internal Type<br />
! Description<br />
! Default Value<br />
|-<br />
|lighting<br />
|Boolean<br />
|This is a switch to the entire lighting status of an entity. If true, lighting calculations are allowed on the entity. Otherwise all lighting computations are dropped. Setting this flag to false for entities that never expected no lighting can cause undefined behavior.<br />
|true<br />
|-<br />
|lighting_ambient<br />
|Boolean<br />
|This is a switch that controls ambient lighting calculations for entities. If true, ambient lighting colors are added to the final color.<br />
|true<br />
|-<br />
|lighting_directional<br />
|Boolean<br />
|This is a switch that controls directional lighting calculations for entities. If true, directional lighting is added to the final color.<br />
|true<br />
|-<br />
|lighting_point<br />
|Boolean<br />
|This is a switch that controls point lighting calculations for entities. If true, point lighting colors are added to the final color.<br />
|true<br />
|-<br />
|lighting_spot<br />
|Boolean<br />
|This is a switch that controls spot lighting calculations for entities. If true, spot lighting colors are added to the entity's final color.<br />
|true<br />
|-<br />
|lighting_material<br />
|Boolean<br />
|This is a switch that controls special material lighting calculations for entities. If true, materials are allowed to create special light sources that affect only them. Only vehicles are using material lighting.<br />
|true<br />
|-<br />
|reflection<br />
|Boolean<br />
|This is a switch that controls GTA:SA reflection technology for entities. If true, the entity is allowed to display reflection effects on reflective materials. Several game objects use reflections.<br />
|true<br />
|-<br />
|alphaClamp<br />
|Float<br />
|This is a number that specifies the alpha value that is used for alpha testing. In the original world render mode, any pixel whose alpha value is below the alphaClamp value is cut away. Other world render modes behave smarter.<br />
|100.0f / 255.0f<br />
|}</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/resetElementRenderMode&diff=39312MTA:Eir/functions/resetElementRenderMode2014-04-09T19:19:39Z<p>The GTA: </p>
<hr />
<div>__NOTOC__ <br />
This function resets the value of an internal GTA:SA engine render property.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool string resetElementRenderMode ( element theElement, string propertyName )<br />
</syntaxhighlight><br />
<br />
===Arguments===<br />
*'''theElement''': the element to change a render property of<br />
*'''propertyName''': name of the property to adjust<br />
<br />
===Valid Properties===<br />
{{:MTA:Eir/functions/setElementRenderMode/validProps}}<br />
<br />
===Returns===<br />
Returns '''true''' if the property has been successfully reset, '''false''' and a debug message otherwise.</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/resetElementRenderMode&diff=39311MTA:Eir/functions/resetElementRenderMode2014-04-09T19:19:28Z<p>The GTA: Created page with "__NOTOC__ This function returns resets the value of an internal GTA:SA engine render property. ==Syntax== <syntaxhighlight lang="lua"> bool string resetElementRenderMode ( element theElement..."</p>
<hr />
<div>__NOTOC__ <br />
This function returns resets the value of an internal GTA:SA engine render property.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool string resetElementRenderMode ( element theElement, string propertyName )<br />
</syntaxhighlight><br />
<br />
===Arguments===<br />
*'''theElement''': the element to change a render property of<br />
*'''propertyName''': name of the property to adjust<br />
<br />
===Valid Properties===<br />
{{:MTA:Eir/functions/setElementRenderMode/validProps}}<br />
<br />
===Returns===<br />
Returns '''true''' if the property has been successfully reset, '''false''' and a debug message otherwise.</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/New_Scripting_Functions&diff=39310MTA:Eir/New Scripting Functions2014-04-09T19:17:55Z<p>The GTA: </p>
<hr />
<div><pageclass class="client"></pageclass><br />
This page contains new scripting functions that should make their way into the Eir fork. Currently, this page is heavily work-in-progress. I am focusing on client-side scripting functions. Feel free to discuss them in the "discussion" tab of each page.<br />
<br />
'''These functions are added in Phase 4, which is now. Join #mta.recore at irc.multitheftauto.com to share your opinion.'''<br />
<br />
==Engine==<br />
* [[MTA:Eir/functions/engineStreamingSetProperty|engineStreamingSetProperty]] (implemented)<br />
* [[MTA:Eir/functions/engineStreamingGetProperty|engineStreamingGetProperty]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntityCount|engineGetActiveStreamingEntityCount]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingFreeSlotCount|engineGetActiveStreamingFreeSlotCount]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntities|engineGetActiveStreamingEntities]] (implemented)<br />
* [[MTA:Eir/functions/engineGetStreamingFocusEntity|engineGetStreamingFocusEntity]]<br />
* [[MTA:Eir/functions/engineSetWorldStreamingEnabled|engineSetWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineIsWorldStreamingEnabled|engineIsWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineGetRemovedWorldModels|engineGetRemovedWorldModels]]<br />
* [[MTA:Eir/functions/engineClearWorldEntityRemovals|engineClearWorldEntityRemovals]]<br />
* [[MTA:Eir/functions/engineGetGamePoolLimits|engineGetGamePoolLimits]] (implemented)<br />
* [[MTA:Eir/functions/engineGetStreamingInfo|engineGetStreamingInfo]] (implemented)<br />
* [[MTA:Eir/functions/engineStreamingIsElementManaged|engineStreamingIsElementManaged]]<br />
<br />
==Rendering==<br />
* [[MTA:Eir/functions/getEntitiesInRenderQueue|getEntitiesInRenderQueue]]<br />
* [[MTA:Eir/functions/setVehicleLODRenderingEnabled|setVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/isVehicleLODRenderingEnabled|isVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/engineSetWorldRenderMode|engineSetWorldRenderMode]]<br />
* [[MTA:Eir/functions/engineGetWorldRenderMode|engineGetWorldRenderMode]]<br />
* [[MTA:Eir/functions/setElementRenderMode|setElementRenderMode]] (implemented)<br />
* [[MTA:Eir/functions/getElementRenderMode|getElementRenderMode]] (implemented)<br />
* [[MTA:Eir/functions/resetElementRenderMode|resetElementRenderMode]] (implemented)<br />
<br />
==World==<br />
* [[MTA:Eir/functions/createLoadingDummy|createLoadingDummy]]<br />
* [[MTA:Eir/functions/garbageCollectWorldEntities|garbageCollectWorldEntities]]<br />
<br />
==Utilities==<br />
* [[MTA:Eir/functions/getFrameTimestep|getFrameTimestep]]<br />
* [[MTA:Eir/functions/getPerformanceTimer|getPerformanceTimer]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/getElementRenderMode&diff=39309MTA:Eir/functions/getElementRenderMode2014-04-09T19:16:19Z<p>The GTA: Created page with "__NOTOC__ This function returns the current value of an internal GTA:SA rendering property. Use this function for management or debugging purposes in combination with [[MTA:Eir/..."</p>
<hr />
<div>__NOTOC__ <br />
This function returns the current value of an internal GTA:SA rendering property. Use this function for management or debugging purposes in combination with [[MTA:Eir/functions/setElementRenderMode|setElementRenderMode]].<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
value/bool string getElementRenderMode ( element theElement, string propertyName, [ string preferedValueType ] )<br />
</syntaxhighlight><br />
<br />
===Arguments===<br />
*'''theElement''': the element to change a render property of<br />
*'''propertyName''': name of the property to adjust<br />
*'''preferedValueType''' (optional): ''int'', ''bool'' or ''float''<br />
<br />
===Valid Properties===<br />
{{:MTA:Eir/functions/setElementRenderMode/validProps}}<br />
<br />
===Returns===<br />
Returns the '''property value''' if a valid property was selected, '''false''' and a debug message otherwise.</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/setElementRenderMode&diff=39308MTA:Eir/functions/setElementRenderMode2014-04-09T19:13:42Z<p>The GTA: </p>
<hr />
<div>__NOTOC__ <br />
This function changes internal rendering properties of the GTA:SA engine. These directly influence rendering performance and rendering states. Use this function to either stylize your game environment (in addition to shaders) or increase performance by dropping unnecessary but FPS-eating effects. This function can be used to combat rendering artifacts (such as alpha issues).<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool string setElementRenderMode ( element theElement, string propertyName, [ string preferedValueType, ] var value )<br />
</syntaxhighlight><br />
<br />
===Arguments===<br />
*'''theElement''': the element to change a render property of<br />
*'''propertyName''': name of the property to adjust<br />
*'''preferedValueType''' (optional): ''int'', ''bool'' or ''float''<br />
*'''value''': data value to apply to the given property<br />
<br />
===Valid Properties===<br />
{{:MTA:Eir/functions/setElementRenderMode/validProps}}<br />
<br />
===Returns===<br />
Returns '''true''' if the property has been successfully set, '''false''' and a debug message otherwise.<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This snippet disables mesh lighting and reflection for the player's vehicle if he executes the '''/unsetlight''' command.<br />
<syntaxhighlight lang="lua"><br />
addCommandHandler( "unsetlight",<br />
function()<br />
local theVehicle = getPedOccupiedVehicle( localPlayer );<br />
<br />
if not ( theVehicle ) then<br />
outputChatBox( "not in a vehicle!" );<br />
return;<br />
end<br />
<br />
-- Disable mesh lighting and reflections on it.<br />
setElementRenderMode( theVehicle, "lighting_mesh", false );<br />
setElementRenderMode( theVehicle, "reflection", false );<br />
end<br />
);<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/setElementRenderMode&diff=39307MTA:Eir/functions/setElementRenderMode2014-04-09T19:13:00Z<p>The GTA: </p>
<hr />
<div>__NOTOC__ <br />
This function changes internal rendering properties of the GTA:SA engine. These directly influence rendering performance and rendering states. Use this function to either stylize your game environment (in addition to shaders) or increase performance by dropping unnecessary but FPS-eating effects. This function can be used to combat rendering artifacts (such as alpha issues).<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool, string setElementRenderMode ( element theElement, string propertyName, [ string preferedValueType, ] var value )<br />
</syntaxhighlight><br />
<br />
===Arguments===<br />
*'''theElement''': the element to change a render property of<br />
*'''propertyName''': name of the property to adjust<br />
*'''preferedValueType''' (optional): ''int'', ''bool'' or ''float''<br />
*'''value''': data value to apply to the given property<br />
<br />
===Valid Properties===<br />
{{:MTA:Eir/functions/setElementRenderMode/validProps}}<br />
<br />
===Returns===<br />
Returns '''true''' if the property has been successfully set, '''false''' and a debug message otherwise.<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This snippet disables mesh lighting and reflection for the player's vehicle if he executes the '''/unsetlight''' command.<br />
<syntaxhighlight lang="lua"><br />
addCommandHandler( "unsetlight",<br />
function()<br />
local theVehicle = getPedOccupiedVehicle( localPlayer );<br />
<br />
if not ( theVehicle ) then<br />
outputChatBox( "not in a vehicle!" );<br />
return;<br />
end<br />
<br />
-- Disable mesh lighting and reflections on it.<br />
setElementRenderMode( theVehicle, "lighting_mesh", false );<br />
setElementRenderMode( theVehicle, "reflection", false );<br />
end<br />
);<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/setElementRenderMode/validProps&diff=39306MTA:Eir/functions/setElementRenderMode/validProps2014-04-09T19:11:55Z<p>The GTA: </p>
<hr />
<div>{| class="wikitable"<br />
|-<br />
! Name<br />
! Internal Type<br />
! Description<br />
! Default Value<br />
|-<br />
|lighting<br />
|Boolean<br />
|This is a switch to the entire lighting status of an entity. If true, lighting calculations are allowed on the entity. Otherwise all lighting computations are dropped. Setting this flag to false for entities that never expected no lighting can cause undefined behavior.<br />
|true<br />
|-<br />
|lighting_ambient<br />
|Boolean<br />
|This is a switch that controls ambient lighting calculations for entities. If true, ambient lighting colors are added to the final color.<br />
|true<br />
|-<br />
|lighting_directional<br />
|Boolean<br />
|This is a switch that controls directional lighting calculations for entities. If true, directional lighting is added to the final color.<br />
|true<br />
|-<br />
|lighting_point<br />
|Boolean<br />
|This is a switch that controls point lighting calculations for entities. If true, point lighting colors are added to the final color.<br />
|true<br />
|-<br />
|lighting_spot<br />
|Boolean<br />
|This is a switch that controls spot lighting calculations for entities. If true, spot lighting colors are added to the entity's final color.<br />
|true<br />
|-<br />
|lighting_material<br />
|Boolean<br />
|This is a switch that controls special material lighting calculations for entities. If true, materials are allowed to create special light sources that affect only them. Only vehicles are using material lighting.<br />
|true<br />
|-<br />
|reflection<br />
|Boolean<br />
|This is a switch that controls GTA:SA reflection technology for entities. If true, the entity is allowed to display reflection effects on reflective materials. Several game objects use reflections.<br />
|true<br />
|-<br />
|alphaClamp<br />
|Float<br />
|This is a number that specifies the alpha value that is used for alpha testing. In the original world render mode, any pixel whose alpha value is below the alphaClamp value is cut away. Other world render modes behave smarter.<br />
|100<br />
|}</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/setElementRenderMode&diff=39305MTA:Eir/functions/setElementRenderMode2014-04-09T19:11:00Z<p>The GTA: </p>
<hr />
<div>__NOTOC__ <br />
This function changes internal rendering properties of the GTA:SA engine. These directly influence rendering performance and rendering states. Use this function to either stylize your game environment (in addition to shaders) or increase performance by dropping unnecessary but FPS-eating effects.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool, string setElementRenderMode ( element theElement, string propertyName, [ string preferedValueType, ] var value )<br />
</syntaxhighlight><br />
<br />
===Arguments===<br />
*'''theElement''': the element to change a render property of<br />
*'''propertyName''': name of the property to adjust<br />
*'''preferedValueType''' (optional): ''int'', ''bool'' or ''float''<br />
*'''value''': data value to apply to the given property<br />
<br />
===Valid Properties===<br />
{{:MTA:Eir/functions/setElementRenderMode/validProps}}<br />
<br />
===Returns===<br />
Returns '''true''' if the property has been successfully set, '''false''' and a debug message otherwise.<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This snippet disables mesh lighting and reflection for the player's vehicle if he executes the '''/unsetlight''' command.<br />
<syntaxhighlight lang="lua"><br />
addCommandHandler( "unsetlight",<br />
function()<br />
local theVehicle = getPedOccupiedVehicle( localPlayer );<br />
<br />
if not ( theVehicle ) then<br />
outputChatBox( "not in a vehicle!" );<br />
return;<br />
end<br />
<br />
-- Disable mesh lighting and reflections on it.<br />
setElementRenderMode( theVehicle, "lighting_mesh", false );<br />
setElementRenderMode( theVehicle, "reflection", false );<br />
end<br />
);<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/setElementRenderMode/validProps&diff=39304MTA:Eir/functions/setElementRenderMode/validProps2014-04-09T19:10:49Z<p>The GTA: Created page with "{| class="wikitable" |- ! Name ! Internal Type ! Description ! Default Value |- |lighting |Boolean |This is a switch to the entire lighting status of an entity. If true, lighting..."</p>
<hr />
<div>{| class="wikitable"<br />
|-<br />
! Name<br />
! Internal Type<br />
! Description<br />
! Default Value<br />
|-<br />
|lighting<br />
|Boolean<br />
|This is a switch to the entire lighting status of an entity. If true, lighting calculations are allowed on the entity. Otherwise all lighting computations are dropped. Setting this flag to false for entities that never expected no lighting can cause undefined behavior.<br />
|true<br />
|-<br />
|lighting_ambient<br />
|Boolean<br />
|This is a switch that controls ambient lighting calculations for entities. If true, ambient lighting colors are added to the final color.<br />
|true<br />
|-<br />
|lighting_directional<br />
|Boolean<br />
|This is a switch that controls directional lighting calculations for entities. If true, directional lighting is added to the final color.<br />
|true<br />
|-<br />
|lighting_point<br />
|Boolean<br />
|This is a switch that controls point lighting calculations for entities. If true, point lighting colors are added to the final color.<br />
|true<br />
|-<br />
|lighting_spot<br />
|Boolean<br />
|This is a switch that controls spot lighting calculations for entities. If true, spot lighting colors are added to the entity's final color.<br />
|true<br />
|-<br />
|lighting_material<br />
|Boolean<br />
|This is a switch that controls special material lighting calculations for entities. If true, materials are allowed to create special light sources that affect only them. Only vehicles are using material lighting.<br />
|true<br />
|-<br />
|reflection<br />
|Boolean<br />
|This is a switch that controls GTA:SA reflection technology for entities. If true, the entity is a allowed to display reflection effects on reflective materials. Several game objects use reflections.<br />
|true<br />
|-<br />
|alphaClamp<br />
|Float<br />
|This is a number that specifies the alpha value that is used for alpha testing. In the original world render mode, any pixel whose alpha value is below the alphaClamp value is cut away. Other world render modes behave smarter.<br />
|100<br />
|}</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/setElementRenderMode&diff=39303MTA:Eir/functions/setElementRenderMode2014-04-09T19:07:23Z<p>The GTA: Created page with "__NOTOC__ This function changes internal rendering properties of the GTA:SA engine. These directly influence rendering performance and rendering states. Use this function to eit..."</p>
<hr />
<div>__NOTOC__ <br />
This function changes internal rendering properties of the GTA:SA engine. These directly influence rendering performance and rendering states. Use this function to either stylize your game environment (in addition to shaders) or increase performance by dropping unnecessary but FPS-eating effects.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool, string setElementRenderMode ( element theElement, string propertyName, [ string preferedValueType, ] var value )<br />
</syntaxhighlight><br />
<br />
===Arguments===<br />
*'''theElement''': the element to change a render property of<br />
*'''propertyName''': name of the property to adjust<br />
*'''preferedValueType''' (optional): ''int'', ''bool'' or ''float''<br />
*'''value''': data value to apply to the given property<br />
<br />
===Valid Properties===<br />
{| class="wikitable"<br />
|-<br />
! Name<br />
! Internal Type<br />
! Description<br />
! Default Value<br />
|-<br />
|lighting<br />
|Boolean<br />
|This is a switch to the entire lighting status of an entity. If true, lighting calculations are allowed on the entity. Otherwise all lighting computations are dropped. Setting this flag to false for entities that never expected no lighting can cause undefined behavior.<br />
|true<br />
|-<br />
|lighting_ambient<br />
|Boolean<br />
|This is a switch that controls ambient lighting calculations for entities. If true, ambient lighting colors are added to the final color.<br />
|true<br />
|-<br />
|lighting_directional<br />
|Boolean<br />
|This is a switch that controls directional lighting calculations for entities. If true, directional lighting is added to the final color.<br />
|true<br />
|-<br />
|lighting_point<br />
|Boolean<br />
|This is a switch that controls point lighting calculations for entities. If true, point lighting colors are added to the final color.<br />
|true<br />
|-<br />
|lighting_spot<br />
|Boolean<br />
|This is a switch that controls spot lighting calculations for entities. If true, spot lighting colors are added to the entity's final color.<br />
|true<br />
|-<br />
|lighting_material<br />
|Boolean<br />
|This is a switch that controls special material lighting calculations for entities. If true, materials are allowed to create special light sources that affect only them. Only vehicles are using material lighting.<br />
|true<br />
|-<br />
|reflection<br />
|Boolean<br />
|This is a switch that controls GTA:SA reflection technology for entities. If true, the entity is a allowed to display reflection effects on reflective materials. Several game objects use reflections.<br />
|true<br />
|-<br />
|alphaClamp<br />
|Float<br />
|This is a number that specifies the alpha value that is used for alpha testing. In the original world render mode, any pixel whose alpha value is below the alphaClamp value is cut away. Other world render modes behave smarter.<br />
|100<br />
|}<br />
<br />
===Returns===<br />
Returns '''true''' if the property has been successfully set, '''false''' and a debug message otherwise.<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This snippet disables mesh lighting and reflection for the player's vehicle if he executes the '''/unsetlight''' command.<br />
<syntaxhighlight lang="lua"><br />
addCommandHandler( "unsetlight",<br />
function()<br />
local theVehicle = getPedOccupiedVehicle( localPlayer );<br />
<br />
if not ( theVehicle ) then<br />
outputChatBox( "not in a vehicle!" );<br />
return;<br />
end<br />
<br />
-- Disable mesh lighting and reflections on it.<br />
setElementRenderMode( theVehicle, "lighting_mesh", false );<br />
setElementRenderMode( theVehicle, "reflection", false );<br />
end<br />
);<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/New_Scripting_Functions&diff=39302MTA:Eir/New Scripting Functions2014-04-09T18:38:51Z<p>The GTA: </p>
<hr />
<div><pageclass class="client"></pageclass><br />
This page contains new scripting functions that should make their way into the Eir fork. Currently, this page is heavily work-in-progress. I am focusing on client-side scripting functions. Feel free to discuss them in the "discussion" tab of each page.<br />
<br />
'''These functions are added in Phase 4, which is now. Join #mta.recore at irc.multitheftauto.com to share your opinion.'''<br />
<br />
==Engine==<br />
* [[MTA:Eir/functions/engineStreamingSetProperty|engineStreamingSetProperty]] (implemented)<br />
* [[MTA:Eir/functions/engineStreamingGetProperty|engineStreamingGetProperty]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntityCount|engineGetActiveStreamingEntityCount]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingFreeSlotCount|engineGetActiveStreamingFreeSlotCount]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntities|engineGetActiveStreamingEntities]] (implemented)<br />
* [[MTA:Eir/functions/engineGetStreamingFocusEntity|engineGetStreamingFocusEntity]]<br />
* [[MTA:Eir/functions/engineSetWorldStreamingEnabled|engineSetWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineIsWorldStreamingEnabled|engineIsWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineGetRemovedWorldModels|engineGetRemovedWorldModels]]<br />
* [[MTA:Eir/functions/engineClearWorldEntityRemovals|engineClearWorldEntityRemovals]]<br />
* [[MTA:Eir/functions/engineGetGamePoolLimits|engineGetGamePoolLimits]] (implemented)<br />
* [[MTA:Eir/functions/engineGetStreamingInfo|engineGetStreamingInfo]] (implemented)<br />
* [[MTA:Eir/functions/engineStreamingIsElementManaged|engineStreamingIsElementManaged]]<br />
<br />
==Rendering==<br />
* [[MTA:Eir/functions/getEntitiesInRenderQueue|getEntitiesInRenderQueue]]<br />
* [[MTA:Eir/functions/setVehicleLODRenderingEnabled|setVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/isVehicleLODRenderingEnabled|isVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/engineSetWorldRenderMode|engineSetWorldRenderMode]]<br />
* [[MTA:Eir/functions/engineGetWorldRenderMode|engineGetWorldRenderMode]]<br />
* [[MTA:Eir/functions/setElementRenderMode|setElementRenderMode]] (implemented)<br />
* [[MTA:Eir/functions/getElementRenderMode|getElementRenderMode]] (implemented)<br />
<br />
==World==<br />
* [[MTA:Eir/functions/createLoadingDummy|createLoadingDummy]]<br />
* [[MTA:Eir/functions/garbageCollectWorldEntities|garbageCollectWorldEntities]]<br />
<br />
==Utilities==<br />
* [[MTA:Eir/functions/getFrameTimestep|getFrameTimestep]]<br />
* [[MTA:Eir/functions/getPerformanceTimer|getPerformanceTimer]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineStreamingSetProperty&diff=39204MTA:Eir/functions/engineStreamingSetProperty2014-03-31T21:14:22Z<p>The GTA: </p>
<hr />
<div>{{*Client_function}}<br />
__NOTOC__ <br />
This function changes the behavior of the GTA:SA streaming system. It is meant to optimize the performance of the game for your custom server. Changes in these properties affect the gameplay quality of the entire server.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool engineStreamingSetProperty ( string propertyName, var propValue )<br />
</syntaxhighlight> <br />
<br />
===Arguments===<br />
*'''propertyName:''' the name of the streaming property you want to change<br />
*'''propValue:''' value to pass to the property<br />
<br />
===Valid Properties===<br />
{{:MTA:Eir/functions/engineStreamingSetProperty/validProps}}<br />
<br />
===Useful Media===<br />
* https://dl.dropboxusercontent.com/u/55896914/eir_resources/streaming_opt.zip - streaming debugging resource<br />
* https://dl.dropboxusercontent.com/u/55896914/eir_resources/streaming_test.zip - streaming mode example resource<br />
* http://youtu.be/sk8WsHwPgsU - showcase video<br />
<br />
===Returns===<br />
Returns ''true'' if valid arguments have been passed, ''false'' otherwise.<br />
<br />
==Examples== <br />
<section name="Client" class="client" show="true"><br />
This snippet ultimatively fixes the world flickering.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "strictNodeDistrib", false );<br />
engineStreamingSetProperty( "infiniteStreaming", true );<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet sets the Streaming GC system to sparse mode. In this mode only the preallocated amount of Streaming GC nodes is allowed. Keeping a low amount of Streaming nodes is interesting for performance optimizations.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "gcOnDemand", true );<br />
engineStreamingSetProperty( "infiniteStreaming", false );<br />
engineStreamingSetProperty( "strictNodeDistrib", true );<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet turns on fibered loading when the Streaming system is busy and leaves it that way for five seconds.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "isFibered", false );<br />
<br />
local lastBusyTime = false;<br />
local fiberedDuration = 5000;<br />
<br />
addEventHandler( "onClientRender", root,<br />
function()<br />
local isBusy = engineGetStreamingInfo().isBusy;<br />
<br />
if ( isBusy ) then<br />
local now = getTickCount();<br />
<br />
if not ( lastBusyTime ) then<br />
lastBusyTime = now;<br />
<br />
engineStreamingSetProperty( "isFibered", true );<br />
end<br />
elseif ( lastBusyTime ) then<br />
if ( now - lastBusyTime > fiberedDuration ) then<br />
engineStreamingSetProperty( "isFibered", false );<br />
end<br />
end<br />
end<br />
);<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet makes the world load very slow. Lag spikes cannot occur due to Streaming loading anymore.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "isFibered", true );<br />
engineStreamingSetProperty( "fiberedPerfMult", 0 );<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineStreamingSetProperty&diff=39203MTA:Eir/functions/engineStreamingSetProperty2014-03-31T21:13:59Z<p>The GTA: </p>
<hr />
<div>{{*Client_function}}<br />
__NOTOC__ <br />
This function changes the behavior of the GTA:SA streaming system. It is meant to optimize the performance of the game for your custom server. Changes in these properties affect the gameplay quality of the entire server.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool engineStreamingSetProperty ( string propertyName, var propValue )<br />
</syntaxhighlight> <br />
<br />
===Arguments===<br />
*'''propertyName:''' the name of the streaming property you want to change<br />
*'''propValue:''' value to pass to the property<br />
<br />
===Valid Properties===<br />
{{:MTA:Eir/functions/engineStreamingSetProperty/validProps}}<br />
<br />
==Useful Media==<br />
* https://dl.dropboxusercontent.com/u/55896914/eir_resources/streaming_opt.zip - streaming debugging resource<br />
* https://dl.dropboxusercontent.com/u/55896914/eir_resources/streaming_test.zip - streaming mode example resource<br />
* http://youtu.be/sk8WsHwPgsU - showcase video<br />
<br />
===Returns===<br />
Returns ''true'' if valid arguments have been passed, ''false'' otherwise.<br />
<br />
==Examples== <br />
<section name="Client" class="client" show="true"><br />
This snippet ultimatively fixes the world flickering.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "strictNodeDistrib", false );<br />
engineStreamingSetProperty( "infiniteStreaming", true );<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet sets the Streaming GC system to sparse mode. In this mode only the preallocated amount of Streaming GC nodes is allowed. Keeping a low amount of Streaming nodes is interesting for performance optimizations.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "gcOnDemand", true );<br />
engineStreamingSetProperty( "infiniteStreaming", false );<br />
engineStreamingSetProperty( "strictNodeDistrib", true );<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet turns on fibered loading when the Streaming system is busy and leaves it that way for five seconds.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "isFibered", false );<br />
<br />
local lastBusyTime = false;<br />
local fiberedDuration = 5000;<br />
<br />
addEventHandler( "onClientRender", root,<br />
function()<br />
local isBusy = engineGetStreamingInfo().isBusy;<br />
<br />
if ( isBusy ) then<br />
local now = getTickCount();<br />
<br />
if not ( lastBusyTime ) then<br />
lastBusyTime = now;<br />
<br />
engineStreamingSetProperty( "isFibered", true );<br />
end<br />
elseif ( lastBusyTime ) then<br />
if ( now - lastBusyTime > fiberedDuration ) then<br />
engineStreamingSetProperty( "isFibered", false );<br />
end<br />
end<br />
end<br />
);<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet makes the world load very slow. Lag spikes cannot occur due to Streaming loading anymore.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "isFibered", true );<br />
engineStreamingSetProperty( "fiberedPerfMult", 0 );<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/New_Scripting_Functions&diff=39200MTA:Eir/New Scripting Functions2014-03-30T21:28:04Z<p>The GTA: </p>
<hr />
<div><pageclass class="client"></pageclass><br />
This page contains new scripting functions that should make their way into the Eir fork. Currently, this page is heavily work-in-progress. I am focusing on client-side scripting functions. Feel free to discuss them in the "discussion" tab of each page.<br />
<br />
'''These functions are added in Phase 4, which is now. Join #mta.recore at irc.multitheftauto.com to share your opinion.'''<br />
<br />
==Engine==<br />
* [[MTA:Eir/functions/engineStreamingSetProperty|engineStreamingSetProperty]] (implemented)<br />
* [[MTA:Eir/functions/engineStreamingGetProperty|engineStreamingGetProperty]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntityCount|engineGetActiveStreamingEntityCount]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingFreeSlotCount|engineGetActiveStreamingFreeSlotCount]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntities|engineGetActiveStreamingEntities]] (implemented)<br />
* [[MTA:Eir/functions/engineGetStreamingFocusEntity|engineGetStreamingFocusEntity]]<br />
* [[MTA:Eir/functions/engineSetWorldStreamingEnabled|engineSetWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineIsWorldStreamingEnabled|engineIsWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineGetRemovedWorldModels|engineGetRemovedWorldModels]]<br />
* [[MTA:Eir/functions/engineClearWorldEntityRemovals|engineClearWorldEntityRemovals]]<br />
* [[MTA:Eir/functions/engineGetGamePoolLimits|engineGetGamePoolLimits]] (implemented)<br />
* [[MTA:Eir/functions/engineGetStreamingInfo|engineGetStreamingInfo]] (implemented)<br />
* [[MTA:Eir/functions/engineStreamingIsElementManaged|engineStreamingIsElementManaged]]<br />
<br />
==Rendering==<br />
* [[MTA:Eir/functions/getEntitiesInRenderQueue|getEntitiesInRenderQueue]]<br />
* [[MTA:Eir/functions/setVehicleLODRenderingEnabled|setVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/isVehicleLODRenderingEnabled|isVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/engineSetWorldRenderMode|engineSetWorldRenderMode]]<br />
* [[MTA:Eir/functions/engineGetWorldRenderMode|engineGetWorldRenderMode]]<br />
<br />
==World==<br />
* [[MTA:Eir/functions/createLoadingDummy|createLoadingDummy]]<br />
* [[MTA:Eir/functions/garbageCollectWorldEntities|garbageCollectWorldEntities]]<br />
<br />
==Utilities==<br />
* [[MTA:Eir/functions/getFrameTimestep|getFrameTimestep]]<br />
* [[MTA:Eir/functions/getPerformanceTimer|getPerformanceTimer]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineGetGamePoolLimits&diff=39199MTA:Eir/functions/engineGetGamePoolLimits2014-03-30T19:33:09Z<p>The GTA: /* Example */</p>
<hr />
<div>{{*Client_function}}<br />
__NOTOC__ <br />
This function returns a table of game resource allocation limits. In GTA:SA resources are allocated on statically-sized pools. Pool information returned may look like this:<br />
<syntaxhighlight lang="lua"><br />
{<br />
{ name = "Buildings", usedCount = 1132, maxCount = 13000 },<br />
{ name = "Peds", usedCount = 2, maxCount = 110 },<br />
{ name = "Objects", usedCount = 44, maxCount = 800 },<br />
{ name = "Dummies", usedCount = 2199, maxCount = 8000 },<br />
{ name = "Vehicles", usedCount = 2, maxCount = 110 },<br />
{ name = "ColModels", usedCount = 2268, maxCount = 20000 },<br />
{ name = "Tasks", usedCount = 7, maxCount = 9000 },<br />
{ name = "Events", usedCount = 0, maxCount = 5000 },<br />
{ name = "TaskAllocators", usedCount = 2, maxCount = 800 },<br />
{ name = "PedIntelligence", usedCount = 2, maxCount = 110 },<br />
{ name = "PedAttractors", usedCount = 0, maxCount = 400 },<br />
{ name = "EntryInfoNodes", usedCount = 104, maxCount = 10000 },<br />
{ name = "NodeRoutes", usedCount = 181, maxCount = 8000 },<br />
{ name = "PatrolRoutes", usedCount = 23, maxCount = 6000 },<br />
{ name = "PointRoutes", usedCount = 273, maxCount = 7000 },<br />
{ name = "PointerNodeDoubleLinks", usedCount = 48, maxCount = 20000 },<br />
{ name = "PointerNodeSingleLinks", usedCount = 3379, maxCount = 20000 },<br />
{ name = "EnvMapMaterials", usedCount = 61, maxCount = 5000 },<br />
{ name = "EnvMapAtomics", usedCount = 98, maxCount = 5000 },<br />
{ name = "SpecMapMaterials", usedCount = 56, maxCount = 5000 },<br />
{ name = "COLSectors", usedCount = 81, maxCount = 256 },<br />
{ name = "IPLSectors", usedCount = 76, maxCount = 255 }<br />
}<br />
</syntaxhighlight><br />
When certain limits (such as the "PointerNodeSingleLinks") are reached within the engine, the game will crash. Hence retrieving pool information during testing is important.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
table engineGetGamePoolLimits ()<br />
</syntaxhighlight><br />
<br />
===Returns===<br />
Returns a '''table''' holding internal engine pool limit info.<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This snippet prints out the engine pool information to the client console.<br />
<syntaxhighlight lang="lua"><br />
addCommandHandler( "debug_pools",<br />
function()<br />
local poolInfo = engineGetGamePoolLimits();<br />
<br />
outputConsole( "-- GAME POOL INFO --" );<br />
<br />
for m,n in ipairs( poolInfo ) do<br />
outputConsole( n.name .. ": " .. n.usedCount .. " / " .. n.maxCount );<br />
end<br />
end<br />
);<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineGetGamePoolLimits&diff=39198MTA:Eir/functions/engineGetGamePoolLimits2014-03-30T19:32:22Z<p>The GTA: </p>
<hr />
<div>{{*Client_function}}<br />
__NOTOC__ <br />
This function returns a table of game resource allocation limits. In GTA:SA resources are allocated on statically-sized pools. Pool information returned may look like this:<br />
<syntaxhighlight lang="lua"><br />
{<br />
{ name = "Buildings", usedCount = 1132, maxCount = 13000 },<br />
{ name = "Peds", usedCount = 2, maxCount = 110 },<br />
{ name = "Objects", usedCount = 44, maxCount = 800 },<br />
{ name = "Dummies", usedCount = 2199, maxCount = 8000 },<br />
{ name = "Vehicles", usedCount = 2, maxCount = 110 },<br />
{ name = "ColModels", usedCount = 2268, maxCount = 20000 },<br />
{ name = "Tasks", usedCount = 7, maxCount = 9000 },<br />
{ name = "Events", usedCount = 0, maxCount = 5000 },<br />
{ name = "TaskAllocators", usedCount = 2, maxCount = 800 },<br />
{ name = "PedIntelligence", usedCount = 2, maxCount = 110 },<br />
{ name = "PedAttractors", usedCount = 0, maxCount = 400 },<br />
{ name = "EntryInfoNodes", usedCount = 104, maxCount = 10000 },<br />
{ name = "NodeRoutes", usedCount = 181, maxCount = 8000 },<br />
{ name = "PatrolRoutes", usedCount = 23, maxCount = 6000 },<br />
{ name = "PointRoutes", usedCount = 273, maxCount = 7000 },<br />
{ name = "PointerNodeDoubleLinks", usedCount = 48, maxCount = 20000 },<br />
{ name = "PointerNodeSingleLinks", usedCount = 3379, maxCount = 20000 },<br />
{ name = "EnvMapMaterials", usedCount = 61, maxCount = 5000 },<br />
{ name = "EnvMapAtomics", usedCount = 98, maxCount = 5000 },<br />
{ name = "SpecMapMaterials", usedCount = 56, maxCount = 5000 },<br />
{ name = "COLSectors", usedCount = 81, maxCount = 256 },<br />
{ name = "IPLSectors", usedCount = 76, maxCount = 255 }<br />
}<br />
</syntaxhighlight><br />
When certain limits (such as the "PointerNodeSingleLinks") are reached within the engine, the game will crash. Hence retrieving pool information during testing is important.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
table engineGetGamePoolLimits ()<br />
</syntaxhighlight><br />
<br />
===Returns===<br />
Returns a '''table''' holding internal engine pool limit info.<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This snippet prints out the engine pool information to the client console.<br />
<syntaxhighlight lang="lua"><br />
addCommandHandler( "debug_pools",<br />
function()<br />
local poolInfo = engineGetGamePoolLimits();<br />
<br />
outputConsole( "-- GAME POOL INFO --" );<br />
<br />
for m,n in ipairs( poolInfo ) do<br />
outputConsole( m .. ": " .. n.usedCount .. " / " .. n.maxCount );<br />
end<br />
end<br />
);<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/New_Scripting_Functions&diff=39197MTA:Eir/New Scripting Functions2014-03-30T18:36:39Z<p>The GTA: </p>
<hr />
<div><pageclass class="client"></pageclass><br />
This page contains new scripting functions that should make their way into the Eir fork. Currently, this page is heavily work-in-progress. I am focusing on client-side scripting functions. Feel free to discuss them in the "discussion" tab of each page.<br />
<br />
'''These functions are added in Phase 4, which is now. Join #mta.recore at irc.multitheftauto.com to share your opinion.'''<br />
<br />
==Engine==<br />
* [[MTA:Eir/functions/engineStreamingSetProperty|engineStreamingSetProperty]] (implemented)<br />
* [[MTA:Eir/functions/engineStreamingGetProperty|engineStreamingGetProperty]] (implemented)<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntityCount|engineGetActiveStreamingEntityCount]]<br />
* [[MTA:Eir/functions/engineGetActiveStreamingFreeSlotCount|engineGetActiveStreamingFreeSlotCount]]<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntities|engineGetActiveStreamingEntities]]<br />
* [[MTA:Eir/functions/engineGetStreamingFocusEntity|engineGetStreamingFocusEntity]]<br />
* [[MTA:Eir/functions/engineSetWorldStreamingEnabled|engineSetWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineIsWorldStreamingEnabled|engineIsWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineGetRemovedWorldModels|engineGetRemovedWorldModels]]<br />
* [[MTA:Eir/functions/engineClearWorldEntityRemovals|engineClearWorldEntityRemovals]]<br />
* [[MTA:Eir/functions/engineGetGamePoolLimits|engineGetGamePoolLimits]]<br />
* [[MTA:Eir/functions/engineGetStreamingInfo|engineGetStreamingInfo]]<br />
* [[MTA:Eir/functions/engineStreamingIsElementManaged|engineStreamingIsElementManaged]]<br />
<br />
==Rendering==<br />
* [[MTA:Eir/functions/getEntitiesInRenderQueue|getEntitiesInRenderQueue]]<br />
* [[MTA:Eir/functions/setVehicleLODRenderingEnabled|setVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/isVehicleLODRenderingEnabled|isVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/engineSetWorldRenderMode|engineSetWorldRenderMode]]<br />
* [[MTA:Eir/functions/engineGetWorldRenderMode|engineGetWorldRenderMode]]<br />
<br />
==World==<br />
* [[MTA:Eir/functions/createLoadingDummy|createLoadingDummy]]<br />
* [[MTA:Eir/functions/garbageCollectWorldEntities|garbageCollectWorldEntities]]<br />
<br />
==Utilities==<br />
* [[MTA:Eir/functions/getFrameTimestep|getFrameTimestep]]<br />
* [[MTA:Eir/functions/getPerformanceTimer|getPerformanceTimer]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/New_Scripting_Functions&diff=39180MTA:Eir/New Scripting Functions2014-03-29T16:09:55Z<p>The GTA: </p>
<hr />
<div><pageclass class="client"></pageclass><br />
This page contains new scripting functions that should make their way into the Eir fork. Currently, this page is heavily work-in-progress. I am focusing on client-side scripting functions. Feel free to discuss them in the "discussion" tab of each page.<br />
<br />
'''These functions are added in Phase 4, which is now. Join #mta.recore at irc.multitheftauto.com to share your opinion.'''<br />
<br />
==Engine==<br />
* [[MTA:Eir/functions/engineStreamingSetProperty|engineStreamingSetProperty]]<br />
* [[MTA:Eir/functions/engineStreamingGetProperty|engineStreamingGetProperty]]<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntityCount|engineGetActiveStreamingEntityCount]]<br />
* [[MTA:Eir/functions/engineGetActiveStreamingFreeSlotCount|engineGetActiveStreamingFreeSlotCount]]<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntities|engineGetActiveStreamingEntities]]<br />
* [[MTA:Eir/functions/engineGetStreamingFocusEntity|engineGetStreamingFocusEntity]]<br />
* [[MTA:Eir/functions/engineSetWorldStreamingEnabled|engineSetWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineIsWorldStreamingEnabled|engineIsWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineGetRemovedWorldModels|engineGetRemovedWorldModels]]<br />
* [[MTA:Eir/functions/engineClearWorldEntityRemovals|engineClearWorldEntityRemovals]]<br />
* [[MTA:Eir/functions/engineGetGamePoolLimits|engineGetGamePoolLimits]]<br />
* [[MTA:Eir/functions/engineGetStreamingInfo|engineGetStreamingInfo]]<br />
* [[MTA:Eir/functions/engineStreamingIsElementManaged|engineStreamingIsElementManaged]]<br />
<br />
==Rendering==<br />
* [[MTA:Eir/functions/getEntitiesInRenderQueue|getEntitiesInRenderQueue]]<br />
* [[MTA:Eir/functions/setVehicleLODRenderingEnabled|setVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/isVehicleLODRenderingEnabled|isVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/engineSetWorldRenderMode|engineSetWorldRenderMode]]<br />
* [[MTA:Eir/functions/engineGetWorldRenderMode|engineGetWorldRenderMode]]<br />
<br />
==World==<br />
* [[MTA:Eir/functions/garbageCollectWorldEntities|garbageCollectWorldEntities]]<br />
<br />
==Utilities==<br />
* [[MTA:Eir/functions/getFrameTimestep|getFrameTimestep]]<br />
* [[MTA:Eir/functions/getPerformanceTimer|getPerformanceTimer]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineStreamingGetProperty&diff=39179MTA:Eir/functions/engineStreamingGetProperty2014-03-29T16:09:28Z<p>The GTA: Created page with "{{*Client_function}} __NOTOC__ This function returns the current behavior of the GTA:SA streaming system. Use it for debugging purposes. ==Syntax== <syntaxhighlight lang="lua"> var engineStr..."</p>
<hr />
<div>{{*Client_function}}<br />
__NOTOC__ <br />
This function returns the current behavior of the GTA:SA streaming system. Use it for debugging purposes.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
var engineStreamingGetProperty ( string propertyName )<br />
</syntaxhighlight> <br />
<br />
===Arguments===<br />
*'''propertyName:''' the name of the streaming property you want to change<br />
<br />
===Valid Properties===<br />
{{:MTA:Eir/functions/engineStreamingSetProperty/validProps}}<br />
<br />
===Returns===<br />
Returns '''the property value''' if valid arguments have been passed, ''false'' otherwise.<br />
<br />
==Examples== <br />
<section name="Client" class="client" show="true"><br />
This snippet enables infinite Streaming node allocation after two seconds of node shortage.<br />
<syntaxhighlight lang="lua"><br />
local firstNodeShortageTime = false;<br />
local nodeShortageDuration = 2000;<br />
<br />
local function isNodeShortage()<br />
return engineGetActiveStreamingFreeSlotCount() == 0;<br />
end<br />
<br />
local function enableStrictlessNodeAllocation( enabled )<br />
engineStreamingSetProperty( "infiniteStreaming", enabled );<br />
engineStreamingSetProperty( "strictNodeDistrib", not enabled );<br />
return true;<br />
end<br />
<br />
addEventHandler( "onClientPreRender", root,<br />
function()<br />
local isShortage = isNodeShortage();<br />
<br />
if ( isShortage ) then<br />
local now = getTickCount();<br />
<br />
if not ( firstNodeShortageTime ) then<br />
firstNodeShortageTime = now;<br />
elseif ( now - firstNodeShortageTime > nodeShortageDuration ) then<br />
engineStrictlessNodeAllocation( true );<br />
end<br />
else<br />
firstNodeShortageTime = false;<br />
end<br />
end<br />
);<br />
</syntaxhighlight><br />
</section><br />
<section name="Client" class="client" show="true"><br />
This snippet doubles the amount of frame time the fibered loader is allowed to take when the Streaming system is busy.<br />
<syntaxhighlight lang="lua"><br />
local normalFiberedPerc = false;<br />
<br />
addEventHandler( "onClientPreRender", root,<br />
function()<br />
local isBusy = engineGetStreamingInfo().isBusy;<br />
<br />
if ( isBusy ) then<br />
if not ( normalFiberedPerc ) then<br />
normalFiberedPerc = engineStreamingGetProperty( "fiberedPerfMult" );<br />
engineStreamingSetProperty( "fiberedPerfMult", normalFiberedPerc * 2 );<br />
end<br />
elseif ( normalFiberedPerc ) then<br />
engineStreamingSetProperty( "fiberedPerfMult", normalFiberedPerc );<br />
<br />
normalFiberedPerc = false;<br />
end<br />
end<br />
);<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/New_Scripting_Functions&diff=39178MTA:Eir/New Scripting Functions2014-03-29T16:03:31Z<p>The GTA: </p>
<hr />
<div><pageclass class="client"></pageclass><br />
This page contains new scripting functions that should make their way into the Eir fork. Currently, this page is heavily work-in-progress. I am focusing on client-side scripting functions. Feel free to discuss them in the "discussion" tab of each page.<br />
<br />
'''These functions are added in Phase 4, which is now. Join #mta.recore at irc.multitheftauto.com to share your opinion.'''<br />
<br />
==Engine==<br />
* [[MTA:Eir/functions/engineStreamingSetProperty|engineStreamingSetProperty]]<br />
* [[MTA:Eir/functions/engineStreamingGetProperty|engineStreamingGetProperty]]<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntityCount|engineGetActiveStreamingEntityCount]]<br />
* [[MTA:Eir/functions/engineGetActiveStreamingFreeSlotCount|engineGetActiveStreamingFreeSlotCount]]<br />
* [[MTA:Eir/functions/engineIsStrictStreamingNodeDistributionEnabled|engineIsStrictStreamingNodeDistributionEnabled]]<br />
* [[MTA:Eir/functions/engineIsInfiniteStreamingEnabled|engineIsInfiniteStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntities|engineGetActiveStreamingEntities]]<br />
* [[MTA:Eir/functions/engineGetStreamingFocusEntity|engineGetStreamingFocusEntity]]<br />
* [[MTA:Eir/functions/engineSetWorldStreamingEnabled|engineSetWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineIsWorldStreamingEnabled|engineIsWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineGetRemovedWorldModels|engineGetRemovedWorldModels]]<br />
* [[MTA:Eir/functions/engineClearWorldEntityRemovals|engineClearWorldEntityRemovals]]<br />
* [[MTA:Eir/functions/engineGetGamePoolLimits|engineGetGamePoolLimits]]<br />
* [[MTA:Eir/functions/engineGetStreamingInfo|engineGetStreamingInfo]]<br />
* [[MTA:Eir/functions/engineStreamingIsElementManaged|engineStreamingIsElementManaged]]<br />
* [[MTA:Eir/functions/engineStreamingIsGCOnDemandEnabled|engineStreamingIsGCOnDemandEnabled]]<br />
* [[MTA:Eir/functions/engineIsStreamingNodeStealingAllowed|engineIsStreamingNodeStealingAllowed]]<br />
* [[MTA:Eir/functions/engineStreamingIsFiberedLoadingEnabled|engineStreamingIsFiberedLoadingEnabled]]<br />
* [[MTA:Eir/functions/engineStreamingGetFiberedPerfMultiplier|engineStreamingGetFiberedPerfMultiplier]]<br />
<br />
==Rendering==<br />
* [[MTA:Eir/functions/getEntitiesInRenderQueue|getEntitiesInRenderQueue]]<br />
* [[MTA:Eir/functions/setVehicleLODRenderingEnabled|setVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/isVehicleLODRenderingEnabled|isVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/engineSetWorldRenderMode|engineSetWorldRenderMode]]<br />
* [[MTA:Eir/functions/engineGetWorldRenderMode|engineGetWorldRenderMode]]<br />
<br />
==World==<br />
* [[MTA:Eir/functions/garbageCollectWorldEntities|garbageCollectWorldEntities]]<br />
<br />
==Utilities==<br />
* [[MTA:Eir/functions/getFrameTimestep|getFrameTimestep]]<br />
* [[MTA:Eir/functions/getPerformanceTimer|getPerformanceTimer]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineStreamingSetProperty&diff=39177MTA:Eir/functions/engineStreamingSetProperty2014-03-29T16:02:47Z<p>The GTA: </p>
<hr />
<div>{{*Client_function}}<br />
__NOTOC__ <br />
This function changes the behavior of the GTA:SA streaming system. It is meant to optimize the performance of the game for your custom server. Changes in these properties affect the gameplay quality of the entire server.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool engineStreamingSetProperty ( string propertyName, var propValue )<br />
</syntaxhighlight> <br />
<br />
===Arguments===<br />
*'''propertyName:''' the name of the streaming property you want to change<br />
*'''propValue:''' value to pass to the property<br />
<br />
===Valid Properties===<br />
{{:MTA:Eir/functions/engineStreamingSetProperty/validProps}}<br />
<br />
===Returns===<br />
Returns ''true'' if valid arguments have been passed, ''false'' otherwise.<br />
<br />
==Examples== <br />
<section name="Client" class="client" show="true"><br />
This snippet ultimatively fixes the world flickering.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "strictNodeDistrib", false );<br />
engineStreamingSetProperty( "infiniteStreaming", true );<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet sets the Streaming GC system to sparse mode. In this mode only the preallocated amount of Streaming GC nodes is allowed. Keeping a low amount of Streaming nodes is interesting for performance optimizations.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "gcOnDemand", true );<br />
engineStreamingSetProperty( "infiniteStreaming", false );<br />
engineStreamingSetProperty( "strictNodeDistrib", true );<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet turns on fibered loading when the Streaming system is busy and leaves it that way for five seconds.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "isFibered", false );<br />
<br />
local lastBusyTime = false;<br />
local fiberedDuration = 5000;<br />
<br />
addEventHandler( "onClientRender", root,<br />
function()<br />
local isBusy = engineGetStreamingInfo().isBusy;<br />
<br />
if ( isBusy ) then<br />
local now = getTickCount();<br />
<br />
if not ( lastBusyTime ) then<br />
lastBusyTime = now;<br />
<br />
engineStreamingSetProperty( "isFibered", true );<br />
end<br />
elseif ( lastBusyTime ) then<br />
if ( now - lastBusyTime > fiberedDuration ) then<br />
engineStreamingSetProperty( "isFibered", false );<br />
end<br />
end<br />
end<br />
);<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet makes the world load very slow. Lag spikes cannot occur due to Streaming loading anymore.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "isFibered", true );<br />
engineStreamingSetProperty( "fiberedPerfMult", 0 );<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineStreamingSetProperty/validProps&diff=39176MTA:Eir/functions/engineStreamingSetProperty/validProps2014-03-29T16:02:23Z<p>The GTA: Created page with "{|class="wikitable" |- ! Name ! Type ! Description ! Default |- |strictNodeDistrib |boolean |It is only valid in conjunction with '''infiniteStreaming'''. If enabled, entities fi..."</p>
<hr />
<div>{|class="wikitable"<br />
|-<br />
! Name<br />
! Type<br />
! Description<br />
! Default<br />
|-<br />
|strictNodeDistrib<br />
|boolean<br />
|It is only valid in conjunction with '''infiniteStreaming'''. If enabled, entities first allocate from existing nodes. If disabled, entities are allowed to allocate new streaming nodes from the heap without touching existing nodes.<br />
|Enabled<br />
|-<br />
|infiniteStreaming<br />
|boolean<br />
|Enables or disables heap allocation of [[GTA:SA_Streaming_Garbage_Collection|streaming garbage collector]] nodes. The allocation behavior order is changed using '''strictNodeDistrib'''. If enabled, GTA:SA can keep an theoretically infinite amount of entities inside of the streaming garbage collector. This also means that an theoretically infinite amount of entities can render on-screen at a time.<br />
|Disabled<br />
|-<br />
|gcOnDemand<br />
|boolean<br />
|Used to add a [[GTA:SA_Streaming_Garbage_Collection|Streaming garbage collector]] run to the event that the engine runs out of freely available Streaming GC nodes. The whole world is checked for off-screen or far-away entities. Every entity it finds loses its RenderWare data. When the model info of the specific entity model is not used anymore, it is freed. This way multiple Streaming GC nodes are made available for allocation. It is a safer way to free nodes from in-game entities than the Streaming node stealing implemented by Rockstar Games.<br />
|Disabled<br />
|-<br />
|nodeStealing<br />
|boolean<br />
|Allows or disallows the [[GTA:SA_Streaming_Garbage_Collection|Streaming GC]] node stealing performed by native GTA:SA. This is the functionality that directly causes world flickering if the engine encounters Streaming GC node shortage. Disabling this functionality will greatly reduce the amount of entities that can be freed of their Streaming GC nodes.<br />
|Enabled<br />
|-<br />
|isFibered<br />
|boolean<br />
|Switches between original and fibered loading of the [[GTA:SA_Resource_Streaming|GTA:SA Streaming system]]. In original mode, most resources are loaded in one go, but big ones (exceeding slicer buffer size) are loaded exclusively and in two pulses. In fibered mode, the Streaming system can only take a user-defined percentage of the game frame time, meaning that resources can take an arbitrary amount of pulses depending on the complexity of said resources.<br />
|Enabled<br />
|-<br />
|fiberedPerfMult<br />
|number<br />
|This function changes the fibered loading frame time execution percentage of the [[GTA:SA_Resource_Streaming|MTA:Eir Streaming system]]. 100% means that the Streaming system can take as much as the last frame time the engine took. If set to 0%, the Streaming system will not halt but take a step at a time, disregarding any time settings.<br />
<br />
Lower percentages decrease the CPU load that the Streaming loader issues every frame. While it does not affect high-end CPUs, low end CPUs can greatly benefit from lower percentages when traveling across the world or entering dense areas. In general, lower percentages reduce lag spikes that occur when loading dense areas.<br />
|0.6<br />
|}</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineStreamingSetProperty&diff=39175MTA:Eir/functions/engineStreamingSetProperty2014-03-29T15:57:47Z<p>The GTA: </p>
<hr />
<div>{{*Client_function}}<br />
__NOTOC__ <br />
This function changes the behavior of the GTA:SA streaming system. It is meant to optimize the performance of the game for your custom server. Changes in these properties affect the gameplay quality of the entire server.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool engineStreamingSetProperty ( string propertyName, var propValue )<br />
</syntaxhighlight> <br />
<br />
===Arguments===<br />
*'''propertyName:''' the name of the streaming property you want to change<br />
*'''propValue:''' value to pass to the property<br />
<br />
===Valid Properties===<br />
{|class="wikitable"<br />
|-<br />
! Name<br />
! Type<br />
! Description<br />
! Default<br />
|-<br />
|strictNodeDistrib<br />
|boolean<br />
|It is only valid in conjunction with '''infiniteStreaming'''. If enabled, entities first allocate from existing nodes. If disabled, entities are allowed to allocate new streaming nodes from the heap without touching existing nodes.<br />
|Enabled<br />
|-<br />
|infiniteStreaming<br />
|boolean<br />
|Enables or disables heap allocation of [[GTA:SA_Streaming_Garbage_Collection|streaming garbage collector]] nodes. The allocation behavior order is changed using '''strictNodeDistrib'''. If enabled, GTA:SA can keep an theoretically infinite amount of entities inside of the streaming garbage collector. This also means that an theoretically infinite amount of entities can render on-screen at a time.<br />
|Disabled<br />
|-<br />
|gcOnDemand<br />
|boolean<br />
|Used to add a [[GTA:SA_Streaming_Garbage_Collection|Streaming garbage collector]] run to the event that the engine runs out of freely available Streaming GC nodes. The whole world is checked for off-screen or far-away entities. Every entity it finds loses its RenderWare data. When the model info of the specific entity model is not used anymore, it is freed. This way multiple Streaming GC nodes are made available for allocation. It is a safer way to free nodes from in-game entities than the Streaming node stealing implemented by Rockstar Games.<br />
|Disabled<br />
|-<br />
|nodeStealing<br />
|boolean<br />
|Allows or disallows the [[GTA:SA_Streaming_Garbage_Collection|Streaming GC]] node stealing performed by native GTA:SA. This is the functionality that directly causes world flickering if the engine encounters Streaming GC node shortage. Disabling this functionality will greatly reduce the amount of entities that can be freed of their Streaming GC nodes.<br />
|Enabled<br />
|-<br />
|isFibered<br />
|boolean<br />
|Switches between original and fibered loading of the [[GTA:SA_Resource_Streaming|GTA:SA Streaming system]]. In original mode, most resources are loaded in one go, but big ones (exceeding slicer buffer size) are loaded exclusively and in two pulses. In fibered mode, the Streaming system can only take a user-defined percentage of the game frame time, meaning that resources can take an arbitrary amount of pulses depending on the complexity of said resources.<br />
|Enabled<br />
|-<br />
|fiberedPerfMult<br />
|number<br />
|This function changes the fibered loading frame time execution percentage of the [[GTA:SA_Resource_Streaming|MTA:Eir Streaming system]]. 100% means that the Streaming system can take as much as the last frame time the engine took. If set to 0%, the Streaming system will not halt but take a step at a time, disregarding any time settings.<br />
<br />
Lower percentages decrease the CPU load that the Streaming loader issues every frame. While it does not affect high-end CPUs, low end CPUs can greatly benefit from lower percentages when traveling across the world or entering dense areas. In general, lower percentages reduce lag spikes that occur when loading dense areas.<br />
|0.6<br />
|}<br />
<br />
===Returns===<br />
Returns ''true'' if valid arguments have been passed, ''false'' otherwise.<br />
<br />
==Examples== <br />
<section name="Client" class="client" show="true"><br />
This snippet ultimatively fixes the world flickering.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "strictNodeDistrib", false );<br />
engineStreamingSetProperty( "infiniteStreaming", true );<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet sets the Streaming GC system to sparse mode. In this mode only the preallocated amount of Streaming GC nodes is allowed. Keeping a low amount of Streaming nodes is interesting for performance optimizations.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "gcOnDemand", true );<br />
engineStreamingSetProperty( "infiniteStreaming", false );<br />
engineStreamingSetProperty( "strictNodeDistrib", true );<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet turns on fibered loading when the Streaming system is busy and leaves it that way for five seconds.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "isFibered", false );<br />
<br />
local lastBusyTime = false;<br />
local fiberedDuration = 5000;<br />
<br />
addEventHandler( "onClientRender", root,<br />
function()<br />
local isBusy = engineGetStreamingInfo().isBusy;<br />
<br />
if ( isBusy ) then<br />
local now = getTickCount();<br />
<br />
if not ( lastBusyTime ) then<br />
lastBusyTime = now;<br />
<br />
engineStreamingSetProperty( "isFibered", true );<br />
end<br />
elseif ( lastBusyTime ) then<br />
if ( now - lastBusyTime > fiberedDuration ) then<br />
engineStreamingSetProperty( "isFibered", false );<br />
end<br />
end<br />
end<br />
);<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet makes the world load very slow. Lag spikes cannot occur due to Streaming loading anymore.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "isFibered", true );<br />
engineStreamingSetProperty( "fiberedPerfMult", 0 );<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineStreamingSetProperty&diff=39174MTA:Eir/functions/engineStreamingSetProperty2014-03-29T15:55:44Z<p>The GTA: Created page with "{{*Client_function}} __NOTOC__ This function changes the behavior of the GTA:SA streaming system. It is meant to optimize the performance of the game for your custom server. Cha..."</p>
<hr />
<div>{{*Client_function}}<br />
__NOTOC__ <br />
This function changes the behavior of the GTA:SA streaming system. It is meant to optimize the performance of the game for your custom server. Changes in these properties affect the gameplay quality of the entire server.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
bool engineStreamingSetProperty ( string propertyName, var propValue )<br />
</syntaxhighlight> <br />
<br />
===Arguments===<br />
*'''propertyName:''' the name of the streaming property you want to change<br />
*'''propValue:''' value to pass to the property<br />
<br />
===Valid Properties===<br />
{|class="wikitable"<br />
|-<br />
! Name<br />
! Type<br />
! Description<br />
! Default<br />
|-<br />
|strictNodeDistrib<br />
|boolean<br />
|It is only valid in conjunction with '''infiniteStreaming'''. If enabled, entities first allocate from existing nodes. If disabled, entities are allowed to allocate new streaming nodes from the heap without touching existing nodes.<br />
|Enabled<br />
|-<br />
|infiniteStreaming<br />
|boolean<br />
|Enables or disables heap allocation of [[GTA:SA_Streaming_Garbage_Collection|streaming garbage collector]] nodes. The allocation behavior order is changed using '''strictNodeDistrib'''. If enabled, GTA:SA can keep an theoretically infinite amount of entities inside of the streaming garbage collector. This also means that an theoretically infinite amount of entities can render on-screen at a time.<br />
|Disabled<br />
|-<br />
|gcOnDemand<br />
|boolean<br />
|Used to add a [[GTA:SA_Streaming_Garbage_Collection|Streaming garbage collector]] run to the event that the engine runs out of freely available Streaming GC nodes. The whole world is checked for off-screen or far-away entities. Every entity it finds loses its RenderWare data. When the model info of the specific entity model is not used anymore, it is freed. This way multiple Streaming GC nodes are made available for allocation. It is a safer way to free nodes from in-game entities than the Streaming node stealing implemented by Rockstar Games.<br />
|Disabled<br />
|-<br />
|nodeStealing<br />
|boolean<br />
|Allows or disallows the [[GTA:SA_Streaming_Garbage_Collection|Streaming GC]] node stealing performed by native GTA:SA. This is the functionality that directly causes world flickering if the engine encounters Streaming GC node shortage. Disabling this functionality will greatly reduce the amount of entities that can be freed of their Streaming GC nodes.<br />
|Enabled<br />
|-<br />
|isFibered<br />
|boolean<br />
|Switches between original and fibered loading of the [[GTA:SA_Resource_Streaming|GTA:SA Streaming system]]. In original mode, most resources are loaded in one go, but big ones (exceeding slicer buffer size) are loaded exclusively and in two pulses. In fibered mode, the Streaming system can only take a user-defined percentage of the game frame time, meaning that resources can take an arbitrary amount of pulses depending on the complexity of said resources.<br />
|Enabled<br />
|-<br />
|fiberedPerfMult<br />
|number<br />
|This function changes the fibered loading frame time execution percentage of the [[GTA:SA_Resource_Streaming|MTA:Eir Streaming system]]. 100% means that the Streaming system can take as much as the last frame time the engine took. If set to 0%, the Streaming system will not halt but take a step at a time, disregarding any time settings.<br />
<br />
Lower percentages decrease the CPU load that the Streaming loader issues every frame. While it does not affect high-end CPUs, low end CPUs can greatly benefit from lower percentages when traveling across the world or entering dense areas. In general, lower percentages reduce lag spikes that occur when loading dense areas.<br />
|0.6<br />
|}<br />
<br />
===Returns===<br />
Returns ''true'' if enabled is passed as valid bool, ''false'' otherwise.<br />
<br />
==Examples== <br />
<section name="Client" class="client" show="true"><br />
This snippet ultimatively fixes the world flickering.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "strictNodeDistrib", false );<br />
engineStreamingSetProperty( "infiniteStreaming", true );<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet sets the Streaming GC system to sparse mode. In this mode only the preallocated amount of Streaming GC nodes is allowed. Keeping a low amount of Streaming nodes is interesting for performance optimizations.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "gcOnDemand", true );<br />
engineStreamingSetProperty( "infiniteStreaming", false );<br />
engineStreamingSetProperty( "strictNodeDistrib", true );<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet turns on fibered loading when the Streaming system is busy and leaves it that way for five seconds.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "isFibered", false );<br />
<br />
local lastBusyTime = false;<br />
local fiberedDuration = 5000;<br />
<br />
addEventHandler( "onClientRender", root,<br />
function()<br />
local isBusy = engineGetStreamingInfo().isBusy;<br />
<br />
if ( isBusy ) then<br />
local now = getTickCount();<br />
<br />
if not ( lastBusyTime ) then<br />
lastBusyTime = now;<br />
<br />
engineStreamingSetProperty( "isFibered", true );<br />
end<br />
elseif ( lastBusyTime ) then<br />
if ( now - lastBusyTime > fiberedDuration ) then<br />
engineStreamingSetProperty( "isFibered", false );<br />
end<br />
end<br />
end<br />
);<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet makes the world load very slow. Lag spikes cannot occur due to Streaming loading anymore.<br />
<syntaxhighlight lang="lua"><br />
engineStreamingSetProperty( "isFibered", true );<br />
engineStreamingSetProperty( "fiberedPerfMult", 0 );<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/New_Scripting_Functions&diff=39173MTA:Eir/New Scripting Functions2014-03-29T15:25:20Z<p>The GTA: </p>
<hr />
<div><pageclass class="client"></pageclass><br />
This page contains new scripting functions that should make their way into the Eir fork. Currently, this page is heavily work-in-progress. I am focusing on client-side scripting functions. Feel free to discuss them in the "discussion" tab of each page.<br />
<br />
'''These functions are added in Phase 4, which is now. Join #mta.recore at irc.multitheftauto.com to share your opinion.'''<br />
<br />
==Engine==<br />
* [[MTA:Eir/functions/engineStreamingSetProperty|engineStreamingSetProperty]]<br />
* [[MTA:Eir/functions/engineStreamingGetProperty|engineStreamingGetProperty]]<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntityCount|engineGetActiveStreamingEntityCount]]<br />
* [[MTA:Eir/functions/engineGetActiveStreamingFreeSlotCount|engineGetActiveStreamingFreeSlotCount]]<br />
* [[MTA:Eir/functions/engineSetStrictStreamingNodeDistributionEnabled|engineSetStrictStreamingNodeDistributionEnabled]]<br />
* [[MTA:Eir/functions/engineIsStrictStreamingNodeDistributionEnabled|engineIsStrictStreamingNodeDistributionEnabled]]<br />
* [[MTA:Eir/functions/engineSetInfiniteStreamingEnabled|engineSetInfiniteStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineIsInfiniteStreamingEnabled|engineIsInfiniteStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntities|engineGetActiveStreamingEntities]]<br />
* [[MTA:Eir/functions/engineGetStreamingFocusEntity|engineGetStreamingFocusEntity]]<br />
* [[MTA:Eir/functions/engineSetWorldStreamingEnabled|engineSetWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineIsWorldStreamingEnabled|engineIsWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineGetRemovedWorldModels|engineGetRemovedWorldModels]]<br />
* [[MTA:Eir/functions/engineClearWorldEntityRemovals|engineClearWorldEntityRemovals]]<br />
* [[MTA:Eir/functions/engineGetGamePoolLimits|engineGetGamePoolLimits]]<br />
* [[MTA:Eir/functions/engineGetStreamingInfo|engineGetStreamingInfo]]<br />
* [[MTA:Eir/functions/engineStreamingIsElementManaged|engineStreamingIsElementManaged]]<br />
* [[MTA:Eir/functions/engineStreamingSetGCOnDemandEnabled|engineStreamingSetGCOnDemandEnabled]]<br />
* [[MTA:Eir/functions/engineStreamingIsGCOnDemandEnabled|engineStreamingIsGCOnDemandEnabled]]<br />
* [[MTA:Eir/functions/engineAllowStreamingNodeStealing|engineAllowStreamingNodeStealing]]<br />
* [[MTA:Eir/functions/engineIsStreamingNodeStealingAllowed|engineIsStreamingNodeStealingAllowed]]<br />
* [[MTA:Eir/functions/engineStreamingSetFiberedLoadingEnabled|engineStreamingSetFiberedLoadingEnabled]]<br />
* [[MTA:Eir/functions/engineStreamingIsFiberedLoadingEnabled|engineStreamingIsFiberedLoadingEnabled]]<br />
* [[MTA:Eir/functions/engineStreamingSetFiberedPerfMultiplier|engineStreamingSetFiberedPerfMultiplier]]<br />
* [[MTA:Eir/functions/engineStreamingGetFiberedPerfMultiplier|engineStreamingGetFiberedPerfMultiplier]]<br />
<br />
==Rendering==<br />
* [[MTA:Eir/functions/getEntitiesInRenderQueue|getEntitiesInRenderQueue]]<br />
* [[MTA:Eir/functions/setVehicleLODRenderingEnabled|setVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/isVehicleLODRenderingEnabled|isVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/engineSetWorldRenderMode|engineSetWorldRenderMode]]<br />
* [[MTA:Eir/functions/engineGetWorldRenderMode|engineGetWorldRenderMode]]<br />
<br />
==World==<br />
* [[MTA:Eir/functions/garbageCollectWorldEntities|garbageCollectWorldEntities]]<br />
<br />
==Utilities==<br />
* [[MTA:Eir/functions/getFrameTimestep|getFrameTimestep]]<br />
* [[MTA:Eir/functions/getPerformanceTimer|getPerformanceTimer]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/New_Scripting_Functions&diff=39171MTA:Eir/New Scripting Functions2014-03-29T14:07:52Z<p>The GTA: </p>
<hr />
<div><pageclass class="client"></pageclass><br />
This page contains new scripting functions that should make their way into the Eir fork. Currently, this page is heavily work-in-progress. I am focusing on client-side scripting functions. Feel free to discuss them in the "discussion" tab of each page.<br />
<br />
'''These functions are added in Phase 4, which is now. Join #mta.recore at irc.multitheftauto.com to share your opinion.'''<br />
<br />
==Engine==<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntityCount|engineGetActiveStreamingEntityCount]]<br />
* [[MTA:Eir/functions/engineGetActiveStreamingFreeSlotCount|engineGetActiveStreamingFreeSlotCount]]<br />
* [[MTA:Eir/functions/engineSetStrictStreamingNodeDistributionEnabled|engineSetStrictStreamingNodeDistributionEnabled]]<br />
* [[MTA:Eir/functions/engineIsStrictStreamingNodeDistributionEnabled|engineIsStrictStreamingNodeDistributionEnabled]]<br />
* [[MTA:Eir/functions/engineSetInfiniteStreamingEnabled|engineSetInfiniteStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineIsInfiniteStreamingEnabled|engineIsInfiniteStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineGetActiveStreamingEntities|engineGetActiveStreamingEntities]]<br />
* [[MTA:Eir/functions/engineGetStreamingFocusEntity|engineGetStreamingFocusEntity]]<br />
* [[MTA:Eir/functions/engineSetWorldStreamingEnabled|engineSetWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineIsWorldStreamingEnabled|engineIsWorldStreamingEnabled]]<br />
* [[MTA:Eir/functions/engineGetRemovedWorldModels|engineGetRemovedWorldModels]]<br />
* [[MTA:Eir/functions/engineClearWorldEntityRemovals|engineClearWorldEntityRemovals]]<br />
* [[MTA:Eir/functions/engineGetGamePoolLimits|engineGetGamePoolLimits]]<br />
* [[MTA:Eir/functions/engineGetStreamingInfo|engineGetStreamingInfo]]<br />
* [[MTA:Eir/functions/engineStreamingIsElementManaged|engineStreamingIsElementManaged]]<br />
* [[MTA:Eir/functions/engineStreamingSetGCOnDemandEnabled|engineStreamingSetGCOnDemandEnabled]]<br />
* [[MTA:Eir/functions/engineStreamingIsGCOnDemandEnabled|engineStreamingIsGCOnDemandEnabled]]<br />
* [[MTA:Eir/functions/engineAllowStreamingNodeStealing|engineAllowStreamingNodeStealing]]<br />
* [[MTA:Eir/functions/engineIsStreamingNodeStealingAllowed|engineIsStreamingNodeStealingAllowed]]<br />
* [[MTA:Eir/functions/engineStreamingSetFiberedLoadingEnabled|engineStreamingSetFiberedLoadingEnabled]]<br />
* [[MTA:Eir/functions/engineStreamingIsFiberedLoadingEnabled|engineStreamingIsFiberedLoadingEnabled]]<br />
* [[MTA:Eir/functions/engineStreamingSetFiberedPerfMultiplier|engineStreamingSetFiberedPerfMultiplier]]<br />
* [[MTA:Eir/functions/engineStreamingGetFiberedPerfMultiplier|engineStreamingGetFiberedPerfMultiplier]]<br />
<br />
==Rendering==<br />
* [[MTA:Eir/functions/getEntitiesInRenderQueue|getEntitiesInRenderQueue]]<br />
* [[MTA:Eir/functions/setVehicleLODRenderingEnabled|setVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/isVehicleLODRenderingEnabled|isVehicleLODRenderingEnabled]]<br />
* [[MTA:Eir/functions/engineSetWorldRenderMode|engineSetWorldRenderMode]]<br />
* [[MTA:Eir/functions/engineGetWorldRenderMode|engineGetWorldRenderMode]]<br />
<br />
==World==<br />
* [[MTA:Eir/functions/garbageCollectWorldEntities|garbageCollectWorldEntities]]<br />
<br />
==Utilities==<br />
* [[MTA:Eir/functions/getFrameTimestep|getFrameTimestep]]<br />
* [[MTA:Eir/functions/getPerformanceTimer|getPerformanceTimer]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem&diff=39167Modules/FileSystem2014-03-29T02:31:23Z<p>The GTA: </p>
<hr />
<div><pageclass class="#62A033" subcaption="FileSystem module"></pageclass><br />
<br />
{{Module_Info|<br />
name = FileSystem |<br />
version = 1.3 |<br />
author = [[User:The_GTA|Martin Turski (The_GTA)]] |<br />
module_website = [https://www.assembla.com/code/green-candy/subversion/nodes Here] |<br />
download_link = [https://dl.dropboxusercontent.com/u/55896914/modules/fileSystem/fileSystem_13.dll Win32] [https://dl.dropboxusercontent.com/u/55896914/modules/fileSystem/fileSystem_13.so Linux] |<br />
license = none |<br />
written_in = C++ |<br />
operating_system = Cross-platform |<br />
compatible_with = 1.X |<br />
}}<br />
FileSystem is the [[MTA:Eir]] file management implementation exported as MTA:BLUE module. It is made for those people who are not satisfied with the standard MTA file functions. Its feature-set covers '''binary stream writing''', '''directory scanning''' and '''path resolution logic'''. It should satisfy all needs regarding file functionality. The modules' source code is released within the MTA:Eir SVN.<br />
<br />
Its documentation can be found [[MTA:Eir/FileSystem|here]]. To find coding examples, ''browse the individual class methods''.<br />
<br />
==Installing FileSystem into your Server==<br />
*Place the fileSystem*.dll module into your MTA server modules directory<br />
*Add the module into the mtaserver.conf module loading list (at the bottom of the file)<br />
*'''Edit the acl.xml in a way that resources require admin rights to call''' [[MTA:Eir/FileSystem/createFilesystemInterface|createFilesystemInterface]]''<br />
<br />
==System Access Possibilities==<br />
*Accessing whole system<br />
*Listing and editing all server resources<br />
*Modifying MTA Server configuration<br />
<br />
'''Be careful how you expose the FileSystem module to your server resources!'''<br />
<br />
==Support==<br />
To ask questions about this module, report any bugs or just hang around in general, join #mta.recore at irc.gtanet.com<br />
<br />
*[[Modules/FileSystem/Porting_Between_Clientside_and_Serverside|Porting Clientside and Serverside code]]<br />
<br />
'''LINUX: The .so module currently has stability issues due to conflicting Lua versions. I am working on resolving these. Until then the module may crash when executing callbacks (namely scanDir or scanDirEx methods).'''<br />
<br />
{{:MTA:Eir/FileSystem/functions}}<br />
<br />
[[Category:Modules]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem&diff=39140Modules/FileSystem2014-03-22T16:36:50Z<p>The GTA: </p>
<hr />
<div><pageclass class="#62A033" subcaption="FileSystem module"></pageclass><br />
<br />
{{Module_Info|<br />
name = FileSystem |<br />
version = 1.3 |<br />
author = [[User:The_GTA|Martin Turski (The_GTA)]] |<br />
module_website = [https://www.assembla.com/code/green-candy/subversion/nodes Here] |<br />
download_link = [https://dl.dropboxusercontent.com/u/55896914/modules/fileSystem/fileSystem_13.dll Win32] [https://dl.dropboxusercontent.com/u/55896914/modules/fileSystem/fileSystem_13.so Linux] |<br />
license = none |<br />
written_in = C++ |<br />
operating_system = Cross-platform |<br />
compatible_with = 1.X |<br />
}}<br />
FileSystem is the [[MTA:Eir]] file management implementation exported as MTA:BLUE module. It is made for those people who are not satisfied with the standard MTA file functions. Its feature-set covers '''binary stream writing''', '''directory scanning''' and '''path resolution logic'''. It should satisfy all needs regarding file functionality. The modules' source code is released within the MTA:Eir SVN.<br />
<br />
Its documentation can be found [[MTA:Eir/FileSystem|here]]. To find coding examples, ''browse the individual class methods''.<br />
<br />
==Installing FileSystem into your Server==<br />
*Place the fileSystem*.dll module into your MTA server modules directory<br />
*Add the module into the mtaserver.conf module loading list (at the bottom of the file)<br />
*'''Edit the acl.xml in a way that resources require admin rights to call''' [[MTA:Eir/FileSystem/createFilesystemInterface|createFilesystemInterface]]''<br />
<br />
==System Access Possibilities==<br />
*Accessing whole system<br />
*Listing and editing all server resources<br />
*Modifying MTA Server configuration<br />
<br />
'''Be careful how you expose the FileSystem module to your server resources!'''<br />
<br />
==Support==<br />
To ask questions about this module, report any bugs or just hang around in general, join #mta.recore at irc.gtanet.com<br />
<br />
*[[Modules/FileSystem/Porting_Between_Clientside_and_Serverside|Porting Clientside and Serverside code]]<br />
<br />
{{:MTA:Eir/FileSystem/functions}}<br />
<br />
[[Category:Modules]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineCreateLight&diff=39061MTA:Eir/functions/engineCreateLight2014-03-14T13:30:57Z<p>The GTA: </p>
<hr />
<div>__NOTOC__ <br />
This function creates a RenderWare RpLight object. A light is an object that affects its surrouding RpAtomic instances in a certain radius and casts effects on them. The most notable effect is the '''pointlight''', that colors its surroundings based on attenuation settings.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
rplight engineCreateLight ( string type )<br />
</syntaxhighlight><br />
<br />
===Arguments===<br />
*'''type:''' decides which type that light should have, can be '''point''', '''spot''', '''spot_soft''', '''directional''' or '''ambient'''<br />
<br />
===Returns===<br />
Returns the '''rplight object''' if creation was successful, '''false''' otherwise.<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This snippet creates a RenderWare light object and sets it up properly.<br />
<syntaxhighlight lang="lua"><br />
local light = engineCreateLight( "point" ); -- creates the new point light<br />
light.setColor(1, 1, 1, 1); -- gives the point light a bright color<br />
light.setAttenuation(0.8, 1.4, 4); -- makes the light fade somewhat<br />
light.setRadius(100); -- makes the light affect atomics in a 100 unit radius<br />
<br />
local lightFrame = engineCreateFrame(); -- create a 3D transformation for the light<br />
light.setParent( lightFrame ); -- attaches the light to its frame, the light can now be active in the world.<br />
light.addToScene(); -- activates the light object, so it illuminates its surroundings<br />
<br />
lightFrame.setPosition( 0, 0, 10 ); -- repositions the light<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet creates a spotlight that points in the direction of the player.<br />
<syntaxhighlight lang="lua"><br />
local light = engineCreateLight( "spot_soft" ); -- create a soft spot light<br />
light.setColor( 1, 1, 1, 1 ); -- set its color to white<br />
light.setAttenuation( 0, 10, 8 ); -- give it a random attenuation value<br />
light.setRadius( 300 ); -- set its radius to 300 game units<br />
light.setFalloff( 99 ); -- set the softness of the spot light<br />
light.setConeAngle( 15 ); -- set the spot light's cone angle<br />
<br />
-- Spot lights face in the direction of the "up" vector.<br />
-- If we want to rotate it according to the player's "front" vector,<br />
-- we must tilt the light so that the "up" vector becomes the "front" vector.<br />
local lightFrame = engineCreateFrame();<br />
light.setParent( lightFrame );<br />
light.addToScene();<br />
<br />
-- We tilt the light "up vector" onto the ped "x" axis using 90-degree y angle.<br />
-- Then the "up" vector is rotated onto the "y" axis using 90-degree x angle.<br />
local transMatrix = matrixNew();<br />
transMatrix.setEulerAngles( 90, 90, 0 );<br />
lightFrame.setModelling( transMatrix );<br />
<br />
-- We use another transformation frame to actually face the direction of the player.<br />
-- This frame is updated with the player's world matrix.<br />
local lightPointTransform = engineCreateFrame();<br />
lightFrame.setParent( lightPointTransform );<br />
<br />
-- We need to update it every frame.<br />
local function updateLight()<br />
local playerMatrix = localPlayer.getMatrix();<br />
<br />
-- I decided to offset the world matrix by 1 unit up.<br />
playerMatrix.setPosition(<br />
playerMatrix.offset( 0, 0, 1 )<br />
);<br />
<br />
-- Apply it to the light's root transformation.<br />
lightPointTransform.setModelling( playerMatrix );<br />
<br />
-- Remember to clean up resources to simplify the task of<br />
-- the garbage collector.<br />
playerMatrix.destroy();<br />
end<br />
<br />
addEventHandler( "onClientRender", root, updateLight );<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineCreateLight&diff=39060MTA:Eir/functions/engineCreateLight2014-03-14T13:10:26Z<p>The GTA: </p>
<hr />
<div>__NOTOC__ <br />
This function creates a RenderWare RpLight object. A light is an object that affects its surrouding RpAtomic instances in a certain radius and casts effects on them. The most notable effect is the '''pointlight''', that colors its surroundings based on attenuation settings.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
rplight engineCreateLight ( string type )<br />
</syntaxhighlight><br />
<br />
===Arguments===<br />
*'''type:''' decides which type that light should have, can be '''point''', '''spot''', '''spot_soft''', '''directional''' or '''ambient'''<br />
<br />
===Returns===<br />
Returns the '''rplight object''' if creation was successful, '''false''' otherwise.<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This snippet creates a RenderWare light object and sets it up properly.<br />
<syntaxhighlight lang="lua"><br />
local light = engineCreateLight( "point" ); -- creates the new point light<br />
light.setColor(1, 1, 1, 1); -- gives the point light a bright color<br />
light.setAttenuation(0.8, 1.4, 4); -- makes the light fade somewhat<br />
light.setRadius(100); -- makes the light affect atomics in a 100 unit radius<br />
<br />
local lightFrame = engineCreateFrame(); -- create a 3D transformation for the light<br />
light.setParent( lightFrame ); -- attaches the light to its frame, the light can now be active in the world.<br />
light.addToScene(); -- activates the light object, so it illuminates its surroundings<br />
<br />
lightFrame.setPosition( 0, 0, 10 ); -- repositions the light<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet creates a spotlight that point in the direction of the player.<br />
<syntaxhighlight lang="lua"><br />
local light = engineCreateLight( "spot_soft" ); -- create a soft spot light<br />
light.setColor( 1, 1, 1, 1 ); -- set its color to white<br />
light.setAttenuation( 0, 10, 8 ); -- give it a random attenuation value<br />
light.setRadius( 300 ); -- set its radius to 300 game units<br />
light.setFalloff( 99 ); -- set the softness of the spot light<br />
light.setConeAngle( 15 ); -- set the spot light's cone angle<br />
<br />
-- Spot lights face in the direction of the "up" vector.<br />
-- If we want to rotate it according to the player's "front" vector,<br />
-- we must tilt the light so that the "up" vector becomes the "front" vector.<br />
local lightFrame = engineCreateFrame();<br />
light.setParent( lightFrame );<br />
light.addToScene();<br />
<br />
-- We tilt the light "up vector" onto the ped "x" axis using 90-degree y angle.<br />
-- Then the "up" vector is rotated onto the "y" axis using 90-degree x angle.<br />
local transMatrix = matrixNew();<br />
transMatrix.setEulerAngles( 90, 90, 0 );<br />
lightFrame.setModelling( transMatrix );<br />
<br />
-- We use another transformation frame to actually face the direction of the player.<br />
-- This frame is updated with the player's world matrix.<br />
local lightPointTransform = engineCreateFrame();<br />
lightFrame.setParent( lightPointTransform );<br />
<br />
-- We need to update it every frame.<br />
local function updateLight()<br />
local playerMatrix = localPlayer.getMatrix();<br />
<br />
-- I decided to offset the world matrix by 1 unit up.<br />
playerMatrix.setPosition(<br />
playerMatrix.offset( 0, 0, 1 )<br />
);<br />
<br />
-- Apply it to the light's root transformation.<br />
lightPointTransform.setModelling( playerMatrix );<br />
<br />
-- Remember to clean up resources to simplify the task of<br />
-- the garbage collector.<br />
playerMatrix.destroy();<br />
end<br />
<br />
addEventHandler( "onClientRender", root, updateLight );<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/functions/engineCreateLight&diff=39059MTA:Eir/functions/engineCreateLight2014-03-14T12:35:27Z<p>The GTA: </p>
<hr />
<div>__NOTOC__ <br />
This function creates a RenderWare RpLight object. A light is an object that affects its surrouding RpAtomic instances in a certain radius and casts effects on them. The most notable effect is the '''pointlight''', that colors its surroundings based on attenuation settings.<br />
<br />
==Syntax== <br />
<syntaxhighlight lang="lua"><br />
rplight engineCreateLight ( string type )<br />
</syntaxhighlight><br />
<br />
===Arguments===<br />
*'''type:''' decides which type that light should have, can be '''point''', '''spot''', '''spot_soft''', '''directional''' or '''ambient'''<br />
<br />
===Returns===<br />
Returns the '''rplight object''' if creation was successful, '''false''' otherwise.<br />
<br />
==Example== <br />
<section name="Client" class="client" show="true"><br />
This snippet creates a RenderWare light object and sets it up properly.<br />
<syntaxhighlight lang="lua"><br />
local light = engineCreateLight( "point" ); -- creates the new point light<br />
light.setColor(1, 1, 1, 1); -- gives the point light a bright color<br />
light.setAttenuation(0.8, 1.4, 4); -- makes the light fade somewhat<br />
light.setRadius(100); -- makes the light affect atomics in a 100 unit radius<br />
<br />
local lightFrame = engineCreateFrame(); -- create a 3D transformation for the light<br />
light.setParent( lightFrame ); -- attaches the light to its frame, the light can now be active in the world.<br />
light.addToScene(); -- activates the light object, so it illuminates its surroundings<br />
<br />
lightFrame.setPosition( 0, 0, 10 ); -- repositions the light<br />
</syntaxhighlight><br />
</section><br />
<br />
<section name="Client" class="client" show="true"><br />
This snippet creates a spotlight that point in the direction of the player.<br />
<syntaxhighlight lang="lua"><br />
local light = engineCreateLight( "spot" );<br />
light.setColor( 1, 1, 1, 1 );<br />
light.setAttenuation( 0, 10, 8 );<br />
light.setRadius( 150 );<br />
light.setFalloff( 1.5 );<br />
<br />
local lightFrame = engineCreateFrame();<br />
light.setParent( lightFrame );<br />
light.addToScene();<br />
<br />
local function updateLight()<br />
local playerMatrix = localPlayer.getMatrix();<br />
<br />
-- todo<br />
<br />
playerMatrix.destroy();<br />
end<br />
<br />
addEventHandler( "onClientFrame", root, updateLight );<br />
</syntaxhighlight><br />
</section></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem&diff=38802MTA:Eir/FileSystem2014-02-02T21:26:42Z<p>The GTA: /* References */</p>
<hr />
<div>The '''MTA:Eir FileSystem''' is the framework used for accessing persistent data in [[MTA:Eir]] on places like the harddisk and .zip archives. It is a cross-platform library that currently supports Windows and Unix operating systems. It is based on browsing file system directories after named file entries. A directory can be accessed using a '''translator'''. Each file entry has a path which can be accessed from '''translators'''. To open a file, a '''binary stream handle''' is created and returned to the runtime (CFile native class). Each translator has a '''root directory''' and '''current directory''' that it bases all operations on. It is only allowed to access file system objects from '''its directory tree'''.<br />
<br />
==Definition of Paths==<br />
A '''path''' is a string that is used to '''browse a file system''' with. It can consist of multiple namespaces that resolve into folders on the underlying file system. Every path has a ''target location'' that it points to on a translator file system.<br />
<br />
===Distinction between paths===<br />
A '''directory path''' is a path that ends with either '''/''' or '''\'''. Functions that expect directory paths are allowed to '''trim away the filename at the end of the path'''.<br />
<br />
A '''file path''' is a path that does '''not''' end with either '''/''' or '''\'''. These paths are accepted by functions that '''open binary streams''' or '''handle binary data directly'''. There has to be a '''filename''' at the end of the '''file path'''. It is a string whose size is greater than 0 and contains the name of a '''file object'''.<br />
<br />
The '''null path''' is the path whose '''size is zero'''. This path has to be accepted by all functions. It should cause '''no additional browsing''' other than the '''translators current status'''. If passed to '''translator path resolution functions''', these functions should return the path that they base operations on (i.e. the current directory of the translator).<br />
<br />
A '''relative path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two relative paths are only equal if their translators current directory at the time of resolution was the same.<br />
<br />
An '''absolute path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two absolute paths can be equal independent from the '''translator status'''.<br />
<br />
An '''unique path''' is a path that is returned by '''translator path resolution functions'''. It must not contain '''path scripting symbols'''. If two unique paths are compared for equality, then they '''point to the same file system object''' if the ''context of the comparison'' stays the same (i.e. the translator current directory).<br />
<br />
[[File:Path derivation tree.png|x540px|center]]<br />
<br />
===Windows===<br />
On Windows, a file path is '''case-'''in'''sensitive'''. This means that paths can be checked for equality by comparing the lower-case version of their '''unique absolute path'''. Paths do not allow the symbols '''<''', '''>''', '''"''', '''|''', '''?''' and '''*'''. File paths cannot allow the symbols '''/''' and '''\'''.<br />
<br />
===Linux===<br />
On Linux, a file path is '''case-sensitive'''. Paths can be checked for equality by '''comparing their characters directly'''. In Lua, this is a simple string reference comparison.<br />
<br />
==Browsing a File System using Paths==<br />
A '''file system''' is a structure that consists of named and partitioned '''file system objects'''. It is a '''tree structure''' that has a ''root directory''. From the root directory each file system object should be addressable using '''paths'''. There are infinite variations of paths to address file system objects using '''path scripting''', unless the path is an '''unique path'''.<br />
<br />
Translators behave in a similar way in that they have a root directory where every file system object is addressable from. Hence a translator is a ''special derivation'' of a file system. Like in file systems the runtime '''cannot address file system objects that are outside of the root directory''' (a process called up-rooting). Using scanning functions translators can request the contents of directories. The returned list of names is OS specific. In general, if the OS sets a ''hidden-flag'' onto a file object, its name should not be returned.<br />
<br />
===Translator Access on Windows===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|''*drive_letter*'':/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''drive root''' (OS specific).<br />
|-<br />
|/''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|@''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|}<br />
<br />
===Translator Access on Unix===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''Unix file system root''' (OS specific).<br />
|-<br />
|@''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|}<br />
<br />
==Path Scripting and Path Resolution==<br />
Paths can contain the following scripting and formating symbols.<br />
{| class="wikitable"<br />
|Symbol<br />
|Description<br />
|-<br />
|/ or \<br />
|'''Namespace separator'''. If a string of valid file system characters is put before it or the string is a ''special namespace'', then that string is recognized as a namespace.<br />
|-<br />
|.<br />
|'''Current-directory pointer'''. If this character is recognized as a namespace, then it stands for the ''current directory at parsing level''. Effectively, this symbol does nothing.<br />
|-<br />
|..<br />
|'''Previous-directory pointer'''. If this character is recognized as a namespace, then the ''parser changes context'' to the ''upper directory'' on the translator file system tree.<br />
|}<br />
<br />
==References==<br />
*[[MTA:Eir/FileSystem/functions|FileSystem module Lua functions]]<br />
*[[Modules/FileSystem|MTA:BLUE FileSystem Module Port]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem&diff=38801Modules/FileSystem2014-02-02T21:25:47Z<p>The GTA: </p>
<hr />
<div><pageclass class="#62A033" subcaption="FileSystem module"></pageclass><br />
<br />
{{Module_Info|<br />
name = FileSystem |<br />
version = 1.2 |<br />
author = [[User:The_GTA|Martin Turski (The_GTA)]] |<br />
module_website = [https://www.assembla.com/code/green-candy/subversion/nodes Here] |<br />
download_link = [https://dl.dropboxusercontent.com/u/55896914/modules/fileSystem/fileSystem_12.dll Win32] [https://dl.dropboxusercontent.com/u/55896914/modules/fileSystem/fileSystem_12.so Linux] |<br />
license = none |<br />
written_in = C++ |<br />
operating_system = Cross-platform |<br />
compatible_with = 1.X |<br />
}}<br />
FileSystem is the [[MTA:Eir]] file management implementation exported as MTA:BLUE module. It is made for those people who are not satisfied with the standard MTA file functions. Its feature-set covers '''binary stream writing''', '''directory scanning''' and '''path resolution logic'''. It should satisfy all needs regarding file functionality. The modules' source code is released within the MTA:Eir SVN.<br />
<br />
Its documentation can be found [[MTA:Eir/FileSystem|here]]. To find coding examples, ''browse the individual class methods''.<br />
<br />
==Installing FileSystem into your Server==<br />
*Place the fileSystem*.dll module into your MTA server modules directory<br />
*Add the module into the mtaserver.conf module loading list (at the bottom of the file)<br />
*'''Edit the acl.xml in a way that resources require admin rights to call''' [[MTA:Eir/FileSystem/createFilesystemInterface|createFilesystemInterface]]''<br />
<br />
==System Access Possibilities==<br />
*Accessing whole system<br />
*Listing and editing all server resources<br />
*Modifying MTA Server configuration<br />
<br />
'''Be careful how you expose the FileSystem module to your server resources!'''<br />
<br />
==Support==<br />
To ask questions about this module, report any bugs or just hang around in general, join #mta.recore at irc.gtanet.com<br />
<br />
*[[Modules/FileSystem/Porting_Between_Clientside_and_Serverside|Porting Clientside and Serverside code]]<br />
<br />
{{:MTA:Eir/FileSystem/functions}}<br />
<br />
[[Category:Modules]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem/Porting_Between_Clientside_and_Serverside&diff=38800Modules/FileSystem/Porting Between Clientside and Serverside2014-02-02T21:25:01Z<p>The GTA: Created page with "There are common issues when wanting to port FileSystem code between clientside and serverside environments. This article should help you avoid pitfalls an..."</p>
<hr />
<div>There are common issues when wanting to port [[Modules/FileSystem|FileSystem]] code between clientside and serverside environments. This article should help you avoid pitfalls and getting stuck. Since the issues are mostly about lower-level functionality - with a good abstraction layer - you will not have to rewrite much logic.<br />
<br />
==There is No 'This Resource' Directory serverside==<br />
While the [[MTA:Eir]] client exposes a secure API that bases translator creation around resource folders, the FileSystem module '''cannot do that'''. The reason is very technical. Hence if you want to get the resource directory you are ''operating'' in, you need to '''hardcode''' it.<br />
<syntaxhighlight lang="lua"><br />
-- Create a translator in our resource directory.<br />
local resRoot = fsys.createTranslator( "mods/deathmatch/resources/thisResource/" ); -- thisResource shall be the name of the running resource.<br />
</syntaxhighlight><br />
<br />
==Serverside Translator Abstraction API==<br />
Once the location of the resource is known and a translator is established, then the creation of translators can be abstracted to the resource directory in a similar way as on the MTA:Eir client. This allows creation of translators that are relative to the resources in a secure way.<br />
<syntaxhighlight lang="lua"><br />
function fileCreateTranslator( path )<br />
-- Get an absolute path relative to the resource instance directory.<br />
local absTransPath = resRoot.absPathRoot( path );<br />
<br />
-- It fails if it tries to up-root.<br />
if not ( absTransPath ) then<br />
return false;<br />
end<br />
<br />
-- Create a new translator and return it.<br />
return fsys.createTranslator( absTransPath );<br />
end<br />
</syntaxhighlight></div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem/translator/open&diff=38799MTA:Eir/FileSystem/translator/open2014-02-02T20:44:45Z<p>The GTA: added server example</p>
<hr />
<div>__NOTOC__<br />
This function opens a link to a file instance on a given MTA:Eir FileSystem translator. Using a file link, you can write and/or receive data from filesystems.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
file translator.open ( string filePath, string fileMode )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''filePath:''' the path to the file that should be opened<br />
*'''fileMode:''' an ANSI file mode descriptor (can be 'w', 'r' or 'a', with 'b' and/or '+' appended)<br />
<br />
==Returns==<br />
This function returns the '''FileSystem file''' class that can be used to retrieve or store data persistently. Returns '''false''' if the file failed to open for ''some reason''.<br />
<br />
==Example==<br />
<section name="Server" class="server" show="true"><br />
This snippet lists information about the registered MTA server modules. This information can be retrieved through a command.<br />
<syntaxhighlight lang="lua"><br />
-- The table that will contain all module information.<br />
local moduleInfo = {};<br />
<br />
-- Attempt to get a handle to the FileSystem module namespace.<br />
local fsys = createFilesystemInterface();<br />
<br />
-- Could fail if the server restrictions are set tight.<br />
if not ( fsys ) then<br />
outputDebugString( "could not get a handle to the FileSystem module namespace" );<br />
return false;<br />
end<br />
<br />
local function moduleFileIterator( filePath )<br />
-- Create an entry for this module.<br />
local moduleName = fsys.root.relPath( filePath );<br />
local moduleStats = fsys.root.stat( filePath );<br />
<br />
local entry = {<br />
name = moduleName,<br />
stats = moduleStats<br />
};<br />
<br />
-- Add the entry into the registry.<br />
table.insert( moduleInfo, entry );<br />
end<br />
<br />
-- Loop through all server modules.<br />
fsys.root.chdir( "mods/deathmatch/modules/" );<br />
fsys.root.scanDirEx( "", "*", nil, moduleFileIterator, false );<br />
<br />
-- Function to get a module into by name.<br />
local function getModuleByName( name )<br />
for m,n in ipairs( moduleInfo ) do<br />
if ( n.name == name ) then<br />
return n;<br />
end<br />
end<br />
<br />
return false;<br />
end<br />
<br />
-- Command to request server module information.<br />
addCommandHandler( "modules",<br />
function(player, moduleName)<br />
-- Output module information to the player.<br />
local module = getModuleByName( moduleName );<br />
<br />
if not ( module ) then<br />
outputChatBox( "could not find module named " .. tostring( moduleName ), player );<br />
return false;<br />
end<br />
<br />
-- Output it.<br />
outputChatBox( "module-name: " .. module.name );<br />
outputChatBox( "module-size: " .. module.stats.size );<br />
<br />
-- todo: add more info about the module.<br />
end<br />
);<br />
</syntaxhighlight><br />
</section><br />
<section name="Client" class="client" show="true"><br />
This snippet attempts to open a file and output its contents inside of a CEGUI memo.<br />
<syntaxhighlight lang="lua"><br />
-- Get the screen size so we can scale the memo properly<br />
local screenWidth, screenHeight = guiGetScreenSize();<br />
<br />
-- Make the memo cover nearly the entire screen.<br />
local myMemo = guiCreateMemo( 20, 20, screenWidth - 40, screenHeight - 40, "", false );<br />
<br />
-- Read the contents of some file.<br />
local fileContents = "";<br />
<br />
local fileHandle = fileOpen( "someFile.txt", "rb" );<br />
<br />
if ( fileHandle ) then<br />
fileContents = fileHandle.read( fileHandle.size() );<br />
<br />
-- Clean up our file handle.<br />
fileHandle.destroy();<br />
end<br />
<br />
-- Update the memo.<br />
guiSetText( myMemo, fileContents );<br />
</syntaxhighlight><br />
</section><br />
{{:MTA:Eir/FileSystem/translator/functions}}<br />
<br />
{{:MTA:Eir/FileSystem/file/functions}}</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem/createTranslator&diff=38798MTA:Eir/FileSystem/createTranslator2014-02-02T20:06:06Z<p>The GTA: added server example</p>
<hr />
<div>__NOTOC__<br />
This function creates a FileSystem translator. A FileSystem translator represents a directory on a real or virtual filesystem. Through translators you get access to the files that reside in their directory trees. The translator returned by this function usually represents an OS filesystem directory.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
translator fsnamespace.createTranslator( string rootPath )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''rootPath:''' the absolute path to the directory that you want access to.<br />
<br />
==Returns==<br />
This function returns the '''FileSystem translator''' that grants access to files in the requested directory.<br />
<br />
==Example==<br />
<section name="Server" class="server" show="true"><br />
This snippet links all directories inside of your resource instance folder using translators and lists them in a dictionary under their name.<br />
<syntaxhighlight lang="lua"><br />
-- Dictionary that will contain all directory links of our resource.<br />
local dirs = {};<br />
<br />
-- Get a handle to the FileSystem module namespace.<br />
local fsys = createFilesystemInterface();<br />
<br />
-- Make sure we could obtain the module namespace.<br />
if not ( fsys ) then<br />
outputDebugString( "could not obtain FileSystem module namespace" );<br />
return false;<br />
end<br />
<br />
-- Create a translator to the resource root.<br />
local resRoot = fsys.createTranslator( "mods/deathmatch/resources/" .. getResourceName(resource) .. "/" );<br />
<br />
local function dirIterator( dirPath )<br />
-- get the simple name of this directory.<br />
-- the simple name is the path relative to resRoot without the '/'<br />
local simpleName = resRoot.relPathRoot( dirPath );<br />
simpleName = string.sub( simpleName, 1, #simpleName - 1 );<br />
<br />
-- link this directory and set it into our dirs dictionary.<br />
-- we should always pass the absolute directory to this function.<br />
local translator = fileCreateTranslator( dirPath );<br />
<br />
dirs[simpleName] = translator;<br />
end<br />
<br />
local function fileIterator( filePath )<br />
-- do nothing.<br />
return;<br />
end<br />
<br />
resRoot.scanDirEx( "/", "*", dirIterator, fileIterator, false );<br />
</syntaxhighlight><br />
</section><br />
<section name="Client" class="client" show="false"><br />
This snippet links all directories inside of your resource instance folder using translators and lists them in a dictionary under their name.<br />
<syntaxhighlight lang="lua"><br />
-- Dictionary that will contain all directory links of our resource.<br />
local dirs = {};<br />
<br />
-- Create a translator to the resource root.<br />
local resRoot = fileCreateTranslator( "/" );<br />
<br />
local function dirIterator( dirPath )<br />
-- get the simple name of this directory.<br />
-- the simple name is the path relative to resRoot without the '/'<br />
local simpleName = resRoot.relPathRoot( dirPath );<br />
simpleName = string.sub( simpleName, 1, #simpleName - 1 );<br />
<br />
-- link this directory and set it into our dirs dictionary.<br />
-- we should always pass the absolute directory to this function.<br />
local translator = fileCreateTranslator( dirPath );<br />
<br />
dirs[simpleName] = translator;<br />
end<br />
<br />
local function fileIterator( filePath )<br />
-- do nothing.<br />
return;<br />
end<br />
<br />
resRoot.scanDirEx( "/", "*", dirIterator, fileIterator, false );<br />
</syntaxhighlight><br />
</section><br />
{{:MTA:Eir/FileSystem/namespace/functions}}<br />
<br />
{{:MTA:Eir/FileSystem/translator/functions}}</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem&diff=38797Modules/FileSystem2014-02-02T19:34:13Z<p>The GTA: added Linux version of the FileSystem module</p>
<hr />
<div><pageclass class="#62A033" subcaption="FileSystem module"></pageclass><br />
<br />
{{Module_Info|<br />
name = FileSystem |<br />
version = 1.2 |<br />
author = [[User:The_GTA|Martin Turski (The_GTA)]] |<br />
module_website = [https://www.assembla.com/code/green-candy/subversion/nodes Here] |<br />
download_link = [https://dl.dropboxusercontent.com/u/55896914/modules/fileSystem/fileSystem_12.dll Win32] [https://dl.dropboxusercontent.com/u/55896914/modules/fileSystem/fileSystem_12.so Linux] |<br />
license = none |<br />
written_in = C++ |<br />
operating_system = Cross-platform |<br />
compatible_with = 1.X |<br />
}}<br />
FileSystem is the [[MTA:Eir]] file management implementation exported as MTA:BLUE module. It is made for those people who are not satisfied with the standard MTA file functions. Its feature-set covers '''binary stream writing''', '''directory scanning''' and '''path resolution logic'''. It should satisfy all needs regarding file functionality. The modules' source code is released within the MTA:Eir SVN.<br />
<br />
Its documentation can be found [[MTA:Eir/FileSystem|here]]. To find coding examples, ''browse the individual class methods''.<br />
<br />
==Installing FileSystem into your Server==<br />
*Place the fileSystem*.dll module into your MTA server modules directory<br />
*Add the module into the mtaserver.conf module loading list (at the bottom of the file)<br />
*'''Edit the acl.xml in a way that resources require admin rights to call''' [[MTA:Eir/FileSystem/createFilesystemInterface|createFilesystemInterface]]''<br />
<br />
==System Access Possibilities==<br />
*Accessing whole system<br />
*Listing and editing all server resources<br />
*Modifying MTA Server configuration<br />
<br />
'''Be careful how you expose the FileSystem module to your server resources!'''<br />
<br />
==Support==<br />
To ask questions about this module, report any bugs or just hang around in general, join #mta.recore at irc.gtanet.com<br />
<br />
{{:MTA:Eir/FileSystem/functions}}<br />
<br />
[[Category:Modules]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem/createZIPArchive&diff=38791MTA:Eir/FileSystem/createZIPArchive2014-02-01T23:38:04Z<p>The GTA: </p>
<hr />
<div>__NOTOC__<br />
This function creates a .zip archive inside of the given MTA:Eir file/stream class and returns its translator handle. The archive will not be written into the stream unless the '''save''' method of the archive translator is called.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
atranslator fsnamespace.createZIPArchive ( file fileHandle )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''fileHandle:''' a MTA:Eir FileSystem file/stream class that is writable.<br />
<br />
==Returns==<br />
This function returns the '''FileSystem translator''' that grants access to contents of an archive if fileHandle is a valid file pointer to create a .zip archive in, '''false''' otherwise.<br />
<br />
==Remarks==<br />
This function is currently unavailable in the fileSystem.dll module.<br />
<br />
==Example==<br />
<section name="Server" class="server" show="true"><br />
This snippet packs all server resources into .zip archives and puts them into an output directory, which can be a shared release directory.<br />
This sample should be expanded to support resource sub-directories. It is highly conceptual for now.<br />
<syntaxhighlight lang="lua"><br />
-- Create our FileSystem interface.<br />
local fsys = createFilesystemInterface();<br />
<br />
if not ( fsys ) then<br />
outputDebugString( "cannot create FileSystem interface" );<br />
return false;<br />
end<br />
<br />
-- Gain access to the resource root.<br />
local resourcesRoot = fsys.createTranslator( fsys.root.absPath() .. "mods/deathmatch/resources/" );<br />
<br />
if not ( resourcesRoot ) then<br />
outputDebugString( "cannot link server resources directory" );<br />
return false;<br />
end<br />
<br />
-- Create an output release directory next to the actual resources directory.<br />
fsys.root.createDir( "mods/deathmatch/release_resources/" );<br />
<br />
-- Attempt to link it.<br />
local releaseRoot = fsys.createTranslator( fsys.root.absPath() .. "mods/deathmatch/release_resources/" );<br />
<br />
if not ( releaseRoot ) then<br />
outputDebugString( "cannot link release directory" );<br />
return false;<br />
end<br />
<br />
-- Archive the resources.<br />
local function dirIterator( dirPath )<br />
-- Get the simple name of the resource.<br />
-- It should be the name of the .zip archive<br />
local relPath = resourcesRoot.relPath( dirPath );<br />
<br />
local simpleName = string.sub( relPath, 1, #relPath - 1 );<br />
<br />
-- Get the resource instance directory link.<br />
local resRoot = fsys.createTranslator( dirPath );<br />
<br />
if not ( resRoot ) then<br />
outputDebugString( "resource " .. simpleName .. " could not be linked" );<br />
return;<br />
end<br />
<br />
-- todo: validate the resource.<br />
<br />
-- Create our resource .zip<br />
local zipFile = releaseRoot.open( simpleName .. ".zip", "wb+" );<br />
<br />
if ( zipFile ) then<br />
local zipTranslator = fsys.createZIPArchive( zipFile );<br />
<br />
if ( zipTranslator ) then<br />
-- Copy all files into it.<br />
local function copyIterator( filePath )<br />
-- todo: optimize this operation.<br />
-- can be done by splitting up into multiple write operations.<br />
local copyFile = resRoot.open( filePath, "rb" );<br />
<br />
if ( copyFile ) then<br />
local outFile = zipTranslator.open( resRoot.relPath( filePath ), "wb" );<br />
<br />
if ( outFile ) then<br />
zipTranslator.write( copyFile.read( copyFile.size() ) );<br />
<br />
outFile.destroy();<br />
end<br />
<br />
copyFile.destroy();<br />
end<br />
end<br />
<br />
resRoot.scanDirEx( "/", "*", nil, copyIterator, true );<br />
<br />
-- Write the .zip archive and close the link.<br />
zipTranslator.save();<br />
zipTranslator.destroy();<br />
end<br />
<br />
-- We can close the file now.<br />
zipFile.destroy();<br />
end<br />
<br />
-- Clean up.<br />
resRoot.destroy();<br />
end<br />
<br />
resourcesRoot.scanDirEx( "/", "*", dirIterator, nil, false );<br />
<br />
-- Clean up after ourselves.<br />
resourcesRoot.destroy();<br />
releaseRoot.destroy();<br />
</syntaxhighlight><br />
</section><br />
{{:MTA:Eir/FileSystem/namespace/functions}}<br />
<br />
{{:MTA:Eir/FileSystem/translator/functions}}<br />
<br />
{{:MTA:Eir/FileSystem/atranslator/functions}}</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem/createArchiveTranslator&diff=38790MTA:Eir/FileSystem/createArchiveTranslator2014-02-01T23:37:13Z<p>The GTA: </p>
<hr />
<div>__NOTOC__<br />
This function creates a FileSystem archive translator. A FileSystem archive translator is a virtual FileSystem that grants access to the contents of archives. You can browse archives the same way as you would with native OS directories. The archive implementations usually cache their operations inside of the OS temp directory.<br />
<br />
Currently, only .zip archives are supported.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
atranslator fsnamespace.createArchiveTranslator ( file fileHandle )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''fileHandle:''' a MTA:Eir FileSystem file/stream class that contains the archive.<br />
<br />
==Returns==<br />
This function returns the '''FileSystem translator''' that grants access to contents of an archive.<br />
<br />
==Remarks==<br />
This function is currently unavailable in the fileSystem.dll module.<br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
This snippet lists the contents of a .zip archive.<br />
<syntaxhighlight lang="lua"><br />
-- Opens the file link to our .zip archive.<br />
-- The input fileStream can actually be any file/stream class that is exported to the script.<br />
-- The implementation is allowed to throw exceptions if a file/stream class is incompatible.<br />
local zipFile = fileOpen( "theArchive.zip", "rb" );<br />
<br />
-- Check that we can access that .zip archive.<br />
if not ( zipFile ) then<br />
outputDebugString( "could not open theArchive.zip" );<br />
return false;<br />
end<br />
<br />
-- Try to open a content link to the .zip archive.<br />
-- This operation will fail is the archive is not valid.<br />
local zipTranslator = fileOpenArchive( zipFile );<br />
<br />
if not ( zipTranslator ) then<br />
outputDebugString( "could not access the contents of theArchive.zip" );<br />
outputDebugString( "the archive could be damaged" );<br />
return false;<br />
end<br />
<br />
-- This table shall contain all filenames of the archive.<br />
local fileEntries = {};<br />
<br />
local function fileIterator( filePath )<br />
-- Add the filename to our list.<br />
table.insert( fileEntries, zipTranslator.relPathRoot( filePath ) );<br />
end<br />
<br />
zipTranslator.scanDirEx( "/", "*", nil, fileIterator, true );<br />
<br />
-- List the filenames on the chatbox.<br />
for m,n in ipairs( fileEntries ) do<br />
outputChatBox( n );<br />
end<br />
</syntaxhighlight><br />
</section><br />
{{:MTA:Eir/FileSystem/namespace/functions}}<br />
<br />
{{:MTA:Eir/FileSystem/translator/functions}}<br />
<br />
{{:MTA:Eir/FileSystem/atranslator/functions}}</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem&diff=38789Modules/FileSystem2014-02-01T23:21:58Z<p>The GTA: </p>
<hr />
<div><pageclass class="#62A033" subcaption="FileSystem module"></pageclass><br />
<br />
{{Module_Info|<br />
name = FileSystem |<br />
version = 1.2 |<br />
author = [[User:The_GTA|Martin Turski (The_GTA)]] |<br />
module_website = [https://www.assembla.com/code/green-candy/subversion/nodes Here] |<br />
download_link = [https://dl.dropboxusercontent.com/u/55896914/modules/fileSystem/fileSystem_12.dll Win32] |<br />
license = none |<br />
written_in = C++ |<br />
operating_system = Cross-platform |<br />
compatible_with = 1.X |<br />
}}<br />
FileSystem is the [[MTA:Eir]] file management implementation exported as MTA:BLUE module. It is made for those people who are not satisfied with the standard MTA file functions. Its feature-set covers '''binary stream writing''', '''directory scanning''' and '''path resolution logic'''. It should satisfy all needs regarding file functionality. The modules' source code is released within the MTA:Eir SVN.<br />
<br />
Its documentation can be found [[MTA:Eir/FileSystem|here]]. To find coding examples, ''browse the individual class methods''.<br />
<br />
==Installing FileSystem into your Server==<br />
*Place the fileSystem*.dll module into your MTA server modules directory<br />
*Add the module into the mtaserver.conf module loading list (at the bottom of the file)<br />
*'''Edit the acl.xml in a way that resources require admin rights to call''' [[MTA:Eir/FileSystem/createFilesystemInterface|createFilesystemInterface]]''<br />
<br />
==System Access Possibilities==<br />
*Accessing whole system<br />
*Listing and editing all server resources<br />
*Modifying MTA Server configuration<br />
<br />
'''Be careful how you expose the FileSystem module to your server resources!'''<br />
<br />
==Support==<br />
To ask questions about this module, report any bugs or just hang around in general, join #mta.recore at irc.gtanet.com<br />
<br />
{{:MTA:Eir/FileSystem/functions}}<br />
<br />
[[Category:Modules]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=Modules/FileSystem&diff=38788Modules/FileSystem2014-02-01T23:19:48Z<p>The GTA: Created page with "<pageclass class="#62A033" subcaption="FileSystem module"></pageclass> {{Module_Info| name = FileSystem | version = 1.2 | author = [[User:The_GTA|..."</p>
<hr />
<div><pageclass class="#62A033" subcaption="FileSystem module"></pageclass><br />
<br />
{{Module_Info|<br />
name = FileSystem |<br />
version = 1.2 |<br />
author = [[User:The_GTA|Martin Turski (The_GTA)]] |<br />
module_website = [https://www.assembla.com/code/green-candy/subversion/nodes Here] |<br />
download_link = [https://dl.dropboxusercontent.com/u/55896914/modules/fileSystem/fileSystem_12.dll Win32] |<br />
license = none |<br />
written_in = C++ |<br />
operating_system = Cross-platform |<br />
compatible_with = 1.X |<br />
}}<br />
FileSystem is the [[MTA:Eir]] file management implementation exported as MTA:BLUE module. It is made for those people who are not satisfied with the standard MTA file functions. Its feature-set covers '''binary stream writing''', '''directory scanning''' and '''path resolution logic'''. It should satisfy all needs regarding file functionality. The modules' source code is released within the MTA:Eir SVN.<br />
<br />
Its documentation can be found [[MTA:Eir/FileSystem|here]]. To find coding examples, ''browse the individual class methods''.<br />
<br />
==Installing FileSystem into your Server==<br />
*Place the fileSystem*.dll module into your MTA server modules directory<br />
*Add the module into the mtaserver.conf module loading list (at the bottom of the file)<br />
*'''Edit the acl.xml in a way that resources require admin rights to call''' [[MTA:Eir/FileSystem/createFilesystemInterface|createFilesystemInterface]]''<br />
<br />
==System Access Possibilities==<br />
*Accessing whole system<br />
*Listing and editing all server resources<br />
*Modifying MTA Server configuration<br />
<br />
'''Be careful how you expose the FileSystem module to your server resources!'''<br />
<br />
{{:MTA:Eir/FileSystem/functions}}<br />
<br />
[[Category:Modules]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem/translator/scanDirEx&diff=38787MTA:Eir/FileSystem/translator/scanDirEx2014-02-01T20:54:00Z<p>The GTA: /* Arguments */</p>
<hr />
<div>__NOTOC__<br />
This function loops through all translator filesystem entries that are captured by the wildcard and the directory specifier. The wildcard is glob-style and supports '''*''' and '''?''' modifiers. The scan can be made recursive to enter every directory it finds, so that files and folders of a whole directory tree are captured. This function is used to process filesystem objects inside of directories without having to add the filenames into a configuration file. This greatly increases flexibility when processing files. This function is more flexible than [[MTA:Eir/FileSystem/translator/scanDir|scanDir]] as it triggers callbacks directly when either files or directories are found, making a distinction between files and directories very easy.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool translator.scanDirEx ( string dirPath, string wildcard, function dirCallback, function fileCallback, bool recursive )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''dirPath:''' a path to the directory the scan shall take place or start in<br />
*'''wildcard:''' glob-style wild-card for filename matching; every filename that matches the wild-card is returned<br />
*'''dirCallback:''' the function callback that should trigger for every directory found (can be nil); the absolute path of the directory is passed to it<br />
*'''fileCallback:''' the directory callback that should trigger for every file found (can be nil); the absolute path of the file is passed to it<br />
*'''recursive:''' a boolean that specifies whether the whole directory tree at dirPath should be included into the scan<br />
<br />
==Returns==<br />
This function performs a scan of all filesystem objects captured inside of the '''dirPath''' folder using the '''wild-card''' glob-style pattern. It returns '''false''' if '''dirPath''' is an invalid path specifier for the translator.<br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
This snippet outputs the count of directories and files in a specified directory relative to the resource instance root. This is an alternative to the '''scanDir''' way.<br />
<syntaxhighlight lang="lua"><br />
-- Get a handle to the resource instance directory.<br />
local resRoot = fileCreateTranslator( "/" );<br />
<br />
local function getFilesystemObjectCounts( path )<br />
local fileCount = 0;<br />
local dirCount = 0;<br />
<br />
-- Create iterator closures that are triggered for each file and directory<br />
local function fileIterator( filePath )<br />
-- filePath is always an absolute path.<br />
fileCount = fileCount + 1;<br />
end<br />
<br />
local function dirIterator( dirPath )<br />
-- filePath is always an absolute path.<br />
dirCount = dirCount + 1;<br />
end<br />
<br />
-- Get a list of all fs objects.<br />
local fsObjects =<br />
resRoot.scanDirEx(<br />
path, -- scan anywhere the script wants us to<br />
"*", -- include all files<br />
dirIterator, -- pass the callbacks to the routine<br />
fileIterator,<br />
false -- scan the specified directory only<br />
);<br />
<br />
-- We do not need to loop anymore.<br />
<br />
-- Return the counts.<br />
return fileCount, dirCount;<br />
end<br />
<br />
-- Output the filesystem object counts for the resource instance root.<br />
local fileCount, dirCount = getFilesystemObjectCounts( "/" );<br />
<br />
outputChatBox( "found " .. fileCount .. " files and " .. dirCount .. " directories in the resource folder root." );<br />
</syntaxhighlight><br />
</section><br />
{{:MTA:Eir/FileSystem/translator/functions}}</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem/translator/scanDirEx&diff=38786MTA:Eir/FileSystem/translator/scanDirEx2014-02-01T20:53:15Z<p>The GTA: /* Example */</p>
<hr />
<div>__NOTOC__<br />
This function loops through all translator filesystem entries that are captured by the wildcard and the directory specifier. The wildcard is glob-style and supports '''*''' and '''?''' modifiers. The scan can be made recursive to enter every directory it finds, so that files and folders of a whole directory tree are captured. This function is used to process filesystem objects inside of directories without having to add the filenames into a configuration file. This greatly increases flexibility when processing files. This function is more flexible than [[MTA:Eir/FileSystem/translator/scanDir|scanDir]] as it triggers callbacks directly when either files or directories are found, making a distinction between files and directories very easy.<br />
<br />
==Syntax==<br />
<syntaxhighlight lang="lua"><br />
bool translator.scanDirEx ( string dirPath, string wildcard, function dirCallback, function fileCallback, bool recursive )<br />
</syntaxhighlight><br />
<br />
==Arguments==<br />
*'''dirPath:''' a path to the directory the scan shall take place or start in<br />
*'''wildcard:''' glob-style wild-card for filename matching; every filename that matches the wild-card is returned<br />
*'''dirCallback:''' the function callback that should trigger for every directory found (can be nil)<br />
*'''fileCallback:''' the directory callback that should trigger for every file found (can be nil)<br />
*'''recursive:''' a boolean that specifies whether the whole directory tree at dirPath should be included into the scan<br />
<br />
==Returns==<br />
This function performs a scan of all filesystem objects captured inside of the '''dirPath''' folder using the '''wild-card''' glob-style pattern. It returns '''false''' if '''dirPath''' is an invalid path specifier for the translator.<br />
<br />
==Example==<br />
<section name="Client" class="client" show="true"><br />
This snippet outputs the count of directories and files in a specified directory relative to the resource instance root. This is an alternative to the '''scanDir''' way.<br />
<syntaxhighlight lang="lua"><br />
-- Get a handle to the resource instance directory.<br />
local resRoot = fileCreateTranslator( "/" );<br />
<br />
local function getFilesystemObjectCounts( path )<br />
local fileCount = 0;<br />
local dirCount = 0;<br />
<br />
-- Create iterator closures that are triggered for each file and directory<br />
local function fileIterator( filePath )<br />
-- filePath is always an absolute path.<br />
fileCount = fileCount + 1;<br />
end<br />
<br />
local function dirIterator( dirPath )<br />
-- filePath is always an absolute path.<br />
dirCount = dirCount + 1;<br />
end<br />
<br />
-- Get a list of all fs objects.<br />
local fsObjects =<br />
resRoot.scanDirEx(<br />
path, -- scan anywhere the script wants us to<br />
"*", -- include all files<br />
dirIterator, -- pass the callbacks to the routine<br />
fileIterator,<br />
false -- scan the specified directory only<br />
);<br />
<br />
-- We do not need to loop anymore.<br />
<br />
-- Return the counts.<br />
return fileCount, dirCount;<br />
end<br />
<br />
-- Output the filesystem object counts for the resource instance root.<br />
local fileCount, dirCount = getFilesystemObjectCounts( "/" );<br />
<br />
outputChatBox( "found " .. fileCount .. " files and " .. dirCount .. " directories in the resource folder root." );<br />
</syntaxhighlight><br />
</section><br />
{{:MTA:Eir/FileSystem/translator/functions}}</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem&diff=38785MTA:Eir/FileSystem2014-02-01T19:17:28Z<p>The GTA: /* Path Scripting and Path Resolution */</p>
<hr />
<div>The '''MTA:Eir FileSystem''' is the framework used for accessing persistent data in [[MTA:Eir]] on places like the harddisk and .zip archives. It is a cross-platform library that currently supports Windows and Unix operating systems. It is based on browsing file system directories after named file entries. A directory can be accessed using a '''translator'''. Each file entry has a path which can be accessed from '''translators'''. To open a file, a '''binary stream handle''' is created and returned to the runtime (CFile native class). Each translator has a '''root directory''' and '''current directory''' that it bases all operations on. It is only allowed to access file system objects from '''its directory tree'''.<br />
<br />
==Definition of Paths==<br />
A '''path''' is a string that is used to '''browse a file system''' with. It can consist of multiple namespaces that resolve into folders on the underlying file system. Every path has a ''target location'' that it points to on a translator file system.<br />
<br />
===Distinction between paths===<br />
A '''directory path''' is a path that ends with either '''/''' or '''\'''. Functions that expect directory paths are allowed to '''trim away the filename at the end of the path'''.<br />
<br />
A '''file path''' is a path that does '''not''' end with either '''/''' or '''\'''. These paths are accepted by functions that '''open binary streams''' or '''handle binary data directly'''. There has to be a '''filename''' at the end of the '''file path'''. It is a string whose size is greater than 0 and contains the name of a '''file object'''.<br />
<br />
The '''null path''' is the path whose '''size is zero'''. This path has to be accepted by all functions. It should cause '''no additional browsing''' other than the '''translators current status'''. If passed to '''translator path resolution functions''', these functions should return the path that they base operations on (i.e. the current directory of the translator).<br />
<br />
A '''relative path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two relative paths are only equal if their translators current directory at the time of resolution was the same.<br />
<br />
An '''absolute path''' is a directory or file path that is resolved based on the '''translators current directory''' (unless otherwise specified). Two absolute paths can be equal independent from the '''translator status'''.<br />
<br />
An '''unique path''' is a path that is returned by '''translator path resolution functions'''. It must not contain '''path scripting symbols'''. If two unique paths are compared for equality, then they '''point to the same file system object''' if the ''context of the comparison'' stays the same (i.e. the translator current directory).<br />
<br />
[[File:Path derivation tree.png|x540px|center]]<br />
<br />
===Windows===<br />
On Windows, a file path is '''case-'''in'''sensitive'''. This means that paths can be checked for equality by comparing the lower-case version of their '''unique absolute path'''. Paths do not allow the symbols '''<''', '''>''', '''"''', '''|''', '''?''' and '''*'''. File paths cannot allow the symbols '''/''' and '''\'''.<br />
<br />
===Linux===<br />
On Linux, a file path is '''case-sensitive'''. Paths can be checked for equality by '''comparing their characters directly'''. In Lua, this is a simple string reference comparison.<br />
<br />
==Browsing a File System using Paths==<br />
A '''file system''' is a structure that consists of named and partitioned '''file system objects'''. It is a '''tree structure''' that has a ''root directory''. From the root directory each file system object should be addressable using '''paths'''. There are infinite variations of paths to address file system objects using '''path scripting''', unless the path is an '''unique path'''.<br />
<br />
Translators behave in a similar way in that they have a root directory where every file system object is addressable from. Hence a translator is a ''special derivation'' of a file system. Like in file systems the runtime '''cannot address file system objects that are outside of the root directory''' (a process called up-rooting). Using scanning functions translators can request the contents of directories. The returned list of names is OS specific. In general, if the OS sets a ''hidden-flag'' onto a file object, its name should not be returned.<br />
<br />
===Translator Access on Windows===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|''*drive_letter*'':/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''drive root''' (OS specific).<br />
|-<br />
|/''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|@''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|}<br />
<br />
===Translator Access on Unix===<br />
{| class="wikitable"<br />
|-<br />
|Path Syntax<br />
|Description<br />
|-<br />
|/''*path*''<br />
|Format of an '''absolute path''' that is based from the '''Unix file system root''' (OS specific).<br />
|-<br />
|@''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator root'''.<br />
|-<br />
|''*path*''<br />
|Format of a '''relative path''' that is based from the '''translator current directory'''.<br />
|}<br />
<br />
==Path Scripting and Path Resolution==<br />
Paths can contain the following scripting and formating symbols.<br />
{| class="wikitable"<br />
|Symbol<br />
|Description<br />
|-<br />
|/ or \<br />
|'''Namespace separator'''. If a string of valid file system characters is put before it or the string is a ''special namespace'', then that string is recognized as a namespace.<br />
|-<br />
|.<br />
|'''Current-directory pointer'''. If this character is recognized as a namespace, then it stands for the ''current directory at parsing level''. Effectively, this symbol does nothing.<br />
|-<br />
|..<br />
|'''Previous-directory pointer'''. If this character is recognized as a namespace, then the ''parser changes context'' to the ''upper directory'' on the translator file system tree.<br />
|}<br />
<br />
==References==<br />
*[[MTA:Eir/FileSystem/functions|FileSystem module Lua functions]]</div>The GTAhttps://wiki.multitheftauto.com/index.php?title=MTA:Eir/FileSystem/functions&diff=38784MTA:Eir/FileSystem/functions2014-02-01T19:11:59Z<p>The GTA: /* FileSystem Library functions */</p>
<hr />
<div>__NOTOC__<br />
==[[MTA:Eir/FileSystem|FileSystem]] Library Functions==<br />
*[[MTA:Eir/FileSystem/createFilesystemInterface|createFilesystemInterface]]<br />
<br />
{{:MTA:Eir/FileSystem/namespace/functions}}<br />
<br />
{{:MTA:Eir/FileSystem/translator/functions}}<br />
<br />
{{:MTA:Eir/FileSystem/atranslator/functions}}<br />
<br />
{{:MTA:Eir/FileSystem/file/functions}}</div>The GTA