Custom Train Tracks: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (→‎Functions: alter api)
(improve structure)
Line 11: Line 11:
|'''Branch version'''
|'''Branch version'''
|1.6
|1.6
|}</onlyinclude>
|}


== Functions ==
=== Functions ===
* [[createTrack]]
* [[createTrack]]
* [[getDefaultTrack]]
* [[getDefaultTrack]]
Line 21: Line 21:
* [[getTrackNodes]]
* [[getTrackNodes]]


=== Media ===
* [https://www.youtube.com/watch?v=S_Q3Gk4jVr0&user=UCbl-5xYsT5KwnrfGdW9LYPQ MTA:SA Custom train tracks #1]</onlyinclude>
== Development ==
=== API ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- trainNode is a Vector3, or table of three coordinates
-- trainNode is a Vector3, or table of three coordinates
Line 36: Line 41:
</syntaxhighlight>
</syntaxhighlight>


== Old Functions ==
=== Issues ===
(will be removed once new functions are implemented)
 
* [[createTrainTrack]]
* [[destroyTrainTrack]]
* [[setTrainTrackLength]]
* [[getTrainTrackLength]]
* [[setTrainTrackNumberOfNodes]]
* [[getTrainTrackNumberOfNodes]]
* [[getTrainTrackID]]
* [[getVehicleTrainTrack]]
* [[setVehicleTrainTrack]]
* [[getTrainTrackPosition]]
 
== Media ==
<includeonly>
=== Media ===
test 2
</includeonly><onlyinclude>
* [https://www.youtube.com/watch?v=S_Q3Gk4jVr0&user=UCbl-5xYsT5KwnrfGdW9LYPQ MTA:SA Custom train tracks #1]</onlyinclude>
 
== Issues ==
* There may be some issues (relating to infinite loops) if a track runs across another or crosses another
* There may be some issues (relating to infinite loops) if a track runs across another or crosses another
** Infinite loop occurs at 006f8fda, see [http://i.imgur.com/HvBWAFm.png call stack]. Occurs when a track of two nodes have same x/y, but different z. Only occurs for tracks that ONLY consist of nodes atop each other.
** Infinite loop occurs at 006f8fda, see [http://i.imgur.com/HvBWAFm.png call stack]. Occurs when a track of two nodes have same x/y, but different z. Only occurs for tracks that ONLY consist of nodes atop each other.
Line 63: Line 47:
* <strike>int CWorldSA::FindClosestRailTrackNode needs updating. It needs to use MAX_TOTAL_TRACKS and the train manager.</strike> [https://github.com/multitheftauto/mtasa-blue/commit/09e3ee8f25810c17742728f038786b6a223c5296 See 09e3ee8f25810c17742]
* <strike>int CWorldSA::FindClosestRailTrackNode needs updating. It needs to use MAX_TOTAL_TRACKS and the train manager.</strike> [https://github.com/multitheftauto/mtasa-blue/commit/09e3ee8f25810c17742728f038786b6a223c5296 See 09e3ee8f25810c17742]


== Re-merge ==
=== Re-merge ===
{| class="wikitable" style="width: auto; table-layout: fixed;"
{| class="wikitable" style="width: auto; table-layout: fixed;"
|-
|-

Revision as of 20:10, 14 July 2016

This branch makes it possible to make your own train tracks.

Status Work in progress
Branch custom-train-tracks
Branch version 1.6

Functions

Media

Development

API

-- trainNode is a Vector3, or table of three coordinates
-- nodes is a table of trainNodes

track = TrainTrack(...nodes) -- createTrack(node1, node2, node3, ...)

-- Default track functions
TrainTrack.removeDefault(int trackID)
TrainTrack.resetDefault(int trackID)

-- These functions already exist, but I'm not sure how these lengths are used or what they are for
float track:getLength() -- getTrainTrack(track)
bool track:setLength(float length) -- setTrackLength(track, float length)

Issues

  • There may be some issues (relating to infinite loops) if a track runs across another or crosses another
    • Infinite loop occurs at 006f8fda, see call stack. Occurs when a track of two nodes have same x/y, but different z. Only occurs for tracks that ONLY consist of nodes atop each other.
  • Tracks may not be cleaned up
  • int CWorldSA::FindClosestRailTrackNode needs updating. It needs to use MAX_TOTAL_TRACKS and the train manager. See 09e3ee8f25810c17742

Re-merge

Status Abandoned
Branch custom-train-tracks-old (renamed from custom-train-tracks)
Branch version 1.4

The old custom-train-tracks branch contains commits cherry-picked and other merges from the 1.4 branch. The first task in updating this branch is to distinguish between merge commits and actual branch commits:

This means that there are only four commits that need to be merged into the new branch. There is currently a packet issue introduced by the merge that needs to be fixed.