aboutsummaryrefslogtreecommitdiff
path: root/advtrains/advtrains
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains/advtrains')
-rw-r--r--advtrains/advtrains/api_doc.txt157
-rw-r--r--advtrains/advtrains/atc.lua312
-rw-r--r--advtrains/advtrains/couple.lua184
-rw-r--r--advtrains/advtrains/craft_items.lua23
-rw-r--r--advtrains/advtrains/crafting.lua110
-rw-r--r--advtrains/advtrains/debugitems.lua28
-rw-r--r--advtrains/advtrains/debugringbuffer.lua44
-rw-r--r--advtrains/advtrains/depends.txt3
-rw-r--r--advtrains/advtrains/description.txt8
-rw-r--r--advtrains/advtrains/digtron.lua25
-rw-r--r--advtrains/advtrains/helpers.lua262
-rw-r--r--advtrains/advtrains/init.lua400
-rw-r--r--advtrains/advtrains/loading.lua99
-rw-r--r--advtrains/advtrains/locale/de.txt50
-rw-r--r--advtrains/advtrains/misc_nodes.lua67
-rw-r--r--advtrains/advtrains/models/advtrains_across.obj537
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_bumper_st.b3dbin32927 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_bumper_st_30.b3dbin48546 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_bumper_st_45.b3dbin32926 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_bumper_st_60.b3dbin48546 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_cr.b3dbin28040 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_cr_30.b3dbin28043 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_cr_45.b3dbin34483 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_cr_60.b3dbin34483 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_st.b3dbin10712 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_st_30.b3dbin20043 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_st_45.b3dbin12235 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_st_60.b3dbin20043 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swlcr.b3dbin36203 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swlcr_30.b3dbin39958 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swlcr_45.b3dbin41302 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swlcr_60.b3dbin46270 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swlst.b3dbin36203 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swlst_30.b3dbin39958 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swlst_45.b3dbin41302 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swlst_60.b3dbin46270 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swrcr.b3dbin36203 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swrcr_30.b3dbin46270 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swrcr_45.b3dbin41302 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swrcr_60.b3dbin39958 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swrst.b3dbin36203 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swrst_30.b3dbin46270 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swrst_45.b3dbin41302 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_swrst_60.b3dbin39958 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_vst1.obj348
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_vst1_45.obj434
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_vst2.obj372
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_vst2_45.obj462
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_vst31.obj348
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_vst32.obj372
-rw-r--r--advtrains/advtrains/models/advtrains_dtrack_vst33.obj388
-rw-r--r--advtrains/advtrains/models/advtrains_modernwagon.b3dbin172028 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_retrosignal_off.b3dbin13093 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_retrosignal_off_30.b3dbin13093 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_retrosignal_off_45.b3dbin13093 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_retrosignal_off_60.b3dbin13093 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_retrosignal_on.b3dbin13093 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_retrosignal_on_30.b3dbin13093 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_retrosignal_on_45.b3dbin13093 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_retrosignal_on_60.b3dbin13093 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_signal.b3dbin61544 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_signal_30.b3dbin61544 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_signal_45.b3dbin61544 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_signal_60.b3dbin61544 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_signal_wall_l.b3dbin40514 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_signal_wall_r.b3dbin40514 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_signal_wall_t.b3dbin40514 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_track_cr.b3dbin8023 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_track_st.b3dbin15831 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/advtrains_track_st_45.b3dbin8935 -> 0 bytes
-rw-r--r--advtrains/advtrains/models/trackplane.b3dbin262 -> 0 bytes
-rw-r--r--advtrains/advtrains/nodedb.lua307
-rw-r--r--advtrains/advtrains/settingtypes.txt8
-rw-r--r--advtrains/advtrains/signals.lua227
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_across.pngbin302 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_across_anim.pngbin524 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_boiler.pngbin413 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_chimney.pngbin309 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_couple.pngbin339 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_discouple.pngbin293 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_driver_cab.pngbin352 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_atc_placer.pngbin1259 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_bumper_placer.pngbin2213 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_detector_placer.pngbin1253 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_load_placer.pngbin1248 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_placer.pngbin1097 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_rail.pngbin4582 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_shared.pngbin7141 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_shared_atc.pngbin7215 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_shared_detector_off.pngbin7180 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_shared_detector_on.pngbin7181 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_shared_load.pngbin7339 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_shared_unload.pngbin7338 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_slopeplacer.pngbin2415 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_dtrack_unload_placer.pngbin1260 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_platform.pngbin193 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_retrosignal.pngbin8496 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_retrosignal_inv.pngbin2242 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_signal_inv.pngbin856 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_signal_off.pngbin5882 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_signal_on.pngbin5884 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_signal_wall_off.pngbin3056 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_signal_wall_on.pngbin3043 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_track_cr.pngbin33370 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_track_cr_45.pngbin33938 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_track_placer.pngbin32349 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_track_st.pngbin20405 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_track_st_45.pngbin39977 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_track_swlcr.pngbin33378 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_track_swlcr_45.pngbin45772 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_track_swlst.pngbin32321 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_track_swlst_45.pngbin46408 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_track_swrcr.pngbin33670 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_track_swrcr_45.pngbin46865 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_track_swrst.pngbin32654 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_track_swrst_45.pngbin47636 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_trackworker.pngbin328 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/advtrains_wheel.pngbin582 -> 0 bytes
-rwxr-xr-xadvtrains/advtrains/textures/drwho_screwdriver.pngbin328 -> 0 bytes
-rw-r--r--advtrains/advtrains/trackdb_legacy.lua27
-rw-r--r--advtrains/advtrains/trackplacer.lua305
-rw-r--r--advtrains/advtrains/tracks.lua734
-rw-r--r--advtrains/advtrains/trainhud.lua126
-rw-r--r--advtrains/advtrains/trainlogic.lua1005
-rw-r--r--advtrains/advtrains/wagons.lua900
125 files changed, 0 insertions, 8672 deletions
diff --git a/advtrains/advtrains/api_doc.txt b/advtrains/advtrains/api_doc.txt
deleted file mode 100644
index 20f285f..0000000
--- a/advtrains/advtrains/api_doc.txt
+++ /dev/null
@@ -1,157 +0,0 @@
-Advanced Trains [advtrains] API documentation
---------
-To use the API, mods must depend on 'advtrains'.
-All boolean values in definition tables default to 'false' and can be omitted.
-### Wagons
-Wagons are registered using the function
-
-advtrains.register_wagon(name, prototype, description, inventory_image)
-- 'name' is the internal name of the wagon. It is registered inside the 'advtrains:' namespace.
- Example: A wagon with name="engine_tgv" will be registered as "advtrains:engine_tgv".
-- 'prototype' is the lua entity prototype. The regular definition keys for luaentites apply. Additional required and optional properties see below. DO NOT define 'on_step', 'on_activate', 'on_punch', 'on_rightclick' and 'get_staticdata' since these will be overridden. Use 'custom_*' instead.
-- 'description' is the description of the inventory item that is used to place the wagon.
-- 'inventory_image' is the inventory image of said item.
-
-# Wagon prototype properties
-{
- ... all regular luaentity properties (mesh, textures, collisionbox a.s.o)...
- drives_on = {default=true},
- ^- used to define the tracktypes (see below) that wagon can drive on. The tracktype identifiers are given as keys, similar to privileges)
- max_speed = 10,
- ^- optional, default 10: defines the maximum speed this wagon can drive. The maximum speed of a train is determined by the wagon with the lowest max_speed value.
- seats = {
- ^- contains zero or more seat definitions. A seat is a place where a player can be attached when getting on a wagon.
- {
- name="Left front window",
- ^- display name of this seat
- attach_offset={x=0, y=10, z=0},
- ^- this value is passed to 'set_attach'
- view_offset={x=0, y=6, z=0},
- ^- player:set_eye_offset is called with this parameter.
- driving_ctrl_access=false,
- ^- If the seat is a driver stand, and players sitting here should get access to the train's driving control.
- group="default"
- ^- optional. Defines the seat group. See 'seat_groups' below
- },
- },
- seat_groups = {
- ^- optional. If defined, activates advanced seating behavior. See "seating behavior".
- default = {
- name = "Seats"
- ^- name of this seat group, to be shown in get-on menu.
- access_to = {"foo", "bar"}
- ^- List of seat groups you can access from this seat using the menu when sitting inside the train.
- require_doors_open = true
- ^- Only allow getting on and off if doors are open.
- }
- }
- assign_to_seat_group = {"default"},
- ^- optional, like seat_groups. When player right_clicks the wagon, player will be assigned to the first free seat group in the list.
-
- doors={
- ^- optional. If defined, defines door animation frames. Opposite door has to be closed during animation period.
- ^- Remember, advtrains can't handle doors on both sides opened simultaneously.
- open={
- [-1]={frames={x=0, y=20}, time=1}, -- open left doors
- [1]={frames={x=40, y=60}, time=1} -- open right doors
- },
- close={
- [-1]={frames={x=20, y=40}, time=1}, -- close left doors
- [1]={frames={x=60, y=80}, time=1} -- close right doors
- }
- },
- door_entry={ 1.5, -1.5 }
- ^- optional. If defined, defines the locations of the doors on the model as distance from the object center on the path.
- ^- Getting on by walking in then takes effect.
- ^- Positive values mean front, negative ones back. Resulting position is automatically shifted to the right side.
-
- wagon_span=2,
- ^- How far this wagon extends from its base position. Is the half of the wagon length.
- ^- Used to determine in which distance the other wagons have to be positioned. Will require tweaking.
- drops = {"default:steelblock 3"}
- ^- List of itemstrings what to drop when the wagon is destroyed
-
- has_inventory = false
- ^- If this wagon has an inventory. The inventory is saved with the wagon.
- ^- the following settings are ignored if not.
- inventory_list_sizes = {
- box=8*6,
- },
- ^- List of assignments of type list_name=size.
- ^- For every entry, an inventory list is created with the specified size.
- get_inventory_formspec = function(self, player_name)
- return "<a formspec>"
- end,
- ^- Function that should return the formspec to be displayed when <player> requests to open the wagon's inventory
- ^- Use "list[detached:advtrains_wgn_"..self.unique_id..";<list_name>;<X>,<Y>;<W>,<H>;<Start>]" to display a wagon's inventory list.
-
- custom_on_step = function(self, dtime) end
- ^- optional: Execute custom code on every step
- custom_on_activate = function(self, dtime_s) end
- ^- optional: Execute custom code on activate. Staticdata does not need to be saved and restored since all properties written in 'self' are preserved over unloads.
- update_animation = function(self, velocity) end
- ^- optional: Function that is called whenever the train's velocity changes or every 2 seconds. Used to call 'self.object:update_animation()' if needed.
-
-}
-
-# Notes on wagons
-
-- Every wagon has the field 'unique_id' which assigns each wagon a random id.
-- All properties written in the lua entity (self) are saved and restored automatically. Minetest's internal staticdata is only used to save the unique_id of the wagon, which serves as a key in an externally saved table.
-- Assuming Z Axis as the axis parallel to the tracks and Y Axis as the one pointing into the sky, wagon models should be dimensioned in a way that:
- - their origin is centered in X and Z direction
- - their origin lies 0.5 units above the bottom of the model
- - the overall extent in X and Y direction is <=3 units
-- wagon_span is then the distance between the model origin and the Z axis extent.
-
-# Seating behavior
-If the advanced seating behavior is active, clicking on a wagon will immediately get you on that wagon depending on the entries in assign_to_seat_group.
-If all seat groups are full, if the doors are closed or if you are not authorized to enter this seat group(e.g. driver stands), will show a warning.
-On a train, right-clicking the wagon will make you get off the train unless:
-- the doors are closed and it requires open doors.
-- you have access to a seat group specified in access_to (you may enter it and it's not full)
-- you are the owner and can access the wagon preferences
-In case there's no possibility, does nothing.
-In case there are multiple possibilities, will show a form.
-
-If you can't enter or leave a train because the doors are closed, holding the Sneak key while right-clicking bypasses the "doors have to be open" enforcement.
-
-### Tracks
-Most modders will be satisfied with the built-in tracks. If cog railways, maglev trains and mine trains are added, it is necessary to understand the definition of tracks. Although the tracks API is there, explaining it would require more effort than me creating the wanted definitions myself. Contact me if you need to register your own rails using my registration functions.
-
-However, it is still possible to register single rails by understanding the node properties of rails.
-minetest.register_node(nodename, {
- ... usual node definition ...
- groups = {
- advtrains_track_<tracktype>=1
- ^- this group tells that the node is a track
- not_blocking_trains=1,
- ^- this group tells that the node should not block trains although it's walkable.
- },
- connect1 = 0,
- connect2 = 8,
- ^- These values tell the direction (horizontal) the rail ends are pointing to. 0 means +Z, then rotation values increase clockwise. For a translation of directions to positions see helpers.lua.
- rely1=0,
- rely2=0,
- ^- the Y height of the rail end 1/2. A value of >=1 means that the rail end points to the next y layer at rely-1
- railheight=0,
- ^- the height value of this rail that is saved in the path. usually the median of rely1 and rely2.
-
- can_dig=function(pos)
- return not advtrains.get_train_at_pos(pos)
- end,
- after_dig_node=function(pos)
- advtrains.ndb.update(pos)
- end,
- after_place_node=function(pos)
- advtrains.ndb.update(pos)
- end,
- ^- the code in these 3 default minetest API functions is required for advtrains to work, however you can add your own code
-
- advtrains = {
- on_train_enter=function(pos, train_id) end
- ^- called when a train enters the rail
- on_train_leave=function(pos, train_id) end
- ^- called when a train leaves the rail
- }
-}) \ No newline at end of file
diff --git a/advtrains/advtrains/atc.lua b/advtrains/advtrains/atc.lua
deleted file mode 100644
index 5f1f64d..0000000
--- a/advtrains/advtrains/atc.lua
+++ /dev/null
@@ -1,312 +0,0 @@
---atc.lua
---registers and controls the ATC system
-
-local atc={}
--- ATC persistence table. advtrains.atc is created by init.lua when it loads the save file.
-atc.controllers = {}
-function atc.load_data(data)
- local temp = data and data.controllers or {}
- --transcode atc controller data to node hashes: table access times for numbers are far less than for strings
- for pts, data in pairs(temp) do
- if type(pts)=="number" then
- pts=minetest.pos_to_string(minetest.get_position_from_hash(pts))
- end
- atc.controllers[pts] = data
- end
-end
-function atc.save_data()
- return {controllers = atc.controllers}
-end
---contents: {command="...", arrowconn=0-15 where arrow points}
-
---general
-
-function atc.send_command(pos, par_tid)
- local pts=minetest.pos_to_string(pos)
- if atc.controllers[pts] then
- --atprint("Called send_command at "..pts)
- local train_id = par_tid or advtrains.detector.on_node[pts]
- if train_id then
- if advtrains.trains[train_id] then
- --atprint("send_command inside if: "..sid(train_id))
- atc.train_reset_command(train_id)
- local arrowconn=atc.controllers[pts].arrowconn
- local train=advtrains.trains[train_id]
- for index, ppos in pairs(train.path) do
- if vector.equals(advtrains.round_vector_floor_y(ppos), pos) then
- advtrains.trains[train_id].atc_arrow =
- vector.equals(
- advtrains.dirCoordSet(pos, arrowconn),
- advtrains.round_vector_floor_y(train.path[index+train.movedir])
- )
- advtrains.trains[train_id].atc_command=atc.controllers[pts].command
- atprint("Sending ATC Command: ", atc.controllers[pts].command)
- return true
- end
- end
- atwarn("ATC rail at", pos, ": Rail not on train's path! Can't determine arrow direction. Assuming +!")
- advtrains.trains[train_id].atc_arrow=true
- advtrains.trains[train_id].atc_command=atc.controllers[pts].command
- atprint("Sending ATC Command: ", atc.controllers[pts].command)
- else
- atwarn("ATC rail at", pos, ": Sending command failed: The train",train_id,"does not exist. This seems to be a bug.")
- end
- else
- atwarn("ATC rail at", pos, ": Sending command failed: There's no train at this position. This seems to be a bug.")
- end
- else
- atwarn("ATC rail at", pos, ": Sending command failed: Entry for controller not found.")
- atwarn("ATC rail at", pos, ": Please visit controller and click 'Save'")
- end
- return false
-end
-
-function atc.train_reset_command(train_id)
- advtrains.trains[train_id].atc_command=nil
- advtrains.trains[train_id].atc_delay=0
- advtrains.trains[train_id].atc_brake_target=nil
- advtrains.trains[train_id].atc_wait_finish=nil
- advtrains.trains[train_id].atc_arrow=nil
-end
-
---nodes
-local idxtrans={static=1, mesecon=2, digiline=3}
-local apn_func=function(pos, node)
- advtrains.ndb.update(pos, node)
- local meta=minetest.get_meta(pos)
- if meta then
- meta:set_string("infotext", attrans("ATC controller, unconfigured."))
- meta:set_string("formspec", atc.get_atc_controller_formspec(pos, meta))
- end
-end
-
-advtrains.register_tracks("default", {
- nodename_prefix="advtrains:dtrack_atc",
- texture_prefix="advtrains_dtrack_atc",
- models_prefix="advtrains_dtrack",
- models_suffix=".b3d",
- shared_texture="advtrains_dtrack_shared_atc.png",
- description=attrans("ATC controller"),
- formats={},
- get_additional_definiton = function(def, preset, suffix, rotation)
- return {
- after_place_node=apn_func,
- after_dig_node=function(pos)
- return advtrains.pcall(function()
- advtrains.invalidate_all_paths(pos)
- advtrains.ndb.clear(pos)
- local pts=minetest.pos_to_string(pos)
- atc.controllers[pts]=nil
- end)
- end,
- on_receive_fields = function(pos, formname, fields, player)
- return advtrains.pcall(function()
- if advtrains.is_protected(pos, player:get_player_name()) then
- minetest.record_protection_violation(pos, player:get_player_name())
- return
- end
- local meta=minetest.get_meta(pos)
- if meta then
- if not fields.save then
- --maybe only the dropdown changed
- if fields.mode then
- meta:set_string("mode", idxtrans[fields.mode])
- if fields.mode=="digiline" then
- meta:set_string("infotext", attrans("ATC controller, mode @1\nChannel: @2", fields.mode, meta:get_string("command")) )
- else
- meta:set_string("infotext", attrans("ATC controller, mode @1\nCommand: @2", fields.mode, meta:get_string("command")) )
- end
- meta:set_string("formspec", atc.get_atc_controller_formspec(pos, meta))
- end
- return
- end
- meta:set_string("mode", idxtrans[fields.mode])
- meta:set_string("command", fields.command)
- meta:set_string("command_on", fields.command_on)
- meta:set_string("channel", fields.channel)
- if fields.mode=="digiline" then
- meta:set_string("infotext", attrans("ATC controller, mode @1\nChannel: @2", fields.mode, meta:get_string("command")) )
- else
- meta:set_string("infotext", attrans("ATC controller, mode @1\nCommand: @2", fields.mode, meta:get_string("command")) )
- end
- meta:set_string("formspec", atc.get_atc_controller_formspec(pos, meta))
-
- local pts=minetest.pos_to_string(pos)
- local _, conn1=advtrains.get_rail_info_at(pos, advtrains.all_tracktypes)
- atc.controllers[pts]={command=fields.command, arrowconn=conn1}
- if advtrains.detector.on_node[pts] then
- atc.send_command(pos)
- end
- end
- end)
- end,
- advtrains = {
- on_train_enter = function(pos, train_id)
- atc.send_command(pos)
- end,
- },
- }
- end
-}, advtrains.trackpresets.t_30deg_straightonly)
-
-
-function atc.get_atc_controller_formspec(pos, meta)
- local mode=tonumber(meta:get_string("mode")) or 1
- local command=meta:get_string("command")
- local command_on=meta:get_string("command_on")
- local channel=meta:get_string("channel")
- local formspec="size[8,6]"..
- "dropdown[0,0;3;mode;static,mesecon,digiline;"..mode.."]"
- if mode<3 then
- formspec=formspec.."field[0.5,1.5;7,1;command;"..attrans("Command")..";"..minetest.formspec_escape(command).."]"
- if tonumber(mode)==2 then
- formspec=formspec.."field[0.5,3;7,1;command_on;"..attrans("Command (on)")..";"..minetest.formspec_escape(command_on).."]"
- end
- else
- formspec=formspec.."field[0.5,1.5;7,1;channel;"..attrans("Digiline channel")..";"..minetest.formspec_escape(channel).."]"
- end
- return formspec.."button_exit[0.5,4.5;7,1;save;"..attrans("Save").."]"
-end
-
---from trainlogic.lua train step
-local matchptn={
- ["SM"]=function(id, train)
- train.tarvelocity=train.max_speed
- return 2
- end,
- ["S([0-9]+)"]=function(id, train, match)
- train.tarvelocity=tonumber(match)
- return #match+1
- end,
- ["B([0-9]+)"]=function(id, train, match)
- if train.velocity>tonumber(match) then
- train.atc_brake_target=tonumber(match)
- if train.tarvelocity>train.atc_brake_target then
- train.tarvelocity=train.atc_brake_target
- end
- end
- return #match+1
- end,
- ["W"]=function(id, train)
- train.atc_wait_finish=true
- return 1
- end,
- ["D([0-9]+)"]=function(id, train, match)
- train.atc_delay=tonumber(match)
- return #match+1
- end,
- ["R"]=function(id, train)
- if train.velocity<=0 then
- train.movedir=train.movedir*-1
- train.atc_arrow = not train.atc_arrow
- else
- atwarn(sid(id), attrans("ATC Reverse command warning: didn't reverse train, train moving!"))
- end
- return 1
- end,
- ["O([LRC])"]=function(id, train, match)
- local tt={L=-1, R=1, C=0}
- local arr=train.atc_arrow and 1 or -1
- train.door_open = tt[match]*arr*train.movedir
- return 2
- end,
-}
-
-function atc.execute_atc_command(id, train)
- --strip whitespaces
- local command=string.match(train.atc_command, "^%s*(.*)$")
-
-
- if string.match(command, "^%s*$") then
- train.atc_command=nil
- return
- end
- --conditional statement?
- local is_cond, cond_applies, compare
- local cond, rest=string.match(command, "^I([%+%-])(.+)$")
- if cond then
- is_cond=true
- if cond=="+" then
- cond_applies=train.atc_arrow
- end
- if cond=="-" then
- cond_applies=not train.atc_arrow
- end
- else
- cond, compare, rest=string.match(command, "^I([<>]=?)([0-9]+)(.+)$")
- if cond and compare then
- is_cond=true
- if cond=="<" then
- cond_applies=train.velocity<tonumber(compare)
- end
- if cond==">" then
- cond_applies=train.velocity>tonumber(compare)
- end
- if cond=="<=" then
- cond_applies=train.velocity<=tonumber(compare)
- end
- if cond==">=" then
- cond_applies=train.velocity>=tonumber(compare)
- end
- end
- end
- if is_cond then
- atprint("Evaluating if statement: "..command)
- atprint("Cond: "..(cond or "nil"))
- atprint("Applies: "..(cond_applies and "true" or "false"))
- atprint("Rest: "..rest)
- --find end of conditional statement
- local nest, pos, elsepos=0, 1
- while nest>=0 do
- if pos>#rest then
- atwarn(sid(id), attrans("ATC command syntax error: I statement not closed: @1",command))
- atc.train_reset_command(id)
- return
- end
- local char=string.sub(rest, pos, pos)
- if char=="I" then
- nest=nest+1
- end
- if char==";" then
- nest=nest-1
- end
- if nest==0 and char=="E" then
- elsepos=pos+0
- end
- pos=pos+1
- end
- if not elsepos then elsepos=pos-1 end
- if cond_applies then
- command=string.sub(rest, 1, elsepos-1)..string.sub(rest, pos)
- else
- command=string.sub(rest, elsepos+1, pos-2)..string.sub(rest, pos)
- end
- atprint("Result: "..command)
- train.atc_command=command
- atc.execute_atc_command(id, train)
- return
- else
- for pattern, func in pairs(matchptn) do
- local match=string.match(command, "^"..pattern)
- if match then
- local patlen=func(id, train, match)
-
- atprint("Executing: "..string.sub(command, 1, patlen))
-
- train.atc_command=string.sub(command, patlen+1)
- if train.atc_delay<=0 and not train.atc_wait_finish then
- --continue (recursive, cmds shouldn't get too long, and it's a end-recursion.)
- atc.execute_atc_command(id, train)
- end
- return
- end
- end
- end
- atwarn(sid(id), attrans("ATC command parse error: Unknown command: @1", command))
- atc.train_reset_command(id)
-end
-
-
-
---move table to desired place
-advtrains.atc=atc
diff --git a/advtrains/advtrains/couple.lua b/advtrains/advtrains/couple.lua
deleted file mode 100644
index 7bab241..0000000
--- a/advtrains/advtrains/couple.lua
+++ /dev/null
@@ -1,184 +0,0 @@
---couple.lua
---defines couple entities.
-
---advtrains:discouple
---set into existing trains to split them when punched.
---they are attached to the wagons.
---[[fields
-wagon
-
-wagons keep their couple entity minetest-internal id inside the field discouple_id. if it refers to nowhere, they will spawn a new one if player is near
-]]
-
-local couple_max_dist=3
-
-minetest.register_entity("advtrains:discouple", {
- visual="sprite",
- textures = {"advtrains_discouple.png"},
- collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
- visual_size = {x=1, y=1},
- initial_sprite_basepos = {x=0, y=0},
-
- is_discouple=true,
- on_activate=function(self, staticdata)
- if staticdata=="DISCOUPLE" then
- --couple entities have no right to exist further...
- atprint("Discouple loaded from staticdata, destroying")
- self.object:remove()
- return
- end
- self.object:set_armor_groups({immortal=1})
- end,
- get_staticdata=function() return "DISCOUPLE" end,
- on_punch=function(self, player)
- return advtrains.pcall(function()
- --only if player owns at least one wagon next to this
- local own=player:get_player_name()
- if self.wagon.owner and self.wagon.owner==own and not self.wagon.lock_couples then
- local train=advtrains.trains[self.wagon.train_id]
- local nextwgn_id=train.trainparts[self.wagon.pos_in_trainparts-1]
- for aoi, le in pairs(minetest.luaentities) do
- if le and le.is_wagon then
- if le.unique_id==nextwgn_id then
- if le.owner and le.owner~=own then
- minetest.chat_send_player(own, attrans("You need to own at least one neighboring wagon to destroy this couple."))
- return
- end
- end
- end
- end
- atprint("Discouple punched. Splitting train", self.wagon.train_id)
- advtrains.split_train_at_wagon(self.wagon)--found in trainlogic.lua
- self.object:remove()
- elseif self.wagon.lock_couples then
- minetest.chat_send_player(own, "Couples of one of the wagons are locked, can't discouple!")
- else
- minetest.chat_send_player(own, attrans("You need to own at least one neighboring wagon to destroy this couple."))
- end
- end)
- end,
- on_step=function(self, dtime)
- return advtrains.pcall(function()
- local t=os.clock()
- if not self.wagon then
- self.object:remove()
- atprint("Discouple: no wagon, destroying")
- return
- end
- --getyaw seems to be a reliable method to check if an object is loaded...if it returns nil, it is not.
- if not self.wagon.object:getyaw() then
- atprint("Discouple: wagon no longer loaded, destroying")
- self.object:remove()
- return
- end
- local velocityvec=self.wagon.object:getvelocity()
- self.updatepct_timer=(self.updatepct_timer or 0)-dtime
- if not self.old_velocity_vector or not vector.equals(velocityvec, self.old_velocity_vector) or self.updatepct_timer<=0 then--only send update packet if something changed
- local flipsign=self.wagon.wagon_flipped and -1 or 1
- self.object:setpos(vector.add(self.wagon.object:getpos(), {y=0, x=-math.sin(self.wagon.object:getyaw())*self.wagon.wagon_span*flipsign, z=math.cos(self.wagon.object:getyaw())*self.wagon.wagon_span*flipsign}))
- self.object:setvelocity(velocityvec)
- self.updatepct_timer=2
- end
- atprintbm("discouple_step", t)
- end)
- end,
-})
-
---advtrains:couple
---when two trains overlap with their end-positions, this entity will be spawned and both trains set its id into appropiate fields for them to know when to free them again. The entity will destroy automatically when it recognizes that any of the trains left the common position.
---[[fields
-train_id_1
-train_id_2
-train1_is_backpos
-train2_is_backpos
-]]
-
-
-minetest.register_entity("advtrains:couple", {
- visual="sprite",
- textures = {"advtrains_couple.png"},
- collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
- visual_size = {x=1, y=1},
- initial_sprite_basepos = {x=0, y=0},
-
- is_couple=true,
- on_activate=function(self, staticdata)
- return advtrains.pcall(function()
- if staticdata=="COUPLE" then
- --couple entities have no right to exist further...
- atprint("Couple loaded from staticdata, destroying")
- self.object:remove()
- return
- end
- end)
- end,
- get_staticdata=function(self) return "COUPLE" end,
- on_rightclick=function(self, clicker)
- return advtrains.pcall(function()
- if not self.train_id_1 or not self.train_id_2 then return end
-
- local id1, id2=self.train_id_1, self.train_id_2
- if self.train1_is_backpos and not self.train2_is_backpos then
- advtrains.do_connect_trains(id1, id2, clicker)
- --case 2 (second train is front)
- elseif self.train2_is_backpos and not self.train1_is_backpos then
- advtrains.do_connect_trains(id2, id1, clicker)
- --case 3
- elseif self.train1_is_backpos and self.train2_is_backpos then
- advtrains.invert_train(id2)
- advtrains.do_connect_trains(id1, id2, clicker)
- --case 4
- elseif not self.train1_is_backpos and not self.train2_is_backpos then
- advtrains.invert_train(id1)
- advtrains.do_connect_trains(id1, id2, clicker)
- end
- atprint("Coupled trains", id1, id2)
- self.object:remove()
- end)
- end,
- on_step=function(self, dtime)
- return advtrains.pcall(function()
- advtrains.atprint_context_tid=sid(self.train_id_1)
- advtrains.atprint_context_tid_full=self.train_id_1
- local t=os.clock()
- if not self.train_id_1 or not self.train_id_2 then atprint("Couple: train ids not set!") self.object:remove() return end
- local train1=advtrains.trains[self.train_id_1]
- local train2=advtrains.trains[self.train_id_2]
- if not train1 or not train2 then
- atprint("Couple: trains missing, destroying")
- self.object:remove()
- return
- end
- if not train1.path or not train2.path or not train1.index or not train2.index or not train1.end_index or not train2.end_index then
- atprint("Couple: paths or end_index missing. Might happen when paths got cleared")
- return
- end
-
- local tp1
- if not self.train1_is_backpos then
- tp1=advtrains.get_real_index_position(train1.path, train1.index)
- else
- tp1=advtrains.get_real_index_position(train1.path, train1.end_index)
- end
- local tp2
- if not self.train2_is_backpos then
- tp2=advtrains.get_real_index_position(train2.path, train2.index)
- else
- tp2=advtrains.get_real_index_position(train2.path, train2.end_index)
- end
- if not tp1 or not tp2 or not (vector.distance(tp1,tp2)<couple_max_dist) then
- atprint("Couple: train end positions too distanced, destroying (distance is",vector.distance(tp1,tp2),")")
- self.object:remove()
- return
- else
- local pos_median=advtrains.pos_median(tp1, tp2)
- if not vector.equals(pos_median, self.object:getpos()) then
- self.object:setpos(pos_median)
- end
- end
- atprintbm("couple step", t)
- advtrains.atprint_context_tid=nil
- advtrains.atprint_context_tid_full=nil
- end)
- end,
-})
diff --git a/advtrains/advtrains/craft_items.lua b/advtrains/advtrains/craft_items.lua
deleted file mode 100644
index a4db385..0000000
--- a/advtrains/advtrains/craft_items.lua
+++ /dev/null
@@ -1,23 +0,0 @@
-
-core.register_craftitem("advtrains:boiler", {
- description = "Boiler",
- inventory_image = "advtrains_boiler.png",
-})
-
-
-core.register_craftitem("advtrains:driver_cab", {
- description = "driver's cab",
- inventory_image = "advtrains_driver_cab.png",
-})
-
-
-core.register_craftitem("advtrains:wheel", {
- description = "Wheel",
- inventory_image = "advtrains_wheel.png",
-})
-
-
-core.register_craftitem("advtrains:chimney", {
- description = "Chimney",
- inventory_image = "advtrains_chimney.png",
-})
diff --git a/advtrains/advtrains/crafting.lua b/advtrains/advtrains/crafting.lua
deleted file mode 100644
index 72cd6da..0000000
--- a/advtrains/advtrains/crafting.lua
+++ /dev/null
@@ -1,110 +0,0 @@
---advtrains by orwell96, see readme.txt and license.txt
---crafting.lua
---registers crafting recipes
-
---tracks
-minetest.register_craft({
- output = 'advtrains:dtrack_placer 50',
- recipe = {
- {'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
- {'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
- {'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
- },
-})
-minetest.register_craft({
- type = "shapeless",
- output = 'advtrains:dtrack_slopeplacer 2',
- recipe = {
- "advtrains:dtrack_placer",
- "advtrains:dtrack_placer",
- "default:gravel",
- },
-})
-
-minetest.register_craft({
- output = 'advtrains:dtrack_bumper_placer 2',
- recipe = {
- {'default:wood', 'dye:red'},
- {'default:steel_ingot', 'default:steel_ingot'},
- {'advtrains:dtrack_placer', 'advtrains:dtrack_placer'},
- },
-})
-minetest.register_craft({
- type="shapeless",
- output = 'advtrains:dtrack_detector_off_placer',
- recipe = {
- "advtrains:dtrack_placer",
- "mesecons:wire_00000000_off"
- },
-})
---signals
-minetest.register_craft({
- output = 'advtrains:retrosignal_off 2',
- recipe = {
- {'dye:red', 'default:steel_ingot', 'default:steel_ingot'},
- {'', '', 'default:steel_ingot'},
- {'', '', 'default:steel_ingot'},
- },
-})
-minetest.register_craft({
- output = 'advtrains:signal_off 2',
- recipe = {
- {'', 'dye:red', 'default:steel_ingot'},
- {'', 'dye:dark_green', 'default:steel_ingot'},
- {'', '', 'default:steel_ingot'},
- },
-})
-
---trackworker
-minetest.register_craft({
- output = 'advtrains:trackworker',
- recipe = {
- {'default:diamond'},
- {'screwdriver:screwdriver'},
- {'default:steel_ingot'},
- },
-})
-
---boiler
-minetest.register_craft({
- output = 'advtrains:boiler',
- recipe = {
- {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
- {'doors:trapdoor_steel', '', 'default:steel_ingot'},
- {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
- },
-})
-
---drivers'cab
-minetest.register_craft({
- output = 'advtrains:driver_cab',
- recipe = {
- {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
- {'', '', 'default:glass'},
- {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
- },
-})
-
---drivers'cab
-minetest.register_craft({
- output = 'advtrains:wheel',
- recipe = {
- {'', 'default:steel_ingot', ''},
- {'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
- {'', 'default:steel_ingot', ''},
- },
-})
-
---chimney
-minetest.register_craft({
- output = 'advtrains:chimney',
- recipe = {
- {'', 'default:steel_ingot', ''},
- {'', 'default:steel_ingot', 'default:torch'},
- {'', 'default:steel_ingot', ''},
- },
-})
-
-
---misc_nodes
---crafts for platforms see misc_nodes.lua
diff --git a/advtrains/advtrains/debugitems.lua b/advtrains/advtrains/debugitems.lua
deleted file mode 100644
index dcc95d9..0000000
--- a/advtrains/advtrains/debugitems.lua
+++ /dev/null
@@ -1,28 +0,0 @@
-minetest.register_tool("advtrains:tunnelborer",
-{
- description = "tunnelborer",
- groups = {cracky=1}, -- key=name, value=rating; rating=1..3.
- inventory_image = "drwho_screwdriver.png",
- wield_image = "drwho_screwdriver.png",
- stack_max = 1,
- range = 7.0,
-
- on_place = function(itemstack, placer, pointed_thing)
-
- end,
- --[[
- ^ Shall place item and return the leftover itemstack
- ^ default: minetest.item_place ]]
- on_use = function(itemstack, user, pointed_thing)
- if pointed_thing.type=="node" then
- for x=-1,1 do
- for y=-1,1 do
- for z=-1,1 do
- minetest.remove_node(vector.add(pointed_thing.under, {x=x, y=y, z=z}))
- end
- end
- end
- end
- end,
-}
-)
diff --git a/advtrains/advtrains/debugringbuffer.lua b/advtrains/advtrains/debugringbuffer.lua
deleted file mode 100644
index 704c0c5..0000000
--- a/advtrains/advtrains/debugringbuffer.lua
+++ /dev/null
@@ -1,44 +0,0 @@
---so, some ringbuffers one for each train
-
-local ringbuflen=1000
-
-local ringbufs={}
-local ringbufcnt={}
-
-function advtrains.drb_record(tid, msg)
- if not ringbufs[tid] then
- ringbufs[tid]={}
- ringbufcnt[tid]=0
- end
- ringbufs[tid][ringbufcnt[tid]]=msg
- ringbufcnt[tid]=ringbufcnt[tid]+1
- if ringbufcnt[tid] > ringbuflen then
- ringbufcnt[tid]=0
- end
-end
-function advtrains.drb_dump(tid)
- atdebug("Debug ring buffer output for '"..tid.."':")
- local stopcnt=ringbufcnt[tid]
- if not stopcnt then
- atdebug("ID unknown!")
- return
- end
- repeat
- atdebug(ringbufs[tid][ringbufcnt[tid]])
- ringbufcnt[tid]=ringbufcnt[tid]+1
- if ringbufcnt[tid] > ringbuflen then
- ringbufcnt[tid]=0
- end
- until ringbufcnt[tid]==stopcnt
-end
-
-minetest.register_chatcommand("atdebug_show",
- {
- params = "train sid", -- Short parameter description
- description = "Dump debug log", -- Full description
- privs = {train_operator=true}, -- Require the "privs" privilege to run
- func = function(name, param)
- advtrains.drb_dump(param)
- end, -- Called when command is run.
- -- Returns boolean success and text output.
- })
diff --git a/advtrains/advtrains/depends.txt b/advtrains/advtrains/depends.txt
deleted file mode 100644
index 1815e54..0000000
--- a/advtrains/advtrains/depends.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-default
-mesecons?
-digtron? \ No newline at end of file
diff --git a/advtrains/advtrains/description.txt b/advtrains/advtrains/description.txt
deleted file mode 100644
index bb13b97..0000000
--- a/advtrains/advtrains/description.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-Advanced Trains v1.3.8, by orwell and contributors. Also see readme.
-Good-looking, realistic trains for minetest.
-
-For crafting recipes, see manual.pdf
-
-Website: http://advtrains.bleipb.de/
-Manual: https://github.com/orwell96/advtrains/blob/master/manual.pdf
-Forum : https://forum.minetest.net/viewtopic.php?f=11&t=14726
diff --git a/advtrains/advtrains/digtron.lua b/advtrains/advtrains/digtron.lua
deleted file mode 100644
index 7105a54..0000000
--- a/advtrains/advtrains/digtron.lua
+++ /dev/null
@@ -1,25 +0,0 @@
---digtron.lua
---make tracks placeable by digtrons by overriding the place function.
-
-local old_item_place = digtron.item_place_node
-
-digtron.item_place_node = function(itemstack, placer, place_to, param2)
- if minetest.get_item_group(itemstack:get_name(), "advtrains_trackplacer")>0 then
- return advtrains.pcall(function()
- local def = minetest.registered_items[itemstack:get_name()]
- if not def then return itemstack, false end
-
- local pointed_thing = {}
- pointed_thing.type = "node"
- pointed_thing.above = {x=place_to.x, y=place_to.y, z=place_to.z}
- pointed_thing.under = {x=place_to.x, y=place_to.y - 1, z=place_to.z}
-
- --call the on_rightclick callback
- local success
- itemstack, success = def.on_place(itemstack, placer, pointed_thing)
- return itemstack, success
- end)
- else
- return old_item_place(itemstack, placer, place_to, param2)
- end
-end
diff --git a/advtrains/advtrains/helpers.lua b/advtrains/advtrains/helpers.lua
deleted file mode 100644
index df2d9a8..0000000
--- a/advtrains/advtrains/helpers.lua
+++ /dev/null
@@ -1,262 +0,0 @@
---advtrains by orwell96, see readme.txt
-
-advtrains.dir_trans_tbl={
- [0]={x=0, z=1},
- [1]={x=1, z=2},
- [2]={x=1, z=1},
- [3]={x=2, z=1},
- [4]={x=1, z=0},
- [5]={x=2, z=-1},
- [6]={x=1, z=-1},
- [7]={x=1, z=-2},
- [8]={x=0, z=-1},
- [9]={x=-1, z=-2},
- [10]={x=-1, z=-1},
- [11]={x=-2, z=-1},
- [12]={x=-1, z=0},
- [13]={x=-2, z=1},
- [14]={x=-1, z=1},
- [15]={x=-1, z=2},
-}
-
-function advtrains.dirCoordSet(coord, dir)
- local x,z
- if advtrains.dir_trans_tbl[dir] then
- x,z=advtrains.dir_trans_tbl[dir].x, advtrains.dir_trans_tbl[dir].z
- else
- error("advtrains: in helpers.lua/dirCoordSet() given dir="..(dir or "nil"))
- end
- return {x=coord.x+x, y=coord.y, z=coord.z+z}
-end
-function advtrains.dirToCoord(dir)
- return advtrains.dirCoordSet({x=0, y=0, z=0}, dir)
-end
-
-function advtrains.maxN(list, expectstart)
- local n=expectstart or 0
- while list[n] do
- n=n+1
- end
- return n-1
-end
-
-function advtrains.minN(list, expectstart)
- local n=expectstart or 0
- while list[n] do
- n=n-1
- end
- return n+1
-end
-
---vertical_transmit:
---[[
-rely1, rely2 tell to which height the connections are pointed to. 1 means it will go up the next node
-
-]]
-
-function advtrains.conway(midreal, prev, drives_on)--in order prev,mid,return
- local mid=advtrains.round_vector_floor_y(midreal)
-
- local midnode_ok, middir1, middir2, midrely1, midrely2=advtrains.get_rail_info_at(mid, drives_on)
- if not midnode_ok then
- return nil
- end
-
- local next, chkdir, chkrely, y_offset
- y_offset=0
- --atprint(" in order mid1,mid2",middir1,middir2)
- --try if it is dir1
- local cor1=advtrains.dirCoordSet(mid, middir2)--<<<<
- if cor1.x==prev.x and cor1.z==prev.z then--this was previous
- next=advtrains.dirCoordSet(mid, middir1)
- if midrely1>=1 then
- next.y=next.y+1
- --atprint("found midrely1 to be >=1: next is now "..(next and minetest.pos_to_string(next) or "nil"))
- y_offset=1
- end
- chkdir=middir1
- chkrely=midrely1
- --atprint("dir2 applied next pos:",minetest.pos_to_string(next),"(chkdir is ",chkdir,")")
- end
- --dir2???
- local cor2=advtrains.dirCoordSet(mid, middir1)--<<<<
- if math.floor(cor2.x+0.5)==math.floor(prev.x+0.5) and math.floor(cor2.z+0.5)==math.floor(prev.z+0.5) then
- next=advtrains.dirCoordSet(mid, middir2)--dir2 wird überprüft, alles gut.
- if midrely2>=1 then
- next.y=next.y+1
- --atprint("found midrely2 to be >=1: next is now "..(next and minetest.pos_to_string(next) or "nil"))
- y_offset=1
- end
- chkdir=middir2
- chkrely=midrely2
- --atprint(" dir2 applied next pos:",minetest.pos_to_string(next),"(chkdir is ",chkdir,")")
- end
- --atprint("dir applied next pos: "..(next and minetest.pos_to_string(next) or "nil").."(chkdir is "..(chkdir or "nil")..", y-offset "..y_offset..")")
- --is there a next
- if not next then
- --atprint("in conway: no next rail(nil), returning!")
- return nil
- end
-
- local nextnode_ok, nextdir1, nextdir2, nextrely1, nextrely2, nextrailheight=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(next), drives_on)
-
- --is it a rail?
- if(not nextnode_ok) then
- --atprint("in conway: next "..minetest.pos_to_string(next).." not a rail, trying one node below!")
- next.y=next.y-1
- y_offset=y_offset-1
-
- nextnode_ok, nextdir1, nextdir2, nextrely1, nextrely2, nextrailheight=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(next), drives_on)
- if(not nextnode_ok) then
- --atprint("in conway: one below "..minetest.pos_to_string(next).." is not a rail either, returning!")
- return nil
- end
- end
-
- --is this next rail connecting to the mid?
- if not ( (((nextdir1+8)%16)==chkdir and nextrely1==chkrely-y_offset) or (((nextdir2+8)%16)==chkdir and nextrely2==chkrely-y_offset) ) then
- --atprint("in conway: next "..minetest.pos_to_string(next).." not connecting, trying one node below!")
- next.y=next.y-1
- y_offset=y_offset-1
-
- nextnode_ok, nextdir1, nextdir2, nextrely1, nextrely2, nextrailheight=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(next), drives_on)
- if(not nextnode_ok) then
- --atprint("in conway: (at connecting if check again) one below "..minetest.pos_to_string(next).." is not a rail either, returning!")
- return nil
- end
- if not ( (((nextdir1+8)%16)==chkdir and nextrely1==chkrely) or (((nextdir2+8)%16)==chkdir and nextrely2==chkrely) ) then
- --atprint("in conway: one below "..minetest.pos_to_string(next).." rail not connecting, returning!")
- --atprint(" in order mid1,2,next1,2,chkdir "..middir1.." "..middir2.." "..nextdir1.." "..nextdir2.." "..chkdir)
- return nil
- end
- end
-
- --atprint("conway found rail.")
- return vector.add(advtrains.round_vector_floor_y(next), {x=0, y=nextrailheight, z=0}), chkdir
-end
---TODO use this
-function advtrains.oppd(dir)
- return ((dir+8)%16)
-end
-
-function advtrains.round_vector_floor_y(vec)
- return {x=math.floor(vec.x+0.5), y=math.floor(vec.y), z=math.floor(vec.z+0.5)}
-end
-
-function advtrains.yawToDirection(yaw, conn1, conn2)
- if not conn1 or not conn2 then
- error("given nil to yawToDirection: conn1="..(conn1 or "nil").." conn2="..(conn1 or "nil"))
- end
- local yaw1=math.pi*(conn1/4)
- local yaw2=math.pi*(conn2/4)
- if advtrains.minAngleDiffRad(yaw, yaw1)<advtrains.minAngleDiffRad(yaw, yaw2) then--change to > if weird behavior
- return conn2
- else
- return conn1
- end
-end
-
-function advtrains.minAngleDiffRad(r1, r2)
- local try1=r2-r1
- local try2=(r2+2*math.pi)-r1
- local try3=r2-(r1+2*math.pi)
- if math.min(math.abs(try1), math.abs(try2), math.abs(try3))==math.abs(try1) then
- return try1
- end
- if math.min(math.abs(try1), math.abs(try2), math.abs(try3))==math.abs(try2) then
- return try2
- end
- if math.min(math.abs(try1), math.abs(try2), math.abs(try3))==math.abs(try3) then
- return try3
- end
-end
-
-function advtrains.dumppath(path)
- atlog("Dumping a path:")
- if not path then atlog("dumppath: no path(nil)") return end
- local temp_path={}
- for ipt, iit in pairs(path) do
- temp_path[#temp_path+1]={i=ipt, p=iit}
- end
- table.sort(temp_path, function (k1, k2) return k1.i < k2.i end)
- for _,pit in ipairs(temp_path) do
- atlog(pit.i.." > "..minetest.pos_to_string(pit.p))
- end
-end
-
-function advtrains.merge_tables(a, ...)
- local new={}
- for _,t in ipairs({a,...}) do
- for k,v in pairs(t) do new[k]=v end
- end
- return new
-end
-function advtrains.yaw_from_3_positions(prev, curr, next)
- local pts=minetest.pos_to_string
- --atprint("p3 "..pts(prev)..pts(curr)..pts(next))
- local prev2curr=math.atan2((curr.x-prev.x), (prev.z-curr.z))
- local curr2next=math.atan2((next.x-curr.x), (curr.z-next.z))
- --atprint("y3 "..(prev2curr*360/(2*math.pi)).." "..(curr2next*360/(2*math.pi)))
- return prev2curr+(advtrains.minAngleDiffRad(prev2curr, curr2next)/2)
-end
-function advtrains.get_wagon_yaw(front, first, second, back, pct)
- local pts=minetest.pos_to_string
- --atprint("p "..pts(front)..pts(first)..pts(second)..pts(back))
- local y2=advtrains.yaw_from_3_positions(second, first, front)
- local y1=advtrains.yaw_from_3_positions(back, second, first)
- --atprint("y "..(y1*360/(2*math.pi)).." "..(y2*360/(2*math.pi)))
- return y1+advtrains.minAngleDiffRad(y1, y2)*pct
-end
-function advtrains.get_real_index_position(path, index)
- if not path or not index then return end
-
- local first_pos=path[math.floor(index)]
- local second_pos=path[math.floor(index)+1]
-
- if not first_pos or not second_pos then return nil end
-
- local factor=index-math.floor(index)
- local actual_pos={x=first_pos.x-(first_pos.x-second_pos.x)*factor, y=first_pos.y-(first_pos.y-second_pos.y)*factor, z=first_pos.z-(first_pos.z-second_pos.z)*factor,}
- return actual_pos
-end
-function advtrains.pos_median(pos1, pos2)
- return {x=pos1.x-(pos1.x-pos2.x)*0.5, y=pos1.y-(pos1.y-pos2.y)*0.5, z=pos1.z-(pos1.z-pos2.z)*0.5}
-end
-function advtrains.abs_ceil(i)
- return math.ceil(math.abs(i))*math.sign(i)
-end
-
-function advtrains.serialize_inventory(inv)
- local ser={}
- local liszts=inv:get_lists()
- for lisztname, liszt in pairs(liszts) do
- ser[lisztname]={}
- for idx, item in ipairs(liszt) do
- local istring=item:to_string()
- if istring~="" then
- ser[lisztname][idx]=istring
- end
- end
- end
- return minetest.serialize(ser)
-end
-function advtrains.deserialize_inventory(sers, inv)
- local ser=minetest.deserialize(sers)
- if ser then
- inv:set_lists(ser)
- return true
- end
- return false
-end
-
---is_protected wrapper that checks for protection_bypass privilege
-function advtrains.is_protected(pos, name)
- if not name then
- error("advtrains.is_protected() called without name parameter!")
- end
- if minetest.check_player_privs(name, {protection_bypass=true}) then
- --player can bypass protection
- return false
- end
- return minetest.is_protected(pos, name)
-end
diff --git a/advtrains/advtrains/init.lua b/advtrains/advtrains/init.lua
deleted file mode 100644
index 301ff89..0000000
--- a/advtrains/advtrains/init.lua
+++ /dev/null
@@ -1,400 +0,0 @@
--- Boilerplate to support localized strings if intllib mod is installed.
-if minetest.get_modpath("intllib") then
- attrans = intllib.Getter()
-else
- attrans = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
-end
-
---advtrains
-
-advtrains = {trains={}, wagon_save={}, player_to_train_mapping={}}
-
---pcall
-local no_action=false
-
-local function reload_saves()
- atwarn("Restoring saved state in 1 second...")
- no_action=true
- --read last save state and continue, as if server was restarted
- for aoi, le in pairs(minetest.luaentities) do
- if le.is_wagon then
- le.object:remove()
- end
- end
- minetest.after(1, function()
- advtrains.load()
- atwarn("Reload successful!")
- advtrains.ndb.restore_all()
- end)
-end
-
-function advtrains.pcall(fun)
- if no_action then return end
-
- local succ, return1, return2, return3, return4=xpcall(fun, function(err)
- if advtrains.atprint_context_tid then
- local train=advtrains.trains[advtrains.atprint_context_tid_full]
- advtrains.dumppath(train.path)
- atwarn("Dumping last debug outputs: ", err)
- atprint("Train state: index",train.index,"end_index", train.end_index,"| max_iot", train.max_index_on_track, "min_iot", train.min_index_on_track, "<> pe_min", train.path_extent_min,"pe_max", train.path_extent_max)
- advtrains.drb_dump(advtrains.atprint_context_tid)
- end
- atwarn("Lua Error occured: ", err)
- atwarn(debug.traceback())
- end)
- if not succ then
- reload_saves()
- else
- return return1, return2, return3, return4
- end
-end
-
-
-advtrains.modpath = minetest.get_modpath("advtrains")
-
-function advtrains.print_concat_table(a)
- local str=""
- local stra=""
- local t
- for i=1,20 do
- t=a[i]
- if t==nil then
- stra=stra.."nil "
- else
- str=str..stra
- stra=""
- if type(t)=="table" then
- if t.x and t.y and t.z then
- str=str..minetest.pos_to_string(t)
- else
- str=str..dump(t)
- end
- elseif type(t)=="boolean" then
- if t then
- str=str.."true"
- else
- str=str.."false"
- end
- else
- str=str..t
- end
- str=str.." "
- end
- end
- return str
-end
-
-atprint=function() end
-atdebug=function() end
-atlog=function(t, ...)
- local text=advtrains.print_concat_table({t, ...})
- minetest.log("action", "[advtrains]"..text)
-end
-atwarn=function(t, ...)
- local text=advtrains.print_concat_table({t, ...})
- minetest.log("warning", "[advtrains]"..text)
- minetest.chat_send_all("[advtrains] -!- "..text)
-end
-sid=function(id) if id then return string.sub(id, -6) end end
-
-if minetest.settings:get_bool("advtrains_enable_debugging") then
- atprint=function(t, ...)
- local context=advtrains.atprint_context_tid
- if not context then return end
- local text=advtrains.print_concat_table({t, ...})
- advtrains.drb_record(context, text)
- end
- atdebug=function(t, ...)
- local text=advtrains.print_concat_table({t, ...})
- minetest.log("action", "[advtrains]"..text)
- minetest.chat_send_all("[advtrains]"..text)
- end
- dofile(advtrains.modpath.."/debugringbuffer.lua")
-end
-
-dofile(advtrains.modpath.."/helpers.lua");
---dofile(advtrains.modpath.."/debugitems.lua");
-
-advtrains.meseconrules =
-{{x=0, y=0, z=-1},
- {x=1, y=0, z=0},
- {x=-1, y=0, z=0},
- {x=0, y=0, z=1},
- {x=1, y=1, z=0},
- {x=1, y=-1, z=0},
- {x=-1, y=1, z=0},
- {x=-1, y=-1, z=0},
- {x=0, y=1, z=1},
- {x=0, y=-1, z=1},
- {x=0, y=1, z=-1},
- {x=0, y=-1, z=-1},
- {x=0, y=-2, z=0}}
-
-
-
-dofile(advtrains.modpath.."/trainlogic.lua")
-dofile(advtrains.modpath.."/trainhud.lua")
-dofile(advtrains.modpath.."/trackplacer.lua")
-dofile(advtrains.modpath.."/tracks.lua")
-dofile(advtrains.modpath.."/atc.lua")
-dofile(advtrains.modpath.."/wagons.lua")
-
-dofile(advtrains.modpath.."/trackdb_legacy.lua")
-dofile(advtrains.modpath.."/nodedb.lua")
-dofile(advtrains.modpath.."/couple.lua")
-
-dofile(advtrains.modpath.."/signals.lua")
-dofile(advtrains.modpath.."/misc_nodes.lua")
-dofile(advtrains.modpath.."/crafting.lua")
-dofile(advtrains.modpath.."/craft_items.lua")
-dofile(advtrains.modpath.."/loading.lua")
-
-if minetest.global_exists("digtron") then
- dofile(advtrains.modpath.."/digtron.lua")
-end
-
---load/save
-
-advtrains.fpath=minetest.get_worldpath().."/advtrains"
-
-function advtrains.avt_load()
- local file, err = io.open(advtrains.fpath, "r")
- if not file then
- minetest.log("error", " Failed to read advtrains save data from file "..advtrains.fpath..": "..(err or "Unknown Error"))
- else
- local tbl = minetest.deserialize(file:read("*a"))
- if type(tbl) == "table" then
- if tbl.version then
- --congrats, we have the new save format.
- advtrains.trains = tbl.trains
- advtrains.wagon_save = tbl.wagon_save
- advtrains.player_to_train_mapping = tbl.ptmap or {}
- advtrains.ndb.load_data(tbl.ndb)
- advtrains.atc.load_data(tbl.atc)
- else
- --oh no, its the old one...
- advtrains.trains=tbl
- --load ATC
- advtrains.fpath_atc=minetest.get_worldpath().."/advtrains_atc"
- local file, err = io.open(advtrains.fpath_atc, "r")
- if not file then
- local er=err or "Unknown Error"
- atprint("Failed loading advtrains atc save file "..er)
- else
- local tbl = minetest.deserialize(file:read("*a"))
- if type(tbl) == "table" then
- advtrains.atc.controllers=tbl.controllers
- end
- file:close()
- end
- --load wagon saves
- advtrains.fpath_ws=minetest.get_worldpath().."/advtrains_wagon_save"
- local file, err = io.open(advtrains.fpath_ws, "r")
- if not file then
- local er=err or "Unknown Error"
- atprint("Failed loading advtrains save file "..er)
- else
- local tbl = minetest.deserialize(file:read("*a"))
- if type(tbl) == "table" then
- advtrains.wagon_save=tbl
- end
- file:close()
- end
- end
- else
- minetest.log("error", " Failed to deserialize advtrains save data: Not a table!")
- end
- file:close()
- end
-end
-
-advtrains.avt_save = function(remove_players_from_wagons)
- --atprint("saving")
- --No more invalidating.
- --Instead, remove path a.s.o from the saved table manually
-
- -- update wagon saves
- for _,wagon in pairs(minetest.luaentities) do
- if wagon.is_wagon and wagon.initialized then
- wagon:get_staticdata()
- end
- end
- --cross out userdata
- for w_id, data in pairs(advtrains.wagon_save) do
- data.name=nil
- data.object=nil
- if data.driver then
- data.driver_name=data.driver:get_player_name()
- data.driver=nil
- else
- data.driver_name=nil
- end
- if data.discouple then
- data.discouple.object:remove()
- data.discouple=nil
- end
- if remove_players_from_wagons then
- data.seatp={}
- end
- end
- if remove_players_from_wagons then
- advtrains.player_to_train_mapping={}
- end
-
- local tmp_trains={}
- for id, train in pairs(advtrains.trains) do
- --first, deep_copy the train
- local v=advtrains.merge_tables(train)
- --then invalidate
- if v.index then
- v.restore_add_index=v.index-math.floor(v.index+0.5)
- end
- v.path=nil
- v.path_dist=nil
- v.index=nil
- v.end_index=nil
- v.min_index_on_track=nil
- v.max_index_on_track=nil
- v.path_extent_min=nil
- v.path_extent_max=nil
-
- v.detector_old_index=nil
- v.detector_old_end_index=nil
-
- --then save it
- tmp_trains[id]=v
- end
-
- --versions:
- -- 1 - Initial new save format.
- local save_tbl={
- trains = tmp_trains,
- wagon_save = advtrains.wagon_save,
- ptmap = advtrains.player_to_train_mapping,
- atc = advtrains.atc.save_data(),
- ndb = advtrains.ndb.save_data(),
- version = 1,
- }
- local datastr = minetest.serialize(save_tbl)
- if not datastr then
- minetest.log("error", " Failed to serialize advtrains save data!")
- return
- end
- local file, err = io.open(advtrains.fpath, "w")
- if err then
- minetest.log("error", " Failed to write advtrains save data to file "..advtrains.fpath..": "..(err or "Unknown Error"))
- return
- end
- file:write(datastr)
- file:close()
-end
-
---## MAIN LOOP ##--
---Calls all subsequent main tasks of both advtrains and atlatc
-local init_load=false
-local save_interval=20
-local save_timer=save_interval
-advtrains.mainloop_runcnt=0
-
-minetest.register_globalstep(function(dtime_mt)
- return advtrains.pcall(function()
- advtrains.mainloop_runcnt=advtrains.mainloop_runcnt+1
- atprint("Running the main loop, runcnt",advtrains.mainloop_runcnt)
- --call load once. see advtrains.load() comment
- if not init_load then
- advtrains.load()
- end
- --limit dtime: if trains move too far in one step, automation may cause stuck and wrongly braking trains
- local dtime=dtime_mt
- if dtime>0.2 then
- atprint("Limiting dtime to 0.2!")
- dtime=0.2
- end
-
- advtrains.mainloop_trainlogic(dtime)
- if advtrains_itm_mainloop then
- advtrains_itm_mainloop(dtime)
- end
- if atlatc then
- atlatc.mainloop_stepcode(dtime)
- atlatc.interrupt.mainloop(dtime)
- end
-
-
- --trigger a save when necessary
- save_timer=save_timer-dtime
- if save_timer<=0 then
- local t=os.clock()
- --save
- advtrains.save()
- save_timer=save_interval
- atprintbm("saving", t)
- end
- end)
-end)
-
---if something goes wrong in these functions, there is no help. no pcall here.
-
---## MAIN LOAD ROUTINE ##
--- Causes the loading of everything
--- first time called in main loop (after the init phase) because luaautomation has to initialize first.
-function advtrains.load()
- advtrains.avt_load() --loading advtrains. includes ndb at advtrains.ndb.load_data()
- if atlatc then
- atlatc.load() --includes interrupts
- end
- if advtrains_itm_init then
- advtrains_itm_init()
- end
- init_load=true
- no_action=false
- atlog("[load_all]Loaded advtrains save files")
-end
-
---## MAIN SAVE ROUTINE ##
--- Causes the saving of everything
-function advtrains.save(remove_players_from_wagons)
- if not init_load then
- --wait... we haven't loaded yet?!
- atwarn("Instructed to save() but load() was never called!")
- return
- end
- advtrains.avt_save(remove_players_from_wagons) --saving advtrains. includes ndb at advtrains.ndb.save_data()
- if atlatc then
- atlatc.save()
- end
- atprint("[save_all]Saved advtrains save files")
-end
-minetest.register_on_shutdown(advtrains.save)
-
--- This chat command provides a solution to the problem known on the LinuxWorks server
--- There are many players that joined a single time, got on a train and then left forever
--- These players still occupy seats in the trains.
-minetest.register_chatcommand("at_empty_seats",
- {
- params = "", -- Short parameter description
- description = "Detach all players, especially the offline ones, from all trains. Use only when no one serious is on a train.", -- Full description
- privs = {train_operator=true, server=true}, -- Require the "privs" privilege to run
- func = function(name, param)
- return advtrains.pcall(function()
- atwarn("Data is being saved. While saving, advtrains will remove the players from trains. Save files will be reloaded afterwards!")
- advtrains.save(true)
- reload_saves()
- end)
- end,
-})
--- This chat command solves another problem: Trains getting randomly stuck.
-minetest.register_chatcommand("at_reroute",
- {
- params = "",
- description = "Delete all train routes, force them to recalculate",
- privs = {train_operator=true}, -- Only train operator is required, since this is relatively safe.
- func = function(name, param)
- return advtrains.pcall(function()
- atwarn("Train routes will be recalculated now")
- advtrains.save(false)
- reload_saves()
- end)
- end,
-})
-
diff --git a/advtrains/advtrains/loading.lua b/advtrains/advtrains/loading.lua
deleted file mode 100644
index 8ac7b00..0000000
--- a/advtrains/advtrains/loading.lua
+++ /dev/null
@@ -1,99 +0,0 @@
--- Tracks for loading and unloading trains
--- Copyright (C) 2017 Gabriel Pérez-Cerezo <gabriel@gpcf.eu>
-
-local function get_far_node(pos)
- local node = minetest.get_node(pos)
- if node.name == "ignore" then
- minetest.get_voxel_manip():read_from_map(pos, pos)
- node = minetest.get_node(pos)
- end
- return node
-end
-
-local function train_load(pos, train_id, unload)
- local train=advtrains.trains[train_id]
- local below = get_far_node({x=pos.x, y=pos.y-1, z=pos.z})
- if not string.match(below.name, "chest") then
- atprint("this is not a chest! at "..minetest.pos_to_string(pos))
- return
- end
- local inv = minetest.get_inventory({type="node", pos={x=pos.x, y=pos.y-1, z=pos.z}})
- if inv and train.velocity < 2 then
- for k, v in ipairs(train.trainparts) do
-
- local i=minetest.get_inventory({type="detached", name="advtrains_wgn_"..v})
- if i then
- if not unload then
- for _, item in ipairs(inv:get_list("main")) do
- if i:get_list("box") and i:room_for_item("box", item) then
- i:add_item("box", item)
- inv:remove_item("main", item)
- end
- end
- else
- for _, item in ipairs(i:get_list("box")) do
- if inv:get_list("main") and inv:room_for_item("main", item) then
- i:remove_item("box", item)
- inv:add_item("main", item)
- end
- end
- end
- end
- end
- end
-end
-
-
-advtrains.register_tracks("default", {
- nodename_prefix="advtrains:dtrack_unload",
- texture_prefix="advtrains_dtrack_unload",
- models_prefix="advtrains_dtrack",
- models_suffix=".b3d",
- shared_texture="advtrains_dtrack_shared_unload.png",
- description=attrans("Unloading Track"),
- formats={},
- get_additional_definiton = function(def, preset, suffix, rotation)
- return {
- after_dig_node=function(pos)
- advtrains.invalidate_all_paths()
- advtrains.ndb.clear(pos)
- -- local pts=minetest.pos_to_string(pos)
- -- atc.controllers[pts]=nil
- end,
- -- on_receive_fields = function(pos, formname, fields, player)
- -- if minetest.is_protected(pos, player:get_player_name()) then
- -- minetest.chat_send_player(player:get_player_name(), attrans("This position is protected!"))
- -- return
- -- end
- -- end,
- advtrains = {
- on_train_enter = function(pos, train_id)
- train_load(pos, train_id, true)
- end,
- },
- }
- end
- }, advtrains.trackpresets.t_30deg_straightonly)
-advtrains.register_tracks("default", {
- nodename_prefix="advtrains:dtrack_load",
- texture_prefix="advtrains_dtrack_load",
- models_prefix="advtrains_dtrack",
- models_suffix=".b3d",
- shared_texture="advtrains_dtrack_shared_load.png",
- description=attrans("Loading Track"),
- formats={},
- get_additional_definiton = function(def, preset, suffix, rotation)
- return {
- after_dig_node=function(pos)
- advtrains.invalidate_all_paths()
- advtrains.ndb.clear(pos)
- end,
-
- advtrains = {
- on_train_enter = function(pos, train_id)
- train_load(pos, train_id, false)
- end,
- },
- }
- end
- }, advtrains.trackpresets.t_30deg_straightonly)
diff --git a/advtrains/advtrains/locale/de.txt b/advtrains/advtrains/locale/de.txt
deleted file mode 100644
index fe770d8..0000000
--- a/advtrains/advtrains/locale/de.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-This wagon is owned by @1, you can't destroy it. = Dieser Waggon gehört @1, du kannst ihn nicht abbauen.
-Warning: If you destroy this wagon, you only get some steel back! If you are sure, hold Sneak and left-click the wagon. = Warnung: Du erhältst nur etwas Stahl zurück. Wenn du sicher bist, dass du den Waggon zerstören willst, halte 'Schleichen' und klicke links.
-Show Inventory = Zeige Inventar
-Select seat: = Wähle einen Sitzplatz aus:
-ATC controller, unconfigured. = Zugbeeinflussungsschiene, nicht konfiguiert.
-ATC controller = Zugbeeinflussungsschiene
-ATC controller, mode @1\nChannel: @2 = Zugbeeinflussungsschiene in Betriebsart "@1"\nKanal: @2
-ATC controller, mode @1\nCommand: @2 = Zugbeeinflussungsschiene in Betriebsart "@1"\nBefehl: @2
-Command = Befehl
-Command (on) = Befehl (wenn ein)
-Digiline channel = Digiline-Kanal
-Save = Speichern
-ATC Reverse command warning: didn't reverse train, train moving! = Zugbeeinflussung - Warnung: Befehl 'R' nicht ausgeführt, Zug in Bewegung!
-ATC command syntax error: I statement not closed: @1 = Zugbeeinflussung - Syntaxfehler: I-Anweisung nicht geschlossen: @1
-ATC command parse error: Unknown command: @1 = Zugbeeinflussung - Fehler: Unbekannter Befehl: @1
-This position is protected! = Diese Position ist geschützt!
-You need to own at least one neighboring wagon to destroy this couple. = Du musst Besitzer eines angrenzenden Waggons sein, um hier abzukuppeln.
-@1 Platform (low) = Niedriger @1-Bahnsteig
-@1 Platform (high) = Hoher @1-Bahnsteig
-off = aus
-on = ein
-Lampless Signal (@1) = Mechanisches Signal (@1)
-Signal (@1) = Lichtsignal (@1)
-Track Worker Tool\n\nLeft-click: change rail type (straight/curve/switch)\nRight-click: rotate rail/bumper/signal/etc. = Schienenwerkzeug\n\nLinksklick: Schienentyp ändern, Rechtsklick: Objekt drehen.
-This node can't be rotated using the trackworker! = Kann diesen Block nicht mit dem Schienenwerkzeug drehen.
-This node can't be changed using the trackworker! = Kann diesen Block nicht mit dem Schienenwerkzeug bearbeiten.
-Can't place: not pointing at node = Kann nicht platzieren: Du zeigst nicht auf einen Block.
-Can't place: space occupied! = Kann nicht platzieren: Platz besetzt.
-Can't place: protected position! = Kann nicht platzieren: Position geschützt.
-Can't place: Not enough slope items left (@1 required) = Kann nicht platzieren: nicht genug Steigungsblöcke, es werden insgesamt @1 benötigt.
-Can't place: There's no slope of length @1 = Kann nicht platzieren: Keine Steigung der Länge @1 definiert.
-Can't place: no supporting node at upper end. = Kann nicht platzieren: kein unterstützender Block am Ende der Steigung.
-Deprecated Track = ausrangierte Schiene, nicht verwenden.
-Track = Schiene
-Bumper = Prellbock
-Detector Rail = Detektorschiene
-Speed: = Geschw.:
-Target: = Zielges.:
-@1 Slope = @1 Steigung
-Can't get on: wagon full or doors closed! = Kann nicht einsteigen: Waggon voll oder Türen geschlossen.
-Use Sneak+rightclick to bypass closed doors! = Nutze Sneak+Rechtsklick, um die Türnotöffnung zu aktivieren und trotzdem einzusteigen.
-Lock couples = Kupplungen sperren
-Save wagon properties = Waggon-Einstellungen speichern
-Doors are closed! Use Sneak+rightclick to ignore the closed doors and get off! = Türen sind geschlossen! Sneak+Rechtsklick, um die Türnotöffnung zu aktivieren und trotzdem auszusteigen.
-Wagon properties = Waggon-Einstellungen
-Get off = Aussteigen
-Get off (forced) = Aussteigen (erzwingen)
-(Doors closed) = (Türen geschlossen)
-Access to @1 = Zugang zu @1
-
diff --git a/advtrains/advtrains/misc_nodes.lua b/advtrains/advtrains/misc_nodes.lua
deleted file mode 100644
index 37f535d..0000000
--- a/advtrains/advtrains/misc_nodes.lua
+++ /dev/null
@@ -1,67 +0,0 @@
---all nodes that do not fit in any other category
-
-function advtrains.register_platform(preset)
- local ndef=minetest.registered_nodes[preset]
- if not ndef then
- minetest.log("warning", " register_platform couldn't find preset node "..preset)
- return
- end
- local btex=ndef.tiles
- if type(btex)=="table" then
- btex=btex[1]
- end
- local desc=ndef.description or ""
- local nodename=string.match(preset, ":(.+)$")
- minetest.register_node("advtrains:platform_low_"..nodename, {
- description = attrans("@1 Platform (low)", desc),
- tiles = {btex.."^advtrains_platform.png", btex, btex, btex, btex, btex},
- groups = {cracky = 1, not_blocking_trains = 1, platform=1},
- sounds = default.node_sound_stone_defaults(),
- drawtype = "nodebox",
- node_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.1, -0.1, 0.5, 0 , 0.5},
- {-0.5, -0.5, 0 , 0.5, -0.1, 0.5}
- },
- },
- paramtype2="facedir",
- paramtype = "light",
- sunlight_propagates = true,
- })
- minetest.register_node("advtrains:platform_high_"..nodename, {
- description = attrans("@1 Platform (high)", desc),
- tiles = {btex.."^advtrains_platform.png", btex, btex, btex, btex, btex},
- groups = {cracky = 1, not_blocking_trains = 1, platform=2},
- sounds = default.node_sound_stone_defaults(),
- drawtype = "nodebox",
- node_box = {
- type = "fixed",
- fixed = {
- {-0.5, 0.3, -0.1, 0.5, 0.5, 0.5},
- {-0.5, -0.5, 0 , 0.5, 0.3, 0.5}
- },
- },
- paramtype2="facedir",
- paramtype = "light",
- sunlight_propagates = true,
- })
- minetest.register_craft({
- type="shapeless",
- output = "advtrains:platform_high_"..nodename.." 4",
- recipe = {
- "dye:yellow", preset, preset
- },
- })
- minetest.register_craft({
- type="shapeless",
- output = "advtrains:platform_low_"..nodename.." 4",
- recipe = {
- "dye:yellow", preset
- },
- })
-end
-
-
-advtrains.register_platform("default:stonebrick")
-advtrains.register_platform("default:sandstonebrick")
diff --git a/advtrains/advtrains/models/advtrains_across.obj b/advtrains/advtrains/models/advtrains_across.obj
deleted file mode 100644
index 4ebf393..0000000
--- a/advtrains/advtrains/models/advtrains_across.obj
+++ /dev/null
@@ -1,537 +0,0 @@
-# Blender v2.78 (sub 0) OBJ File: 'andreaskreuz.blend'
-# www.blender.org
-o Cube
-v 0.183133 0.500062 -0.365883
-v 0.300122 0.552646 -0.365883
-v 0.300122 0.552646 -0.337392
-v 0.183133 0.500062 -0.337392
-v -0.300121 1.575195 -0.365883
-v -0.183133 1.627780 -0.365883
-v -0.183133 1.627780 -0.337392
-v -0.300121 1.575195 -0.337392
-v -0.035079 -0.503415 -0.299723
-v -0.035079 1.055075 -0.299723
-v -0.024805 -0.503415 -0.324528
-v -0.024805 1.055075 -0.324528
-v -0.000000 -0.503415 -0.334802
-v -0.000000 1.055075 -0.334802
-v 0.024805 -0.503415 -0.324528
-v 0.024805 1.055075 -0.324528
-v 0.035079 -0.503415 -0.299723
-v 0.035079 1.055075 -0.299723
-v 0.024805 -0.503415 -0.274918
-v 0.024805 1.055075 -0.274918
-v -0.000000 -0.503415 -0.264644
-v -0.000000 1.055075 -0.264644
-v -0.024805 -0.503415 -0.274918
-v -0.024805 1.055075 -0.274918
-v -0.000000 -0.698893 -0.299723
-v -0.032318 0.979391 -0.365883
-v -0.084671 1.095865 -0.365883
-v 0.084671 1.031976 -0.365883
-v 0.032318 1.148450 -0.365883
-v 0.084671 1.031976 -0.337392
-v 0.032318 1.148450 -0.337392
-v -0.032318 0.979391 -0.337392
-v -0.084671 1.095865 -0.337392
-v -0.133841 1.055075 -0.323880
-v -0.096352 1.055075 -0.376499
-v -0.115909 0.988154 -0.323880
-v -0.083444 1.006899 -0.376499
-v -0.066920 0.939165 -0.323880
-v -0.048176 0.971631 -0.376499
-v -0.000000 0.921234 -0.323880
-v -0.000000 0.958722 -0.376499
-v 0.066920 0.939165 -0.323880
-v 0.048176 0.971631 -0.376499
-v 0.115909 0.988154 -0.323880
-v 0.083443 1.006899 -0.376499
-v 0.133841 1.055075 -0.323880
-v 0.096352 1.055075 -0.376499
-v 0.115909 1.121995 -0.323880
-v 0.083443 1.103251 -0.376499
-v 0.066920 1.170984 -0.323880
-v 0.048176 1.138518 -0.376499
-v 0.000000 1.188915 -0.323880
-v 0.000000 1.151427 -0.376499
-v -0.066920 1.170984 -0.323880
-v -0.048176 1.138518 -0.376499
-v -0.115909 1.121995 -0.323880
-v -0.083444 1.103251 -0.376499
-v -0.115909 0.988154 -0.376499
-v -0.133841 1.055075 -0.376499
-v -0.066920 0.939165 -0.376499
-v -0.000000 0.921234 -0.376499
-v 0.066920 0.939165 -0.376499
-v 0.115909 0.988154 -0.376499
-v 0.133841 1.055075 -0.376499
-v 0.115909 1.121995 -0.376499
-v 0.066920 1.170984 -0.376499
-v 0.000000 1.188915 -0.376499
-v -0.066920 1.170984 -0.376499
-v -0.115909 1.121995 -0.376499
-v -0.094673 1.000415 -0.376499
-v -0.109318 1.055075 -0.376499
-v -0.054659 0.960402 -0.376499
-v -0.000000 0.945756 -0.376499
-v 0.054659 0.960402 -0.376499
-v 0.094672 1.000415 -0.376499
-v 0.109318 1.055075 -0.376499
-v 0.094672 1.109734 -0.376499
-v 0.054659 1.149747 -0.376499
-v 0.000000 1.164393 -0.376499
-v -0.054659 1.149747 -0.376499
-v -0.094672 1.109734 -0.376499
-v -0.094673 1.000415 -0.397361
-v -0.109318 1.055075 -0.397361
-v -0.054659 0.960402 -0.397361
-v -0.000000 0.945756 -0.397361
-v 0.054659 0.960402 -0.397361
-v 0.094672 1.000415 -0.397361
-v 0.109318 1.055075 -0.397361
-v 0.094672 1.109734 -0.459571
-v 0.054659 1.149747 -0.459571
-v 0.000000 1.164393 -0.459571
-v -0.054659 1.149747 -0.459571
-v -0.094672 1.109734 -0.459571
-v -0.083444 1.006899 -0.397361
-v -0.096352 1.055075 -0.397361
-v -0.048176 0.971631 -0.397361
-v -0.000000 0.958722 -0.397361
-v 0.048176 0.971631 -0.397361
-v 0.083443 1.006899 -0.397361
-v 0.096352 1.055075 -0.397361
-v 0.083443 1.103251 -0.459571
-v 0.048176 1.138518 -0.459571
-v 0.000000 1.151427 -0.459571
-v -0.048176 1.138518 -0.459571
-v -0.083444 1.103251 -0.459571
-v 0.084671 1.095865 -0.337392
-v 0.032318 0.979391 -0.337392
-v -0.032318 1.148450 -0.337392
-v -0.084671 1.031976 -0.337392
-v -0.032318 1.148450 -0.365883
-v -0.084671 1.031976 -0.365883
-v 0.084671 1.095865 -0.365883
-v 0.032318 0.979391 -0.365883
-v 0.300122 1.575195 -0.337392
-v 0.183133 1.627780 -0.337392
-v 0.183133 1.627780 -0.365883
-v 0.300122 1.575195 -0.365883
-v -0.183133 0.500062 -0.337392
-v -0.300121 0.552646 -0.337392
-v -0.300121 0.552646 -0.365883
-v -0.183133 0.500062 -0.365883
-vt 0.9201 0.4239
-vt 0.9201 0.4892
-vt 0.9044 0.4892
-vt 0.9044 0.4239
-vt 0.1944 0.7581
-vt 0.2101 0.7581
-vt 0.2101 0.8279
-vt 0.1944 0.8279
-vt 0.2539 0.3060
-vt 0.2539 0.0160
-vt 0.3247 0.0160
-vt 0.3247 0.3060
-vt 0.4596 0.8350
-vt 0.7496 0.8350
-vt 0.7496 0.8507
-vt 0.4596 0.8507
-vt 0.2539 0.6281
-vt 0.2539 0.3381
-vt 0.3247 0.3381
-vt 0.3247 0.6281
-vt 0.7609 0.4251
-vt 0.7609 0.1508
-vt 0.7767 0.1508
-vt 0.7767 0.4251
-vt 0.2081 0.7222
-vt 0.2081 0.0160
-vt 0.2218 0.0199
-vt 0.2218 0.7261
-vt 0.0434 0.0160
-vt 0.0434 0.9840
-vt 0.0297 0.9840
-vt 0.0297 0.0160
-vt 0.0160 0.9840
-vt 0.0160 0.0160
-vt 0.1623 0.0183
-vt 0.1623 0.9082
-vt 0.1486 0.9060
-vt 0.1486 0.0160
-vt 0.1350 0.9082
-vt 0.1350 0.0183
-vt 0.0755 0.9840
-vt 0.0755 0.0160
-vt 0.0892 0.0160
-vt 0.0892 0.9840
-vt 0.7932 0.9090
-vt 0.7830 0.8984
-vt 0.7830 0.8836
-vt 0.7932 0.8734
-vt 0.8076 0.8737
-vt 0.8178 0.8844
-vt 0.8178 0.8991
-vt 0.8076 0.9093
-vt 0.1029 0.0160
-vt 0.1029 0.9840
-vt 0.1944 0.7261
-vt 0.1944 0.0199
-vt 0.2199 0.8822
-vt 0.2124 0.8943
-vt 0.2019 0.8972
-vt 0.1944 0.8892
-vt 0.1944 0.8750
-vt 0.2019 0.8629
-vt 0.2124 0.8600
-vt 0.2199 0.8680
-vt 0.8087 0.4251
-vt 0.8087 0.1508
-vt 0.8245 0.1508
-vt 0.8245 0.4251
-vt 0.4275 0.3381
-vt 0.4275 0.6281
-vt 0.3567 0.6281
-vt 0.3567 0.3381
-vt 0.6653 0.4408
-vt 0.6653 0.1508
-vt 0.6811 0.1508
-vt 0.6811 0.4408
-vt 0.5625 0.3060
-vt 0.5625 0.0160
-vt 0.6333 0.0160
-vt 0.6333 0.3060
-vt 0.7433 0.4931
-vt 0.7723 0.4931
-vt 0.7723 0.5268
-vt 0.7433 0.5268
-vt 0.7723 0.5650
-vt 0.7433 0.5650
-vt 0.7723 0.5975
-vt 0.7433 0.5975
-vt 0.9044 0.2874
-vt 0.9334 0.2874
-vt 0.9334 0.3198
-vt 0.9044 0.3198
-vt 0.9334 0.3581
-vt 0.9044 0.3581
-vt 0.9334 0.3918
-vt 0.9044 0.3918
-vt 0.8566 0.8329
-vt 0.8856 0.8329
-vt 0.8856 0.8708
-vt 0.8566 0.8708
-vt 0.8856 0.9063
-vt 0.8566 0.9063
-vt 0.9334 0.2553
-vt 0.9044 0.2553
-vt 0.9044 0.2220
-vt 0.9334 0.2220
-vt 0.9044 0.1838
-vt 0.9334 0.1838
-vt 0.7029 0.1188
-vt 0.6791 0.1050
-vt 0.6653 0.0812
-vt 0.6653 0.0536
-vt 0.6791 0.0298
-vt 0.7029 0.0160
-vt 0.7305 0.0160
-vt 0.7543 0.0298
-vt 0.7681 0.0536
-vt 0.7681 0.0812
-vt 0.7543 0.1050
-vt 0.7305 0.1188
-vt 0.9044 0.1508
-vt 0.9334 0.1508
-vt 0.7433 0.4729
-vt 0.7723 0.4729
-vt 0.4596 0.7507
-vt 0.4596 0.7124
-vt 0.4787 0.6793
-vt 0.5118 0.6602
-vt 0.5501 0.6602
-vt 0.5832 0.6793
-vt 0.6023 0.7124
-vt 0.6023 0.7507
-vt 0.5832 0.7838
-vt 0.5501 0.8029
-vt 0.5118 0.8029
-vt 0.4787 0.7838
-vt 0.3408 0.6733
-vt 0.3096 0.6733
-vt 0.3061 0.6602
-vt 0.3443 0.6602
-vt 0.2826 0.6889
-vt 0.2730 0.6793
-vt 0.2669 0.7160
-vt 0.2539 0.7124
-vt 0.2669 0.7472
-vt 0.2539 0.7507
-vt 0.2826 0.7742
-vt 0.2730 0.7838
-vt 0.3096 0.7898
-vt 0.3061 0.8029
-vt 0.3408 0.7898
-vt 0.3443 0.8029
-vt 0.3679 0.7742
-vt 0.3774 0.7838
-vt 0.3835 0.7472
-vt 0.3966 0.7507
-vt 0.3835 0.7160
-vt 0.3966 0.7124
-vt 0.3679 0.6889
-vt 0.3774 0.6793
-vt 0.8044 0.4994
-vt 0.8044 0.4729
-vt 0.8159 0.4729
-vt 0.8159 0.4994
-vt 0.9044 0.6442
-vt 0.9044 0.6187
-vt 0.9159 0.6187
-vt 0.9159 0.6442
-vt 0.8460 0.0160
-vt 0.8460 0.0429
-vt 0.8001 0.0429
-vt 0.8001 0.0160
-vt 0.2773 0.8808
-vt 0.2539 0.8808
-vt 0.2539 0.8350
-vt 0.2773 0.8350
-vt 0.7112 0.4729
-vt 0.7112 0.4994
-vt 0.6997 0.4994
-vt 0.6997 0.4729
-vt 0.9044 0.6715
-vt 0.9159 0.6715
-vt 0.8460 0.0742
-vt 0.8001 0.0742
-vt 0.3048 0.8808
-vt 0.3048 0.8350
-vt 0.7112 0.5306
-vt 0.6997 0.5306
-vt 0.8460 0.1014
-vt 0.8001 0.1014
-vt 0.3290 0.8808
-vt 0.3290 0.8693
-vt 0.7112 0.5582
-vt 0.6997 0.5582
-vt 0.7302 0.7561
-vt 0.7440 0.7323
-vt 0.7509 0.7341
-vt 0.7353 0.7611
-vt 0.7440 0.7047
-vt 0.7509 0.7029
-vt 0.7302 0.6809
-vt 0.7353 0.6758
-vt 0.7064 0.6671
-vt 0.7083 0.6602
-vt 0.6789 0.6671
-vt 0.6770 0.6602
-vt 0.6550 0.6809
-vt 0.6500 0.6758
-vt 0.6413 0.7047
-vt 0.6344 0.7029
-vt 0.6413 0.7323
-vt 0.6344 0.7341
-vt 0.6550 0.7561
-vt 0.6500 0.7611
-vt 0.6789 0.7699
-vt 0.6770 0.7768
-vt 0.7064 0.7699
-vt 0.7083 0.7768
-vt 0.9024 0.7257
-vt 0.9024 0.7491
-vt 0.8566 0.7491
-vt 0.8566 0.7257
-vt 0.7112 0.5746
-vt 0.6653 0.5746
-vt 0.8896 0.0160
-vt 0.8896 0.0400
-vt 0.8781 0.0400
-vt 0.8781 0.0160
-vt 0.8044 0.5306
-vt 0.8159 0.5306
-vt 0.9024 0.7766
-vt 0.8566 0.7766
-vt 0.8896 0.0675
-vt 0.8781 0.0675
-vt 0.8044 0.5582
-vt 0.8159 0.5582
-vt 0.9024 0.8008
-vt 0.8909 0.8008
-vt 0.8896 0.0912
-vt 0.8781 0.0912
-vt 0.3756 0.8659
-vt 0.3756 0.8350
-vt 0.3872 0.8350
-vt 0.4215 0.8659
-vt 0.3436 0.8808
-vt 0.3436 0.8693
-vt 0.3756 0.8949
-vt 0.4215 0.8949
-vt 0.7987 0.8413
-vt 0.7830 0.8413
-vt 0.7830 0.6602
-vt 0.7987 0.6602
-vt 0.4596 0.0160
-vt 0.5304 0.0160
-vt 0.5304 0.3060
-vt 0.4596 0.3060
-vt 0.8723 0.6936
-vt 0.8566 0.6936
-vt 0.8566 0.5125
-vt 0.8723 0.5125
-vt 0.8723 0.4572
-vt 0.8566 0.4572
-vt 0.9044 0.5213
-vt 0.9201 0.5213
-vt 0.9201 0.5866
-vt 0.9044 0.5866
-vt 0.5304 0.6281
-vt 0.4596 0.6281
-vt 0.4596 0.3381
-vt 0.5304 0.3381
-vt 0.3567 0.0160
-vt 0.4275 0.0160
-vt 0.4275 0.3060
-vt 0.3567 0.3060
-vt 0.8723 0.4251
-vt 0.8566 0.4251
-vt 0.8566 0.1508
-vt 0.8723 0.1508
-vt 0.7289 0.4251
-vt 0.7131 0.4251
-vt 0.7131 0.1508
-vt 0.7289 0.1508
-vt 0.6333 0.6281
-vt 0.5625 0.6281
-vt 0.5625 0.3381
-vt 0.6333 0.3381
-vn 0.4100 -0.9121 0.0000
-vn -0.4100 0.9121 0.0000
-vn 0.0000 0.0000 -1.0000
-vn 0.9121 0.4100 0.0000
-vn 0.0000 0.0000 1.0000
-vn -0.9121 -0.4100 0.0000
-vn -0.9239 0.0000 -0.3827
-vn -0.3827 0.0000 -0.9239
-vn 0.3827 0.0000 -0.9239
-vn 0.9239 0.0000 -0.3827
-vn 0.9239 0.0000 0.3827
-vn 0.3827 0.0000 0.9239
-vn 0.0000 1.0000 0.0000
-vn -0.3827 0.0000 0.9239
-vn -0.9239 0.0000 0.3827
-vn 0.0000 -1.0000 0.0000
-vn -0.9659 -0.2588 0.0000
-vn -0.7071 -0.7071 0.0000
-vn -0.2588 -0.9659 -0.0000
-vn 0.2588 -0.9659 0.0000
-vn 0.7071 -0.7071 0.0000
-vn 0.9659 -0.2588 0.0000
-vn 0.9659 0.2588 0.0000
-vn 0.7071 0.7071 0.0000
-vn 0.2588 0.9659 0.0000
-vn -0.2588 0.9659 -0.0000
-vn -0.7071 0.7071 0.0000
-vn -0.9659 0.2588 0.0000
-vn 0.1966 -0.7339 -0.6502
-vn -0.1967 -0.7339 -0.6502
-vn -0.9121 0.4100 0.0000
-vn 0.4100 0.9121 0.0000
-vn -0.4100 -0.9121 0.0000
-vn 0.9121 -0.4100 -0.0000
-s off
-f 1/1/1 2/2/1 3/3/1 4/4/1
-f 5/5/2 8/6/2 7/7/2 6/8/2
-f 27/9/3 5/10/3 6/11/3 29/12/3
-f 29/13/4 6/14/4 7/15/4 31/16/4
-f 31/17/5 7/18/5 8/19/5 33/20/5
-f 26/21/6 1/22/6 4/23/6 32/24/6
-f 9/25/7 10/26/7 12/27/7 11/28/7
-f 11/29/8 12/30/8 14/31/8 13/32/8
-f 13/32/9 14/31/9 16/33/9 15/34/9
-f 15/35/10 16/36/10 18/37/10 17/38/10
-f 17/38/11 18/37/11 20/39/11 19/40/11
-f 19/41/12 20/42/12 22/43/12 21/44/12
-f 12/45/13 10/46/13 24/47/13 22/48/13 20/49/13 18/50/13 16/51/13 14/52/13
-f 21/44/14 22/43/14 24/53/14 23/54/14
-f 23/55/15 24/56/15 10/26/15 9/25/15
-f 9/57/16 11/58/16 13/59/16 15/60/16 17/61/16 19/62/16 21/63/16 23/64/16
-f 5/65/6 27/66/6 33/67/6 8/68/6
-f 3/69/5 30/70/5 32/71/5 4/72/5
-f 2/73/4 28/74/4 30/75/4 3/76/4
-f 1/77/3 26/78/3 28/79/3 2/80/3
-f 34/81/17 59/82/17 58/83/17 36/84/17
-f 36/84/18 58/83/18 60/85/18 38/86/18
-f 38/86/19 60/85/19 61/87/19 40/88/19
-f 40/89/20 61/90/20 62/91/20 42/92/20
-f 42/92/21 62/91/21 63/93/21 44/94/21
-f 44/94/22 63/93/22 64/95/22 46/96/22
-f 46/97/23 64/98/23 65/99/23 48/100/23
-f 48/100/24 65/99/24 66/101/24 50/102/24
-f 50/103/25 66/104/25 67/105/25 52/106/25
-f 52/106/26 67/105/26 68/107/26 54/108/26
-f 37/109/3 35/110/3 57/111/3 55/112/3 53/113/3 51/114/3 49/115/3 47/116/3 45/117/3 43/118/3 41/119/3 39/120/3
-f 54/108/27 68/107/27 69/121/27 56/122/27
-f 56/123/28 69/124/28 59/82/28 34/81/28
-f 34/125/5 36/126/5 38/127/5 40/128/5 42/129/5 44/130/5 46/131/5 48/132/5 50/133/5 52/134/5 54/135/5 56/136/5
-f 71/137/3 70/138/3 58/139/3 59/140/3
-f 70/138/3 72/141/3 60/142/3 58/139/3
-f 72/141/3 73/143/3 61/144/3 60/142/3
-f 73/143/3 74/145/3 62/146/3 61/144/3
-f 74/145/3 75/147/3 63/148/3 62/146/3
-f 75/147/3 76/149/3 64/150/3 63/148/3
-f 76/149/3 77/151/3 65/152/3 64/150/3
-f 77/151/3 78/153/3 66/154/3 65/152/3
-f 78/153/3 79/155/3 67/156/3 66/154/3
-f 79/155/3 80/157/3 68/158/3 67/156/3
-f 80/157/3 81/159/3 69/160/3 68/158/3
-f 81/159/3 71/137/3 59/140/3 69/160/3
-f 74/161/20 73/162/20 85/163/20 86/164/20
-f 37/165/24 39/166/24 96/167/24 94/168/24
-f 81/169/27 80/170/27 92/171/27 93/172/27
-f 51/173/19 53/174/19 103/175/19 102/176/19
-f 73/177/19 72/178/19 84/179/19 85/180/19
-f 35/181/23 37/165/23 94/168/23 95/182/23
-f 80/170/26 79/183/26 91/184/26 92/171/26
-f 49/185/18 51/173/18 102/176/18 101/186/18
-f 72/178/18 70/187/18 82/188/18 84/179/18
-f 79/183/25 78/189/25 90/190/25 91/184/25
-f 47/191/17 49/185/17 101/186/17 100/192/17
-f 70/187/17 71/193/17 83/194/17 82/188/17
-f 95/195/3 94/196/3 82/197/3 83/198/3
-f 94/196/3 96/199/3 84/200/3 82/197/3
-f 96/199/3 97/201/3 85/202/3 84/200/3
-f 97/201/3 98/203/3 86/204/3 85/202/3
-f 98/203/3 99/205/3 87/206/3 86/204/3
-f 99/205/3 100/207/3 88/208/3 87/206/3
-f 100/207/29 101/209/29 89/210/29 88/208/29
-f 101/209/3 102/211/3 90/212/3 89/210/3
-f 102/211/3 103/213/3 91/214/3 90/212/3
-f 103/213/3 104/215/3 92/216/3 91/214/3
-f 104/215/3 105/217/3 93/218/3 92/216/3
-f 105/217/30 95/195/30 83/198/30 93/218/30
-f 53/219/20 55/220/20 104/221/20 103/222/20
-f 71/193/28 81/223/28 93/224/28 83/194/28
-f 39/225/25 41/226/25 97/227/25 96/228/25
-f 75/229/21 74/161/21 86/164/21 87/230/21
-f 55/220/21 57/231/21 105/232/21 104/221/21
-f 41/226/26 43/233/26 98/234/26 97/227/26
-f 76/235/22 75/229/22 87/230/22 88/236/22
-f 57/231/22 35/237/22 95/238/22 105/232/22
-f 43/233/27 45/239/27 99/240/27 98/234/27
-f 77/241/23 76/242/23 88/243/23 89/244/23
-f 45/245/28 47/191/28 100/192/28 99/246/28
-f 78/247/24 77/241/24 89/244/24 90/248/24
-f 120/249/31 119/250/31 109/251/31 111/252/31
-f 112/253/3 110/254/3 116/255/3 117/256/3
-f 110/257/31 108/258/31 115/259/31 116/260/31
-f 117/261/32 116/260/32 115/259/32 114/262/32
-f 121/263/33 118/264/33 119/265/33 120/266/33
-f 119/267/5 118/268/5 107/269/5 109/270/5
-f 108/271/5 106/272/5 114/273/5 115/274/5
-f 113/275/34 107/276/34 118/277/34 121/278/34
-f 117/279/34 114/280/34 106/281/34 112/282/34
-f 121/283/3 120/284/3 111/285/3 113/286/3
diff --git a/advtrains/advtrains/models/advtrains_dtrack_bumper_st.b3d b/advtrains/advtrains/models/advtrains_dtrack_bumper_st.b3d
deleted file mode 100644
index a6d9745..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_bumper_st.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_bumper_st_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_bumper_st_30.b3d
deleted file mode 100644
index 5f5b3f4..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_bumper_st_30.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_bumper_st_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_bumper_st_45.b3d
deleted file mode 100644
index f13ae75..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_bumper_st_45.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_bumper_st_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_bumper_st_60.b3d
deleted file mode 100644
index 59a2285..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_bumper_st_60.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_cr.b3d b/advtrains/advtrains/models/advtrains_dtrack_cr.b3d
deleted file mode 100644
index c708292..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_cr.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_cr_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_cr_30.b3d
deleted file mode 100644
index 7ca0bda..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_cr_30.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_cr_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_cr_45.b3d
deleted file mode 100644
index b22ea0d..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_cr_45.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_cr_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_cr_60.b3d
deleted file mode 100644
index e9b16d6..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_cr_60.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_st.b3d b/advtrains/advtrains/models/advtrains_dtrack_st.b3d
deleted file mode 100644
index c240416..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_st.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_st_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_st_30.b3d
deleted file mode 100644
index fd77e66..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_st_30.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_st_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_st_45.b3d
deleted file mode 100644
index af3afb1..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_st_45.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_st_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_st_60.b3d
deleted file mode 100644
index 6cb19e6..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_st_60.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swlcr.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlcr.b3d
deleted file mode 100644
index 8b1ac0e..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swlcr.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swlcr_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlcr_30.b3d
deleted file mode 100644
index 6def7ab..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swlcr_30.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swlcr_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlcr_45.b3d
deleted file mode 100644
index cc874ca..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swlcr_45.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swlcr_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlcr_60.b3d
deleted file mode 100644
index 1472a00..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swlcr_60.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swlst.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlst.b3d
deleted file mode 100644
index ecdb326..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swlst.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swlst_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlst_30.b3d
deleted file mode 100644
index fd6e91d..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swlst_30.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swlst_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlst_45.b3d
deleted file mode 100644
index dae694e..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swlst_45.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swlst_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlst_60.b3d
deleted file mode 100644
index 8f2b0e2..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swlst_60.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swrcr.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrcr.b3d
deleted file mode 100644
index 4610826..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swrcr.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swrcr_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrcr_30.b3d
deleted file mode 100644
index 71b87f3..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swrcr_30.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swrcr_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrcr_45.b3d
deleted file mode 100644
index 5457972..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swrcr_45.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swrcr_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrcr_60.b3d
deleted file mode 100644
index 167a3ff..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swrcr_60.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swrst.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrst.b3d
deleted file mode 100644
index 69b6996..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swrst.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swrst_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrst_30.b3d
deleted file mode 100644
index 19ee483..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swrst_30.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swrst_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrst_45.b3d
deleted file mode 100644
index 70d051f..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swrst_45.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_swrst_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrst_60.b3d
deleted file mode 100644
index 69a58fb..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_swrst_60.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_dtrack_vst1.obj b/advtrains/advtrains/models/advtrains_dtrack_vst1.obj
deleted file mode 100644
index 33d9bf3..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_vst1.obj
+++ /dev/null
@@ -1,348 +0,0 @@
-# Blender v2.78 (sub 0) OBJ File: 'rail_redo.blend'
-# www.blender.org
-o dtrack_vst1_Cube.031
-v 0.753760 -0.500000 -0.500000
-v 0.753760 -0.500000 0.500000
-v 0.753760 -0.000000 0.500000
-v -0.753760 -0.500000 -0.500000
-v -0.753760 -0.500000 0.500000
-v -0.753760 -0.000000 0.500000
-v 0.329165 -0.196108 0.171599
-v 0.329165 -0.032047 0.171599
-v 0.329165 -0.367707 -0.171599
-v 0.329165 -0.203646 -0.171599
-v 0.462280 -0.196108 0.171599
-v 0.462280 -0.032047 0.171599
-v 0.462280 -0.367707 -0.171599
-v 0.462280 -0.203646 -0.171599
-v 0.412289 0.040000 0.500000
-v 0.412289 -0.460000 -0.500000
-v 0.560528 -0.460000 -0.500000
-v 0.560528 0.040000 0.500000
-v 0.474055 0.060000 0.500000
-v 0.474055 -0.440000 -0.500000
-v 0.498762 -0.440000 -0.500000
-v 0.498762 0.060000 0.500000
-v 0.474055 0.110000 0.500000
-v 0.474055 -0.390000 -0.500000
-v 0.498762 -0.390000 -0.500000
-v 0.498762 0.110000 0.500000
-v 0.529645 -0.385000 -0.500000
-v 0.529645 0.115000 0.500000
-v 0.443172 0.115000 0.500000
-v 0.443172 -0.385000 -0.500000
-v 0.529645 -0.360000 -0.500000
-v 0.529645 0.140000 0.500000
-v 0.443172 0.140000 0.500000
-v 0.443172 -0.360000 -0.500000
-v 0.741194 -0.042500 0.435000
-v -0.741194 -0.042500 0.435000
-v -0.741194 -0.102500 0.315000
-v 0.741194 -0.102500 0.315000
-v 0.741193 0.007500 0.435000
-v -0.741194 0.007500 0.435000
-v -0.741194 -0.052500 0.315000
-v 0.741194 -0.052500 0.315000
-v -0.011733 2.879186 0.500000
-v -0.011732 2.379186 -0.500001
-v -0.011733 2.900814 0.500000
-v -0.011732 2.400814 -0.500000
-v 0.011732 2.379186 -0.500000
-v 0.011732 2.879186 0.500000
-v 0.011732 2.400814 -0.500000
-v 0.011732 2.900814 0.500000
-v -0.412289 -0.460000 -0.500000
-v -0.412289 0.040000 0.500000
-v -0.560528 0.040000 0.500000
-v -0.560528 -0.460000 -0.500000
-v -0.474055 -0.440000 -0.500000
-v -0.474055 0.060000 0.500000
-v -0.498762 0.060000 0.500000
-v -0.498762 -0.440000 -0.500000
-v -0.474055 -0.390000 -0.500000
-v -0.474055 0.110000 0.500000
-v -0.498762 0.110000 0.500000
-v -0.498762 -0.390000 -0.500000
-v -0.529645 0.115000 0.500000
-v -0.529645 -0.385000 -0.500000
-v -0.443172 -0.385000 -0.500000
-v -0.443172 0.115000 0.500000
-v -0.529645 0.140000 0.500000
-v -0.529645 -0.360000 -0.500000
-v -0.443172 -0.360000 -0.500000
-v -0.443172 0.140000 0.500000
-v -0.741194 -0.477500 -0.435000
-v 0.741194 -0.477500 -0.435000
-v 0.741194 -0.417500 -0.315000
-v -0.741194 -0.417500 -0.315000
-v -0.741193 -0.427500 -0.435000
-v 0.741194 -0.427500 -0.435000
-v 0.741194 -0.367500 -0.315000
-v -0.741194 -0.367500 -0.315000
-v 0.741194 -0.166069 0.187862
-v -0.741194 -0.166069 0.187862
-v -0.741194 -0.226069 0.067862
-v 0.741194 -0.226069 0.067862
-v 0.741193 -0.116069 0.187862
-v -0.741194 -0.116069 0.187862
-v -0.741194 -0.176069 0.067862
-v 0.741194 -0.176069 0.067862
-v -0.741194 -0.353931 -0.187862
-v 0.741194 -0.353931 -0.187862
-v 0.741194 -0.293931 -0.067862
-v -0.741194 -0.293931 -0.067862
-v -0.741193 -0.303931 -0.187862
-v 0.741194 -0.303931 -0.187862
-v 0.741194 -0.243931 -0.067862
-v -0.741194 -0.243931 -0.067862
-v -0.329165 -0.196108 0.171599
-v -0.329165 -0.032047 0.171599
-v -0.329165 -0.367707 -0.171599
-v -0.329165 -0.203646 -0.171599
-v -0.462280 -0.196108 0.171599
-v -0.462280 -0.032047 0.171599
-v -0.462280 -0.367707 -0.171599
-v -0.462280 -0.203646 -0.171599
-vt 0.7427 0.1169
-vt 0.7427 0.3317
-vt 0.6400 0.3317
-vt 0.6400 0.1169
-vt 0.8260 0.3317
-vt 0.8260 0.4343
-vt 0.7427 0.4343
-vt 0.8260 0.1169
-vt 0.7427 0.0142
-vt 0.8260 0.0142
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.6554 0.3627
-vt 0.6690 0.3627
-vt 0.6690 0.9885
-vt 0.6554 0.9885
-vt 0.6972 0.9885
-vt 0.6837 0.9885
-vt 0.6837 0.3627
-vt 0.6972 0.3627
-vt 0.7119 0.3627
-vt 0.7119 0.9885
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.7427 0.1169
-vt 0.6400 0.1169
-vt 0.6400 0.3317
-vt 0.7427 0.3317
-vt 0.7427 0.4343
-vt 0.8260 0.4343
-vt 0.8260 0.3317
-vt 0.8260 0.1169
-vt 0.8260 0.0142
-vt 0.7427 0.0142
-vt 1.2064 -0.1190
-vt -0.2978 -0.1190
-vt -0.2978 -0.6179
-vt 1.2064 -0.6179
-vt -0.2924 0.9963
-vt -0.2924 -0.0015
-vt 1.2117 -0.0015
-vt 1.2117 0.9963
-vt 1.2064 0.9965
-vt 1.6526 0.1041
-vt -0.2978 0.9965
-vt -0.7440 0.1041
-vn -1.0000 0.0000 -0.0000
-vn 0.0000 0.0000 -1.0000
-vn -0.0000 0.0000 1.0000
-vn 0.0000 0.8944 -0.4472
-vn 1.0000 0.0000 0.0000
-vn -0.2782 0.8591 -0.4296
-vn 0.2782 0.8591 -0.4296
-vn 0.1433 -0.8852 0.4426
-vn -0.1433 -0.8852 0.4426
-vn 0.0000 -0.8944 0.4472
-vn 0.0000 -1.0000 0.0000
-g dtrack_vst1_Cube.031_SlopeRailMaterial
-s off
-f 8/1/1 10/2/1 9/3/1 7/4/1
-f 10/2/2 14/5/2 13/6/2 9/7/2
-f 12/8/3 8/1/3 7/9/3 11/10/3
-f 12/8/4 14/5/4 10/2/4 8/1/4
-f 22/11/5 21/12/5 25/13/5 26/14/5
-f 15/15/6 19/16/6 20/17/6 16/18/6
-f 16/19/2 20/20/2 21/21/2 17/22/2
-f 17/23/7 21/12/7 22/11/7 18/24/7
-f 19/25/3 15/26/3 18/27/3 22/28/3
-f 26/29/3 23/30/3 19/25/3 22/28/3
-f 19/16/1 23/31/1 24/32/1 20/17/1
-f 21/21/2 20/20/2 24/33/2 25/34/2
-f 26/14/8 25/13/8 27/35/8 28/36/8
-f 24/32/9 23/31/9 29/37/9 30/38/9
-f 28/36/5 27/35/5 31/39/5 32/40/5
-f 30/38/1 29/37/1 33/41/1 34/42/1
-f 31/39/4 34/42/4 33/41/4 32/40/4
-f 23/30/3 26/29/3 28/43/3 32/40/3 33/41/3 29/44/3
-f 24/33/2 30/45/2 34/42/2 31/39/2 27/46/2 25/34/2
-f 39/47/4 42/48/4 41/49/4 40/50/4
-f 35/51/3 39/47/3 40/50/3 36/52/3
-f 36/53/1 40/50/1 41/49/1 37/54/1
-f 37/55/2 41/49/2 42/48/2 38/56/2
-f 39/47/5 35/57/5 38/58/5 42/48/5
-f 43/59/1 45/60/1 46/61/1 44/62/1
-f 47/63/5 49/64/5 50/65/5 48/66/5
-f 43/67/10 44/68/10 47/63/10 48/66/10
-f 45/60/4 50/65/4 49/64/4 46/61/4
-f 58/69/1 57/70/1 61/71/1 62/72/1
-f 51/73/7 55/74/7 56/75/7 52/76/7
-f 52/77/3 56/78/3 57/79/3 53/80/3
-f 53/81/6 57/70/6 58/69/6 54/82/6
-f 55/83/2 51/84/2 54/85/2 58/86/2
-f 62/87/2 59/88/2 55/83/2 58/86/2
-f 55/74/5 59/89/5 60/90/5 56/75/5
-f 57/79/3 56/78/3 60/91/3 61/92/3
-f 62/72/9 61/71/9 63/93/9 64/94/9
-f 60/90/8 59/89/8 65/95/8 66/96/8
-f 64/94/1 63/93/1 67/97/1 68/98/1
-f 66/96/5 65/95/5 69/99/5 70/100/5
-f 67/97/4 70/100/4 69/99/4 68/98/4
-f 59/88/2 62/87/2 64/101/2 68/98/2 69/99/2 65/102/2
-f 60/91/3 66/103/3 70/100/3 67/97/3 63/104/3 61/92/3
-f 75/105/4 78/106/4 77/107/4 76/108/4
-f 71/109/2 75/105/2 76/108/2 72/110/2
-f 72/111/5 76/108/5 77/107/5 73/112/5
-f 73/113/3 77/107/3 78/106/3 74/114/3
-f 75/105/1 71/115/1 74/116/1 78/106/1
-f 83/117/4 86/118/4 85/119/4 84/120/4
-f 79/121/3 83/117/3 84/120/3 80/122/3
-f 80/123/1 84/120/1 85/119/1 81/124/1
-f 81/125/2 85/119/2 86/118/2 82/126/2
-f 83/117/5 79/127/5 82/128/5 86/118/5
-f 91/129/4 94/130/4 93/131/4 92/132/4
-f 87/133/2 91/129/2 92/132/2 88/134/2
-f 88/135/5 92/132/5 93/131/5 89/136/5
-f 89/137/3 93/131/3 94/130/3 90/138/3
-f 91/129/1 87/139/1 90/140/1 94/130/1
-f 96/141/5 95/142/5 97/143/5 98/144/5
-f 98/144/2 97/145/2 101/146/2 102/147/2
-f 100/148/3 99/149/3 95/150/3 96/141/3
-f 100/148/4 96/141/4 98/144/4 102/147/4
-g dtrack_vst1_Cube.031_SlopeGravelMaterial
-f 3/151/3 6/152/3 5/153/3 2/154/3
-f 1/155/11 2/156/11 5/157/11 4/158/11
-f 1/159/5 3/151/5 2/160/5
-f 6/152/1 4/161/1 5/162/1
-f 4/161/4 6/152/4 3/151/4 1/159/4
diff --git a/advtrains/advtrains/models/advtrains_dtrack_vst1_45.obj b/advtrains/advtrains/models/advtrains_dtrack_vst1_45.obj
deleted file mode 100644
index 8ff8343..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_vst1_45.obj
+++ /dev/null
@@ -1,434 +0,0 @@
-# Blender v2.78 (sub 0) OBJ File: 'rail_redo.blend'
-# www.blender.org
-o dtrack_vst1_45_Cube.033
-v 0.111416 -0.221340 0.354093
-v 0.111416 -0.057279 0.354093
-v 0.354093 -0.342660 0.111416
-v 0.354093 -0.178600 0.111416
-v 0.205542 -0.221340 0.448220
-v 0.205542 -0.057279 0.448220
-v 0.448220 -0.342660 0.205543
-v 0.448220 -0.178600 0.205543
-v -0.208358 0.039814 0.791422
-v 0.791423 -0.460000 -0.208357
-v 0.896243 -0.460000 -0.103536
-v -0.103538 0.039814 0.896242
-v -0.164683 0.059814 0.835097
-v 0.835098 -0.440000 -0.164682
-v 0.852568 -0.440000 -0.147212
-v -0.147213 0.059814 0.852567
-v -0.164683 0.109814 0.835097
-v 0.835098 -0.390000 -0.164682
-v 0.852568 -0.390000 -0.147212
-v -0.147213 0.109814 0.852567
-v 0.874406 -0.385000 -0.125374
-v -0.125375 0.114814 0.874405
-v -0.186520 0.114814 0.813259
-v 0.813260 -0.385000 -0.186519
-v 0.874406 -0.360000 -0.125374
-v -0.125375 0.139814 0.874405
-v -0.186520 0.139814 0.813259
-v 0.813260 -0.360000 -0.186519
-v 0.476117 -0.186104 0.572089
-v -0.572088 -0.186104 -0.476117
-v -0.656942 -0.143684 -0.391265
-v 0.391264 -0.143684 0.656941
-v 0.476117 -0.236104 0.572089
-v -0.572088 -0.236104 -0.476117
-v -0.656941 -0.193684 -0.391265
-v 0.391264 -0.193684 0.656942
-v -0.508186 2.879001 0.491594
-v 0.491594 2.379186 -0.508186
-v -0.508186 2.900629 0.491593
-v 0.491594 2.400814 -0.508186
-v 0.508186 2.379186 -0.491594
-v -0.491594 2.879001 0.508186
-v 0.508186 2.400814 -0.491594
-v -0.491594 2.900629 0.508186
-v 0.208358 -0.460000 -0.791421
-v -0.791423 0.039814 0.208357
-v -0.896244 0.039814 0.103537
-v 0.103537 -0.460000 -0.896242
-v 0.164682 -0.440000 -0.835097
-v -0.835099 0.059815 0.164682
-v -0.852568 0.059814 0.147212
-v 0.147212 -0.440000 -0.852567
-v 0.164682 -0.390000 -0.835097
-v -0.835099 0.109815 0.164682
-v -0.852568 0.109814 0.147212
-v 0.147212 -0.390000 -0.852567
-v -0.874406 0.114814 0.125374
-v 0.125375 -0.385000 -0.874404
-v 0.186520 -0.385000 -0.813259
-v -0.813261 0.114815 0.186520
-v -0.874406 0.139814 0.125374
-v 0.125375 -0.360000 -0.874404
-v 0.186520 -0.360000 -0.813259
-v -0.813261 0.139814 0.186520
-v -0.230055 -0.407095 -0.818151
-v 0.818151 -0.407095 0.230055
-v 0.733298 -0.364675 0.314908
-v -0.314908 -0.364675 -0.733299
-v -0.230055 -0.357095 -0.818151
-v 0.818151 -0.357095 0.230056
-v 0.733298 -0.314675 0.314908
-v -0.314908 -0.314675 -0.733298
-v 0.314908 -0.105511 0.733298
-v -0.733298 -0.105511 -0.314908
-v -0.818151 -0.063091 -0.230056
-v 0.230055 -0.063091 0.818151
-v 0.314908 -0.155511 0.733298
-v -0.733298 -0.155511 -0.314908
-v -0.818151 -0.113091 -0.230055
-v 0.230055 -0.113091 0.818151
-v -0.391264 -0.326502 -0.656942
-v 0.656941 -0.326502 0.391265
-v 0.572089 -0.284082 0.476118
-v -0.476117 -0.284082 -0.572089
-v -0.391264 -0.276502 -0.656941
-v 0.656942 -0.276502 0.391265
-v 0.572088 -0.234082 0.476117
-v -0.476117 -0.234082 -0.572089
-v -0.354093 -0.221340 -0.111416
-v -0.354093 -0.057279 -0.111416
-v -0.111416 -0.342660 -0.354093
-v -0.111416 -0.178600 -0.354093
-v -0.448220 -0.221340 -0.205543
-v -0.448220 -0.057279 -0.205543
-v -0.205543 -0.342660 -0.448220
-v -0.205543 -0.178600 -0.448220
-v -0.069408 -0.487406 -0.978798
-v 0.978798 -0.487406 0.069409
-v 0.893945 -0.444986 0.154261
-v -0.154261 -0.444986 -0.893945
-v -0.069408 -0.437406 -0.978798
-v 0.978798 -0.437406 0.069409
-v 0.893945 -0.394986 0.154261
-v -0.154261 -0.394986 -0.893945
-v 0.069408 -0.032780 0.978798
-v -0.978798 -0.032780 -0.069409
-v -0.893945 -0.075200 -0.154261
-v 0.154261 -0.075200 0.893945
-v 0.069408 0.017220 0.978797
-v -0.978798 0.017220 -0.069409
-v -0.893945 -0.025200 -0.154261
-v 0.154261 -0.025200 0.893945
-v -0.029561 -0.500000 -1.029558
-v 1.029558 -0.500000 0.029561
-v -1.029558 -0.500000 -0.029561
-v -1.029558 0.000000 -0.029561
-v 0.029561 -0.500000 1.029558
-v 0.029561 0.000000 1.029558
-v -0.500000 0.000000 1.559119
-v -1.559119 0.000000 0.500000
-v -0.499999 0.000000 0.499999
-v -1.559120 -0.500000 0.500000
-v -0.500000 -0.500000 1.559119
-v -0.500003 -0.500000 0.500000
-vt 0.7427 0.1169
-vt 0.7427 0.3317
-vt 0.6400 0.3317
-vt 0.6400 0.1169
-vt 0.8260 0.3317
-vt 0.8260 0.4343
-vt 0.7427 0.4343
-vt 0.8260 0.1169
-vt 0.7427 0.0142
-vt 0.8260 0.0142
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.8837 0.9625
-vt 0.8524 0.0348
-vt 0.8837 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.0035
-vt 0.9588 0.0348
-vt 0.8837 0.0035
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.6554 0.3627
-vt 0.6690 0.3627
-vt 0.6690 0.9885
-vt 0.6554 0.9885
-vt 0.6972 0.9885
-vt 0.6837 0.9885
-vt 0.6837 0.3627
-vt 0.6972 0.3627
-vt 0.7119 0.3627
-vt 0.7119 0.9885
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.8837 0.9625
-vt 0.8524 0.0348
-vt 0.8837 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.0035
-vt 0.9588 0.0348
-vt 0.8837 0.0035
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.7427 0.1169
-vt 0.6400 0.1169
-vt 0.6400 0.3317
-vt 0.7427 0.3317
-vt 0.7427 0.4343
-vt 0.8260 0.4343
-vt 0.8260 0.3317
-vt 0.8260 0.1169
-vt 0.8260 0.0142
-vt 0.7427 0.0142
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt -0.3235 0.5003
-vt 0.6181 0.0296
-vt 0.6181 0.5003
-vt 0.6188 0.9848
-vt -0.3228 0.5141
-vt 0.6188 0.5141
-vt 0.0669 1.0031
-vt 0.0669 0.5045
-vt 0.0669 0.0059
-vt 1.1195 0.0059
-vt 1.1195 1.0031
-vt 0.1925 0.0071
-vt 0.1925 0.5057
-vt -0.3061 0.0071
-vt -0.4317 1.0031
-vt -0.4317 0.0059
-vt 1.1341 0.0071
-vt 1.1341 1.0043
-vt 0.1925 1.0043
-vt 1.1202 0.9906
-vt 0.4151 0.9906
-vt 0.4151 0.5199
-vt 1.1202 0.5199
-vt 0.4050 0.0285
-vt 1.1101 0.0285
-vt 1.1101 0.4992
-vt 0.4050 0.4992
-vt -0.3061 1.0043
-vt 1.1174 0.5141
-vt 1.1174 0.9848
-vt 1.1167 0.0296
-vt 1.1167 0.5003
-vn -0.7071 0.0000 -0.7071
-vn 0.7071 0.0000 -0.7071
-vn -0.7071 0.0000 0.7071
-vn 0.2357 0.9428 -0.2357
-vn 0.7071 0.0000 0.7071
-vn 0.0189 0.9017 -0.4319
-vn 0.4319 0.9017 -0.0189
-vn -0.1263 -0.9320 0.3397
-vn -0.3397 -0.9320 0.1263
-vn -0.2357 -0.9428 0.2357
-vn 0.0000 -1.0000 0.0000
-vn 0.0000 1.0000 0.0000
-vn 0.0000 0.0000 1.0000
-vn -1.0000 0.0000 0.0000
-g dtrack_vst1_45_Cube.033_SlopeRailMaterial
-s off
-f 2/1/1 4/2/1 3/3/1 1/4/1
-f 4/2/2 8/5/2 7/6/2 3/7/2
-f 6/8/3 2/1/3 1/9/3 5/10/3
-f 6/8/4 8/5/4 4/2/4 2/1/4
-f 16/11/5 15/12/5 19/13/5 20/14/5
-f 9/15/6 13/16/6 14/17/6 10/18/6
-f 10/19/2 14/20/2 15/21/2 11/22/2
-f 11/23/7 15/12/7 16/11/7 12/24/7
-f 13/25/3 9/26/3 12/27/3 16/28/3
-f 20/29/3 17/30/3 13/25/3 16/28/3
-f 13/16/1 17/31/1 18/32/1 14/17/1
-f 15/21/2 14/20/2 18/33/2 19/34/2
-f 20/14/8 19/13/8 21/35/8 22/36/8
-f 18/32/9 17/31/9 23/37/9 24/38/9
-f 22/36/5 21/35/5 25/39/5 26/40/5
-f 24/38/1 23/37/1 27/41/1 28/42/1
-f 25/39/4 28/42/4 27/41/4 26/40/4
-f 17/30/3 20/29/3 22/43/3 26/40/3 27/41/3 23/44/3
-f 18/33/2 24/45/2 28/42/2 25/39/2 21/46/2 19/34/2
-f 32/47/5 36/48/5 33/49/5 29/50/5
-f 34/51/2 30/52/2 29/50/2 33/53/2
-f 35/54/1 31/55/1 30/52/1 34/56/1
-f 36/57/3 32/47/3 31/55/3 35/58/3
-f 32/47/4 29/50/4 30/52/4 31/55/4
-f 37/59/1 39/60/1 40/61/1 38/62/1
-f 41/63/5 43/64/5 44/65/5 42/66/5
-f 37/67/10 38/68/10 41/63/10 42/66/10
-f 39/60/4 44/65/4 43/64/4 40/61/4
-f 52/69/1 51/70/1 55/71/1 56/72/1
-f 45/73/7 49/74/7 50/75/7 46/76/7
-f 46/77/3 50/78/3 51/79/3 47/80/3
-f 47/81/6 51/70/6 52/69/6 48/82/6
-f 49/83/2 45/84/2 48/85/2 52/86/2
-f 56/87/2 53/88/2 49/83/2 52/86/2
-f 49/74/5 53/89/5 54/90/5 50/75/5
-f 51/79/3 50/78/3 54/91/3 55/92/3
-f 56/72/9 55/71/9 57/93/9 58/94/9
-f 54/90/8 53/89/8 59/95/8 60/96/8
-f 58/94/1 57/93/1 61/97/1 62/98/1
-f 60/96/5 59/95/5 63/99/5 64/100/5
-f 61/97/4 64/100/4 63/99/4 62/98/4
-f 53/88/2 56/87/2 58/101/2 62/98/2 63/99/2 59/102/2
-f 54/91/3 60/103/3 64/100/3 61/97/3 57/104/3 55/92/3
-f 69/105/4 72/106/4 71/107/4 70/108/4
-f 65/109/2 69/105/2 70/108/2 66/110/2
-f 66/111/5 70/108/5 71/107/5 67/112/5
-f 67/113/3 71/107/3 72/106/3 68/114/3
-f 69/105/1 65/115/1 68/116/1 72/106/1
-f 76/117/5 80/118/5 77/119/5 73/120/5
-f 78/121/2 74/122/2 73/120/2 77/123/2
-f 79/124/1 75/125/1 74/122/1 78/126/1
-f 80/127/3 76/117/3 75/125/3 79/128/3
-f 76/117/4 73/120/4 74/122/4 75/125/4
-f 85/129/4 88/130/4 87/131/4 86/132/4
-f 81/133/2 85/129/2 86/132/2 82/134/2
-f 82/135/5 86/132/5 87/131/5 83/136/5
-f 83/137/3 87/131/3 88/130/3 84/138/3
-f 85/129/1 81/139/1 84/140/1 88/130/1
-f 90/141/5 89/142/5 91/143/5 92/144/5
-f 92/144/2 91/145/2 95/146/2 96/147/2
-f 94/148/3 93/149/3 89/150/3 90/141/3
-f 94/148/4 90/141/4 92/144/4 96/147/4
-f 101/151/4 104/152/4 103/153/4 102/154/4
-f 97/155/2 101/151/2 102/154/2 98/156/2
-f 98/157/5 102/154/5 103/153/5 99/158/5
-f 99/159/3 103/153/3 104/152/3 100/160/3
-f 101/151/1 97/161/1 100/162/1 104/152/1
-f 109/163/4 112/164/4 111/165/4 110/166/4
-f 105/167/3 109/163/3 110/166/3 106/168/3
-f 106/169/1 110/166/1 111/165/1 107/170/1
-f 107/171/2 111/165/2 112/164/2 108/172/2
-f 109/163/5 105/173/5 108/174/5 112/164/5
-g dtrack_vst1_45_Cube.033_SlopeGravelMaterial
-f 114/175/5 118/176/5 117/177/5
-f 116/178/1 113/179/1 115/180/1
-f 116/181/4 121/182/4 118/183/4 114/184/4 113/185/4
-f 115/186/11 124/187/11 122/188/11
-f 116/181/12 120/189/12 121/182/12
-f 118/183/12 121/182/12 119/190/12
-f 113/191/11 114/192/11 117/193/11 124/187/11 115/186/11
-f 121/194/13 120/195/13 122/196/13 124/197/13
-f 119/198/14 121/199/14 124/200/14 123/201/14
-f 123/202/11 124/187/11 117/193/11
-f 116/178/1 115/180/1 122/203/1 120/204/1
-f 117/177/5 118/176/5 119/205/5 123/206/5
diff --git a/advtrains/advtrains/models/advtrains_dtrack_vst2.obj b/advtrains/advtrains/models/advtrains_dtrack_vst2.obj
deleted file mode 100644
index 444ce42..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_vst2.obj
+++ /dev/null
@@ -1,372 +0,0 @@
-# Blender v2.78 (sub 0) OBJ File: 'rail_redo.blend'
-# www.blender.org
-o dtrack_vst2_Cube.032
-v 0.753760 0.000000 -0.500000
-v 0.753760 0.000000 0.500000
-v 0.753760 0.500000 0.500000
-v -0.753760 0.000000 -0.500000
-v -0.753760 0.000000 0.500000
-v -0.753760 0.500000 0.500000
-v 0.329165 0.303892 0.171599
-v 0.329165 0.467953 0.171599
-v 0.329165 0.132293 -0.171599
-v 0.329165 0.296354 -0.171599
-v 0.462280 0.303892 0.171599
-v 0.462280 0.467953 0.171599
-v 0.462280 0.132293 -0.171599
-v 0.462280 0.296354 -0.171599
-v 0.412289 0.540000 0.500000
-v 0.412289 0.040000 -0.500000
-v 0.560528 0.040000 -0.500000
-v 0.560528 0.540000 0.500000
-v 0.474055 0.560000 0.500000
-v 0.474055 0.060000 -0.500000
-v 0.498762 0.060000 -0.500000
-v 0.498762 0.560000 0.500000
-v 0.474055 0.610000 0.500000
-v 0.474055 0.110000 -0.500000
-v 0.498762 0.110000 -0.500000
-v 0.498762 0.610000 0.500000
-v 0.529645 0.115000 -0.500000
-v 0.529645 0.615000 0.500000
-v 0.443172 0.615000 0.500000
-v 0.443172 0.115000 -0.500000
-v 0.529645 0.140000 -0.500000
-v 0.529645 0.640000 0.500000
-v 0.443172 0.640000 0.500000
-v 0.443172 0.140000 -0.500000
-v 0.741194 0.457500 0.435000
-v -0.741194 0.457500 0.435000
-v -0.741194 0.397500 0.315000
-v 0.741194 0.397500 0.315000
-v 0.741193 0.507500 0.435000
-v -0.741194 0.507500 0.435000
-v -0.741194 0.447500 0.315000
-v 0.741194 0.447500 0.315000
-v -0.011733 3.379186 0.500000
-v -0.011732 2.879186 -0.500001
-v -0.011733 3.400814 0.500000
-v -0.011732 2.900814 -0.500000
-v 0.011732 2.879186 -0.500000
-v 0.011732 3.379186 0.500000
-v 0.011732 2.900814 -0.500000
-v 0.011732 3.400814 0.500000
-v -0.412289 0.040000 -0.500000
-v -0.412289 0.540000 0.500000
-v -0.560528 0.540000 0.500000
-v -0.560528 0.040000 -0.500000
-v -0.474055 0.060000 -0.500000
-v -0.474055 0.560000 0.500000
-v -0.498762 0.560000 0.500000
-v -0.498762 0.060000 -0.500000
-v -0.474055 0.110000 -0.500000
-v -0.474055 0.610000 0.500000
-v -0.498762 0.610000 0.500000
-v -0.498762 0.110000 -0.500000
-v -0.529645 0.615000 0.500000
-v -0.529645 0.115000 -0.500000
-v -0.443172 0.115000 -0.500000
-v -0.443172 0.615000 0.500000
-v -0.529645 0.640000 0.500000
-v -0.529645 0.140000 -0.500000
-v -0.443172 0.140000 -0.500000
-v -0.443172 0.640000 0.500000
-v -0.741194 0.022500 -0.435000
-v 0.741194 0.022500 -0.435000
-v 0.741194 0.082500 -0.315000
-v -0.741194 0.082500 -0.315000
-v -0.741193 0.072500 -0.435000
-v 0.741194 0.072500 -0.435000
-v 0.741194 0.132500 -0.315000
-v -0.741194 0.132500 -0.315000
-v 0.741194 0.333931 0.187862
-v -0.741194 0.333931 0.187862
-v -0.741194 0.273931 0.067862
-v 0.741194 0.273931 0.067862
-v 0.741193 0.383931 0.187862
-v -0.741194 0.383931 0.187862
-v -0.741194 0.323931 0.067862
-v 0.741194 0.323931 0.067862
-v -0.741194 0.146069 -0.187862
-v 0.741194 0.146069 -0.187862
-v 0.741194 0.206069 -0.067862
-v -0.741194 0.206069 -0.067862
-v -0.741193 0.196069 -0.187862
-v 0.741194 0.196069 -0.187862
-v 0.741194 0.256069 -0.067862
-v -0.741194 0.256069 -0.067862
-v -0.329165 0.303892 0.171599
-v -0.329165 0.467953 0.171599
-v -0.329165 0.132293 -0.171599
-v -0.329165 0.296354 -0.171599
-v -0.462280 0.303892 0.171599
-v -0.462280 0.467953 0.171599
-v -0.462280 0.132293 -0.171599
-v -0.462280 0.296354 -0.171599
-v 0.753760 -0.500000 0.500000
-v 0.753760 -0.500000 -0.500000
-v -0.753760 -0.500000 0.500000
-v -0.753760 -0.500000 -0.500000
-vt 0.7427 0.1169
-vt 0.7427 0.3317
-vt 0.6400 0.3317
-vt 0.6400 0.1169
-vt 0.8260 0.3317
-vt 0.8260 0.4343
-vt 0.7427 0.4343
-vt 0.8260 0.1169
-vt 0.7427 0.0142
-vt 0.8260 0.0142
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.6554 0.3627
-vt 0.6690 0.3627
-vt 0.6690 0.9885
-vt 0.6554 0.9885
-vt 0.6972 0.9885
-vt 0.6837 0.9885
-vt 0.6837 0.3627
-vt 0.6972 0.3627
-vt 0.7119 0.3627
-vt 0.7119 0.9885
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.7427 0.1169
-vt 0.6400 0.1169
-vt 0.6400 0.3317
-vt 0.7427 0.3317
-vt 0.7427 0.4343
-vt 0.8260 0.4343
-vt 0.8260 0.3317
-vt 0.8260 0.1169
-vt 0.8260 0.0142
-vt 0.7427 0.0142
-vt 1.2113 -0.1167
-vt -0.2846 -0.1167
-vt -0.2846 -0.6128
-vt 1.2113 -0.6128
-vt -0.2852 0.4989
-vt 1.2107 0.4989
-vt 1.2107 0.9950
-vt -0.2852 0.9950
-vt 1.2113 0.9927
-vt 1.6551 0.1052
-vt -0.2846 0.9927
-vt -0.7284 0.1052
-vt -0.2873 0.9952
-vt -0.2873 0.0029
-vt 1.2086 0.0029
-vt 1.2086 0.9952
-vt 0.7066 0.9945
-vt -0.2857 0.9945
-vt -0.2857 0.4984
-vt 0.7066 0.4984
-vt 1.2107 0.9918
-vt -0.2852 0.9918
-vt -0.2852 0.4956
-vt 1.2107 0.4956
-vt 0.7071 0.9996
-vt -0.2852 0.9996
-vt -0.2852 0.5034
-vt 0.7071 0.5034
-vn -1.0000 0.0000 -0.0000
-vn 0.0000 0.0000 -1.0000
-vn -0.0000 0.0000 1.0000
-vn 0.0000 0.8944 -0.4472
-vn 1.0000 0.0000 0.0000
-vn -0.2782 0.8591 -0.4296
-vn 0.2782 0.8591 -0.4296
-vn 0.1433 -0.8852 0.4426
-vn -0.1433 -0.8852 0.4426
-vn 0.0000 -0.8944 0.4472
-vn 0.0000 -1.0000 0.0000
-g dtrack_vst2_Cube.032_SlopeRailMaterial
-s off
-f 8/1/1 10/2/1 9/3/1 7/4/1
-f 10/2/2 14/5/2 13/6/2 9/7/2
-f 12/8/3 8/1/3 7/9/3 11/10/3
-f 12/8/4 14/5/4 10/2/4 8/1/4
-f 22/11/5 21/12/5 25/13/5 26/14/5
-f 15/15/6 19/16/6 20/17/6 16/18/6
-f 16/19/2 20/20/2 21/21/2 17/22/2
-f 17/23/7 21/12/7 22/11/7 18/24/7
-f 19/25/3 15/26/3 18/27/3 22/28/3
-f 26/29/3 23/30/3 19/25/3 22/28/3
-f 19/16/1 23/31/1 24/32/1 20/17/1
-f 21/21/2 20/20/2 24/33/2 25/34/2
-f 26/14/8 25/13/8 27/35/8 28/36/8
-f 24/32/9 23/31/9 29/37/9 30/38/9
-f 28/36/5 27/35/5 31/39/5 32/40/5
-f 30/38/1 29/37/1 33/41/1 34/42/1
-f 31/39/4 34/42/4 33/41/4 32/40/4
-f 23/30/3 26/29/3 28/43/3 32/40/3 33/41/3 29/44/3
-f 24/33/2 30/45/2 34/42/2 31/39/2 27/46/2 25/34/2
-f 39/47/4 42/48/4 41/49/4 40/50/4
-f 35/51/3 39/47/3 40/50/3 36/52/3
-f 36/53/1 40/50/1 41/49/1 37/54/1
-f 37/55/2 41/49/2 42/48/2 38/56/2
-f 39/47/5 35/57/5 38/58/5 42/48/5
-f 43/59/1 45/60/1 46/61/1 44/62/1
-f 47/63/5 49/64/5 50/65/5 48/66/5
-f 43/67/10 44/68/10 47/63/10 48/66/10
-f 45/60/4 50/65/4 49/64/4 46/61/4
-f 58/69/1 57/70/1 61/71/1 62/72/1
-f 51/73/7 55/74/7 56/75/7 52/76/7
-f 52/77/3 56/78/3 57/79/3 53/80/3
-f 53/81/6 57/70/6 58/69/6 54/82/6
-f 55/83/2 51/84/2 54/85/2 58/86/2
-f 62/87/2 59/88/2 55/83/2 58/86/2
-f 55/74/5 59/89/5 60/90/5 56/75/5
-f 57/79/3 56/78/3 60/91/3 61/92/3
-f 62/72/9 61/71/9 63/93/9 64/94/9
-f 60/90/8 59/89/8 65/95/8 66/96/8
-f 64/94/1 63/93/1 67/97/1 68/98/1
-f 66/96/5 65/95/5 69/99/5 70/100/5
-f 67/97/4 70/100/4 69/99/4 68/98/4
-f 59/88/2 62/87/2 64/101/2 68/98/2 69/99/2 65/102/2
-f 60/91/3 66/103/3 70/100/3 67/97/3 63/104/3 61/92/3
-f 75/105/4 78/106/4 77/107/4 76/108/4
-f 71/109/2 75/105/2 76/108/2 72/110/2
-f 72/111/5 76/108/5 77/107/5 73/112/5
-f 73/113/3 77/107/3 78/106/3 74/114/3
-f 75/105/1 71/115/1 74/116/1 78/106/1
-f 83/117/4 86/118/4 85/119/4 84/120/4
-f 79/121/3 83/117/3 84/120/3 80/122/3
-f 80/123/1 84/120/1 85/119/1 81/124/1
-f 81/125/2 85/119/2 86/118/2 82/126/2
-f 83/117/5 79/127/5 82/128/5 86/118/5
-f 91/129/4 94/130/4 93/131/4 92/132/4
-f 87/133/2 91/129/2 92/132/2 88/134/2
-f 88/135/5 92/132/5 93/131/5 89/136/5
-f 89/137/3 93/131/3 94/130/3 90/138/3
-f 91/129/1 87/139/1 90/140/1 94/130/1
-f 96/141/5 95/142/5 97/143/5 98/144/5
-f 98/144/2 97/145/2 101/146/2 102/147/2
-f 100/148/3 99/149/3 95/150/3 96/141/3
-f 100/148/4 96/141/4 98/144/4 102/147/4
-g dtrack_vst2_Cube.032_SlopeGravelMaterial
-f 3/151/3 6/152/3 5/153/3 2/154/3
-f 4/155/2 1/156/2 104/157/2 106/158/2
-f 1/159/5 3/151/5 2/160/5
-f 6/152/1 4/161/1 5/162/1
-f 4/161/4 6/152/4 3/151/4 1/159/4
-f 104/163/11 103/164/11 105/165/11 106/166/11
-f 5/167/1 4/168/1 106/169/1 105/170/1
-f 2/171/3 5/172/3 105/173/3 103/174/3
-f 1/175/5 2/176/5 103/177/5 104/178/5
diff --git a/advtrains/advtrains/models/advtrains_dtrack_vst2_45.obj b/advtrains/advtrains/models/advtrains_dtrack_vst2_45.obj
deleted file mode 100644
index 5dc708b..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_vst2_45.obj
+++ /dev/null
@@ -1,462 +0,0 @@
-# Blender v2.78 (sub 0) OBJ File: 'rail_redo.blend'
-# www.blender.org
-o dtrack_vst2_45_Cube.035
-v 0.111416 0.278660 0.354093
-v 0.111416 0.442721 0.354093
-v 0.354093 0.157340 0.111416
-v 0.354093 0.321400 0.111416
-v 0.205542 0.278660 0.448220
-v 0.205542 0.442721 0.448220
-v 0.448220 0.157340 0.205543
-v 0.448220 0.321400 0.205543
-v -0.208358 0.539814 0.791422
-v 0.791423 0.040000 -0.208357
-v 0.896243 0.040000 -0.103536
-v -0.103538 0.539814 0.896242
-v -0.164683 0.559814 0.835097
-v 0.835098 0.060000 -0.164682
-v 0.852568 0.060000 -0.147212
-v -0.147213 0.559814 0.852567
-v -0.164683 0.609814 0.835097
-v 0.835098 0.110000 -0.164682
-v 0.852568 0.110000 -0.147212
-v -0.147213 0.609814 0.852567
-v 0.874406 0.115000 -0.125374
-v -0.125375 0.614814 0.874405
-v -0.186520 0.614814 0.813259
-v 0.813260 0.115000 -0.186519
-v 0.874406 0.140000 -0.125374
-v -0.125375 0.639814 0.874405
-v -0.186520 0.639814 0.813259
-v 0.813260 0.140000 -0.186519
-v 0.476117 0.313896 0.572089
-v -0.572088 0.313896 -0.476117
-v -0.656942 0.356316 -0.391265
-v 0.391264 0.356316 0.656941
-v 0.476117 0.263896 0.572089
-v -0.572088 0.263896 -0.476117
-v -0.656941 0.306316 -0.391265
-v 0.391264 0.306316 0.656942
-v -0.508186 3.379001 0.491594
-v 0.491594 2.879186 -0.508186
-v -0.508186 3.400629 0.491593
-v 0.491594 2.900814 -0.508186
-v 0.508186 2.879186 -0.491594
-v -0.491594 3.379001 0.508186
-v 0.508186 2.900814 -0.491594
-v -0.491594 3.400629 0.508186
-v 0.208358 0.040000 -0.791421
-v -0.791423 0.539814 0.208357
-v -0.896244 0.539814 0.103537
-v 0.103537 0.040000 -0.896242
-v 0.164682 0.060000 -0.835097
-v -0.835099 0.559815 0.164682
-v -0.852568 0.559814 0.147212
-v 0.147212 0.060000 -0.852567
-v 0.164682 0.110000 -0.835097
-v -0.835099 0.609815 0.164682
-v -0.852568 0.609814 0.147212
-v 0.147212 0.110000 -0.852567
-v -0.874406 0.614814 0.125374
-v 0.125375 0.115000 -0.874404
-v 0.186520 0.115000 -0.813259
-v -0.813261 0.614815 0.186520
-v -0.874406 0.639814 0.125374
-v 0.125375 0.140000 -0.874404
-v 0.186520 0.140000 -0.813259
-v -0.813261 0.639814 0.186520
-v -0.230055 0.092905 -0.818151
-v 0.818151 0.092905 0.230055
-v 0.733298 0.135325 0.314908
-v -0.314908 0.135325 -0.733299
-v -0.230055 0.142905 -0.818151
-v 0.818151 0.142905 0.230056
-v 0.733298 0.185325 0.314908
-v -0.314908 0.185325 -0.733298
-v 0.314908 0.394489 0.733298
-v -0.733298 0.394489 -0.314908
-v -0.818151 0.436909 -0.230056
-v 0.230055 0.436909 0.818151
-v 0.314908 0.344489 0.733298
-v -0.733298 0.344489 -0.314908
-v -0.818151 0.386909 -0.230055
-v 0.230055 0.386909 0.818151
-v -0.391264 0.173498 -0.656942
-v 0.656941 0.173498 0.391265
-v 0.572089 0.215918 0.476118
-v -0.476117 0.215918 -0.572089
-v -0.391264 0.223498 -0.656941
-v 0.656942 0.223498 0.391265
-v 0.572088 0.265918 0.476117
-v -0.476117 0.265918 -0.572089
-v -0.354093 0.278660 -0.111416
-v -0.354093 0.442721 -0.111416
-v -0.111416 0.157340 -0.354093
-v -0.111416 0.321400 -0.354093
-v -0.448220 0.278660 -0.205543
-v -0.448220 0.442721 -0.205543
-v -0.205543 0.157340 -0.448220
-v -0.205543 0.321400 -0.448220
-v -0.069408 0.012594 -0.978798
-v 0.978798 0.012594 0.069409
-v 0.893945 0.055014 0.154261
-v -0.154261 0.055014 -0.893945
-v -0.069408 0.062594 -0.978798
-v 0.978798 0.062594 0.069409
-v 0.893945 0.105014 0.154261
-v -0.154261 0.105014 -0.893945
-v 0.069408 0.467220 0.978798
-v -0.978798 0.467220 -0.069409
-v -0.893945 0.424800 -0.154261
-v 0.154261 0.424800 0.893945
-v 0.069408 0.517220 0.978797
-v -0.978798 0.517220 -0.069409
-v -0.893945 0.474800 -0.154261
-v 0.154261 0.474800 0.893945
-v -0.029561 -0.000000 -1.029558
-v 1.029558 0.000000 0.029561
-v -1.029558 -0.000000 -0.029561
-v -1.029558 0.500000 -0.029561
-v 0.029561 0.000000 1.029558
-v 0.029561 0.500000 1.029558
-v -0.500000 0.500000 1.559119
-v -1.559119 0.500000 0.500000
-v -0.499999 0.500000 0.499999
-v -1.559120 -0.000000 0.500000
-v -0.500000 0.000000 1.559119
-v -0.500003 0.000000 0.500000
-v 1.029558 -0.500000 0.029561
-v -0.029561 -0.500000 -1.029558
-v 0.029561 -0.500000 1.029558
-v -1.029558 -0.500000 -0.029561
-v -0.500003 -0.500000 0.500000
-v -0.500000 -0.500000 1.559119
-v -1.559120 -0.500000 0.500000
-vt 0.7427 0.1169
-vt 0.7427 0.3317
-vt 0.6400 0.3317
-vt 0.6400 0.1169
-vt 0.8260 0.3317
-vt 0.8260 0.4343
-vt 0.7427 0.4343
-vt 0.8260 0.1169
-vt 0.7427 0.0142
-vt 0.8260 0.0142
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.8837 0.9625
-vt 0.8524 0.0348
-vt 0.8837 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.0035
-vt 0.9588 0.0348
-vt 0.8837 0.0035
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.6554 0.3627
-vt 0.6690 0.3627
-vt 0.6690 0.9885
-vt 0.6554 0.9885
-vt 0.6972 0.9885
-vt 0.6837 0.9885
-vt 0.6837 0.3627
-vt 0.6972 0.3627
-vt 0.7119 0.3627
-vt 0.7119 0.9885
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.8837 0.9625
-vt 0.8524 0.0348
-vt 0.8837 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.0035
-vt 0.9588 0.0348
-vt 0.8837 0.0035
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.7427 0.1169
-vt 0.6400 0.1169
-vt 0.6400 0.3317
-vt 0.7427 0.3317
-vt 0.7427 0.4343
-vt 0.8260 0.4343
-vt 0.8260 0.3317
-vt 0.8260 0.1169
-vt 0.8260 0.0142
-vt 0.7427 0.0142
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt -0.2938 0.5095
-vt 0.6540 0.0358
-vt 0.6540 0.5096
-vt 0.6549 0.9852
-vt -0.2928 0.5114
-vt 0.6549 0.5114
-vt 0.1047 0.9953
-vt 0.1047 0.4934
-vt 0.1047 -0.0085
-vt 1.1643 -0.0085
-vt 1.1643 0.9953
-vt 1.1568 0.5114
-vt 0.6549 0.0377
-vt 1.1568 0.0377
-vt -0.3972 0.9953
-vt -0.3972 -0.0085
-vt 1.1431 0.5009
-vt 0.4334 0.5009
-vt 0.4334 0.0272
-vt 1.1431 0.0272
-vt 1.1431 0.9747
-vt 0.4334 0.9747
-vt 0.7633 0.9654
-vt 0.0536 0.9654
-vt 0.0536 0.4916
-vt 0.7633 0.4916
-vt 1.1559 0.5096
-vt 1.1559 0.9833
-vt 0.6540 0.9833
-vt 0.1053 -0.0176
-vt 0.1052 0.4843
-vt -0.3966 -0.0176
-vt 1.0530 -0.0176
-vt 1.0530 0.9861
-vt 0.1053 0.9861
-vt -0.3966 0.9861
-vt 0.0536 0.0179
-vt 0.7633 0.0179
-vt -0.2928 0.0377
-vt -0.2938 0.9833
-vt 0.0455 0.1273
-vt 1.0492 0.1273
-vt 1.0492 0.6011
-vt 0.0455 0.6011
-vt 1.1568 0.9852
-vt 1.1559 0.0358
-vn -0.7071 0.0000 -0.7071
-vn 0.7071 0.0000 -0.7071
-vn -0.7071 0.0000 0.7071
-vn 0.2357 0.9428 -0.2357
-vn 0.7071 0.0000 0.7071
-vn 0.0189 0.9017 -0.4319
-vn 0.4319 0.9017 -0.0189
-vn -0.1263 -0.9320 0.3397
-vn -0.3397 -0.9320 0.1263
-vn -0.2357 -0.9428 0.2357
-vn 0.0000 1.0000 0.0000
-vn -0.0000 0.0000 1.0000
-vn -1.0000 0.0000 0.0000
-vn 0.0000 -1.0000 0.0000
-g dtrack_vst2_45_Cube.035_SlopeRailMaterial
-s off
-f 2/1/1 4/2/1 3/3/1 1/4/1
-f 4/2/2 8/5/2 7/6/2 3/7/2
-f 6/8/3 2/1/3 1/9/3 5/10/3
-f 6/8/4 8/5/4 4/2/4 2/1/4
-f 16/11/5 15/12/5 19/13/5 20/14/5
-f 9/15/6 13/16/6 14/17/6 10/18/6
-f 10/19/2 14/20/2 15/21/2 11/22/2
-f 11/23/7 15/12/7 16/11/7 12/24/7
-f 13/25/3 9/26/3 12/27/3 16/28/3
-f 20/29/3 17/30/3 13/25/3 16/28/3
-f 13/16/1 17/31/1 18/32/1 14/17/1
-f 15/21/2 14/20/2 18/33/2 19/34/2
-f 20/14/8 19/13/8 21/35/8 22/36/8
-f 18/32/9 17/31/9 23/37/9 24/38/9
-f 22/36/5 21/35/5 25/39/5 26/40/5
-f 24/38/1 23/37/1 27/41/1 28/42/1
-f 25/39/4 28/42/4 27/41/4 26/40/4
-f 17/30/3 20/29/3 22/43/3 26/40/3 27/41/3 23/44/3
-f 18/33/2 24/45/2 28/42/2 25/39/2 21/46/2 19/34/2
-f 32/47/5 36/48/5 33/49/5 29/50/5
-f 34/51/2 30/52/2 29/50/2 33/53/2
-f 35/54/1 31/55/1 30/52/1 34/56/1
-f 36/57/3 32/47/3 31/55/3 35/58/3
-f 32/47/4 29/50/4 30/52/4 31/55/4
-f 37/59/1 39/60/1 40/61/1 38/62/1
-f 41/63/5 43/64/5 44/65/5 42/66/5
-f 37/67/10 38/68/10 41/63/10 42/66/10
-f 39/60/4 44/65/4 43/64/4 40/61/4
-f 52/69/1 51/70/1 55/71/1 56/72/1
-f 45/73/7 49/74/7 50/75/7 46/76/7
-f 46/77/3 50/78/3 51/79/3 47/80/3
-f 47/81/6 51/70/6 52/69/6 48/82/6
-f 49/83/2 45/84/2 48/85/2 52/86/2
-f 56/87/2 53/88/2 49/83/2 52/86/2
-f 49/74/5 53/89/5 54/90/5 50/75/5
-f 51/79/3 50/78/3 54/91/3 55/92/3
-f 56/72/9 55/71/9 57/93/9 58/94/9
-f 54/90/8 53/89/8 59/95/8 60/96/8
-f 58/94/1 57/93/1 61/97/1 62/98/1
-f 60/96/5 59/95/5 63/99/5 64/100/5
-f 61/97/4 64/100/4 63/99/4 62/98/4
-f 53/88/2 56/87/2 58/101/2 62/98/2 63/99/2 59/102/2
-f 54/91/3 60/103/3 64/100/3 61/97/3 57/104/3 55/92/3
-f 69/105/4 72/106/4 71/107/4 70/108/4
-f 65/109/2 69/105/2 70/108/2 66/110/2
-f 66/111/5 70/108/5 71/107/5 67/112/5
-f 67/113/3 71/107/3 72/106/3 68/114/3
-f 69/105/1 65/115/1 68/116/1 72/106/1
-f 76/117/5 80/118/5 77/119/5 73/120/5
-f 78/121/2 74/122/2 73/120/2 77/123/2
-f 79/124/1 75/125/1 74/122/1 78/126/1
-f 80/127/3 76/117/3 75/125/3 79/128/3
-f 76/117/4 73/120/4 74/122/4 75/125/4
-f 85/129/4 88/130/4 87/131/4 86/132/4
-f 81/133/2 85/129/2 86/132/2 82/134/2
-f 82/135/5 86/132/5 87/131/5 83/136/5
-f 83/137/3 87/131/3 88/130/3 84/138/3
-f 85/129/1 81/139/1 84/140/1 88/130/1
-f 90/141/5 89/142/5 91/143/5 92/144/5
-f 92/144/2 91/145/2 95/146/2 96/147/2
-f 94/148/3 93/149/3 89/150/3 90/141/3
-f 94/148/4 90/141/4 92/144/4 96/147/4
-f 101/151/4 104/152/4 103/153/4 102/154/4
-f 97/155/2 101/151/2 102/154/2 98/156/2
-f 98/157/5 102/154/5 103/153/5 99/158/5
-f 99/159/3 103/153/3 104/152/3 100/160/3
-f 101/151/1 97/161/1 100/162/1 104/152/1
-f 109/163/4 112/164/4 111/165/4 110/166/4
-f 105/167/3 109/163/3 110/166/3 106/168/3
-f 106/169/1 110/166/1 111/165/1 107/170/1
-f 107/171/2 111/165/2 112/164/2 108/172/2
-f 109/163/5 105/173/5 108/174/5 112/164/5
-g dtrack_vst2_45_Cube.035_SlopeGravelMaterial
-f 114/175/5 118/176/5 117/177/5
-f 116/178/1 113/179/1 115/180/1
-f 116/181/4 121/182/4 118/183/4 114/184/4 113/185/4
-f 122/186/1 115/180/1 128/187/1 131/188/1
-f 116/181/11 120/189/11 121/182/11
-f 118/183/11 121/182/11 119/190/11
-f 124/191/12 122/192/12 131/193/12 129/194/12
-f 121/195/12 120/196/12 122/192/12 124/191/12
-f 119/197/13 121/198/13 124/199/13 123/200/13
-f 117/177/5 123/201/5 130/202/5 127/203/5
-f 128/204/14 129/205/14 131/206/14
-f 126/207/14 125/208/14 127/209/14 129/205/14 128/204/14
-f 130/210/14 129/205/14 127/209/14
-f 123/200/13 124/199/13 129/211/13 130/212/13
-f 115/180/1 113/179/1 126/213/1 128/187/1
-f 114/175/5 117/177/5 127/203/5 125/214/5
-f 113/215/2 114/216/2 125/217/2 126/218/2
-f 116/178/1 115/180/1 122/186/1 120/219/1
-f 117/177/5 118/176/5 119/220/5 123/201/5
diff --git a/advtrains/advtrains/models/advtrains_dtrack_vst31.obj b/advtrains/advtrains/models/advtrains_dtrack_vst31.obj
deleted file mode 100644
index c4cb84f..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_vst31.obj
+++ /dev/null
@@ -1,348 +0,0 @@
-# Blender v2.78 (sub 0) OBJ File: 'rail_redo.blend'
-# www.blender.org
-o dtrack_vst31_Cube.000
-v 0.753760 -0.500000 -0.500000
-v 0.753760 -0.500000 0.500000
-v 0.753760 -0.166667 0.500000
-v -0.753760 -0.500000 -0.500000
-v -0.753760 -0.500000 0.500000
-v -0.753760 -0.166667 0.500000
-v 0.329165 -0.308041 0.171599
-v 0.329165 -0.143980 0.171599
-v 0.329165 -0.422440 -0.171599
-v 0.329165 -0.258379 -0.171599
-v 0.462280 -0.308041 0.171599
-v 0.462280 -0.143980 0.171599
-v 0.462280 -0.422440 -0.171599
-v 0.462280 -0.258379 -0.171599
-v 0.412289 -0.126667 0.500000
-v 0.412289 -0.460000 -0.500000
-v 0.560528 -0.460000 -0.500000
-v 0.560528 -0.126667 0.500000
-v 0.474055 -0.106667 0.500000
-v 0.474055 -0.440000 -0.500000
-v 0.498762 -0.440000 -0.500000
-v 0.498762 -0.106667 0.500000
-v 0.474055 -0.056667 0.500000
-v 0.474055 -0.390000 -0.500000
-v 0.498762 -0.390000 -0.500000
-v 0.498762 -0.056667 0.500000
-v 0.529645 -0.385000 -0.500000
-v 0.529645 -0.051667 0.500000
-v 0.443172 -0.051667 0.500000
-v 0.443172 -0.385000 -0.500000
-v 0.529645 -0.360000 -0.500000
-v 0.529645 -0.026667 0.500000
-v 0.443172 -0.026667 0.500000
-v 0.443172 -0.360000 -0.500000
-v 0.741194 -0.198333 0.435000
-v -0.741194 -0.198333 0.435000
-v -0.741194 -0.238333 0.315000
-v 0.741194 -0.238333 0.315000
-v 0.741193 -0.148333 0.435000
-v -0.741194 -0.148333 0.435000
-v -0.741194 -0.188333 0.315000
-v 0.741194 -0.188333 0.315000
-v -0.011733 2.712519 0.500000
-v -0.011732 2.379186 -0.500001
-v -0.011733 2.734147 0.500000
-v -0.011732 2.400814 -0.500000
-v 0.011732 2.379186 -0.500000
-v 0.011732 2.712519 0.500000
-v 0.011732 2.400814 -0.500000
-v 0.011732 2.734148 0.500000
-v -0.412289 -0.460000 -0.500000
-v -0.412289 -0.126667 0.500000
-v -0.560528 -0.126667 0.500000
-v -0.560528 -0.460000 -0.500000
-v -0.474055 -0.440000 -0.500000
-v -0.474055 -0.106666 0.500000
-v -0.498762 -0.106667 0.500000
-v -0.498762 -0.440000 -0.500000
-v -0.474055 -0.390000 -0.500000
-v -0.474055 -0.056666 0.500000
-v -0.498762 -0.056667 0.500000
-v -0.498762 -0.390000 -0.500000
-v -0.529645 -0.051667 0.500000
-v -0.529645 -0.385000 -0.500000
-v -0.443172 -0.385000 -0.500000
-v -0.443172 -0.051666 0.500000
-v -0.529645 -0.026667 0.500000
-v -0.529645 -0.360000 -0.500000
-v -0.443172 -0.360000 -0.500000
-v -0.443172 -0.026666 0.500000
-v -0.741194 -0.488333 -0.435000
-v 0.741194 -0.488333 -0.435000
-v 0.741194 -0.448333 -0.315000
-v -0.741194 -0.448333 -0.315000
-v -0.741193 -0.438333 -0.435000
-v 0.741194 -0.438333 -0.435000
-v 0.741194 -0.398333 -0.315000
-v -0.741194 -0.398333 -0.315000
-v 0.741194 -0.280713 0.187862
-v -0.741194 -0.280713 0.187862
-v -0.741194 -0.320713 0.067862
-v 0.741194 -0.320713 0.067862
-v 0.741193 -0.230713 0.187862
-v -0.741194 -0.230713 0.187862
-v -0.741194 -0.270713 0.067862
-v 0.741194 -0.270713 0.067862
-v -0.741194 -0.405954 -0.187862
-v 0.741194 -0.405954 -0.187862
-v 0.741194 -0.365954 -0.067862
-v -0.741194 -0.365954 -0.067862
-v -0.741193 -0.355954 -0.187862
-v 0.741194 -0.355954 -0.187862
-v 0.741194 -0.315954 -0.067862
-v -0.741194 -0.315954 -0.067862
-v -0.329165 -0.308041 0.171599
-v -0.329165 -0.143980 0.171599
-v -0.329165 -0.422440 -0.171599
-v -0.329165 -0.258379 -0.171599
-v -0.462280 -0.308041 0.171599
-v -0.462280 -0.143980 0.171599
-v -0.462280 -0.422440 -0.171599
-v -0.462280 -0.258379 -0.171599
-vt 0.7427 0.1169
-vt 0.7427 0.3317
-vt 0.6400 0.3317
-vt 0.6400 0.1169
-vt 0.8260 0.3317
-vt 0.8260 0.4343
-vt 0.7427 0.4343
-vt 0.8260 0.1169
-vt 0.7427 0.0142
-vt 0.8260 0.0142
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.6554 0.3627
-vt 0.6690 0.3627
-vt 0.6690 0.9885
-vt 0.6554 0.9885
-vt 0.6972 0.9885
-vt 0.6837 0.9885
-vt 0.6837 0.3627
-vt 0.6972 0.3627
-vt 0.7119 0.3627
-vt 0.7119 0.9885
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.7427 0.1169
-vt 0.6400 0.1169
-vt 0.6400 0.3317
-vt 0.7427 0.3317
-vt 0.7427 0.4343
-vt 0.8260 0.4343
-vt 0.8260 0.3317
-vt 0.8260 0.1169
-vt 0.8260 0.0142
-vt 0.7427 0.0142
-vt 1.1949 -0.0470
-vt -0.3152 -0.0470
-vt -0.3152 -0.3809
-vt 1.1949 -0.3809
-vt -0.3120 1.0015
-vt -0.3120 -0.0002
-vt 1.1981 -0.0002
-vt 1.1981 1.0015
-vt 1.1949 1.0089
-vt 1.5117 0.0586
-vt -0.3152 1.0089
-vt -0.6320 0.0586
-vn -1.0000 0.0000 -0.0000
-vn 0.0000 0.0000 -1.0000
-vn -0.0000 0.0000 1.0000
-vn 0.0000 0.9487 -0.3162
-vn 1.0000 0.0000 0.0000
-vn -0.2936 0.9069 -0.3023
-vn 0.2936 0.9069 -0.3023
-vn 0.1518 -0.9377 0.3126
-vn -0.1518 -0.9377 0.3126
-vn 0.0000 -0.9487 0.3162
-vn 0.0000 -1.0000 0.0000
-g dtrack_vst31_Cube.000_SlopeRailMaterial
-s off
-f 8/1/1 10/2/1 9/3/1 7/4/1
-f 10/2/2 14/5/2 13/6/2 9/7/2
-f 12/8/3 8/1/3 7/9/3 11/10/3
-f 12/8/4 14/5/4 10/2/4 8/1/4
-f 22/11/5 21/12/5 25/13/5 26/14/5
-f 15/15/6 19/16/6 20/17/6 16/18/6
-f 16/19/2 20/20/2 21/21/2 17/22/2
-f 17/23/7 21/12/7 22/11/7 18/24/7
-f 19/25/3 15/26/3 18/27/3 22/28/3
-f 26/29/3 23/30/3 19/25/3 22/28/3
-f 19/16/1 23/31/1 24/32/1 20/17/1
-f 21/21/2 20/20/2 24/33/2 25/34/2
-f 26/14/8 25/13/8 27/35/8 28/36/8
-f 24/32/9 23/31/9 29/37/9 30/38/9
-f 28/36/5 27/35/5 31/39/5 32/40/5
-f 30/38/1 29/37/1 33/41/1 34/42/1
-f 31/39/4 34/42/4 33/41/4 32/40/4
-f 23/30/3 26/29/3 28/43/3 32/40/3 33/41/3 29/44/3
-f 24/33/2 30/45/2 34/42/2 31/39/2 27/46/2 25/34/2
-f 39/47/4 42/48/4 41/49/4 40/50/4
-f 35/51/3 39/47/3 40/50/3 36/52/3
-f 36/53/1 40/50/1 41/49/1 37/54/1
-f 37/55/2 41/49/2 42/48/2 38/56/2
-f 39/47/5 35/57/5 38/58/5 42/48/5
-f 43/59/1 45/60/1 46/61/1 44/62/1
-f 47/63/5 49/64/5 50/65/5 48/66/5
-f 43/67/10 44/68/10 47/63/10 48/66/10
-f 45/60/4 50/65/4 49/64/4 46/61/4
-f 58/69/1 57/70/1 61/71/1 62/72/1
-f 51/73/7 55/74/7 56/75/7 52/76/7
-f 52/77/3 56/78/3 57/79/3 53/80/3
-f 53/81/6 57/70/6 58/69/6 54/82/6
-f 55/83/2 51/84/2 54/85/2 58/86/2
-f 62/87/2 59/88/2 55/83/2 58/86/2
-f 55/74/5 59/89/5 60/90/5 56/75/5
-f 57/79/3 56/78/3 60/91/3 61/92/3
-f 62/72/9 61/71/9 63/93/9 64/94/9
-f 60/90/8 59/89/8 65/95/8 66/96/8
-f 64/94/1 63/93/1 67/97/1 68/98/1
-f 66/96/5 65/95/5 69/99/5 70/100/5
-f 67/97/4 70/100/4 69/99/4 68/98/4
-f 59/88/2 62/87/2 64/101/2 68/98/2 69/99/2 65/102/2
-f 60/91/3 66/103/3 70/100/3 67/97/3 63/104/3 61/92/3
-f 75/105/4 78/106/4 77/107/4 76/108/4
-f 71/109/2 75/105/2 76/108/2 72/110/2
-f 72/111/5 76/108/5 77/107/5 73/112/5
-f 73/113/3 77/107/3 78/106/3 74/114/3
-f 75/105/1 71/115/1 74/116/1 78/106/1
-f 83/117/4 86/118/4 85/119/4 84/120/4
-f 79/121/3 83/117/3 84/120/3 80/122/3
-f 80/123/1 84/120/1 85/119/1 81/124/1
-f 81/125/2 85/119/2 86/118/2 82/126/2
-f 83/117/5 79/127/5 82/128/5 86/118/5
-f 91/129/4 94/130/4 93/131/4 92/132/4
-f 87/133/2 91/129/2 92/132/2 88/134/2
-f 88/135/5 92/132/5 93/131/5 89/136/5
-f 89/137/3 93/131/3 94/130/3 90/138/3
-f 91/129/1 87/139/1 90/140/1 94/130/1
-f 96/141/5 95/142/5 97/143/5 98/144/5
-f 98/144/2 97/145/2 101/146/2 102/147/2
-f 100/148/3 99/149/3 95/150/3 96/141/3
-f 100/148/4 96/141/4 98/144/4 102/147/4
-g dtrack_vst31_Cube.000_SlopeGravelMaterial
-f 3/151/3 6/152/3 5/153/3 2/154/3
-f 1/155/11 2/156/11 5/157/11 4/158/11
-f 1/159/5 3/151/5 2/160/5
-f 6/152/1 4/161/1 5/162/1
-f 4/161/4 6/152/4 3/151/4 1/159/4
diff --git a/advtrains/advtrains/models/advtrains_dtrack_vst32.obj b/advtrains/advtrains/models/advtrains_dtrack_vst32.obj
deleted file mode 100644
index 297d46b..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_vst32.obj
+++ /dev/null
@@ -1,372 +0,0 @@
-# Blender v2.78 (sub 0) OBJ File: 'rail_redo.blend'
-# www.blender.org
-o dtrack_vst32_Cube.028
-v 0.753760 -0.166667 -0.500000
-v 0.753760 -0.166667 0.500000
-v 0.753760 0.166667 0.500000
-v -0.753760 -0.166667 -0.500000
-v -0.753760 -0.166667 0.500000
-v -0.753760 0.166667 0.500000
-v 0.329165 0.025292 0.171599
-v 0.329165 0.189353 0.171599
-v 0.329165 -0.089107 -0.171599
-v 0.329165 0.074954 -0.171599
-v 0.462280 0.025292 0.171599
-v 0.462280 0.189353 0.171599
-v 0.462280 -0.089107 -0.171599
-v 0.462280 0.074954 -0.171599
-v 0.412289 0.206667 0.500000
-v 0.412289 -0.126667 -0.500000
-v 0.560528 -0.126667 -0.500000
-v 0.560528 0.206667 0.500000
-v 0.474055 0.226667 0.500000
-v 0.474055 -0.106667 -0.500000
-v 0.498762 -0.106667 -0.500000
-v 0.498762 0.226667 0.500000
-v 0.474055 0.276667 0.500000
-v 0.474055 -0.056667 -0.500000
-v 0.498762 -0.056667 -0.500000
-v 0.498762 0.276667 0.500000
-v 0.529645 -0.051667 -0.500000
-v 0.529645 0.281667 0.500000
-v 0.443172 0.281667 0.500000
-v 0.443172 -0.051667 -0.500000
-v 0.529645 -0.026667 -0.500000
-v 0.529645 0.306667 0.500000
-v 0.443172 0.306667 0.500000
-v 0.443172 -0.026667 -0.500000
-v 0.741194 0.135000 0.435000
-v -0.741194 0.135000 0.435000
-v -0.741194 0.095000 0.315000
-v 0.741194 0.095000 0.315000
-v 0.741193 0.185000 0.435000
-v -0.741194 0.185000 0.435000
-v -0.741194 0.145000 0.315000
-v 0.741194 0.145000 0.315000
-v -0.011733 3.045853 0.500000
-v -0.011732 2.712519 -0.500001
-v -0.011733 3.067481 0.500000
-v -0.011732 2.734147 -0.500000
-v 0.011732 2.712519 -0.500000
-v 0.011732 3.045853 0.500000
-v 0.011732 2.734147 -0.500000
-v 0.011732 3.067481 0.500000
-v -0.412289 -0.126667 -0.500000
-v -0.412289 0.206667 0.500000
-v -0.560528 0.206667 0.500000
-v -0.560528 -0.126667 -0.500000
-v -0.474055 -0.106667 -0.500000
-v -0.474055 0.226667 0.500000
-v -0.498762 0.226667 0.500000
-v -0.498762 -0.106667 -0.500000
-v -0.474055 -0.056667 -0.500000
-v -0.474055 0.276667 0.500000
-v -0.498762 0.276667 0.500000
-v -0.498762 -0.056667 -0.500000
-v -0.529645 0.281667 0.500000
-v -0.529645 -0.051667 -0.500000
-v -0.443172 -0.051667 -0.500000
-v -0.443172 0.281667 0.500000
-v -0.529645 0.306667 0.500000
-v -0.529645 -0.026667 -0.500000
-v -0.443172 -0.026667 -0.500000
-v -0.443172 0.306667 0.500000
-v -0.741194 -0.155000 -0.435000
-v 0.741194 -0.155000 -0.435000
-v 0.741194 -0.115000 -0.315000
-v -0.741194 -0.115000 -0.315000
-v -0.741193 -0.105000 -0.435000
-v 0.741194 -0.105000 -0.435000
-v 0.741194 -0.065000 -0.315000
-v -0.741194 -0.065000 -0.315000
-v 0.741194 0.052621 0.187862
-v -0.741194 0.052621 0.187862
-v -0.741194 0.012621 0.067862
-v 0.741194 0.012621 0.067862
-v 0.741193 0.102621 0.187862
-v -0.741194 0.102621 0.187862
-v -0.741194 0.062621 0.067862
-v 0.741194 0.062621 0.067862
-v -0.741194 -0.072621 -0.187862
-v 0.741194 -0.072621 -0.187862
-v 0.741194 -0.032621 -0.067862
-v -0.741194 -0.032621 -0.067862
-v -0.741193 -0.022621 -0.187862
-v 0.741194 -0.022621 -0.187862
-v 0.741194 0.017379 -0.067862
-v -0.741194 0.017379 -0.067862
-v -0.329165 0.025293 0.171599
-v -0.329165 0.189353 0.171599
-v -0.329165 -0.089107 -0.171599
-v -0.329165 0.074954 -0.171599
-v -0.462280 0.025293 0.171599
-v -0.462280 0.189353 0.171599
-v -0.462280 -0.089107 -0.171599
-v -0.462280 0.074954 -0.171599
-v 0.753760 -0.500000 0.500000
-v 0.753760 -0.500000 -0.500000
-v -0.753760 -0.500000 0.500000
-v -0.753760 -0.500000 -0.500000
-vt 0.7427 0.1169
-vt 0.7427 0.3317
-vt 0.6400 0.3317
-vt 0.6400 0.1169
-vt 0.8260 0.3317
-vt 0.8260 0.4343
-vt 0.7427 0.4343
-vt 0.8260 0.1169
-vt 0.7427 0.0142
-vt 0.8260 0.0142
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.6554 0.3627
-vt 0.6690 0.3627
-vt 0.6690 0.9885
-vt 0.6554 0.9885
-vt 0.6972 0.9885
-vt 0.6837 0.9885
-vt 0.6837 0.3627
-vt 0.6972 0.3627
-vt 0.7119 0.3627
-vt 0.7119 0.9885
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.7427 0.1169
-vt 0.6400 0.1169
-vt 0.6400 0.3317
-vt 0.7427 0.3317
-vt 0.7427 0.4343
-vt 0.8260 0.4343
-vt 0.8260 0.3317
-vt 0.8260 0.1169
-vt 0.8260 0.0142
-vt 0.7427 0.0142
-vt 1.2169 -0.0660
-vt -0.3162 -0.0660
-vt -0.3162 -0.4050
-vt 1.2169 -0.4050
-vt -0.3102 0.3256
-vt 1.2229 0.3256
-vt 1.2229 0.6646
-vt -0.3102 0.6646
-vt 1.2169 1.0060
-vt 1.5385 0.0412
-vt -0.3162 1.0060
-vt -0.6378 0.0412
-vt -0.3132 1.0050
-vt -0.3132 -0.0119
-vt 1.2199 -0.0119
-vt 1.2199 1.0050
-vt -0.3075 0.6587
-vt 0.7095 0.6587
-vt 0.7095 0.9977
-vt -0.3075 0.9977
-vt 1.2229 1.0022
-vt -0.3102 1.0022
-vt -0.3102 0.6632
-vt 1.2229 0.6632
-vt 0.7067 0.6635
-vt -0.3102 0.6635
-vt -0.3102 0.3245
-vt 0.7067 0.3245
-vn -1.0000 0.0000 -0.0000
-vn 0.0000 0.0000 -1.0000
-vn -0.0000 0.0000 1.0000
-vn 0.0000 0.9487 -0.3162
-vn 1.0000 0.0000 0.0000
-vn -0.2936 0.9069 -0.3023
-vn 0.2936 0.9069 -0.3023
-vn 0.1518 -0.9377 0.3126
-vn -0.1518 -0.9377 0.3126
-vn 0.0000 -0.9487 0.3162
-vn 0.0000 -1.0000 0.0000
-g dtrack_vst32_Cube.028_SlopeRailMaterial
-s off
-f 8/1/1 10/2/1 9/3/1 7/4/1
-f 10/2/2 14/5/2 13/6/2 9/7/2
-f 12/8/3 8/1/3 7/9/3 11/10/3
-f 12/8/4 14/5/4 10/2/4 8/1/4
-f 22/11/5 21/12/5 25/13/5 26/14/5
-f 15/15/6 19/16/6 20/17/6 16/18/6
-f 16/19/2 20/20/2 21/21/2 17/22/2
-f 17/23/7 21/12/7 22/11/7 18/24/7
-f 19/25/3 15/26/3 18/27/3 22/28/3
-f 26/29/3 23/30/3 19/25/3 22/28/3
-f 19/16/1 23/31/1 24/32/1 20/17/1
-f 21/21/2 20/20/2 24/33/2 25/34/2
-f 26/14/8 25/13/8 27/35/8 28/36/8
-f 24/32/9 23/31/9 29/37/9 30/38/9
-f 28/36/5 27/35/5 31/39/5 32/40/5
-f 30/38/1 29/37/1 33/41/1 34/42/1
-f 31/39/4 34/42/4 33/41/4 32/40/4
-f 23/30/3 26/29/3 28/43/3 32/40/3 33/41/3 29/44/3
-f 24/33/2 30/45/2 34/42/2 31/39/2 27/46/2 25/34/2
-f 39/47/4 42/48/4 41/49/4 40/50/4
-f 35/51/3 39/47/3 40/50/3 36/52/3
-f 36/53/1 40/50/1 41/49/1 37/54/1
-f 37/55/2 41/49/2 42/48/2 38/56/2
-f 39/47/5 35/57/5 38/58/5 42/48/5
-f 43/59/1 45/60/1 46/61/1 44/62/1
-f 47/63/5 49/64/5 50/65/5 48/66/5
-f 43/67/10 44/68/10 47/63/10 48/66/10
-f 45/60/4 50/65/4 49/64/4 46/61/4
-f 58/69/1 57/70/1 61/71/1 62/72/1
-f 51/73/7 55/74/7 56/75/7 52/76/7
-f 52/77/3 56/78/3 57/79/3 53/80/3
-f 53/81/6 57/70/6 58/69/6 54/82/6
-f 55/83/2 51/84/2 54/85/2 58/86/2
-f 62/87/2 59/88/2 55/83/2 58/86/2
-f 55/74/5 59/89/5 60/90/5 56/75/5
-f 57/79/3 56/78/3 60/91/3 61/92/3
-f 62/72/9 61/71/9 63/93/9 64/94/9
-f 60/90/8 59/89/8 65/95/8 66/96/8
-f 64/94/1 63/93/1 67/97/1 68/98/1
-f 66/96/5 65/95/5 69/99/5 70/100/5
-f 67/97/4 70/100/4 69/99/4 68/98/4
-f 59/88/2 62/87/2 64/101/2 68/98/2 69/99/2 65/102/2
-f 60/91/3 66/103/3 70/100/3 67/97/3 63/104/3 61/92/3
-f 75/105/4 78/106/4 77/107/4 76/108/4
-f 71/109/2 75/105/2 76/108/2 72/110/2
-f 72/111/5 76/108/5 77/107/5 73/112/5
-f 73/113/3 77/107/3 78/106/3 74/114/3
-f 75/105/1 71/115/1 74/116/1 78/106/1
-f 83/117/4 86/118/4 85/119/4 84/120/4
-f 79/121/3 83/117/3 84/120/3 80/122/3
-f 80/123/1 84/120/1 85/119/1 81/124/1
-f 81/125/2 85/119/2 86/118/2 82/126/2
-f 83/117/5 79/127/5 82/128/5 86/118/5
-f 91/129/4 94/130/4 93/131/4 92/132/4
-f 87/133/2 91/129/2 92/132/2 88/134/2
-f 88/135/5 92/132/5 93/131/5 89/136/5
-f 89/137/3 93/131/3 94/130/3 90/138/3
-f 91/129/1 87/139/1 90/140/1 94/130/1
-f 96/141/5 95/142/5 97/143/5 98/144/5
-f 98/144/2 97/145/2 101/146/2 102/147/2
-f 100/148/3 99/149/3 95/150/3 96/141/3
-f 100/148/4 96/141/4 98/144/4 102/147/4
-g dtrack_vst32_Cube.028_SlopeGravelMaterial
-f 3/151/3 6/152/3 5/153/3 2/154/3
-f 4/155/2 1/156/2 104/157/2 106/158/2
-f 1/159/5 3/151/5 2/160/5
-f 6/152/1 4/161/1 5/162/1
-f 4/161/4 6/152/4 3/151/4 1/159/4
-f 104/163/11 103/164/11 105/165/11 106/166/11
-f 5/167/1 4/168/1 106/169/1 105/170/1
-f 2/171/3 5/172/3 105/173/3 103/174/3
-f 1/175/5 2/176/5 103/177/5 104/178/5
diff --git a/advtrains/advtrains/models/advtrains_dtrack_vst33.obj b/advtrains/advtrains/models/advtrains_dtrack_vst33.obj
deleted file mode 100644
index 8cb5f04..0000000
--- a/advtrains/advtrains/models/advtrains_dtrack_vst33.obj
+++ /dev/null
@@ -1,388 +0,0 @@
-# Blender v2.78 (sub 0) OBJ File: 'rail_redo.blend'
-# www.blender.org
-o dtrack_vst33_Cube.030
-v 0.753760 0.166667 -0.500000
-v 0.753760 0.166667 0.500000
-v 0.753760 0.500000 0.500000
-v -0.753760 0.166667 -0.500000
-v -0.753760 0.166667 0.500000
-v -0.753760 0.500000 0.500000
-v 0.329165 0.358626 0.171599
-v 0.329165 0.522686 0.171599
-v 0.329165 0.244227 -0.171599
-v 0.329165 0.408287 -0.171599
-v 0.462280 0.358626 0.171599
-v 0.462280 0.522686 0.171599
-v 0.462280 0.244227 -0.171599
-v 0.462280 0.408287 -0.171599
-v 0.412289 0.540000 0.500000
-v 0.412289 0.206667 -0.500000
-v 0.560528 0.206667 -0.500000
-v 0.560528 0.540000 0.500000
-v 0.474055 0.560000 0.500000
-v 0.474055 0.226667 -0.500000
-v 0.498762 0.226667 -0.500000
-v 0.498762 0.560000 0.500000
-v 0.474055 0.610000 0.500000
-v 0.474055 0.276667 -0.500000
-v 0.498762 0.276667 -0.500000
-v 0.498762 0.610000 0.500000
-v 0.529645 0.281667 -0.500000
-v 0.529645 0.615000 0.500000
-v 0.443172 0.615000 0.500000
-v 0.443172 0.281667 -0.500000
-v 0.529645 0.306667 -0.500000
-v 0.529645 0.640000 0.500000
-v 0.443172 0.640000 0.500000
-v 0.443172 0.306667 -0.500000
-v 0.741194 0.468333 0.435000
-v -0.741194 0.468333 0.435000
-v -0.741194 0.428333 0.315000
-v 0.741194 0.428333 0.315000
-v 0.741193 0.518333 0.435000
-v -0.741194 0.518333 0.435000
-v -0.741194 0.478333 0.315000
-v 0.741194 0.478333 0.315000
-v -0.011733 3.379186 0.500000
-v -0.011732 3.045852 -0.500001
-v -0.011733 3.400814 0.500000
-v -0.011732 3.067481 -0.500000
-v 0.011732 3.045853 -0.500000
-v 0.011732 3.379186 0.500000
-v 0.011732 3.067481 -0.500000
-v 0.011732 3.400814 0.500000
-v -0.412289 0.206667 -0.500000
-v -0.412289 0.540000 0.500000
-v -0.560528 0.540000 0.500000
-v -0.560528 0.206667 -0.500000
-v -0.474055 0.226667 -0.500000
-v -0.474055 0.560000 0.500000
-v -0.498762 0.560000 0.500000
-v -0.498762 0.226667 -0.500000
-v -0.474055 0.276667 -0.500000
-v -0.474055 0.610000 0.500000
-v -0.498762 0.610000 0.500000
-v -0.498762 0.276667 -0.500000
-v -0.529645 0.615000 0.500000
-v -0.529645 0.281667 -0.500000
-v -0.443172 0.281667 -0.500000
-v -0.443172 0.615000 0.500000
-v -0.529645 0.640000 0.500000
-v -0.529645 0.306667 -0.500000
-v -0.443172 0.306667 -0.500000
-v -0.443172 0.640000 0.500000
-v -0.741194 0.178333 -0.435000
-v 0.741194 0.178333 -0.435000
-v 0.741194 0.218333 -0.315000
-v -0.741194 0.218333 -0.315000
-v -0.741193 0.228333 -0.435000
-v 0.741194 0.228333 -0.435000
-v 0.741194 0.268333 -0.315000
-v -0.741194 0.268333 -0.315000
-v 0.741194 0.385954 0.187862
-v -0.741194 0.385954 0.187862
-v -0.741194 0.345954 0.067862
-v 0.741194 0.345954 0.067862
-v 0.741193 0.435954 0.187862
-v -0.741194 0.435954 0.187862
-v -0.741194 0.395954 0.067862
-v 0.741194 0.395954 0.067862
-v -0.741194 0.260713 -0.187862
-v 0.741194 0.260713 -0.187862
-v 0.741194 0.300713 -0.067862
-v -0.741194 0.300713 -0.067862
-v -0.741193 0.310713 -0.187862
-v 0.741194 0.310713 -0.187862
-v 0.741194 0.350713 -0.067862
-v -0.741194 0.350713 -0.067862
-v -0.329165 0.358626 0.171599
-v -0.329165 0.522687 0.171599
-v -0.329165 0.244227 -0.171599
-v -0.329165 0.408287 -0.171599
-v -0.462280 0.358626 0.171599
-v -0.462280 0.522686 0.171599
-v -0.462280 0.244227 -0.171599
-v -0.462280 0.408287 -0.171599
-v 0.753760 -0.166667 0.500000
-v 0.753760 -0.166667 -0.500000
-v -0.753760 -0.166667 0.500000
-v -0.753760 -0.166667 -0.500000
-v 0.753760 -0.500000 0.500000
-v 0.753760 -0.500000 -0.500000
-v -0.753760 -0.500000 0.500000
-v -0.753760 -0.500000 -0.500000
-vt 0.7427 0.1169
-vt 0.7427 0.3317
-vt 0.6400 0.3317
-vt 0.6400 0.1169
-vt 0.8260 0.3317
-vt 0.8260 0.4343
-vt 0.7427 0.4343
-vt 0.8260 0.1169
-vt 0.7427 0.0142
-vt 0.8260 0.0142
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.6554 0.3627
-vt 0.6690 0.3627
-vt 0.6690 0.9885
-vt 0.6554 0.9885
-vt 0.6972 0.9885
-vt 0.6837 0.9885
-vt 0.6837 0.3627
-vt 0.6972 0.3627
-vt 0.7119 0.3627
-vt 0.7119 0.9885
-vt 0.5691 0.2971
-vt 0.5691 0.9229
-vt 0.5378 0.9229
-vt 0.5378 0.2971
-vt 0.3413 0.2971
-vt 0.3819 0.2971
-vt 0.3819 0.9229
-vt 0.3413 0.9229
-vt 0.4291 0.9855
-vt 0.4678 0.9730
-vt 0.4833 0.9730
-vt 0.5219 0.9855
-vt 0.6097 0.9229
-vt 0.6097 0.2971
-vt 0.4678 0.2470
-vt 0.4291 0.2345
-vt 0.5219 0.2345
-vt 0.4833 0.2470
-vt 0.4833 0.2783
-vt 0.4678 0.2783
-vt 0.4132 0.2971
-vt 0.4132 0.9229
-vt 0.4678 0.9417
-vt 0.4833 0.9417
-vt 0.5182 0.9229
-vt 0.5182 0.2971
-vt 0.4328 0.2971
-vt 0.4328 0.9229
-vt 0.5026 0.9229
-vt 0.5026 0.2971
-vt 0.4485 0.2971
-vt 0.4485 0.9229
-vt 0.5026 0.2814
-vt 0.4485 0.2814
-vt 0.4485 0.9386
-vt 0.5026 0.9386
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.9588 0.9625
-vt 0.8837 0.9625
-vt 0.8837 0.0348
-vt 0.9588 0.0348
-vt 0.9901 0.9625
-vt 0.9901 0.0348
-vt 0.9588 0.0035
-vt 0.8837 0.0035
-vt 0.8524 0.0348
-vt 0.8524 0.9625
-vt 0.9588 0.9938
-vt 0.8837 0.9938
-vt 0.7427 0.1169
-vt 0.6400 0.1169
-vt 0.6400 0.3317
-vt 0.7427 0.3317
-vt 0.7427 0.4343
-vt 0.8260 0.4343
-vt 0.8260 0.3317
-vt 0.8260 0.1169
-vt 0.8260 0.0142
-vt 0.7427 0.0142
-vt 1.2190 -0.0648
-vt -0.3252 -0.0648
-vt -0.3252 -0.4063
-vt 1.2190 -0.4063
-vt 1.2222 1.0112
-vt -0.3220 1.0112
-vt -0.3220 0.6697
-vt 1.2222 0.6697
-vt 1.2190 1.0149
-vt 1.5430 0.0432
-vt -0.3252 1.0149
-vt -0.6491 0.0432
-vt -0.3220 0.3283
-vt 1.2222 0.3283
-vt -0.3240 0.3223
-vt 0.7003 0.3223
-vt 0.7003 0.6637
-vt -0.3240 0.6637
-vt 1.2202 1.0043
-vt -0.3240 1.0043
-vt -0.3240 0.6629
-vt 1.2202 0.6629
-vt 0.6998 1.0039
-vt -0.3245 1.0039
-vt -0.3245 0.6625
-vt 0.6998 0.6625
-vt -0.3246 1.0127
-vt -0.3246 -0.0117
-vt 1.2196 -0.0117
-vt 1.2196 1.0127
-vt 0.7003 1.0051
-vt -0.3240 1.0051
-vt -0.3240 0.3214
-vt 1.2202 0.3214
-vt -0.3245 0.3210
-vt 0.6998 0.3210
-vn -1.0000 0.0000 -0.0000
-vn 0.0000 0.0000 -1.0000
-vn -0.0000 0.0000 1.0000
-vn 0.0000 0.9487 -0.3162
-vn 1.0000 0.0000 0.0000
-vn -0.2936 0.9069 -0.3023
-vn 0.2936 0.9069 -0.3023
-vn 0.1518 -0.9377 0.3126
-vn -0.1518 -0.9377 0.3126
-vn 0.0000 -0.9487 0.3162
-vn 0.0000 -1.0000 0.0000
-g dtrack_vst33_Cube.030_SlopeRailMaterial
-s off
-f 8/1/1 10/2/1 9/3/1 7/4/1
-f 10/2/2 14/5/2 13/6/2 9/7/2
-f 12/8/3 8/1/3 7/9/3 11/10/3
-f 12/8/4 14/5/4 10/2/4 8/1/4
-f 22/11/5 21/12/5 25/13/5 26/14/5
-f 15/15/6 19/16/6 20/17/6 16/18/6
-f 16/19/2 20/20/2 21/21/2 17/22/2
-f 17/23/7 21/12/7 22/11/7 18/24/7
-f 19/25/3 15/26/3 18/27/3 22/28/3
-f 26/29/3 23/30/3 19/25/3 22/28/3
-f 19/16/1 23/31/1 24/32/1 20/17/1
-f 21/21/2 20/20/2 24/33/2 25/34/2
-f 26/14/8 25/13/8 27/35/8 28/36/8
-f 24/32/9 23/31/9 29/37/9 30/38/9
-f 28/36/5 27/35/5 31/39/5 32/40/5
-f 30/38/1 29/37/1 33/41/1 34/42/1
-f 31/39/4 34/42/4 33/41/4 32/40/4
-f 23/30/3 26/29/3 28/43/3 32/40/3 33/41/3 29/44/3
-f 24/33/2 30/45/2 34/42/2 31/39/2 27/46/2 25/34/2
-f 39/47/4 42/48/4 41/49/4 40/50/4
-f 35/51/3 39/47/3 40/50/3 36/52/3
-f 36/53/1 40/50/1 41/49/1 37/54/1
-f 37/55/2 41/49/2 42/48/2 38/56/2
-f 39/47/5 35/57/5 38/58/5 42/48/5
-f 43/59/1 45/60/1 46/61/1 44/62/1
-f 47/63/5 49/64/5 50/65/5 48/66/5
-f 43/67/10 44/68/10 47/63/10 48/66/10
-f 45/60/4 50/65/4 49/64/4 46/61/4
-f 58/69/1 57/70/1 61/71/1 62/72/1
-f 51/73/7 55/74/7 56/75/7 52/76/7
-f 52/77/3 56/78/3 57/79/3 53/80/3
-f 53/81/6 57/70/6 58/69/6 54/82/6
-f 55/83/2 51/84/2 54/85/2 58/86/2
-f 62/87/2 59/88/2 55/83/2 58/86/2
-f 55/74/5 59/89/5 60/90/5 56/75/5
-f 57/79/3 56/78/3 60/91/3 61/92/3
-f 62/72/9 61/71/9 63/93/9 64/94/9
-f 60/90/8 59/89/8 65/95/8 66/96/8
-f 64/94/1 63/93/1 67/97/1 68/98/1
-f 66/96/5 65/95/5 69/99/5 70/100/5
-f 67/97/4 70/100/4 69/99/4 68/98/4
-f 59/88/2 62/87/2 64/101/2 68/98/2 69/99/2 65/102/2
-f 60/91/3 66/103/3 70/100/3 67/97/3 63/104/3 61/92/3
-f 75/105/4 78/106/4 77/107/4 76/108/4
-f 71/109/2 75/105/2 76/108/2 72/110/2
-f 72/111/5 76/108/5 77/107/5 73/112/5
-f 73/113/3 77/107/3 78/106/3 74/114/3
-f 75/105/1 71/115/1 74/116/1 78/106/1
-f 83/117/4 86/118/4 85/119/4 84/120/4
-f 79/121/3 83/117/3 84/120/3 80/122/3
-f 80/123/1 84/120/1 85/119/1 81/124/1
-f 81/125/2 85/119/2 86/118/2 82/126/2
-f 83/117/5 79/127/5 82/128/5 86/118/5
-f 91/129/4 94/130/4 93/131/4 92/132/4
-f 87/133/2 91/129/2 92/132/2 88/134/2
-f 88/135/5 92/132/5 93/131/5 89/136/5
-f 89/137/3 93/131/3 94/130/3 90/138/3
-f 91/129/1 87/139/1 90/140/1 94/130/1
-f 96/141/5 95/142/5 97/143/5 98/144/5
-f 98/144/2 97/145/2 101/146/2 102/147/2
-f 100/148/3 99/149/3 95/150/3 96/141/3
-f 100/148/4 96/141/4 98/144/4 102/147/4
-g dtrack_vst33_Cube.030_SlopeGravelMaterial
-f 3/151/3 6/152/3 5/153/3 2/154/3
-f 4/155/2 1/156/2 104/157/2 106/158/2
-f 1/159/5 3/151/5 2/160/5
-f 6/152/1 4/161/1 5/162/1
-f 4/161/4 6/152/4 3/151/4 1/159/4
-f 106/158/2 104/157/2 108/163/2 110/164/2
-f 5/165/1 4/166/1 106/167/1 105/168/1
-f 2/169/3 5/170/3 105/171/3 103/172/3
-f 1/173/5 2/174/5 103/175/5 104/176/5
-f 108/177/11 107/178/11 109/179/11 110/180/11
-f 105/168/1 106/167/1 110/181/1 109/182/1
-f 103/172/3 105/171/3 109/183/3 107/184/3
-f 104/176/5 103/175/5 107/185/5 108/186/5
diff --git a/advtrains/advtrains/models/advtrains_modernwagon.b3d b/advtrains/advtrains/models/advtrains_modernwagon.b3d
deleted file mode 100644
index aacddca..0000000
--- a/advtrains/advtrains/models/advtrains_modernwagon.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_retrosignal_off.b3d b/advtrains/advtrains/models/advtrains_retrosignal_off.b3d
deleted file mode 100644
index 3d231dd..0000000
--- a/advtrains/advtrains/models/advtrains_retrosignal_off.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_retrosignal_off_30.b3d b/advtrains/advtrains/models/advtrains_retrosignal_off_30.b3d
deleted file mode 100644
index da258e1..0000000
--- a/advtrains/advtrains/models/advtrains_retrosignal_off_30.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_retrosignal_off_45.b3d b/advtrains/advtrains/models/advtrains_retrosignal_off_45.b3d
deleted file mode 100644
index 338224a..0000000
--- a/advtrains/advtrains/models/advtrains_retrosignal_off_45.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_retrosignal_off_60.b3d b/advtrains/advtrains/models/advtrains_retrosignal_off_60.b3d
deleted file mode 100644
index c560ca1..0000000
--- a/advtrains/advtrains/models/advtrains_retrosignal_off_60.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_retrosignal_on.b3d b/advtrains/advtrains/models/advtrains_retrosignal_on.b3d
deleted file mode 100644
index 3d19439..0000000
--- a/advtrains/advtrains/models/advtrains_retrosignal_on.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_retrosignal_on_30.b3d b/advtrains/advtrains/models/advtrains_retrosignal_on_30.b3d
deleted file mode 100644
index 98f8a92..0000000
--- a/advtrains/advtrains/models/advtrains_retrosignal_on_30.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_retrosignal_on_45.b3d b/advtrains/advtrains/models/advtrains_retrosignal_on_45.b3d
deleted file mode 100644
index 414e121..0000000
--- a/advtrains/advtrains/models/advtrains_retrosignal_on_45.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_retrosignal_on_60.b3d b/advtrains/advtrains/models/advtrains_retrosignal_on_60.b3d
deleted file mode 100644
index a51529a..0000000
--- a/advtrains/advtrains/models/advtrains_retrosignal_on_60.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_signal.b3d b/advtrains/advtrains/models/advtrains_signal.b3d
deleted file mode 100644
index 7f69560..0000000
--- a/advtrains/advtrains/models/advtrains_signal.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_signal_30.b3d b/advtrains/advtrains/models/advtrains_signal_30.b3d
deleted file mode 100644
index 0b949a7..0000000
--- a/advtrains/advtrains/models/advtrains_signal_30.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_signal_45.b3d b/advtrains/advtrains/models/advtrains_signal_45.b3d
deleted file mode 100644
index ccaebf4..0000000
--- a/advtrains/advtrains/models/advtrains_signal_45.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_signal_60.b3d b/advtrains/advtrains/models/advtrains_signal_60.b3d
deleted file mode 100644
index cf41e6d..0000000
--- a/advtrains/advtrains/models/advtrains_signal_60.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_signal_wall_l.b3d b/advtrains/advtrains/models/advtrains_signal_wall_l.b3d
deleted file mode 100644
index b1bcbcf..0000000
--- a/advtrains/advtrains/models/advtrains_signal_wall_l.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_signal_wall_r.b3d b/advtrains/advtrains/models/advtrains_signal_wall_r.b3d
deleted file mode 100644
index cf26389..0000000
--- a/advtrains/advtrains/models/advtrains_signal_wall_r.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_signal_wall_t.b3d b/advtrains/advtrains/models/advtrains_signal_wall_t.b3d
deleted file mode 100644
index 30e77f6..0000000
--- a/advtrains/advtrains/models/advtrains_signal_wall_t.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_track_cr.b3d b/advtrains/advtrains/models/advtrains_track_cr.b3d
deleted file mode 100644
index b0f5e4b..0000000
--- a/advtrains/advtrains/models/advtrains_track_cr.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_track_st.b3d b/advtrains/advtrains/models/advtrains_track_st.b3d
deleted file mode 100644
index 10b5d90..0000000
--- a/advtrains/advtrains/models/advtrains_track_st.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/advtrains_track_st_45.b3d b/advtrains/advtrains/models/advtrains_track_st_45.b3d
deleted file mode 100644
index 32505a1..0000000
--- a/advtrains/advtrains/models/advtrains_track_st_45.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/models/trackplane.b3d b/advtrains/advtrains/models/trackplane.b3d
deleted file mode 100644
index b4728c3..0000000
--- a/advtrains/advtrains/models/trackplane.b3d
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/nodedb.lua b/advtrains/advtrains/nodedb.lua
deleted file mode 100644
index 862fd53..0000000
--- a/advtrains/advtrains/nodedb.lua
+++ /dev/null
@@ -1,307 +0,0 @@
---nodedb.lua
---database of all nodes that have 'save_in_nodedb' field set to true in node definition
-
-
---serialization format:
---(2byte z) (2byte y) (2byte x) (2byte contentid)
---contentid := (14bit nodeid, 2bit param2)
-
-local function int_to_bytes(i)
- local x=i+32768--clip to positive integers
- local cH = math.floor(x / 256) % 256;
- local cL = math.floor(x ) % 256;
- return(string.char(cH, cL));
-end
-local function bytes_to_int(bytes)
- local t={string.byte(bytes,1,-1)}
- local n =
- t[1] * 256 +
- t[2]
- return n-32768
-end
-local function l2b(x)
- return x%4
-end
-local function u14b(x)
- return math.floor(x/4)
-end
-local ndb={}
-
---local variables for performance
-local ndb_nodeids={}
-local ndb_nodes={}
-
-local function ndbget(x,y,z)
- local ny=ndb_nodes[y]
- if ny then
- local nx=ny[x]
- if nx then
- return nx[z]
- end
- end
- return nil
-end
-local function ndbset(x,y,z,v)
- if not ndb_nodes[y] then
- ndb_nodes[y]={}
- end
- if not ndb_nodes[y][x] then
- ndb_nodes[y][x]={}
- end
- ndb_nodes[y][x][z]=v
-end
-
-
-local path=minetest.get_worldpath().."/advtrains_ndb2"
---load
---nodeids get loaded by advtrains init.lua and passed here
-function ndb.load_data(data)
- ndb_nodeids = data and data.nodeids or {}
- local file, err = io.open(path, "r")
- if not file then
- atwarn("Couldn't load the node database: ", err or "Unknown Error")
- else
- local cnt=0
- local hst_z=file:read(2)
- local hst_y=file:read(2)
- local hst_x=file:read(2)
- local cid=file:read(2)
- while hst_z and hst_y and hst_x and cid and #hst_z==2 and #hst_y==2 and #hst_x==2 and #cid==2 do
- ndbset(bytes_to_int(hst_x), bytes_to_int(hst_y), bytes_to_int(hst_z), bytes_to_int(cid))
- cnt=cnt+1
- hst_z=file:read(2)
- hst_y=file:read(2)
- hst_x=file:read(2)
- cid=file:read(2)
- end
- atlog("nodedb: read", cnt, "nodes.")
- file:close()
- end
-end
-
---save
-function ndb.save_data()
- local file, err = io.open(path, "w")
- if not file then
- atwarn("Couldn't save the node database: ", err or "Unknown Error")
- else
- for y, ny in pairs(ndb_nodes) do
- for x, nx in pairs(ny) do
- for z, cid in pairs(nx) do
- file:write(int_to_bytes(z))
- file:write(int_to_bytes(y))
- file:write(int_to_bytes(x))
- file:write(int_to_bytes(cid))
- end
- end
- end
- file:close()
- end
- return {nodeids = ndb_nodeids}
-end
-
---function to get node. track database is not helpful here.
-function ndb.get_node_or_nil(pos)
- local node=minetest.get_node_or_nil(pos)
- if node then
- return node
- else
- --maybe we have the node in the database...
- return ndb.get_node_raw(pos)
- end
- atprint("ndb.get_node_or_nil",pos,"not found")
-end
-function ndb.get_node(pos)
- local n=ndb.get_node_or_nil(pos)
- if not n then
- return {name="ignore", param2=0}
- end
- return n
-end
-function ndb.get_node_raw(pos)
- local cid=ndbget(pos.x, pos.y, pos.z)
- if cid then
- local nodeid = ndb_nodeids[u14b(cid)]
- if nodeid then
- return {name=nodeid, param2 = l2b(cid)}
- end
- end
- return nil
-end
-
-
-function ndb.swap_node(pos, node)
- minetest.swap_node(pos, node)
- ndb.update(pos, node)
-end
-
-function ndb.update(pos, pnode)
- local node = pnode or minetest.get_node_or_nil(pos)
- if not node or node.name=="ignore" then return end
- if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].groups.save_in_nodedb then
- local nid
- for tnid, nname in pairs(ndb_nodeids) do
- if nname==node.name then
- nid=tnid
- end
- end
- if not nid then
- nid=#ndb_nodeids+1
- ndb_nodeids[nid]=node.name
- end
- ndbset(pos.x, pos.y, pos.z, (nid * 4) + (l2b(node.param2 or 0)) )
- --atprint("nodedb: updating node", pos, "stored nid",nid,"assigned",ndb_nodeids[nid],"resulting cid",ndb_nodes[hash])
- else
- --at this position there is no longer a node that needs to be tracked.
- ndbset(pos.x, pos.y, pos.z, nil)
- end
-end
-
-function ndb.clear(pos)
- ndbset(pos.x, pos.y, pos.z, nil)
-end
-
-
---get_node with pseudoload. now we only need track data, so we can use the trackdb as second fallback
---nothing new will be saved inside the trackdb.
---returns:
---true, conn1, conn2, rely1, rely2, railheight in case everything's right.
---false if it's not a rail or the train does not drive on this rail, but it is loaded or
---nil if the node is neither loaded nor in trackdb
---the distraction between false and nil will be needed only in special cases.(train initpos)
-function advtrains.get_rail_info_at(pos, drives_on)
- local rdp=advtrains.round_vector_floor_y(pos)
-
- local node=ndb.get_node_or_nil(rdp)
-
- --still no node?
- --advtrains.trackdb is nil when there's no data available.
- if not node then
- if advtrains.trackdb then
- --try raildb (see trackdb_legacy.lua)
- local dbe=(advtrains.trackdb[rdp.y] and advtrains.trackdb[rdp.y][rdp.x] and advtrains.trackdb[rdp.y][rdp.x][rdp.z])
- if dbe then
- for tt,_ in pairs(drives_on) do
- if not dbe.tracktype or tt==dbe.tracktype then
- return true, dbe.conn1, dbe.conn2, dbe.rely1 or 0, dbe.rely2 or 0, dbe.railheight or 0
- end
- end
- end
- end
- return nil
- end
- local nodename=node.name
- if(not advtrains.is_track_and_drives_on(nodename, drives_on)) then
- return false
- end
- local conn1, conn2, rely1, rely2, railheight, tracktype=advtrains.get_track_connections(node.name, node.param2)
-
- return true, conn1, conn2, rely1, rely2, railheight
-end
-
-ndb.run_lbm = function(pos, node)
- return advtrains.pcall(function()
- local cid=ndbget(pos.x, pos.y, pos.z)
- if cid then
- --if in database, detect changes and apply.
- local nodeid = ndb_nodeids[u14b(cid)]
- local param2 = l2b(cid)
- if not nodeid then
- --something went wrong
- atwarn("Node Database corruption, couldn't determine node to set at", pos)
- ndb.update(pos, node)
- else
- if (nodeid~=node.name or param2~=node.param2) then
- atprint("nodedb: lbm replaced", pos, "with nodeid", nodeid, "param2", param2, "cid is", cid)
- minetest.swap_node(pos, {name=nodeid, param2 = param2})
- local ndef=minetest.registered_nodes[nodeid]
- if ndef and ndef.on_updated_from_nodedb then
- ndef.on_updated_from_nodedb(pos, node)
- end
- return true
- end
- end
- else
- --if not in database, take it.
- atlog("Node Database:", pos, "was not found in the database, have you used worldedit?")
- ndb.update(pos, node)
- end
- return false
- end)
-end
-
-
-minetest.register_lbm({
- name = "advtrains:nodedb_on_load_update",
- nodenames = {"group:save_in_nodedb"},
- run_at_every_load = true,
- run_on_every_load = true,
- action = ndb.run_lbm,
- interval=30,
- chance=1,
- })
-
---used when restoring stuff after a crash
-ndb.restore_all = function()
- atwarn("Updating the map from the nodedb, this may take a while")
- local cnt=0
- for y, ny in pairs(ndb_nodes) do
- for x, nx in pairs(ny) do
- for z, _ in pairs(nx) do
- local pos={x=x, y=y, z=z}
- local node=minetest.get_node_or_nil(pos)
- if node then
- local ori_ndef=minetest.registered_nodes[node.name]
- local ndbnode=ndb.get_node_raw(pos)
- if ori_ndef and ori_ndef.groups.save_in_nodedb then --check if this node has been worldedited, and don't replace then
- if (ndbnode.name~=node.name or ndbnode.param2~=node.param2) then
- minetest.swap_node(pos, ndbnode)
- atwarn("Replaced",node.name,"@",pos,"with",ndbnode.name)
- end
- else
- ndb.clear(pos)
- atwarn("Found ghost node (former",ndbnode.name,") @",pos,"deleting")
- end
- end
- end
- end
- end
- atwarn("Updated",cnt,"nodes")
-end
-
-minetest.register_on_dignode(function(pos, oldnode, digger)
- return advtrains.pcall(function()
- ndb.clear(pos)
- end)
-end)
-
-function ndb.get_nodes()
- return ndb_nodes
-end
-function ndb.get_nodeids()
- return ndb_nodeids
-end
-
-
-advtrains.ndb=ndb
-
-local ptime=0
-
-minetest.register_chatcommand("at_sync_ndb",
- {
- params = "", -- Short parameter description
- description = "Write node db back to map and find ghost nodes", -- Full description
- privs = {train_operator=true, worldedit=true}, -- Require the "privs" privilege to run
- func = function(name, param)
- return advtrains.pcall(function()
- if not minetest.check_player_privs(name, {server=true}) and os.time() < ptime+30 then
- return false, "Please wait at least 30s from the previous execution of /at_restore_ndb!"
- end
- ndb.restore_all()
- ptime=os.time()
- return true
- end)
- end,
- privs = {train_operator=true}, -- Require the "privs" privilege to run
- })
-
diff --git a/advtrains/advtrains/settingtypes.txt b/advtrains/advtrains/settingtypes.txt
deleted file mode 100644
index 60f8477..0000000
--- a/advtrains/advtrains/settingtypes.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Disable the train collision behavior. Trains will never collide and just drive through each other.
-# Note that this makes coupling trains impossible, and introduces 'interesting' behavior with detector and ATC rails.
-# Also, it is very hard to separate two subway trains that are stuck inside each other, since it can be impossible to access the driver seat.
-advtrains_disable_collisions (Disable train collisions) bool false
-# Enable the debug ring buffer
-# This has no effect on the user experience, except decreased performance. Debug outputs are saved in a ring buffer to be printed when an error occurs.
-# You probably want to leave this setting set to false.
-advtrains_enable_debugging (Enable debugging) bool false \ No newline at end of file
diff --git a/advtrains/advtrains/signals.lua b/advtrains/advtrains/signals.lua
deleted file mode 100644
index 5c6e484..0000000
--- a/advtrains/advtrains/signals.lua
+++ /dev/null
@@ -1,227 +0,0 @@
---advtrains by orwell96
---signals.lua
-
---this code /should/ work but does not.
-local mrules_wallsignal = advtrains.meseconrules
-
-for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red", als="green"}}) do
-
- advtrains.trackplacer.register_tracktype("advtrains:retrosignal", "")
- advtrains.trackplacer.register_tracktype("advtrains:signal", "")
-
- for rotid, rotation in ipairs({"", "_30", "_45", "_60"}) do
- local crea=1
- if rotid==1 and r=="off" then crea=0 end
-
- minetest.register_node("advtrains:retrosignal_"..r..rotation, {
- drawtype = "mesh",
- paramtype="light",
- paramtype2="facedir",
- walkable = false,
- selection_box = {
- type = "fixed",
- fixed = {-1/4, -1/2, -1/4, 1/4, 2, 1/4},
- },
- mesh = "advtrains_retrosignal_"..r..rotation..".b3d",
- tiles = {"advtrains_retrosignal.png"},
- inventory_image="advtrains_retrosignal_inv.png",
- drop="advtrains:retrosignal_off",
- description=attrans("Lampless Signal (@1)", attrans(r..rotation)),
- sunlight_propagates=true,
- groups = {
- cracky=3,
- not_blocking_trains=1,
- not_in_creative_inventory=crea,
- save_in_nodedb=1,
- },
- mesecons = {effector = {
- rules=advtrains.meseconrules,
- ["action_"..f.as] = function (pos, node)
- advtrains.ndb.swap_node(pos, {name = "advtrains:retrosignal_"..f.as..rotation, param2 = node.param2})
- end
- }},
- on_rightclick=function(pos, node, player)
- if minetest.check_player_privs(player:get_player_name(), {train_operator=true}) then
- advtrains.ndb.swap_node(pos, {name = "advtrains:retrosignal_"..f.as..rotation, param2 = node.param2})
- end
- end,
- })
- advtrains.trackplacer.add_worked("advtrains:retrosignal", r, rotation, nil)
- minetest.register_node("advtrains:signal_"..r..rotation, {
- drawtype = "mesh",
- paramtype="light",
- paramtype2="facedir",
- walkable = false,
- selection_box = {
- type = "fixed",
- fixed = {-1/4, -1/2, -1/4, 1/4, 2, 1/4},
- },
- mesh = "advtrains_signal"..rotation..".b3d",
- tiles = {"advtrains_signal_"..r..".png"},
- inventory_image="advtrains_signal_inv.png",
- drop="advtrains:signal_off",
- description=attrans("Signal (@1)", attrans(r..rotation)),
- groups = {
- cracky=3,
- not_blocking_trains=1,
- not_in_creative_inventory=crea,
- save_in_nodedb=1,
- },
- light_source = 1,
- sunlight_propagates=true,
- mesecons = {effector = {
- rules=advtrains.meseconrules,
- ["action_"..f.as] = function (pos, node)
- advtrains.ndb.swap_node(pos, {name = "advtrains:signal_"..f.as..rotation, param2 = node.param2})
- end
- }},
- luaautomation = {
- getstate = f.ls,
- setstate = function(pos, node, newstate)
- if newstate == f.als then
- advtrains.ndb.swap_node(pos, {name = "advtrains:signal_"..f.as..rotation, param2 = node.param2})
- end
- end,
- },
- on_rightclick=function(pos, node, player)
- if minetest.check_player_privs(player:get_player_name(), {train_operator=true}) then
- advtrains.ndb.swap_node(pos, {name = "advtrains:signal_"..f.as..rotation, param2 = node.param2})
- end
- end,
- })
- advtrains.trackplacer.add_worked("advtrains:signal", r, rotation, nil)
- end
-
- local crea=1
- if r=="off" then crea=0 end
-
- --tunnel signals. no rotations.
- for loc, sbox in pairs({l={-1/2, -1/2, -1/4, 0, 1/2, 1/4}, r={0, -1/2, -1/4, 1/2, 1/2, 1/4}, t={-1/2, 0, -1/4, 1/2, 1/2, 1/4}}) do
- minetest.register_node("advtrains:signal_wall_"..loc.."_"..r, {
- drawtype = "mesh",
- paramtype="light",
- paramtype2="facedir",
- walkable = false,
- selection_box = {
- type = "fixed",
- fixed = sbox,
- },
- mesh = "advtrains_signal_wall_"..loc..".b3d",
- tiles = {"advtrains_signal_wall_"..r..".png"},
- drop="advtrains:signal_wall_"..loc.."_off",
- description=attrans("Wallmounted Signal ("..loc..")"),
- groups = {
- cracky=3,
- not_blocking_trains=1,
- not_in_creative_inventory=crea,
- save_in_nodedb=1,
- },
- light_source = 1,
- sunlight_propagates=true,
- mesecons = {effector = {
- rules = mrules_wallsignal,
- ["action_"..f.as] = function (pos, node)
- advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2})
- end
- }},
- luaautomation = {
- getstate = f.ls,
- setstate = function(pos, node, newstate)
- if newstate == f.als then
- advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2})
- end
- end,
- },
- on_rightclick=function(pos, node, player)
- if minetest.check_player_privs(player:get_player_name(), {train_operator=true}) then
- advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2})
- end
- end,
- })
- end
-end
-
--- level crossing
--- german version (Andrew's Cross)
-minetest.register_node("advtrains:across_off", {
- drawtype = "mesh",
- paramtype="light",
- paramtype2="facedir",
- walkable = false,
- selection_box = {
- type = "fixed",
- fixed = {-1/4, -1/2, -1/2, 1/4, 1.5, 0},
- },
- mesh = "advtrains_across.obj",
- tiles = {"advtrains_across.png"},
- drop="advtrains:across_off",
- description=attrans("Andrew's Cross"),
- groups = {
- cracky=3,
- not_blocking_trains=1,
- save_in_nodedb=1,
- not_in_creative_inventory=nil,
- },
- light_source = 1,
- sunlight_propagates=true,
- mesecons = {effector = {
- rules = advtrains.meseconrules,
- action_on = function (pos, node)
- advtrains.ndb.swap_node(pos, {name = "advtrains:across_on", param2 = node.param2})
- end
- }},
- luaautomation = {
- getstate = "off",
- setstate = function(pos, node, newstate)
- if newstate == "on" then
- advtrains.ndb.swap_node(pos, {name = "advtrains:across_on", param2 = node.param2})
- end
- end,
- },
- on_rightclick=function(pos, node, player)
- if minetest.check_player_privs(player:get_player_name(), {train_operator=true}) then
- advtrains.ndb.swap_node(pos, {name = "advtrains:across_on", param2 = node.param2})
- end
- end,
-})
-minetest.register_node("advtrains:across_on", {
- drawtype = "mesh",
- paramtype="light",
- paramtype2="facedir",
- walkable = false,
- selection_box = {
- type = "fixed",
- fixed = {-1/4, -1/2, -1/2, 1/4, 1.5, 0},
- },
- mesh = "advtrains_across.obj",
- tiles = {{name="advtrains_across_anim.png", animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=1.0}}},
- drop="advtrains:across_off",
- description=attrans("Andrew's Cross (on) (you hacker you)"),
- groups = {
- cracky=3,
- not_blocking_trains=1,
- save_in_nodedb=1,
- not_in_creative_inventory=1,
- },
- light_source = 1,
- sunlight_propagates=true,
- mesecons = {effector = {
- rules = advtrains.meseconrules,
- action_off = function (pos, node)
- advtrains.ndb.swap_node(pos, {name = "advtrains:across_off", param2 = node.param2})
- end
- }},
- luaautomation = {
- getstate = "on",
- setstate = function(pos, node, newstate)
- if newstate == "off" then
- advtrains.ndb.swap_node(pos, {name = "advtrains:across_off", param2 = node.param2})
- end
- end,
- },
- on_rightclick=function(pos, node, player)
- if minetest.check_player_privs(player:get_player_name(), {train_operator=true}) then
- advtrains.ndb.swap_node(pos, {name = "advtrains:across_off", param2 = node.param2})
- end
- end,
-})
diff --git a/advtrains/advtrains/textures/advtrains_across.png b/advtrains/advtrains/textures/advtrains_across.png
deleted file mode 100755
index da65a61..0000000
--- a/advtrains/advtrains/textures/advtrains_across.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_across_anim.png b/advtrains/advtrains/textures/advtrains_across_anim.png
deleted file mode 100755
index 584d023..0000000
--- a/advtrains/advtrains/textures/advtrains_across_anim.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_boiler.png b/advtrains/advtrains/textures/advtrains_boiler.png
deleted file mode 100755
index 8c7ff0d..0000000
--- a/advtrains/advtrains/textures/advtrains_boiler.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_chimney.png b/advtrains/advtrains/textures/advtrains_chimney.png
deleted file mode 100755
index 285a1a6..0000000
--- a/advtrains/advtrains/textures/advtrains_chimney.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_couple.png b/advtrains/advtrains/textures/advtrains_couple.png
deleted file mode 100755
index eda3704..0000000
--- a/advtrains/advtrains/textures/advtrains_couple.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_discouple.png b/advtrains/advtrains/textures/advtrains_discouple.png
deleted file mode 100755
index 5c064c3..0000000
--- a/advtrains/advtrains/textures/advtrains_discouple.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_driver_cab.png b/advtrains/advtrains/textures/advtrains_driver_cab.png
deleted file mode 100755
index 331bcc9..0000000
--- a/advtrains/advtrains/textures/advtrains_driver_cab.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_atc_placer.png b/advtrains/advtrains/textures/advtrains_dtrack_atc_placer.png
deleted file mode 100755
index 31c2b30..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_atc_placer.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_bumper_placer.png b/advtrains/advtrains/textures/advtrains_dtrack_bumper_placer.png
deleted file mode 100755
index 27191fe..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_bumper_placer.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_detector_placer.png b/advtrains/advtrains/textures/advtrains_dtrack_detector_placer.png
deleted file mode 100755
index e6c6ad6..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_detector_placer.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_load_placer.png b/advtrains/advtrains/textures/advtrains_dtrack_load_placer.png
deleted file mode 100755
index 427c011..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_load_placer.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_placer.png b/advtrains/advtrains/textures/advtrains_dtrack_placer.png
deleted file mode 100755
index 7bef8a9..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_placer.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_rail.png b/advtrains/advtrains/textures/advtrains_dtrack_rail.png
deleted file mode 100755
index bd0c217..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_rail.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_shared.png b/advtrains/advtrains/textures/advtrains_dtrack_shared.png
deleted file mode 100755
index 736c7db..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_shared.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_shared_atc.png b/advtrains/advtrains/textures/advtrains_dtrack_shared_atc.png
deleted file mode 100755
index 1f83c37..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_shared_atc.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_shared_detector_off.png b/advtrains/advtrains/textures/advtrains_dtrack_shared_detector_off.png
deleted file mode 100755
index 724d907..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_shared_detector_off.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_shared_detector_on.png b/advtrains/advtrains/textures/advtrains_dtrack_shared_detector_on.png
deleted file mode 100755
index 7bb29d6..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_shared_detector_on.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_shared_load.png b/advtrains/advtrains/textures/advtrains_dtrack_shared_load.png
deleted file mode 100755
index 5fd0d7a..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_shared_load.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_shared_unload.png b/advtrains/advtrains/textures/advtrains_dtrack_shared_unload.png
deleted file mode 100755
index e9fc5bd..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_shared_unload.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_slopeplacer.png b/advtrains/advtrains/textures/advtrains_dtrack_slopeplacer.png
deleted file mode 100755
index 1d456b0..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_slopeplacer.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_dtrack_unload_placer.png b/advtrains/advtrains/textures/advtrains_dtrack_unload_placer.png
deleted file mode 100755
index 486861e..0000000
--- a/advtrains/advtrains/textures/advtrains_dtrack_unload_placer.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_platform.png b/advtrains/advtrains/textures/advtrains_platform.png
deleted file mode 100755
index 5ba9663..0000000
--- a/advtrains/advtrains/textures/advtrains_platform.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_retrosignal.png b/advtrains/advtrains/textures/advtrains_retrosignal.png
deleted file mode 100755
index 141198d..0000000
--- a/advtrains/advtrains/textures/advtrains_retrosignal.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_retrosignal_inv.png b/advtrains/advtrains/textures/advtrains_retrosignal_inv.png
deleted file mode 100755
index 1036594..0000000
--- a/advtrains/advtrains/textures/advtrains_retrosignal_inv.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_signal_inv.png b/advtrains/advtrains/textures/advtrains_signal_inv.png
deleted file mode 100755
index ed64ed9..0000000
--- a/advtrains/advtrains/textures/advtrains_signal_inv.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_signal_off.png b/advtrains/advtrains/textures/advtrains_signal_off.png
deleted file mode 100755
index 8046e52..0000000
--- a/advtrains/advtrains/textures/advtrains_signal_off.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_signal_on.png b/advtrains/advtrains/textures/advtrains_signal_on.png
deleted file mode 100755
index 5228bb3..0000000
--- a/advtrains/advtrains/textures/advtrains_signal_on.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_signal_wall_off.png b/advtrains/advtrains/textures/advtrains_signal_wall_off.png
deleted file mode 100755
index 3e7b1e1..0000000
--- a/advtrains/advtrains/textures/advtrains_signal_wall_off.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_signal_wall_on.png b/advtrains/advtrains/textures/advtrains_signal_wall_on.png
deleted file mode 100755
index b628c7e..0000000
--- a/advtrains/advtrains/textures/advtrains_signal_wall_on.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_track_cr.png b/advtrains/advtrains/textures/advtrains_track_cr.png
deleted file mode 100755
index 40f0cc5..0000000
--- a/advtrains/advtrains/textures/advtrains_track_cr.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_track_cr_45.png b/advtrains/advtrains/textures/advtrains_track_cr_45.png
deleted file mode 100755
index 54966b3..0000000
--- a/advtrains/advtrains/textures/advtrains_track_cr_45.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_track_placer.png b/advtrains/advtrains/textures/advtrains_track_placer.png
deleted file mode 100755
index 03e17ed..0000000
--- a/advtrains/advtrains/textures/advtrains_track_placer.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_track_st.png b/advtrains/advtrains/textures/advtrains_track_st.png
deleted file mode 100755
index 5ad7e4f..0000000
--- a/advtrains/advtrains/textures/advtrains_track_st.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_track_st_45.png b/advtrains/advtrains/textures/advtrains_track_st_45.png
deleted file mode 100755
index 63b4c96..0000000
--- a/advtrains/advtrains/textures/advtrains_track_st_45.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_track_swlcr.png b/advtrains/advtrains/textures/advtrains_track_swlcr.png
deleted file mode 100755
index d9b5c0b..0000000
--- a/advtrains/advtrains/textures/advtrains_track_swlcr.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_track_swlcr_45.png b/advtrains/advtrains/textures/advtrains_track_swlcr_45.png
deleted file mode 100755
index f098fc9..0000000
--- a/advtrains/advtrains/textures/advtrains_track_swlcr_45.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_track_swlst.png b/advtrains/advtrains/textures/advtrains_track_swlst.png
deleted file mode 100755
index 314bd2d..0000000
--- a/advtrains/advtrains/textures/advtrains_track_swlst.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_track_swlst_45.png b/advtrains/advtrains/textures/advtrains_track_swlst_45.png
deleted file mode 100755
index 765d0ec..0000000
--- a/advtrains/advtrains/textures/advtrains_track_swlst_45.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_track_swrcr.png b/advtrains/advtrains/textures/advtrains_track_swrcr.png
deleted file mode 100755
index f74e1bc..0000000
--- a/advtrains/advtrains/textures/advtrains_track_swrcr.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_track_swrcr_45.png b/advtrains/advtrains/textures/advtrains_track_swrcr_45.png
deleted file mode 100755
index fa432aa..0000000
--- a/advtrains/advtrains/textures/advtrains_track_swrcr_45.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_track_swrst.png b/advtrains/advtrains/textures/advtrains_track_swrst.png
deleted file mode 100755
index 06ea29e..0000000
--- a/advtrains/advtrains/textures/advtrains_track_swrst.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_track_swrst_45.png b/advtrains/advtrains/textures/advtrains_track_swrst_45.png
deleted file mode 100755
index be477b7..0000000
--- a/advtrains/advtrains/textures/advtrains_track_swrst_45.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_trackworker.png b/advtrains/advtrains/textures/advtrains_trackworker.png
deleted file mode 100755
index b50bcae..0000000
--- a/advtrains/advtrains/textures/advtrains_trackworker.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/advtrains_wheel.png b/advtrains/advtrains/textures/advtrains_wheel.png
deleted file mode 100755
index fb72879..0000000
--- a/advtrains/advtrains/textures/advtrains_wheel.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/textures/drwho_screwdriver.png b/advtrains/advtrains/textures/drwho_screwdriver.png
deleted file mode 100755
index b50bcae..0000000
--- a/advtrains/advtrains/textures/drwho_screwdriver.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/advtrains/trackdb_legacy.lua b/advtrains/advtrains/trackdb_legacy.lua
deleted file mode 100644
index 99349e8..0000000
--- a/advtrains/advtrains/trackdb_legacy.lua
+++ /dev/null
@@ -1,27 +0,0 @@
---trackdb_legacy.lua
---loads the (old) track database. the only use for this is to provide data for rails that haven't been written into the ndb database.
---nothing will be saved.
---if the user thinks that he has loaded every track in his world at least once, he can delete the track database.
-
---trackdb[[y][x][z]={conn1, conn2, rely1, rely2, railheight}
-
-
---trackdb keeps its own save file.
-advtrains.fpath_tdb=minetest.get_worldpath().."/advtrains_trackdb2"
-local file, err = io.open(advtrains.fpath_tdb, "r")
-if not file then
- atprint("Not loading a trackdb file.")
-else
- local tbl = minetest.deserialize(file:read("*a"))
- if type(tbl) == "table" then
- advtrains.trackdb=tbl
- atprint("Loaded trackdb file.")
- end
- file:close()
-end
-
-
-
-
-
-
diff --git a/advtrains/advtrains/trackplacer.lua b/advtrains/advtrains/trackplacer.lua
deleted file mode 100644
index e94b4ff..0000000
--- a/advtrains/advtrains/trackplacer.lua
+++ /dev/null
@@ -1,305 +0,0 @@
---trackplacer.lua
---holds code for the track-placing system. the default 'track' item will be a craftitem that places rails as needed. this will neither place or change switches nor place vertical rails.
-
---all new trackplacer code
-local tp={
- tracks={}
-}
-
-function tp.register_tracktype(nnprefix, n_suffix)
- if tp.tracks[nnprefix] then return end--due to the separate registration of slopes and flats for the same nnpref, definition would be overridden here. just don't.
- tp.tracks[nnprefix]={
- default=n_suffix,
- single_conn={},
- double_conn={},
- --keys:conn1_conn2 (example:1_4)
- --values:{name=x, param2=x}
- twcycle={},
- twrotate={},--indexed by suffix, list, tells order of rotations
- modify={}
- }
-end
-function tp.add_double_conn(nnprefix, suffix, rotation, conns)
- local nodename=nnprefix.."_"..suffix..rotation
- for i=0,3 do
- tp.tracks[nnprefix].double_conn[((conns.conn1+4*i)%16).."_"..((conns.conn2+4*i)%16)]={name=nodename, param2=i}
- tp.tracks[nnprefix].double_conn[((conns.conn2+4*i)%16).."_"..((conns.conn1+4*i)%16)]={name=nodename, param2=i}
- end
- tp.tracks[nnprefix].modify[nodename]=true
-end
-function tp.add_single_conn(nnprefix, suffix, rotation, conns)
- local nodename=nnprefix.."_"..suffix..rotation
- for i=0,3 do
- tp.tracks[nnprefix].single_conn[((conns.conn1+4*i)%16)]={name=nodename, param2=i}
- tp.tracks[nnprefix].single_conn[((conns.conn2+4*i)%16)]={name=nodename, param2=i}
- end
- tp.tracks[nnprefix].modify[nodename]=true
-end
-
-function tp.add_worked(nnprefix, suffix, rotation, cycle_follows)
- tp.tracks[nnprefix].twcycle[suffix]=cycle_follows
- if not tp.tracks[nnprefix].twrotate[suffix] then tp.tracks[nnprefix].twrotate[suffix]={} end
- table.insert(tp.tracks[nnprefix].twrotate[suffix], rotation)
-end
-
-
---[[
- rewrite algorithm.
- selection criteria: these will never be changed or even selected:
- - tracks being already connected on both sides
- - tracks that are already connected on one side but are not bendable to the desired position
- the following situations can occur:
- 1. there are two more than two rails around
- 1.1 there is one or more subset(s) that can be directly connected
- -> choose the first possibility
- 2.2 not
- -> choose the first one and orient straight
- 2. there's exactly 1 rail around
- -> choose and orient straight
- 3. there's no rail around
- -> set straight
-]]
-function tp.find_already_connected(pos)--TODO vertical calculations(check node below)
- local function istrackandbc(pos, conn)
- local cnode=minetest.get_node(advtrains.dirCoordSet(pos, conn))
- local bconn=(conn+8)%16
- if advtrains.is_track_and_drives_on(cnode.name, advtrains.all_tracktypes) then
- local cconn1, cconn2=advtrains.get_track_connections(cnode.name, cnode.param2)
- return cconn1==bconn or cconn2==bconn
- end
- return false
- end
- local dnode=minetest.get_node(pos)
- local dconn1, dconn2=advtrains.get_track_connections(dnode.name, dnode.param2)
- local t={[true]="true", [false]="false"}
- if istrackandbc(pos, dconn1) and istrackandbc(pos, dconn2) then return dconn1, dconn2
- elseif istrackandbc(pos, dconn1) then return dconn1
- elseif istrackandbc(pos, dconn2) then return dconn2
- end
- return nil
-end
-function tp.rail_and_can_be_bent(originpos, conn, nnpref)
- local pos=advtrains.dirCoordSet(originpos, conn)
- local newdir=(conn+8)%16
- local node=minetest.get_node(pos)
- local tr=tp.tracks[nnpref]
- if not advtrains.is_track_and_drives_on(node.name, advtrains.all_tracktypes) then
- return false
- end
- --rail at other end?
- local adj1, adj2=tp.find_already_connected(pos)
- if adj1 and adj2 then
- return false--dont destroy existing track
- elseif adj1 and not adj2 then
- if tr.double_conn[adj1.."_"..newdir] then
- return true--if exists, connect new rail and old end
- end
- return false
- else
- if tr.single_conn[newdir] then--just rotate old rail to right orientation
- return true
- end
- return false
- end
-end
-function tp.bend_rail(originpos, conn, nnpref)
- local pos=advtrains.dirCoordSet(originpos, conn)
- local newdir=(conn+8)%16
- local node=minetest.get_node(pos)
- local tr=tp.tracks[nnpref]
- --is rail already connected? no need to bend.
- local conn1, conn2=advtrains.get_track_connections(node.name, node.param2)
- if newdir==conn1 or newdir==conn2 then
- return
- end
- --rail at other end?
- local adj1, adj2=tp.find_already_connected(pos)
- if adj1 and adj2 then
- return false--dont destroy existing track
- elseif adj1 and not adj2 then
- if tr.double_conn[adj1.."_"..newdir] then
- advtrains.ndb.swap_node(pos, tr.double_conn[adj1.."_"..newdir])
- return true--if exists, connect new rail and old end
- end
- return false
- else
- if tr.single_conn[newdir] then--just rotate old rail to right orientation
- advtrains.ndb.swap_node(pos, tr.single_conn[newdir])
- return true
- end
- return false
- end
-end
-function tp.placetrack(pos, nnpref, placer, itemstack, pointed_thing)
- --1. find all rails that are likely to be connected
- local tr=tp.tracks[nnpref]
- local p_rails={}
- for i=0,15 do
- if tp.rail_and_can_be_bent(pos, i, nnpref) then
- p_rails[#p_rails+1]=i
- end
- end
- if #p_rails==0 then
- minetest.set_node(pos, {name=nnpref.."_"..tr.default})
- if minetest.registered_nodes[nnpref.."_"..tr.default] and minetest.registered_nodes[nnpref.."_"..tr.default].after_place_node then
- minetest.registered_nodes[nnpref.."_"..tr.default].after_place_node(pos, placer, itemstack, pointed_thing)
- end
- elseif #p_rails==1 then
- tp.bend_rail(pos, p_rails[1], nnpref)
- advtrains.ndb.swap_node(pos, tr.single_conn[p_rails[1]])
- local nname=tr.single_conn[p_rails[1]].name
- if minetest.registered_nodes[nname] and minetest.registered_nodes[nname].after_place_node then
- minetest.registered_nodes[nname].after_place_node(pos, placer, itemstack, pointed_thing)
- end
- else
- --iterate subsets
- for k1, conn1 in ipairs(p_rails) do
- for k2, conn2 in ipairs(p_rails) do
- if k1~=k2 then
- if (tr.double_conn[conn1.."_"..conn2]) then
- tp.bend_rail(pos, conn1, nnpref)
- tp.bend_rail(pos, conn2, nnpref)
- advtrains.ndb.swap_node(pos, tr.double_conn[conn1.."_"..conn2])
- local nname=tr.double_conn[conn1.."_"..conn2].name
- if minetest.registered_nodes[nname] and minetest.registered_nodes[nname].after_place_node then
- minetest.registered_nodes[nname].after_place_node(pos, placer, itemstack, pointed_thing)
- end
- return
- end
- end
- end
- end
- --not found
- tp.bend_rail(pos, p_rails[1], nnpref)
- advtrains.ndb.swap_node(pos, tr.single_conn[p_rails[1]])
- local nname=tr.single_conn[p_rails[1]].name
- if minetest.registered_nodes[nname] and minetest.registered_nodes[nname].after_place_node then
- minetest.registered_nodes[nname].after_place_node(pos, placer, itemstack, pointed_thing)
- end
- end
-end
-
-
-function tp.register_track_placer(nnprefix, imgprefix, dispname)
- minetest.register_craftitem(nnprefix.."_placer",{
- description = dispname,
- inventory_image = imgprefix.."_placer.png",
- wield_image = imgprefix.."_placer.png",
- groups={advtrains_trackplacer=1},
- on_place = function(itemstack, placer, pointed_thing)
- return advtrains.pcall(function()
- local name = placer:get_player_name()
- if not name then
- return itemstack, false
- end
- if pointed_thing.type=="node" then
- local pos=pointed_thing.above
- local upos=vector.subtract(pointed_thing.above, {x=0, y=1, z=0})
- if advtrains.is_protected(pos,name) then
- minetest.record_protection_violation(pos, name)
- return itemstack, false
- end
- if minetest.registered_nodes[minetest.get_node(pos).name] and minetest.registered_nodes[minetest.get_node(pos).name].buildable_to
- and minetest.registered_nodes[minetest.get_node(upos).name] and minetest.registered_nodes[minetest.get_node(upos).name].walkable then
- tp.placetrack(pos, nnprefix, placer, itemstack, pointed_thing)
- if not minetest.settings:get_bool("creative_mode") then
- itemstack:take_item()
- end
- end
- end
- return itemstack, true
- end)
- end,
- })
-end
-
-
-
-minetest.register_craftitem("advtrains:trackworker",{
- description = attrans("Track Worker Tool\n\nLeft-click: change rail type (straight/curve/switch)\nRight-click: rotate rail/bumper/signal/etc."),
- groups = {cracky=1}, -- key=name, value=rating; rating=1..3.
- inventory_image = "advtrains_trackworker.png",
- wield_image = "advtrains_trackworker.png",
- stack_max = 1,
- on_place = function(itemstack, placer, pointed_thing)
- return advtrains.pcall(function()
- local name = placer:get_player_name()
- if not name then
- return
- end
- if pointed_thing.type=="node" then
- local pos=pointed_thing.under
- if advtrains.is_protected(pos, name) then
- minetest.record_protection_violation(pos, name)
- return
- end
- local node=minetest.get_node(pos)
-
- --if not advtrains.is_track_and_drives_on(minetest.get_node(pos).name, advtrains.all_tracktypes) then return end
- if advtrains.get_train_at_pos(pos) then return end
-
- local nnprefix, suffix, rotation=string.match(node.name, "^(.+)_([^_]+)(_[^_]+)$")
- --atprint(node.name.."\npattern recognizes:"..nodeprefix.." / "..railtype.." / "..rotation)
- if not tp.tracks[nnprefix] or not tp.tracks[nnprefix].twrotate[suffix] then
- nnprefix, suffix=string.match(node.name, "^(.+)_([^_]+)$")
- rotation = ""
- if not tp.tracks[nnprefix] or not tp.tracks[nnprefix].twrotate[suffix] then
- minetest.chat_send_player(placer:get_player_name(), attrans("This node can't be rotated using the trackworker!"))
- return
- end
- end
- local modext=tp.tracks[nnprefix].twrotate[suffix]
-
- if rotation==modext[#modext] then --increase param2
- advtrains.ndb.swap_node(pos, {name=nnprefix.."_"..suffix..modext[1], param2=(node.param2+1)%4})
- return
- else
- local modpos
- for k,v in pairs(modext) do if v==rotation then modpos=k end end
- if not modpos then
- minetest.chat_send_player(placer:get_player_name(), attrans("This node can't be rotated using the trackworker!"))
- return
- end
- advtrains.ndb.swap_node(pos, {name=nnprefix.."_"..suffix..modext[modpos+1], param2=node.param2})
- end
- end
- end)
- end,
- on_use=function(itemstack, user, pointed_thing)
- return advtrains.pcall(function()
- local name = user:get_player_name()
- if not name then
- return
- end
- if pointed_thing.type=="node" then
- local pos=pointed_thing.under
- local node=minetest.get_node(pos)
- if advtrains.is_protected(pos, name) then
- minetest.record_protection_violation(pos, name)
- return
- end
-
- --if not advtrains.is_track_and_drives_on(minetest.get_node(pos).name, advtrains.all_tracktypes) then return end
- if advtrains.get_train_at_pos(pos) then return end
- local nnprefix, suffix, rotation=string.match(node.name, "^(.+)_([^_]+)(_[^_]+)$")
- --atprint(node.name.."\npattern recognizes:"..nodeprefix.." / "..railtype.." / "..rotation)
- if not tp.tracks[nnprefix] or not tp.tracks[nnprefix].twcycle[suffix] then
- nnprefix, suffix=string.match(node.name, "^(.+)_([^_]+)$")
- rotation = ""
- if not tp.tracks[nnprefix] or not tp.tracks[nnprefix].twcycle[suffix] then
- minetest.chat_send_player(user:get_player_name(), attrans("This node can't be changed using the trackworker!"))
- return
- end
- end
- local nextsuffix=tp.tracks[nnprefix].twcycle[suffix]
- advtrains.ndb.swap_node(pos, {name=nnprefix.."_"..nextsuffix..rotation, param2=node.param2})
-
- else
- atprint(name, dump(tp.tracks))
- end
- end)
- end,
-})
-
---putting into right place
-advtrains.trackplacer=tp
diff --git a/advtrains/advtrains/tracks.lua b/advtrains/advtrains/tracks.lua
deleted file mode 100644
index d63e5c8..0000000
--- a/advtrains/advtrains/tracks.lua
+++ /dev/null
@@ -1,734 +0,0 @@
---advtrains by orwell96, see readme.txt
-
---dev-time settings:
---EDIT HERE
---If the old non-model rails on straight tracks should be replaced by the new...
---false: no
---true: yes
-advtrains.register_replacement_lbms=false
-
---[[TracksDefinition
-nodename_prefix
-texture_prefix
-description
-common={}
-straight={}
-straight45={}
-curve={}
-curve45={}
-lswitchst={}
-lswitchst45={}
-rswitchst={}
-rswitchst45={}
-lswitchcr={}
-lswitchcr45={}
-rswitchcr={}
-rswitchcr45={}
-vert1={
- --you'll probably want to override mesh here
-}
-vert2={
- --you'll probably want to override mesh here
-}
-]]--
-advtrains.all_tracktypes={}
-
---definition preparation
-local function conns(c1, c2, r1, r2, rh, rots) return {conn1=c1, conn2=c2, rely1=r1, rely2=r2, railheight=rh} end
-
-local ap={}
-ap.t_30deg_flat={
- regstep=1,
- variant={
- st=conns(0,8),
- cr=conns(0,7),
- swlst=conns(0,8),
- swlcr=conns(0,7),
- swrst=conns(0,8),
- swrcr=conns(0,9),
- },
- description={
- st="straight",
- cr="curve",
- swlst="left switch (straight)",
- swlcr="left switch (curve)",
- swrst="right switch (straight)",
- swrcr="right switch (curve)",
- },
- switch={
- swlst="swlcr",
- swlcr="swlst",
- swrst="swrcr",
- swrcr="swrst",
- },
- switchmc={
- swlst="on",
- swlcr="off",
- swrst="on",
- swrcr="off",
- },
- switchst={
- swlst="st",
- swlcr="cr",
- swrst="st",
- swrcr="cr",
- },
- regtp=true,
- trackplacer={
- st=true,
- cr=true,
- },
- tpsingle={
- st=true,
- },
- tpdefault="st",
- trackworker={
- ["swrcr"]="st",
- ["swrst"]="st",
- ["st"]="cr",
- ["cr"]="swlst",
- ["swlcr"]="swrcr",
- ["swlst"]="swrst",
- },
- rotation={"", "_30", "_45", "_60"},
- slopenodes={},
- increativeinv={},
-}
-ap.t_30deg_slope={
- regstep=1,
- variant={
- vst1=conns(8,0,0,0.5,0.25),
- vst2=conns(8,0,0.5,1,0.75),
- vst31=conns(8,0,0,0.33,0.16),
- vst32=conns(8,0,0.33,0.66,0.5),
- vst33=conns(8,0,0.66,1,0.83),
- },
- description={
- vst1="steep uphill 1/2",
- vst2="steep uphill 2/2",
- vst31="uphill 1/3",
- vst32="uphill 2/3",
- vst33="uphill 3/3",
- },
- switch={},
- switchmc={},
- switchst={},
- regsp=true,
- slopenodes={
- vst1=true, vst2=true,
- vst31=true, vst32=true, vst33=true,
- },
- slopeplacer={
- [2]={"vst1", "vst2"},
- [3]={"vst31", "vst32", "vst33"},
- max=3,--highest entry
- },
- slopeplacer_45={
- [2]={"vst1_45", "vst2_45"},
- max=2,
- },
- rotation={"", "_30", "_45", "_60"},
- trackworker={},
- increativeinv={},
-}
-ap.t_30deg_straightonly={
- regstep=1,
- variant={
- st=conns(0,8),
- },
- description={
- st="straight",
- },
- switch={
- },
- switchmc={
- },
- regtp=true,
- trackplacer={
- },
- tpsingle={
- },
- tpdefault="st",
- trackworker={
- ["st"]="st",
- },
- slopenodes={},
- rotation={"", "_30", "_45", "_60"},
- increativeinv={"st"},
-}
-ap.t_30deg_straightonly_noplacer={
- regstep=1,
- variant={
- st=conns(0,8),
- },
- description={
- st="straight",
- },
- switch={
- },
- switchmc={
- },
- regtp=false,
- trackplacer={
- },
- tpsingle={
- },
- tpdefault="st",
- trackworker={
- ["st"]="st",
- },
- slopenodes={},
- rotation={"", "_30", "_45", "_60"},
- increativeinv={"st"},
-}
-ap.t_45deg={
- regstep=2,
- variant={
- st=conns(0,8),
- cr=conns(0,6),
- swlst=conns(0,8),
- swlcr=conns(0,6),
- swrst=conns(0,8),
- swrcr=conns(0,10),
- vst1=conns(8,0,0,0.5,0.25),
- vst2=conns(8,0,0.5,1,0.75),
- },
- description={
- st="straight",
- cr="curve",
- swlst="left switch (straight)",
- swlcr="left switch (curve)",
- swrst="right switch (straight)",
- swrcr="right switch (curve)",
- vst1="vertical lower node",
- vst2="vertical upper node",
- },
- switch={
- swlst="swlcr",
- swlcr="swlst",
- swrst="swrcr",
- swrcr="swrst",
- },
- switchmc={
- swlst="on",
- swlcr="off",
- swrst="on",
- swrcr="off",
- },
- switchst={
- swlst="st",
- swlcr="cr",
- swrst="st",
- swrcr="cr",
- },
- regtp=true,
- trackplacer={
- st=true,
- cr=true,
- },
- tpsingle={
- st=true,
- },
- tpdefault="st",
- trackworker={
- ["swrcr"]="st",
- ["swrst"]="st",
- ["st"]="cr",
- ["cr"]="swlst",
- ["swlcr"]="swrcr",
- ["swlst"]="swrst",
- },
- slopenodes={},
- rotation={"", "_45"},
- increativeinv={vst1=true, vst2=true}
-}
-advtrains.trackpresets = ap
-
---definition format: ([] optional)
---[[{
- nodename_prefix
- texture_prefix
- [shared_texture]
- models_prefix
- models_suffix (with dot)
- [shared_model]
- formats={
- st,cr,swlst,swlcr,swrst,swrcr,vst1,vst2
- (each a table with indices 0-3, for if to register a rail with this 'rotation' table entry. nil is assumed as 'all', set {} to not register at all)
- }
- common={} change something on common rail appearance
-}]]
-function advtrains.register_tracks(tracktype, def, preset)
- local function make_switchfunc(suffix_target, mesecon_state, is_state)
- local rcswitchfunc=function(pos, node, player)
- if minetest.check_player_privs(player:get_player_name(), {train_operator=true}) then
- advtrains.ndb.swap_node(pos, {name=def.nodename_prefix.."_"..suffix_target, param2=node.param2})
- advtrains.invalidate_all_paths(pos)
- end
- end
- local switchfunc=function(pos, node, newstate)
- if newstate~=is_state then
- advtrains.ndb.swap_node(pos, {name=def.nodename_prefix.."_"..suffix_target, param2=node.param2})
- advtrains.invalidate_all_paths(pos)
- end
- end
- local mesec
- if mesecon_state then -- if mesecons is not wanted, do not.
- mesec = {effector = {
- ["action_"..mesecon_state] = switchfunc,
- rules=advtrains.meseconrules
- }}
- end
- return rcswitchfunc, mesec,
- {
- getstate = is_state,
- setstate = switchfunc,
- }
- end
- local function make_overdef(suffix, rotation, conns, rcswitchfunc, mesecontbl, luaautomation, in_creative_inv, drop_slope)
- local img_suffix=suffix..rotation
- return {
- mesh = def.shared_model or (def.models_prefix.."_"..img_suffix..def.models_suffix),
- tiles = {def.shared_texture or (def.texture_prefix.."_"..img_suffix..".png"), def.second_texture},
- --inventory_image = def.texture_prefix.."_"..img_suffix..".png",
- --wield_image = def.texture_prefix.."_"..img_suffix..".png",
- description=def.description.."("..preset.description[suffix]..rotation..")",
- connect1=conns.conn1,
- connect2=conns.conn2,
- rely1=conns.rely1 or 0,
- rely2=conns.rely2 or 0,
- railheight=conns.railheight or 0,
-
- on_rightclick=rcswitchfunc,
- groups = {
- attached_node=1,
- ["advtrains_track_"..tracktype]=1,
- save_in_nodedb=1,
- dig_immediate=2,
- not_in_creative_inventory=(not in_creative_inv and 1 or nil),
- not_blocking_trains=1,
- },
- mesecons=mesecontbl,
- luaautomation=luaautomation,
- drop = (drop_slope and def.nodename_prefix.."_slopeplacer" or def.nodename_prefix.."_placer"),
- }
- end
- local function cycle_conns(conns, rotid)
- local add=(rotid-1)*preset.regstep
- return {
- conn1=(conns.conn1+add)%16,
- conn2=(conns.conn2+add)%16,
- rely1=conns.rely1 or 0,
- rely2=conns.rely2 or 0,
- railheight=conns.railheight or 0,
- }
- end
- local common_def=advtrains.merge_tables({
- description = def.description,
- drawtype = "mesh",
- paramtype="light",
- paramtype2="facedir",
- walkable = false,
- selection_box = {
- type = "fixed",
- fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
- },
- rely1=0,
- rely2=0,
- railheight=0,
- drop=def.nodename_prefix.."_placer",
- can_dig=function(pos)
- return not advtrains.get_train_at_pos(pos)
- end,
- after_dig_node=function(pos)
- advtrains.ndb.update(pos)
- end,
- after_place_node=function(pos)
- advtrains.ndb.update(pos)
- end,
- }, def.common or {})
- --make trackplacer base def
- advtrains.trackplacer.register_tracktype(def.nodename_prefix, preset.tpdefault)
- if preset.regtp then
- advtrains.trackplacer.register_track_placer(def.nodename_prefix, def.texture_prefix, def.description)
- end
- if preset.regsp then
- advtrains.slope.register_placer(def, preset)
- end
- for suffix, conns in pairs(preset.variant) do
- for rotid, rotation in ipairs(preset.rotation) do
- if not def.formats[suffix] or def.formats[suffix][rotid] then
- local rcswitchfunc, mesecontbl, luaautomation
- if preset.switch[suffix] then
- rcswitchfunc, mesecontbl, luaautomation=make_switchfunc(preset.switch[suffix]..rotation, preset.switchmc[suffix], preset.switchst[suffix])
- end
- local adef={}
- if def.get_additional_definiton then
- adef=def.get_additional_definiton(def, preset, suffix, rotation)
- end
-
- minetest.register_node(def.nodename_prefix.."_"..suffix..rotation, advtrains.merge_tables(
- common_def,
- make_overdef(
- suffix, rotation,
- cycle_conns(conns, rotid),
- rcswitchfunc, mesecontbl, luaautomation, preset.increativeinv[suffix], preset.slopenodes[suffix]
- ),
- adef
- )
- )
- --trackplacer
- if preset.regtp then
- if preset.trackplacer[suffix] then
- advtrains.trackplacer.add_double_conn(def.nodename_prefix, suffix, rotation, cycle_conns(conns, rotid))
- end
- if preset.tpsingle[suffix] then
- advtrains.trackplacer.add_single_conn(def.nodename_prefix, suffix, rotation, cycle_conns(conns, rotid))
- end
- end
- advtrains.trackplacer.add_worked(def.nodename_prefix, suffix, rotation, preset.trackworker[suffix])
- end
- end
- end
- advtrains.all_tracktypes[tracktype]=true
-end
-
-
-function advtrains.is_track_and_drives_on(nodename, drives_on_p)
- if not minetest.registered_nodes[nodename] then
- return false
- end
- local nodedef=minetest.registered_nodes[nodename]
- for k,v in pairs(drives_on_p) do
- if nodedef.groups["advtrains_track_"..k] then
- return true
- end
- end
- return false
-end
-
-function advtrains.get_track_connections(name, param2)
- local nodedef=minetest.registered_nodes[name]
- if not nodedef then atprint(" get_track_connections couldn't find nodedef for nodename "..(name or "nil")) return 0, 8, 0, 0, 0 end
- local noderot=param2
- if not param2 then noderot=0 end
- if noderot > 3 then atprint(" get_track_connections: rail has invaild param2 of "..noderot) noderot=0 end
-
- local tracktype
- for k,_ in pairs(nodedef.groups) do
- local tt=string.match(k, "^advtrains_track_(.+)$")
- if tt then
- tracktype=tt
- end
- end
- return (nodedef.connect1 + 4 * noderot)%16, (nodedef.connect2 + 4 * noderot)%16, nodedef.rely1 or 0, nodedef.rely2 or 0, nodedef.railheight or 0, tracktype
-end
-
---detector code
---holds a table with nodes on which trains are on.
-
-advtrains.detector = {}
-advtrains.detector.on_node = {}
-
-function advtrains.detector.enter_node(pos, train_id)
- local ppos=advtrains.round_vector_floor_y(pos)
- local pts=minetest.pos_to_string(ppos)
- advtrains.detector.on_node[pts]=train_id
- advtrains.detector.call_enter_callback(ppos, train_id)
-end
-function advtrains.detector.leave_node(pos, train_id)
- local ppos=advtrains.round_vector_floor_y(pos)
- advtrains.detector.call_leave_callback(ppos, train_id)
-end
-function advtrains.detector.stay_node(pos, train_id)
- local ppos=advtrains.round_vector_floor_y(pos)
- local pts=minetest.pos_to_string(ppos)
- advtrains.detector.on_node[pts]=train_id
-end
-
-
-
-function advtrains.detector.call_enter_callback(pos, train_id)
- --atprint("instructed to call enter calback")
-
- local node = advtrains.ndb.get_node(pos) --this spares the check if node is nil, it has a name in any case
- local mregnode=minetest.registered_nodes[node.name]
- if mregnode and mregnode.advtrains and mregnode.advtrains.on_train_enter then
- mregnode.advtrains.on_train_enter(pos, train_id)
- end
-end
-function advtrains.detector.call_leave_callback(pos, train_id)
- --atprint("instructed to call leave calback")
-
- local node = advtrains.ndb.get_node(pos) --this spares the check if node is nil, it has a name in any case
- local mregnode=minetest.registered_nodes[node.name]
- if mregnode and mregnode.advtrains and mregnode.advtrains.on_train_leave then
- mregnode.advtrains.on_train_leave(pos, train_id)
- end
-end
-
--- slope placer. Defined in register_tracks.
---crafted with rail and gravel
-local sl={}
-function sl.register_placer(def, preset)
- minetest.register_craftitem(def.nodename_prefix.."_slopeplacer",{
- description = attrans("@1 Slope", def.description),
- inventory_image = def.texture_prefix.."_slopeplacer.png",
- wield_image = def.texture_prefix.."_slopeplacer.png",
- groups={},
- on_place = sl.create_slopeplacer_on_place(def, preset)
- })
-end
---(itemstack, placer, pointed_thing)
-function sl.create_slopeplacer_on_place(def, preset)
- return function(istack, player, pt)
- if not pt.type=="node" then
- minetest.chat_send_player(player:get_player_name(), attrans("Can't place: not pointing at node"))
- return istack
- end
- local pos=pt.above
- if not pos then
- minetest.chat_send_player(player:get_player_name(), attrans("Can't place: not pointing at node"))
- return istack
- end
- local node=minetest.get_node(pos)
- if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].buildable_to then
- minetest.chat_send_player(player:get_player_name(), attrans("Can't place: space occupied!"))
- return istack
- end
- if advtrains.is_protected(pos, player:get_player_name()) then
- minetest.record_protection_violation(pos, player:get_player_name())
- return istack
- end
- --determine player orientation (only horizontal component)
- --get_look_horizontal may not be available
- local yaw=player.get_look_horizontal and player:get_look_horizontal() or (player:get_look_yaw() - math.pi/2)
-
- --rounding unit vectors is a nice way for selecting 1 of 8 directions since sin(30°) is 0.5.
- dirvec={x=math.floor(math.sin(-yaw)+0.5), y=0, z=math.floor(math.cos(-yaw)+0.5)}
- --translate to direction to look up inside the preset table
- local param2, rot45=({
- [-1]={
- [-1]=2,
- [0]=3,
- [1]=3,
- },
- [0]={
- [-1]=2,
- [1]=0,
- },
- [1]={
- [-1]=1,
- [0]=1,
- [1]=0,
- },
- })[dirvec.x][dirvec.z], dirvec.x~=0 and dirvec.z~=0
- local lookup=preset.slopeplacer
- if rot45 then lookup=preset.slopeplacer_45 end
-
- --go unitvector forward and look how far the next node is
- local step=1
- while step<=lookup.max do
- local node=minetest.get_node(vector.add(pos, dirvec))
- --next node solid?
- if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].buildable_to or advtrains.is_protected(pos, player:get_player_name()) then
- --do slopes of this distance exist?
- if lookup[step] then
- if minetest.settings:get_bool("creative_mode") or istack:get_count()>=step then
- --start placing
- local placenodes=lookup[step]
- while step>0 do
- minetest.set_node(pos, {name=def.nodename_prefix.."_"..placenodes[step], param2=param2})
- if not minetest.settings:get_bool("creative_mode") then
- istack:take_item()
- end
- step=step-1
- pos=vector.subtract(pos, dirvec)
- end
- else
- minetest.chat_send_player(player:get_player_name(), attrans("Can't place: Not enough slope items left (@1 required)", step))
- end
- else
- minetest.chat_send_player(player:get_player_name(), attrans("Can't place: There's no slope of length @1",step))
- end
- return istack
- end
- step=step+1
- pos=vector.add(pos, dirvec)
- end
- minetest.chat_send_player(player:get_player_name(), attrans("Can't place: no supporting node at upper end."))
- return itemstack
- end
-end
-
-advtrains.slope=sl
-
---END code, BEGIN definition
---definition format: ([] optional)
---[[{
- nodename_prefix
- texture_prefix
- [shared_texture]
- models_prefix
- models_suffix (with dot)
- [shared_model]
- formats={
- st,cr,swlst,swlcr,swrst,swrcr,vst1,vst2
- (each a table with indices 0-3, for if to register a rail with this 'rotation' table entry. nil is assumed as 'all', set {} to not register at all)
- }
- common={} change something on common rail appearance
-}]]
-
-advtrains.register_tracks("regular", {
- nodename_prefix="advtrains:track",
- texture_prefix="advtrains_track",
- shared_model="trackplane.b3d",
- description=attrans("Deprecated Track"),
- formats={vst1={}, vst2={}},
-}, ap.t_45deg)
-
---flat
-advtrains.register_tracks("default", {
- nodename_prefix="advtrains:dtrack",
- texture_prefix="advtrains_dtrack",
- models_prefix="advtrains_dtrack",
- models_suffix=".b3d",
- shared_texture="advtrains_dtrack_shared.png",
- description=attrans("Track"),
- formats={},
-}, ap.t_30deg_flat)
---slopes
-advtrains.register_tracks("default", {
- nodename_prefix="advtrains:dtrack",
- texture_prefix="advtrains_dtrack",
- models_prefix="advtrains_dtrack",
- models_suffix=".obj",
- shared_texture="advtrains_dtrack_shared.png",
- second_texture="default_gravel.png",
- description=attrans("Track"),
- formats={vst1={true, false, true}, vst2={true, false, true}, vst31={true}, vst32={true}, vst33={true}},
-}, ap.t_30deg_slope)
-
---bumpers
-advtrains.register_tracks("default", {
- nodename_prefix="advtrains:dtrack_bumper",
- texture_prefix="advtrains_dtrack_bumper",
- models_prefix="advtrains_dtrack_bumper",
- models_suffix=".b3d",
- shared_texture="advtrains_dtrack_rail.png",
- --bumpers still use the old texture until the models are redone.
- description=attrans("Bumper"),
- formats={},
-}, ap.t_30deg_straightonly)
---legacy bumpers
-for _,rot in ipairs({"", "_30", "_45", "_60"}) do
- minetest.register_alias("advtrains:dtrack_bumper"..rot, "advtrains:dtrack_bumper_st"..rot)
-end
-
-if mesecon then
- advtrains.register_tracks("default", {
- nodename_prefix="advtrains:dtrack_detector_off",
- texture_prefix="advtrains_dtrack_detector",
- models_prefix="advtrains_dtrack",
- models_suffix=".b3d",
- shared_texture="advtrains_dtrack_shared_detector_off.png",
- description=attrans("Detector Rail"),
- formats={},
- get_additional_definiton = function(def, preset, suffix, rotation)
- return {
- mesecons = {
- receptor = {
- state = mesecon.state.off,
- rules = advtrains.meseconrules
- }
- },
- advtrains = {
- on_train_enter=function(pos, train_id)
- advtrains.ndb.swap_node(pos, {name="advtrains:dtrack_detector_on".."_"..suffix..rotation, param2=advtrains.ndb.get_node(pos).param2})
- mesecon.receptor_on(pos, advtrains.meseconrules)
- end
- }
- }
- end
- }, ap.t_30deg_straightonly)
- advtrains.register_tracks("default", {
- nodename_prefix="advtrains:dtrack_detector_on",
- texture_prefix="advtrains_dtrack",
- models_prefix="advtrains_dtrack",
- models_suffix=".b3d",
- shared_texture="advtrains_dtrack_shared_detector_on.png",
- description="Detector(on)(you hacker you)",
- formats={},
- get_additional_definiton = function(def, preset, suffix, rotation)
- return {
- mesecons = {
- receptor = {
- state = mesecon.state.on,
- rules = advtrains.meseconrules
- }
- },
- advtrains = {
- on_train_leave=function(pos, train_id)
- advtrains.ndb.swap_node(pos, {name="advtrains:dtrack_detector_off".."_"..suffix..rotation, param2=advtrains.ndb.get_node(pos).param2})
- mesecon.receptor_off(pos, advtrains.meseconrules)
- end
- }
- }
- end
- }, ap.t_30deg_straightonly_noplacer)
-end
---TODO legacy
---I know lbms are better for this purpose
-for name,rep in pairs({swl_st="swlst", swr_st="swrst", swl_cr="swlcr", swr_cr="swrcr", }) do
- minetest.register_abm({
- -- In the following two fields, also group:groupname will work.
- nodenames = {"advtrains:track_"..name},
- interval = 1.0, -- Operation interval in seconds
- chance = 1, -- Chance of trigger per-node per-interval is 1.0 / this
- action = function(pos, node, active_object_count, active_object_count_wider) minetest.set_node(pos, {name="advtrains:track_"..rep, param2=node.param2}) end,
- })
- minetest.register_abm({
- -- In the following two fields, also group:groupname will work.
- nodenames = {"advtrains:track_"..name.."_45"},
- interval = 1.0, -- Operation interval in seconds
- chance = 1, -- Chance of trigger per-node per-interval is 1.0 / this
- action = function(pos, node, active_object_count, active_object_count_wider) minetest.set_node(pos, {name="advtrains:track_"..rep.."_45", param2=node.param2}) end,
- })
-end
-
-if advtrains.register_replacement_lbms then
-minetest.register_lbm({
- name = "advtrains:ramp_replacement_1",
--- In the following two fields, also group:groupname will work.
- nodenames = {"advtrains:track_vert1"},
- action = function(pos, node, active_object_count, active_object_count_wider) minetest.set_node(pos, {name="advtrains:dtrack_vst1", param2=(node.param2+2)%4}) end,
-})
-minetest.register_lbm({
- name = "advtrains:ramp_replacement_1",
--- -- In the following two fields, also group:groupname will work.
- nodenames = {"advtrains:track_vert2"},
- action = function(pos, node, active_object_count, active_object_count_wider) minetest.set_node(pos, {name="advtrains:dtrack_vst2", param2=(node.param2+2)%4}) end,
-})
- minetest.register_abm({
- name = "advtrains:st_rep_1",
- -- In the following two fields, also group:groupname will work.
- nodenames = {"advtrains:track_st"},
- interval=1,
- chance=1,
- action = function(pos, node, active_object_count, active_object_count_wider) minetest.set_node(pos, {name="advtrains:dtrack_st", param2=node.param2}) end,
- })
- minetest.register_lbm({
- name = "advtrains:st_rep_1",
- -- -- In the following two fields, also group:groupname will work.
- nodenames = {"advtrains:track_st_45"},
- action = function(pos, node, active_object_count, active_object_count_wider) minetest.set_node(pos, {name="advtrains:dtrack_st_45", param2=node.param2}) end,
- })
-end
-
-
-
-
-
-
-
-
diff --git a/advtrains/advtrains/trainhud.lua b/advtrains/advtrains/trainhud.lua
deleted file mode 100644
index 591881a..0000000
--- a/advtrains/advtrains/trainhud.lua
+++ /dev/null
@@ -1,126 +0,0 @@
---trainhud.lua: holds all the code for train controlling
-
-advtrains.hud = {}
-
-minetest.register_on_leaveplayer(function(player)
-advtrains.hud[player:get_player_name()] = nil
-end)
-
-local mletter={[1]="F", [-1]="R", [0]="N"}
-local doorstr={[-1]="|<>| >|<", [0]=">|< >|<", [1]=">|< |<>|"}
-
-function advtrains.on_control_change(pc, train, flip)
- local maxspeed = train.max_speed or 10
- if pc.sneak then
- if pc.up then
- train.tarvelocity = maxspeed
- end
- if pc.down then
- train.tarvelocity = 0
- end
- if pc.left then
- train.tarvelocity = 4
- end
- if pc.right then
- train.tarvelocity = 8
- end
- if pc.jump then
- train.brake = true
- --0: released, 1: brake and pressed, 2: released and brake, 3: pressed and brake
- if not train.brake_hold_state or train.brake_hold_state==0 then
- train.brake_hold_state = 1
- elseif train.brake_hold_state==2 then
- train.brake_hold_state = 3
- end
- elseif train.brake_hold_state==1 then
- train.brake_hold_state = 2
- elseif train.brake_hold_state==3 then
- train.brake = false
- train.brake_hold_state = 0
- end
- --shift+use:see wagons.lua
- else
- if pc.up then
- train.tarvelocity = math.min(train.tarvelocity + 1, maxspeed)
- end
- if pc.down then
- if train.velocity>0 then
- train.tarvelocity = math.max(train.tarvelocity - 1, 0)
- else
- train.movedir = -train.movedir
- end
- end
- if pc.left then
- if train.door_open ~= 0 then
- train.door_open = 0
- else
- train.door_open = -train.movedir
- end
- end
- if pc.right then
- if train.door_open ~= 0 then
- train.door_open = 0
- else
- train.door_open = train.movedir
- end
- end
- if train.brake_hold_state~=2 then
- train.brake = false
- end
- if pc.jump then
- train.brake = true
- end
- if pc.aux1 then
- --horn
- end
- end
-end
-function advtrains.update_driver_hud(pname, train, flip)
- local inside=train.text_inside or ""
- advtrains.set_trainhud(pname, inside.."\n"..advtrains.hud_train_format(train, flip))
-end
-function advtrains.clear_driver_hud(pname)
- advtrains.set_trainhud(pname, "")
-end
-
-function advtrains.set_trainhud(name, text)
- local hud = advtrains.hud[name]
- local player=minetest.get_player_by_name(name)
- if not player then
- return
- end
- if not hud then
- hud = {}
- advtrains.hud[name] = hud
- hud.id = player:hud_add({
- hud_elem_type = "text",
- name = "ADVTRAINS",
- number = 0xFFFFFF,
- position = {x=0.5, y=0.7},
- offset = {x=0, y=0},
- text = text,
- scale = {x=200, y=60},
- alignment = {x=0, y=0},
- })
- hud.oldText=text
- return
- elseif hud.oldText ~= text then
- player:hud_change(hud.id, "text", text)
- hud.oldText=text
- end
-end
-function advtrains.hud_train_format(train, flip)
- local fct=flip and -1 or 1
- if not train then return "" end
-
- local max=train.max_speed or 10
- local vel=advtrains.abs_ceil(train.velocity)
- local tvel=advtrains.abs_ceil(train.tarvelocity)
- local topLine, firstLine, secondLine
-
- topLine=" ["..mletter[fct*train.movedir].."] "..doorstr[(train.door_open or 0) * train.movedir].." "..(train.brake and "="..( train.brake_hold_state==2 and "^" or "" ).."B=" or "")
- firstLine=attrans("Speed:").." |"..string.rep("+", vel)..string.rep("_", max-vel)..">"
- secondLine=attrans("Target:").." |"..string.rep("+", tvel)..string.rep("_", max-tvel)..">"
-
- return topLine.."\n"..firstLine.."\n"..secondLine
-end
diff --git a/advtrains/advtrains/trainlogic.lua b/advtrains/advtrains/trainlogic.lua
deleted file mode 100644
index 483ea52..0000000
--- a/advtrains/advtrains/trainlogic.lua
+++ /dev/null
@@ -1,1005 +0,0 @@
---trainlogic.lua
---controls train entities stuff about connecting/disconnecting/colliding trains and other things
-
-
-local benchmark=false
-local bm={}
-local bmlt=0
-local bmsteps=0
-local bmstepint=200
-atprintbm=function(action, ta)
- if not benchmark then return end
- local t=(os.clock()-ta)*1000
- if not bm[action] then
- bm[action]=t
- else
- bm[action]=bm[action]+t
- end
- bmlt=bmlt+t
-end
-function endstep()
- if not benchmark then return end
- bmsteps=bmsteps-1
- if bmsteps<=0 then
- bmsteps=bmstepint
- for key, value in pairs(bm) do
- minetest.chat_send_all(key.." "..(value/bmstepint).." ms avg.")
- end
- minetest.chat_send_all("Total time consumed by all advtrains actions per step: "..(bmlt/bmstepint).." ms avg.")
- bm={}
- bmlt=0
- end
-end
-
-advtrains.train_accel_force=2--per second and divided by number of wagons
-advtrains.train_brake_force=3--per second, not divided by number of wagons
-advtrains.train_roll_force=0.5--per second, not divided by number of wagons, acceleration when rolling without brake
-advtrains.train_emerg_force=10--for emergency brakes(when going off track)
-
-
-advtrains.mainloop_trainlogic=function(dtime)
- --build a table of all players indexed by pts. used by damage and door system.
- advtrains.playersbypts={}
- for _, player in pairs(minetest.get_connected_players()) do
- if not advtrains.player_to_train_mapping[player:get_player_name()] then
- --players in train are not subject to damage
- local ptspos=minetest.pos_to_string(vector.round(player:getpos()))
- advtrains.playersbypts[ptspos]=player
- end
- end
- --regular train step
- -- do in two steps:
- -- a: predict path and add all nodes to the advtrains.detector.on_node table
- -- b: check for collisions based on these data
- -- (and more)
- local t=os.clock()
- advtrains.detector.on_node={}
- for k,v in pairs(advtrains.trains) do
- advtrains.atprint_context_tid=sid(k)
- advtrains.atprint_context_tid_full=k
- advtrains.train_step_a(k, v, dtime)
- end
- for k,v in pairs(advtrains.trains) do
- advtrains.atprint_context_tid=sid(k)
- advtrains.atprint_context_tid_full=k
- advtrains.train_step_b(k, v, dtime)
- end
-
- advtrains.atprint_context_tid=nil
- advtrains.atprint_context_tid_full=nil
-
- atprintbm("trainsteps", t)
- endstep()
-end
-
-minetest.register_on_joinplayer(function(player)
- return advtrains.pcall(function()
- local pname=player:get_player_name()
- local id=advtrains.player_to_train_mapping[pname]
- if id then
- local train=advtrains.trains[id]
- if not train then advtrains.player_to_train_mapping[pname]=nil return end
- --set the player to the train position.
- --minetest will emerge the area and load the objects, which then will call reattach_all().
- --because player is in mapping, it will not be subject to dying.
- player:setpos(train.last_pos_prev)
- --independent of this, cause all wagons of the train which are loaded to reattach their players
- --needed because already loaded wagons won't call reattach_all()
- for _,wagon in pairs(minetest.luaentities) do
- if wagon.is_wagon and wagon.initialized and wagon.train_id==id then
- wagon:reattach_all()
- end
- end
- end
- end)
-end)
-
-minetest.register_on_dieplayer(function(player)
- return advtrains.pcall(function()
- local pname=player:get_player_name()
- local id=advtrains.player_to_train_mapping[pname]
- if id then
- local train=advtrains.trains[id]
- if not train then advtrains.player_to_train_mapping[pname]=nil return end
- for _,wagon in pairs(minetest.luaentities) do
- if wagon.is_wagon and wagon.initialized and wagon.train_id==id then
- --when player dies, detach him from the train
- --call get_off_plr on every wagon since we don't know which one he's on.
- wagon:get_off_plr(pname)
- end
- end
- end
- end)
-end)
---[[
-train step structure:
-
-
-- legacy stuff
-- preparing the initial path and creating index
-- setting node coverage old indices
-- handle velocity influences:
- - off-track
- - atc
- - player controls
- - environment collision
-- update index = move
-- create path
-- update node coverage
-- do less important stuff such as checking trainpartload or removing
-
--- break --
-- handle train collisions
-
-]]
-
-function advtrains.train_step_a(id, train, dtime)
- --atprint("--- runcnt ",advtrains.mainloop_runcnt,": index",train.index,"end_index", train.end_index,"| max_iot", train.max_index_on_track, "min_iot", train.min_index_on_track, "<> pe_min", train.path_extent_min,"pe_max", train.path_extent_max)
- if train.min_index_on_track then
- assert(math.floor(train.min_index_on_track)==train.min_index_on_track)
- end
- --- 1. LEGACY STUFF ---
- if not train.drives_on or not train.max_speed then
- advtrains.update_trainpart_properties(id)
- end
- --TODO check for all vars to be present
- if not train.velocity then
- train.velocity=0
- end
- if not train.movedir or (train.movedir~=1 and train.movedir~=-1) then
- train.movedir=1
- end
- --- 2. prepare initial path and index if needed ---
- if not train.index then train.index=0 end
- if not train.path then
- if not train.last_pos then
- --no chance to recover
- atprint("train hasn't saved last-pos, removing train.")
- advtrains.trains[id]=nil
- return false
- end
-
- local node_ok=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(train.last_pos), train.drives_on)
-
- if node_ok==nil then
- --block not loaded, do nothing
- atprint("last_pos", advtrains.round_vector_floor_y(train.last_pos), "not loaded and not in ndb, waiting")
- return nil
- elseif node_ok==false then
- atprint("no track here, (fail) removing train.")
- advtrains.trains[id]=nil
- return false
- end
-
- if not train.last_pos_prev then
- --no chance to recover
- atprint("train hasn't saved last-pos_prev, removing train.")
- advtrains.trains[id]=nil
- return false
- end
-
- local prevnode_ok=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(train.last_pos_prev), train.drives_on)
-
- if prevnode_ok==nil then
- --block not loaded, do nothing
- atprint("last_pos_prev", advtrains.round_vector_floor_y(train.last_pos_prev), "not loaded and not in ndb, waiting")
- return nil
- elseif prevnode_ok==false then
- atprint("no track at prev, (fail) removing train.")
- advtrains.trains[id]=nil
- return false
- end
-
- train.index=(train.restore_add_index or 0)+(train.savedpos_off_track_index_offset or 0)
- --restore_add_index is set by save() to prevent trains hopping to next round index. should be between -0.5 and 0.5
- --savedpos_off_track_index_offset is set if train went off track. see below.
- train.path={}
- train.path_dist={}
- train.path[0]=train.last_pos
- train.path[-1]=train.last_pos_prev
- train.path_dist[-1]=vector.distance(train.last_pos, train.last_pos_prev)
- train.path_extent_min=-1
- train.path_extent_max=0
- train.min_index_on_track=-1
- train.max_index_on_track=0
-
- --[[
- Bugfix for trains randomly ignoring ATC rails:
- - Paths have been invalidated. 1 gets executed and ensures an initial path
- - 2a sets train end index. The problem is that path_dist is not known for the whole path, so train end index will be nearly trainlen
- - Since the detector indices are also unknown, they get set to the new (wrong) train_end_index. Enter_node calls are not executed for the nodes that lie in between real end_index and trainlen.
- - The next step, mistake is recognized, train leaves some positions. From there, everything works again.
- To overcome this, we will generate the full required path here so that path_dist is available for get_train_end_index().
- ]]
- advtrains.pathpredict(id, train)
- end
-
- --- 2a. set train.end_index which is required in different places, IF IT IS NOT SET YET by STMT afterwards. ---
- --- table entry to avoid triple recalculation ---
- if not train.end_index then
- train.end_index=advtrains.get_train_end_index(train)
- end
-
- --- 2b. set node coverage old indices ---
-
- train.detector_old_index = math.floor(train.index)
- train.detector_old_end_index = math.floor(train.end_index)
-
- --- 3. handle velocity influences ---
- local train_moves=(train.velocity~=0)
-
- if train.recently_collided_with_env then
- train.tarvelocity=0
- if not train_moves then
- train.recently_collided_with_env=false--reset status when stopped
- end
- end
- if train.locomotives_in_train==0 then
- train.tarvelocity=0
- end
-
- --- 3a. this can be useful for debugs/warnings and is used for check_trainpartload ---
- local t_info, train_pos=sid(id), train.path[math.floor(train.index)]
- if train_pos then
- t_info=t_info.." @"..minetest.pos_to_string(train_pos)
- --atprint("train_pos:",train_pos)
- end
-
- --apply off-track handling:
- local front_off_track=train.max_index_on_track and train.index>train.max_index_on_track
- local back_off_track=train.min_index_on_track and train.end_index<train.min_index_on_track
- local pprint
-
- if front_off_track and back_off_track then--allow movement in both directions
- if train.tarvelocity>1 then
- train.tarvelocity=1
- atwarn("Train",t_info,"is off track at both ends. Clipping velocity to 1")
- pprint=true
- end
- elseif front_off_track then--allow movement only backward
- if train.movedir==1 and train.tarvelocity>0 then
- train.tarvelocity=0
- atwarn("Train",t_info,"is off track. Trying to drive further out. Velocity clipped to 0")
- pprint=true
- end
- if train.movedir==-1 and train.tarvelocity>1 then
- train.tarvelocity=1
- atwarn("Train",t_info,"is off track. Velocity clipped to 1")
- pprint=true
- end
- elseif back_off_track then--allow movement only forward
- if train.movedir==-1 and train.tarvelocity>0 then
- train.tarvelocity=0
- atwarn("Train",t_info,"is off track. Trying to drive further out. Velocity clipped to 0")
- pprint=true
- end
- if train.movedir==1 and train.tarvelocity>1 then
- train.tarvelocity=1
- atwarn("Train",t_info,"is off track. Velocity clipped to 1")
- pprint=true
- end
- end
- if pprint then
- atprint("max_iot", train.max_index_on_track, "min_iot", train.min_index_on_track, "<> index", train.index, "end_index", train.end_index)
- end
-
- --interpret ATC command
- if train.atc_brake_target and train.atc_brake_target>=train.velocity then
- train.atc_brake_target=nil
- end
- if train.atc_wait_finish then
- if not train.atc_brake_target and train.velocity==train.tarvelocity then
- train.atc_wait_finish=nil
- end
- end
- if train.atc_command then
- if train.atc_delay<=0 and not train.atc_wait_finish then
- advtrains.atc.execute_atc_command(id, train)
- else
- train.atc_delay=train.atc_delay-dtime
- end
- end
-
- --make brake adjust the tarvelocity if necessary
- if train.brake and (math.ceil(train.velocity)-1)<train.tarvelocity then
- train.tarvelocity=math.max((math.ceil(train.velocity)-1), 0)
- end
-
- --- 3a. actually calculate new velocity ---
- if train.velocity~=train.tarvelocity then
- local applydiff=0
- local mass=#train.trainparts
- local diff=train.tarvelocity-train.velocity
- if diff>0 then--accelerating, force will be brought on only by locomotives.
- --atprint("accelerating with default force")
- applydiff=(math.min((advtrains.train_accel_force*train.locomotives_in_train*dtime)/mass, math.abs(diff)))
- else--decelerating
- if front_off_track or back_off_track or train.recently_collided_with_env then --every wagon has a brake, so not divided by mass.
- --atprint("braking with emergency force")
- applydiff= -(math.min((advtrains.train_emerg_force*dtime), math.abs(diff)))
- elseif train.brake or (train.atc_brake_target and train.atc_brake_target<train.velocity) then
- --atprint("braking with default force")
- --no math.min, because it can grow beyond tarvelocity, see up there
- --dont worry, it will never fall below zero.
- applydiff= -((advtrains.train_brake_force*dtime))
- else
- --atprint("roll")
- applydiff= -(math.min((advtrains.train_roll_force*dtime), math.abs(diff)))
- end
- end
- train.last_accel=(applydiff*train.movedir)
- train.velocity=math.min(math.max( train.velocity+applydiff , 0), train.max_speed or 10)
- else
- train.last_accel=0
- end
-
- --- 4. move train ---
-
- train.index=train.index and train.index+(((train.velocity*train.movedir)/(train.path_dist[math.floor(train.index)] or 1))*dtime) or 0
-
- --- 4a. update train.end_index to the new position ---
- train.end_index=advtrains.get_train_end_index(train)
-
- --- 5. extend path as necessary ---
- --why this is an extra function, see under 3.
- advtrains.pathpredict(id, train, true)
-
- --- 5a. make pos/yaw available for possible recover calls ---
- if train.max_index_on_track<train.index then --whoops, train went too far. the saved position will be the last one that lies on a track, and savedpos_off_track_index_offset will hold how far to go from here
- train.savedpos_off_track_index_offset=train.index-train.max_index_on_track
- train.last_pos=train.path[train.max_index_on_track]
- train.last_pos_prev=train.path[train.max_index_on_track-1]
- atprint("train is off-track (front), last positions kept at", train.last_pos, "/", train.last_pos_prev)
- elseif train.min_index_on_track+1>train.index then --whoops, train went even more far. same behavior
- train.savedpos_off_track_index_offset=train.index-train.min_index_on_track
- train.last_pos=train.path[train.min_index_on_track+1]
- train.last_pos_prev=train.path[train.min_index_on_track]
- atprint("train is off-track (back), last positions kept at", train.last_pos, "/", train.last_pos_prev)
- else --regular case
- train.savedpos_off_track_index_offset=nil
- train.last_pos=train.path[math.floor(train.index+0.5)]
- train.last_pos_prev=train.path[math.floor(train.index-0.5)]
- end
-
- --- 5b. Remove path items that are no longer used ---
- -- Necessary since path items are no longer invalidated in save steps
- local path_pregen_keep=20
- local offtrack_keep=4
- local gen_front_keep= path_pregen_keep
- local gen_back_keep= math.floor(- train.trainlen - path_pregen_keep)
-
- local delete_min=math.min(train.max_index_on_track - offtrack_keep, math.floor(train.index)+gen_back_keep)
- local delete_max=math.max(train.min_index_on_track + offtrack_keep, math.floor(train.index)+gen_front_keep)
-
- if train.path_extent_min<delete_min then
- atprint(sid(id),"clearing path min ",train.path_extent_min," to ",delete_min)
- for i=train.path_extent_min,delete_min-1 do
- train.path[i]=nil
- train.path_dist[i]=nil
- end
- train.path_extent_min=delete_min
- train.min_index_on_track=math.max(train.min_index_on_track, delete_min)
- end
- if train.path_extent_max>delete_max then
- atprint(sid(id),"clearing path max ",train.path_extent_max," to ",delete_max)
- train.path_dist[delete_max]=nil
- for i=delete_max+1,train.path_extent_max do
- train.path[i]=nil
- train.path_dist[i]=nil
- end
- train.path_extent_max=delete_max
- train.max_index_on_track=math.min(train.max_index_on_track, delete_max)
- end
-
- --- 6. update node coverage ---
-
- -- when paths get cleared, the old indices set above will be up-to-date and represent the state in which the last run of this code was made
- local ifo, ifn, ibo, ibn = train.detector_old_index, math.floor(train.index), train.detector_old_end_index, math.floor(train.end_index)
-
- local path=train.path
-
- if train.enter_node_all then
- --field set by create_new_train_at.
- --ensures that new train calls enter_node on all nodes
- for i=ibn, ifn do
- if path[i] then
- advtrains.detector.enter_node(path[i], id)
- end
- end
- train.enter_node_all=nil
- else
- for i=ibn, ifn do
- if path[i] then
- local pts=minetest.pos_to_string(path[i])
- if not (advtrains.detector.on_node[pts] and advtrains.detector.on_node[pts]~=id) then
- advtrains.detector.stay_node(path[i], id)
- end
- end
- end
-
- if ifn>ifo then
- for i=ifo+1, ifn do
- if path[i] then
- local pts=minetest.pos_to_string(path[i])
- if advtrains.detector.on_node[pts] and advtrains.detector.on_node[pts]~=id then
- --if another train has signed up for this position first, it won't be recognized in train_step_b. So do collision here.
- atprint("Collision detected in enter_node callbacks (front) @",pts,"with",sid(advtrains.detector.on_node[pts]))
- advtrains.collide_and_spawn_couple(id, path[i], advtrains.detector.on_node[pts], false)
- end
- atprint("enter_node (front) @index",i,"@",pts,"on_node",sid(advtrains.detector.on_node[pts]))
- advtrains.detector.enter_node(path[i], id)
- end
- end
- elseif ifn<ifo then
- for i=ifn+1, ifo do
- if path[i] then
- advtrains.detector.leave_node(path[i], id)
- end
- end
- end
- if ibn<ibo then
- for i=ibn, ibo-1 do
- if path[i] then
- local pts=minetest.pos_to_string(path[i])
- if advtrains.detector.on_node[pts] and advtrains.detector.on_node[pts]~=id then
- --if another train has signed up for this position first, it won't be recognized in train_step_b. So do collision here.
- atprint("Collision detected in enter_node callbacks (back) @",pts,"on_node",sid(advtrains.detector.on_node[pts]))
- advtrains.collide_and_spawn_couple(id, path[i], advtrains.detector.on_node[pts], true)
- end
- atprint("enter_node (back) @index",i,"@",pts,"with",sid(advtrains.detector.on_node[pts]))
- advtrains.detector.enter_node(path[i], id)
- end
- end
- elseif ibn>ibo then
- for i=ibo, ibn-1 do
- if path[i] then
- advtrains.detector.leave_node(path[i], id)
- end
- end
- end
- end
-
- --- 7. do less important stuff ---
- --check for any trainpart entities if they have been unloaded. do this only if train is near a player, to not spawn entities into unloaded areas
-
- train.check_trainpartload=(train.check_trainpartload or 0)-dtime
- local node_range=(math.max((minetest.settings:get("active_block_range") or 0),1)*16)
- if train.check_trainpartload<=0 then
- local ori_pos=train_pos --see 3a.
- --atprint("[train "..id.."] at "..minetest.pos_to_string(vector.round(ori_pos)))
-
- local should_check=false
- for _,p in ipairs(minetest.get_connected_players()) do
- should_check=should_check or ((vector.distance(ori_pos, p:getpos())<node_range))
- end
- if should_check then
- advtrains.update_trainpart_properties(id)
- end
- train.check_trainpartload=2
- end
- --remove?
- if #train.trainparts==0 then
- atprint("[train "..sid(id).."] has empty trainparts, removing.")
- advtrains.detector.leave_node(path[train.detector_old_index], id)
- advtrains.trains[id]=nil
- return
- end
-end
-
---about regular: Used by 1. to ensure path gets generated far enough, since end index is not known at this time.
-function advtrains.pathpredict(id, train, regular)
- --TODO duplicate code under 5b.
- local path_pregen=10
-
- local gen_front= path_pregen
- local gen_back= - train.trainlen - path_pregen
- if regular then
- gen_front=math.max(train.index, train.detector_old_index) + path_pregen
- gen_back=math.min(train.end_index, train.detector_old_end_index) - path_pregen
- end
-
- local maxn=train.path_extent_max or 0
- while maxn < gen_front do--pregenerate
- local conway
- if train.max_index_on_track == maxn then
- atprint("maxn conway for ",maxn,train.path[maxn],maxn-1,train.path[maxn-1])
- conway=advtrains.conway(train.path[maxn], train.path[maxn-1], train.drives_on)
- end
- if conway then
- train.path[maxn+1]=conway
- train.max_index_on_track=maxn+1
- else
- --do as if nothing has happened and preceed with path
- --but do not update max_index_on_track
- atprint("over-generating path max to index ",(maxn+1)," (position ",train.path[maxn]," )")
- train.path[maxn+1]=vector.add(train.path[maxn], vector.subtract(train.path[maxn], train.path[maxn-1]))
- end
- train.path_dist[maxn]=vector.distance(train.path[maxn+1], train.path[maxn])
- maxn=maxn+1
- end
- train.path_extent_max=maxn
-
- local minn=train.path_extent_min or -1
- while minn > gen_back do
- local conway
- if train.min_index_on_track == minn then
- atprint("minn conway for ",minn,train.path[minn],minn+1,train.path[minn+1])
- conway=advtrains.conway(train.path[minn], train.path[minn+1], train.drives_on)
- end
- if conway then
- train.path[minn-1]=conway
- train.min_index_on_track=minn-1
- else
- --do as if nothing has happened and preceed with path
- --but do not update min_index_on_track
- atprint("over-generating path min to index ",(minn-1)," (position ",train.path[minn]," )")
- train.path[minn-1]=vector.add(train.path[minn], vector.subtract(train.path[minn], train.path[minn+1]))
- end
- train.path_dist[minn-1]=vector.distance(train.path[minn], train.path[minn-1])
- minn=minn-1
- end
- train.path_extent_min=minn
- if not train.min_index_on_track then train.min_index_on_track=-1 end
- if not train.max_index_on_track then train.max_index_on_track=0 end
-end
-
-
-function advtrains.train_step_b(id, train, dtime)
-
- --hacky fix: if train_step_a returned in phase 2, end_index may not be set.
- --just return
- if not train.end_index then
- return
- end
-
- --- 8. check for collisions with other trains and damage players ---
-
- local train_moves=(train.velocity~=0)
-
- if train_moves then
- local collpos
- local coll_grace=1
- if train.movedir==1 then
- collpos=advtrains.get_real_index_position(train.path, train.index-coll_grace)
- else
- collpos=advtrains.get_real_index_position(train.path, train.end_index+coll_grace)
- end
- if collpos then
- local rcollpos=advtrains.round_vector_floor_y(collpos)
- for x=-1,1 do
- for z=-1,1 do
- local testpos=vector.add(rcollpos, {x=x, y=0, z=z})
- --- 8a Check collision ---
- local testpts=minetest.pos_to_string(testpos)
- if advtrains.detector.on_node[testpts] and advtrains.detector.on_node[testpts]~=id then
- --collides
- advtrains.collide_and_spawn_couple(id, testpos, advtrains.detector.on_node[testpts], train.movedir==-1)
- end
- --- 8b damage players ---
- if not minetest.settings:get_bool("creative_mode") then
- local player=advtrains.playersbypts[testpts]
- if player and train.velocity>3 then
- --instantly kill player
- --drop inventory contents first, to not to spawn bones
- local player_inv=player:get_inventory()
- for i=1,player_inv:get_size("main") do
- minetest.add_item(testpos, player_inv:get_stack("main", i))
- end
- for i=1,player_inv:get_size("craft") do
- minetest.add_item(testpos, player_inv:get_stack("craft", i))
- end
- -- empty lists main and craft
- player_inv:set_list("main", {})
- player_inv:set_list("craft", {})
- player:set_hp(0)
- end
- end
- end
- end
- end
- end
-end
-
---returns new id
-function advtrains.create_new_train_at(pos, pos_prev)
- local newtrain_id=os.time()..os.clock()
- while advtrains.trains[newtrain_id] do newtrain_id=os.time()..os.clock() end--ensure uniqueness(will be unneccessary)
-
- advtrains.trains[newtrain_id]={}
- advtrains.trains[newtrain_id].last_pos=pos
- advtrains.trains[newtrain_id].last_pos_prev=pos_prev
- advtrains.trains[newtrain_id].tarvelocity=0
- advtrains.trains[newtrain_id].velocity=0
- advtrains.trains[newtrain_id].trainparts={}
-
- advtrains.trains[newtrain_id].enter_node_all=true
-
- return newtrain_id
-end
-
-
-function advtrains.get_train_end_index(train)
- return advtrains.get_real_path_index(train, train.trainlen or 2)--this function can be found inside wagons.lua since it's more related to wagons. we just set trainlen as pos_in_train
-end
-
-function advtrains.add_wagon_to_train(wagon, train_id, index)
- local train=advtrains.trains[train_id]
- if index then
- table.insert(train.trainparts, index, wagon.unique_id)
- else
- table.insert(train.trainparts, wagon.unique_id)
- end
- --this is not the usual case!!!
- --we may set initialized because the wagon has no chance to step()
- wagon.initialized=true
- --TODO is this art or can we throw it away?
- advtrains.update_trainpart_properties(train_id)
-end
-function advtrains.update_trainpart_properties(train_id, invert_flipstate)
- local train=advtrains.trains[train_id]
- train.drives_on=advtrains.all_tracktypes
- train.max_speed=20
- local rel_pos=0
- local count_l=0
- for i, w_id in ipairs(train.trainparts) do
- local wagon=nil
- for aoid,iwagon in pairs(minetest.luaentities) do
- if iwagon.is_wagon and iwagon.unique_id==w_id then
- if wagon then
- --duplicate
- atprint("update_trainpart_properties: Removing duplicate wagon with id="..aoid)
- iwagon.object:remove()
- else
- wagon=iwagon
- end
- end
- end
- if not wagon then
- if advtrains.wagon_save[w_id] then
- --spawn a new and initialize it with the properties from wagon_save
- wagon=minetest.add_entity(train.last_pos, advtrains.wagon_save[w_id].entity_name):get_luaentity()
- if not wagon then
- minetest.chat_send_all("[advtrains] Warning: Wagon "..advtrains.wagon_save[w_id].entity_name.." does not exist. Make sure all required modules are loaded!")
- else
- wagon:init_from_wagon_save(w_id)
- end
- end
- end
- if wagon then
- rel_pos=rel_pos+wagon.wagon_span
- wagon.train_id=train_id
- wagon.pos_in_train=rel_pos
- wagon.pos_in_trainparts=i
- wagon.old_velocity_vector=nil
- if wagon.is_locomotive then
- count_l=count_l+1
- end
- if invert_flipstate then
- wagon.wagon_flipped = not wagon.wagon_flipped
- end
- rel_pos=rel_pos+wagon.wagon_span
-
- if wagon.drives_on then
- for k,_ in pairs(train.drives_on) do
- if not wagon.drives_on[k] then
- train.drives_on[k]=nil
- end
- end
- end
- train.max_speed=math.min(train.max_speed, wagon.max_speed)
- if i==1 then
- train.couple_lock_front=wagon.lock_couples
- end
- if i==#train.trainparts then
- train.couple_lock_back=wagon.lock_couples
- end
-
- else
- atprint(w_id.." not loaded and no save available")
- --what the hell...
- table.remove(train.trainparts, pit)
- end
- end
- train.trainlen=rel_pos
- train.locomotives_in_train=count_l
-end
-
-function advtrains.split_train_at_wagon(wagon)
- --get train
- local train=advtrains.trains[wagon.train_id]
- if not train.path then return end
-
- local real_pos_in_train=advtrains.get_real_path_index(train, wagon.pos_in_train)
- local pos_for_new_train=train.path[math.floor(real_pos_in_train+wagon.wagon_span)]
- local pos_for_new_train_prev=train.path[math.floor(real_pos_in_train-1+wagon.wagon_span)]
-
- --before doing anything, check if both are rails. else do not allow
- if not pos_for_new_train then
- atprint("split_train: pos_for_new_train not set")
- return false
- end
- local node_ok=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(pos_for_new_train), train.drives_on)
- if not node_ok then
- atprint("split_train: pos_for_new_train ",advtrains.round_vector_floor_y(pos_for_new_train_prev)," not loaded or is not a rail")
- return false
- end
-
- if not train.last_pos_prev then
- atprint("split_train: pos_for_new_train_prev not set")
- return false
- end
-
- local prevnode_ok=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(pos_for_new_train), train.drives_on)
- if not prevnode_ok then
- atprint("split_train: pos_for_new_train_prev ", advtrains.round_vector_floor_y(pos_for_new_train_prev), " not loaded or is not a rail")
- return false
- end
-
- --create subtrain
- local newtrain_id=advtrains.create_new_train_at(pos_for_new_train, pos_for_new_train_prev)
- local newtrain=advtrains.trains[newtrain_id]
- --insert all wagons to new train
- for k,v in ipairs(train.trainparts) do
- if k>=wagon.pos_in_trainparts then
- table.insert(newtrain.trainparts, v)
- train.trainparts[k]=nil
- end
- end
- --update train parts
- advtrains.update_trainpart_properties(wagon.train_id)--atm it still is the desierd id.
- advtrains.update_trainpart_properties(newtrain_id)
- train.tarvelocity=0
- newtrain.velocity=train.velocity
- newtrain.tarvelocity=0
- newtrain.enter_node_all=true
-end
-
---there are 4 cases:
---1/2. F<->R F<->R regular, put second train behind first
---->frontpos of first train will match backpos of second
---3. F<->R R<->F flip one of these trains, take the other as new train
---->backpos's will match
---4. R<->F F<->R flip one of these trains and take it as new parent
---->frontpos's will match
-
---true when trains are facing each other. needed on colliding.
--- check done by iterating paths and checking their direction
---returns nil when not on the same track at all OR when required path items are not generated. this distinction may not always be needed.
-function advtrains.trains_facing(train1, train2)
- local sr_pos=train1.path[math.floor(train1.index)]
- local sr_pos_p=train1.path[math.floor(train1.index)-1]
-
- for i=advtrains.minN(train2.path), advtrains.maxN(train2.path) do
- if vector.equals(sr_pos, train2.path[i]) then
- if train2.path[i+1] and vector.equals(sr_pos_p, train2.path[i+1]) then return true end
- if train2.path[i-1] and vector.equals(sr_pos_p, train2.path[i-1]) then return false end
- return nil
- end
- end
- return nil
-end
-
-function advtrains.collide_and_spawn_couple(id1, pos, id2, t1_is_backpos)
- if minetest.settings:get_bool("advtrains_disable_collisions") then
- return
- end
-
- atprint("COLLISION: "..sid(id1).." and "..sid(id2).." at ",pos,", t1_is_backpos="..(t1_is_backpos and "true" or "false"))
- --TODO:
- local train1=advtrains.trains[id1]
-
- -- do collision
- train1.recently_collided_with_env=true
- train1.velocity=0.5*train1.velocity
- train1.movedir=train1.movedir*-1
- train1.tarvelocity=0
-
- local train2=advtrains.trains[id2]
-
- if not train1 or not train2 then return end
-
- local found
- for i=advtrains.minN(train1.path), advtrains.maxN(train1.path) do
- if vector.equals(train1.path[i], pos) then
- found=true
- end
- end
- if not found then
- atprint("Err: pos not in path. Not spawning a couple")
- return
- end
-
- local frontpos2=train2.path[math.floor(train2.detector_old_index)]
- local backpos2=train2.path[math.floor(train2.detector_old_end_index)]
- local t2_is_backpos
- atprint("End positions: ",frontpos2,backpos2)
-
- t2_is_backpos = vector.distance(backpos2, pos) < vector.distance(frontpos2, pos)
-
- atprint("t2_is_backpos="..(t2_is_backpos and "true" or "false"))
-
- local t1_has_couple
- if t1_is_backpos then
- t1_has_couple=train1.couple_eid_back
- else
- t1_has_couple=train1.couple_eid_front
- end
- local t2_has_couple
- if t2_is_backpos then
- t2_has_couple=train2.couple_eid_back
- else
- t2_has_couple=train2.couple_eid_front
- end
-
- if t1_has_couple then
- if minetest.object_refs[t1_has_couple] then minetest.object_refs[t1_has_couple]:remove() end
- end
- if t2_has_couple then
- if minetest.object_refs[t2_has_couple] then minetest.object_refs[t2_has_couple]:remove() end
- end
- local obj=minetest.add_entity(pos, "advtrains:couple")
- if not obj then atprint("failed creating object") return end
- local le=obj:get_luaentity()
- le.train_id_1=id1
- le.train_id_2=id2
- le.train1_is_backpos=t1_is_backpos
- le.train2_is_backpos=t2_is_backpos
- --find in object_refs
- local p_aoi
- for aoi, compare in pairs(minetest.object_refs) do
- if compare==obj then
- if t1_is_backpos then
- train1.couple_eid_back=aoi
- else
- train1.couple_eid_front=aoi
- end
- if t2_is_backpos then
- train2.couple_eid_back=aoi
- else
- train2.couple_eid_front=aoi
- end
- p_aoi=aoi
- end
- end
- atprint("Couple spawned (ActiveObjectID ",p_aoi,")")
-end
---order of trains may be irrelevant in some cases. check opposite cases. TODO does this work?
---pos1 and pos2 are just needed to form a median.
-
-
-function advtrains.do_connect_trains(first_id, second_id, player)
- local first, second=advtrains.trains[first_id], advtrains.trains[second_id]
-
- if not first or not second or not first.index or not second.index or not first.end_index or not second.end_index then
- return false
- end
-
- if first.couple_lock_back or second.couple_lock_front then
- -- trains are ordered correctly!
- if player then
- minetest.chat_send_player(player:get_player_name(), "Can't couple: couples locked!")
- end
- return
- end
-
- local first_wagoncnt=#first.trainparts
- local second_wagoncnt=#second.trainparts
-
- for _,v in ipairs(second.trainparts) do
- table.insert(first.trainparts, v)
- end
- --kick it like physics (with mass being #wagons)
- local new_velocity=((first.velocity*first_wagoncnt)+(second.velocity*second_wagoncnt))/(first_wagoncnt+second_wagoncnt)
- advtrains.trains[second_id]=nil
- advtrains.update_trainpart_properties(first_id)
- advtrains.trains[first_id].velocity=new_velocity
- advtrains.trains[first_id].tarvelocity=0
- return true
-end
-
-function advtrains.invert_train(train_id)
- local train=advtrains.trains[train_id]
-
- local old_path=train.path
- local old_path_dist=train.path_dist
- train.path={}
- train.path_dist={}
- train.index, train.end_index= -train.end_index, -train.index
- train.path_extent_min, train.path_extent_max = -train.path_extent_max, -train.path_extent_min
- train.min_index_on_track, train.max_index_on_track = -train.max_index_on_track, -train.min_index_on_track
- train.detector_old_index, train.detector_old_end_index = -train.detector_old_end_index, -train.detector_old_index
-
- train.velocity=-train.velocity
- train.tarvelocity=-train.tarvelocity
- for k,v in pairs(old_path) do
- train.path[-k]=v
- train.path_dist[-k-1]=old_path_dist[k]
- end
- local old_trainparts=train.trainparts
- train.trainparts={}
- for k,v in ipairs(old_trainparts) do
- table.insert(train.trainparts, 1, v)--notice insertion at first place
- end
- advtrains.update_trainpart_properties(train_id, true)
-end
-
-function advtrains.get_train_at_pos(pos)
- local ph=minetest.pos_to_string(advtrains.round_vector_floor_y(pos))
- return advtrains.detector.on_node[ph]
-end
-
-function advtrains.invalidate_all_paths(pos)
- --if a position is given, only invalidate inside a radius to save performance
- local inv_radius=50
- atprint("invalidating all paths")
- for k,v in pairs(advtrains.trains) do
- local exec=true
- if pos and v.path and v.index and v.end_index then
- --start and end pos of the train
- local cmp1=v.path[math.floor(v.index)]
- local cmp2=v.path[math.floor(v.end_index)]
- if vector.distance(pos, cmp1)>inv_radius and vector.distance(pos, cmp2)>inv_radius then
- exec=false
- end
- end
- if exec then
- --TODO duplicate code in init.lua avt_save()!
- if v.index then
- v.restore_add_index=v.index-math.floor(v.index+0.5)
- end
- v.path=nil
- v.path_dist=nil
- v.index=nil
- v.end_index=nil
- v.min_index_on_track=nil
- v.max_index_on_track=nil
- v.path_extent_min=nil
- v.path_extent_max=nil
-
- v.detector_old_index=nil
- v.detector_old_end_index=nil
- end
- end
-end
-
---not blocking trains group
-function advtrains.train_collides(node)
- if node and minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].walkable then
- if not minetest.registered_nodes[node.name].groups.not_blocking_trains then
- return true
- end
- end
- return false
-end
-
-local nonblocknodes={
- "default:fence_wood",
- "default:fence_acacia_wood",
- "default:fence_aspen_wood",
- "default:fence_pine_wood",
- "default:fence_junglewood",
- "default:torch",
-
- "default:sign_wall",
- "signs:sign_wall",
- "signs:sign_wall_blue",
- "signs:sign_wall_brown",
- "signs:sign_wall_orange",
- "signs:sign_wall_green",
- "signs:sign_yard",
- "signs:sign_wall_white_black",
- "signs:sign_wall_red",
- "signs:sign_wall_white_red",
- "signs:sign_wall_yellow",
- "signs:sign_post",
- "signs:sign_hanging",
-
-
-}
-minetest.after(0, function()
- for _,name in ipairs(nonblocknodes) do
- if minetest.registered_nodes[name] then
- minetest.registered_nodes[name].groups.not_blocking_trains=1
- end
- end
-end)
diff --git a/advtrains/advtrains/wagons.lua b/advtrains/advtrains/wagons.lua
deleted file mode 100644
index 567b560..0000000
--- a/advtrains/advtrains/wagons.lua
+++ /dev/null
@@ -1,900 +0,0 @@
---atan2 counts angles clockwise, minetest does counterclockwise
-
-minetest.register_privilege("train_place", {
- description = "Player can place trains on tracks not owned by player",
- give_to_singleplayer= false,
-});
-minetest.register_privilege("train_remove", {
- description = "Player can remove trains not owned by player",
- give_to_singleplayer= false,
-});
-minetest.register_privilege("train_operator", {
- description = "Player may operate trains and switch signals. Given by default. Revoke to prevent players from griefing automated subway systems.",
- give_to_singleplayer= true,
- default= true,
-});
-
-local wagon={
- collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
- --physical = true,
- visual = "mesh",
- mesh = "wagon.b3d",
- visual_size = {x=3, y=3},
- textures = {"black.png"},
- is_wagon=true,
- wagon_span=1,--how many index units of space does this wagon consume
- has_inventory=false,
-}
-
-
-function wagon:train()
- return advtrains.trains[self.train_id]
-end
-
---[[about 'initalized':
- when initialized is false, the entity hasn't got any data yet and should wait for these to be set before doing anything
- when loading an existing object (with staticdata), it will be set
- when instanciating a new object via add_entity, it is not set at the time on_activate is called.
- then, wagon:initialize() will be called
-
- wagon will save only uid in staticdata, no serialized table
-]]
-function wagon:on_activate(sd_uid, dtime_s)
- if sd_uid~="" then
- --destroy when loaded from static block.
- self.object:remove()
- return
- end
- self.object:set_armor_groups({immortal=1})
- self.entity_name=self.name
-end
-
-function wagon:get_staticdata()
- return advtrains.pcall(function()
- if not self:ensure_init() then return end
- atprint("[wagon "..((self.unique_id and self.unique_id~="" and self.unique_id) or "no-id").."]: saving to wagon_save")
- --serialize inventory, if it has one
- if self.has_inventory then
- local inv=minetest.get_inventory({type="detached", name="advtrains_wgn_"..self.unique_id})
- self.ser_inv=advtrains.serialize_inventory(inv)
- end
- --save to table before being unloaded
- advtrains.wagon_save[self.unique_id]=advtrains.merge_tables(self)
- advtrains.wagon_save[self.unique_id].entity_name=self.name
- advtrains.wagon_save[self.unique_id].name=nil
- advtrains.wagon_save[self.unique_id].object=nil
- return self.unique_id
- end)
-end
---returns: uid of wagon
-function wagon:init_new_instance(train_id, properties)
- self.unique_id=os.time()..os.clock()
- self.train_id=train_id
- for k,v in pairs(properties) do
- if k~="name" and k~="object" then
- self[k]=v
- end
- end
- self:init_shared()
- self.initialized=true
- atprint("init_new_instance "..self.unique_id.." ("..self.train_id..")")
- return self.unique_id
-end
-function wagon:init_from_wagon_save(uid)
- if not advtrains.wagon_save[uid] then
- self.object:remove()
- return
- end
- self.unique_id=uid
- for k,v in pairs(advtrains.wagon_save[uid]) do
- if k~="name" and k~="object" then
- self[k]=v
- end
- end
- if not self.train_id or not self:train() then
- self.object:remove()
- return
- end
- self:init_shared()
- self.initialized=true
- minetest.after(0.2, function() self:reattach_all() end)
- atprint("init_from_wagon_save "..self.unique_id.." ("..self.train_id..")")
-end
-function wagon:init_shared()
- if self.has_inventory then
- local uid_noptr=self.unique_id..""
- --to be used later
- local inv=minetest.create_detached_inventory("advtrains_wgn_"..self.unique_id, {
- allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
- return count
- end,
- allow_put = function(inv, listname, index, stack, player)
- return stack:get_count()
- end,
- allow_take = function(inv, listname, index, stack, player)
- return stack:get_count()
- end
- })
- if self.ser_inv then
- advtrains.deserialize_inventory(self.ser_inv, inv)
- end
- if self.inventory_list_sizes then
- for lst, siz in pairs(self.inventory_list_sizes) do
- inv:set_size(lst, siz)
- end
- end
- end
- if self.doors then
- self.door_anim_timer=0
- self.door_state=0
- end
- if self.custom_on_activate then
- self:custom_on_activate(dtime_s)
- end
-end
-function wagon:ensure_init()
- if self.initialized then
- if self.noninitticks then self.noninitticks=nil end
- return true
- end
- if not self.noninitticks then self.noninitticks=0 end
- self.noninitticks=self.noninitticks+1
- if self.noninitticks>20 then
- self.object:remove()
- else
- self.object:setvelocity({x=0,y=0,z=0})
- end
- return false
-end
-
--- Remove the wagon
-function wagon:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
- return advtrains.pcall(function()
- if not self:ensure_init() then return end
- if not puncher or not puncher:is_player() then
- return
- end
- if self.owner and puncher:get_player_name()~=self.owner and (not minetest.check_player_privs(puncher, {train_remove = true })) then
- minetest.chat_send_player(puncher:get_player_name(), attrans("This wagon is owned by @1, you can't destroy it.", self.owner));
- return
- end
-
- if minetest.settings:get_bool("creative_mode") then
- if not self:destroy() then return end
-
- local inv = puncher:get_inventory()
- if not inv:contains_item("main", self.name) then
- inv:add_item("main", self.name)
- end
- else
- local pc=puncher:get_player_control()
- if not pc.sneak then
- minetest.chat_send_player(puncher:get_player_name(), attrans("Warning: If you destroy this wagon, you only get some steel back! If you are sure, hold Sneak and left-click the wagon."))
- return
- end
-
- if not self:destroy() then return end
-
- local inv = puncher:get_inventory()
- for _,item in ipairs(self.drops or {self.name}) do
- inv:add_item("main", item)
- end
- end
- end)
-end
-function wagon:destroy()
- --some rules:
- -- you get only some items back
- -- single left-click shows warning
- -- shift leftclick destroys
- -- not when a driver is inside
-
- for _,_ in pairs(self.seatp) do
- return
- end
-
- if self.custom_may_destroy then
- if not self.custom_may_destroy(self, puncher, time_from_last_punch, tool_capabilities, direction) then
- return
- end
- end
- if self.custom_on_destroy then
- self.custom_on_destroy(self, puncher, time_from_last_punch, tool_capabilities, direction)
- end
-
- atprint("[wagon "..((self.unique_id and self.unique_id~="" and self.unique_id) or "no-id").."]: destroying")
-
- self.object:remove()
-
- table.remove(self:train().trainparts, self.pos_in_trainparts)
- advtrains.update_trainpart_properties(self.train_id)
- advtrains.wagon_save[self.unique_id]=nil
- if self.discouple then self.discouple.object:remove() end--will have no effect on unloaded objects
- return true
-end
-
-
-function wagon:on_step(dtime)
- return advtrains.pcall(function()
- if not self:ensure_init() then return end
-
- local t=os.clock()
- local pos = self.object:getpos()
-
- if not pos then
- atprint("["..self.unique_id.."][fatal] missing position (object:getpos() returned nil)")
- return
- end
-
- self.entity_name=self.name
-
- --is my train still here
- if not self.train_id or not self:train() then
- atprint("[wagon "..self.unique_id.."] missing train_id, destroying")
- self.object:remove()
- return
- end
- if not self.seatp then
- self.seatp={}
- end
- if not self.seatpc then
- self.seatpc={}
- end
-
- --Legacy: remove infotext since it does not work this way anyways
- self.infotext=nil
-
- --custom on_step function
- if self.custom_on_step then
- self:custom_on_step(self, dtime)
- end
-
- --driver control
- for seatno, seat in ipairs(self.seats) do
- local driver=self.seatp[seatno] and minetest.get_player_by_name(self.seatp[seatno])
- local has_driverstand=seat.driving_ctrl_access and self.seatp[seatno] and minetest.check_player_privs(self.seatp[seatno], {train_operator=true})
- if has_driverstand and driver then
- advtrains.update_driver_hud(driver:get_player_name(), self:train(), self.wagon_flipped)
- elseif driver then
- --only show the inside text
- local inside=self:train().text_inside or ""
- advtrains.set_trainhud(driver:get_player_name(), inside)
- end
- if driver and driver:get_player_control_bits()~=self.seatpc[seatno] then
- local pc=driver:get_player_control()
- self.seatpc[seatno]=driver:get_player_control_bits()
-
- if has_driverstand then
- --regular driver stand controls
- advtrains.on_control_change(pc, self:train(), self.wagon_flipped)
- else
- -- If on a passenger seat and doors are open, get off when W or D pressed.
- local pass = self.seatp[seatno] and minetest.get_player_by_name(self.seatp[seatno])
- if pass and self:train().door_open~=0 then
- local pc=pass:get_player_control()
- if pc.up or pc.down then
- self:get_off(seatno)
- end
- end
- end
- if pc.aux1 and pc.sneak then
- self:get_off(seatno)
- end
- end
- end
-
- --check infotext
- local outside=self:train().text_outside or ""
- if self.object:get_properties().infotext~=outside then
- self.object:set_properties({infotext=outside})
- end
-
- local gp=self:train()
- local fct=self.wagon_flipped and -1 or 1
- --door animation
- if self.doors then
- if (self.door_anim_timer or 0)<=0 then
- local dstate = (gp.door_open or 0) * fct
- if dstate ~= self.door_state then
- local at
- --meaning of the train.door_open field:
- -- -1: left doors (rel. to train orientation)
- -- 0: closed
- -- 1: right doors
- --this code produces the following behavior:
- -- if changed from 0 to +-1, play open anim. if changed from +-1 to 0, play close.
- -- if changed from +-1 to -+1, first close and set 0, then it will detect state change again and run open.
- if self.door_state == 0 then
- at=self.doors.open[dstate]
- self.object:set_animation(at.frames, at.speed or 15, at.blend or 0, false)
- self.door_state = dstate
- else
- at=self.doors.close[self.door_state or 1]--in case it has not been set yet
- self.object:set_animation(at.frames, at.speed or 15, at.blend or 0, false)
- self.door_state = 0
- end
- self.door_anim_timer = at.time
- end
- else
- self.door_anim_timer = (self.door_anim_timer or 0) - dtime
- end
- end
-
- --DisCouple
- if self.pos_in_trainparts and self.pos_in_trainparts>1 then
- if gp.velocity==0 and not self.lock_couples then
- if not self.discouple or not self.discouple.object:getyaw() then
- local object=minetest.add_entity(pos, "advtrains:discouple")
- if object then
- local le=object:get_luaentity()
- le.wagon=self
- --box is hidden when attached, so unuseful.
- --object:set_attach(self.object, "", {x=0, y=0, z=self.wagon_span*10}, {x=0, y=0, z=0})
- self.discouple=le
- else
- atprint("Couldn't spawn DisCouple")
- end
- end
- else
- if self.discouple and self.discouple.object:getyaw() then
- self.discouple.object:remove()
- end
- end
- end
- --for path to be available. if not, skip step
- if not gp.path then
- self.object:setvelocity({x=0, y=0, z=0})
- return
- end
- if not self.pos_in_train then
- --why ever. but better continue next step...
- advtrains.update_trainpart_properties(self.train_id)
- return
- end
-
- local index=advtrains.get_real_path_index(self:train(), self.pos_in_train)
- --atprint("trainindex "..gp.index.." wagonindex "..index)
-
- --automatic get_on
- --needs to know index and path
- if self.door_entry and gp.door_open and gp.door_open~=0 and gp.velocity==0 then
- --using the mapping created by the trainlogic globalstep
- for i, ino in ipairs(self.door_entry) do
- --fct is the flipstate flag from door animation above
- local aci = index + ino*fct
- local ix1=gp.path[math.floor(aci)]
- local ix2=gp.path[math.floor(aci+1)]
- -- the two wanted positions are ix1 and ix2 + (2nd-1st rotated by 90deg)
- -- (x z) rotated by 90deg is (-z x) (http://stackoverflow.com/a/4780141)
- local add = { x = (ix2.z-ix1.z)*gp.door_open, y = 0, z = (ix1.x-ix2.x)*gp.door_open }
- local pts1=vector.round(vector.add(ix1, add))
- local pts2=vector.round(vector.add(ix2, add))
- if minetest.get_item_group(minetest.get_node(pts1).name, "platform")>0 then
- local ckpts={
- pts1,
- pts2,
- vector.add(pts1, {x=0, y=1, z=0}),
- vector.add(pts2, {x=0, y=1, z=0}),
- }
- for _,ckpos in ipairs(ckpts) do
- local cpp=minetest.pos_to_string(ckpos)
- if advtrains.playersbypts[cpp] then
- self:on_rightclick(advtrains.playersbypts[cpp])
- end
- end
- end
- end
- end
-
- --position recalculation
- local first_pos=gp.path[math.floor(index)]
- local second_pos=gp.path[math.floor(index)+1]
- if not first_pos or not second_pos then
- --atprint(" object "..self.unique_id.." path end reached!")
- self.object:setvelocity({x=0,y=0,z=0})
- return
- end
-
- --checking for environment collisions(a 3x3 cube around the center)
- if not gp.recently_collided_with_env then
- local collides=false
- for x=-1,1 do
- for y=0,2 do
- for z=-1,1 do
- local node=minetest.get_node_or_nil(vector.add(first_pos, {x=x, y=y, z=z}))
- if (advtrains.train_collides(node)) then
- collides=true
- end
- end
- end
- end
- if collides then
- if self.collision_count and self.collision_count>10 then
- --enable collision mercy to get trains stuck in walls out of walls
- --actually do nothing except limiting the velocity to 1
- gp.velocity=math.min(gp.velocity, 1)
- gp.tarvelocity=math.min(gp.tarvelocity, 1)
- else
- gp.recently_collided_with_env=true
- gp.velocity=2*gp.velocity
- gp.movedir=-gp.movedir
- gp.tarvelocity=0
- self.collision_count=(self.collision_count or 0)+1
- end
- else
- self.collision_count=nil
- end
- end
-
- --FIX: use index of the wagon, not of the train.
- local velocity=(gp.velocity*gp.movedir)/(gp.path_dist[math.floor(index)] or 1)
- local acceleration=(gp.last_accel or 0)/(gp.path_dist[math.floor(index)] or 1)
- local factor=index-math.floor(index)
- local actual_pos={x=first_pos.x-(first_pos.x-second_pos.x)*factor, y=first_pos.y-(first_pos.y-second_pos.y)*factor, z=first_pos.z-(first_pos.z-second_pos.z)*factor,}
- local velocityvec={x=(first_pos.x-second_pos.x)*velocity*-1, z=(first_pos.z-second_pos.z)*velocity*-1, y=(first_pos.y-second_pos.y)*velocity*-1}
- local accelerationvec={x=(first_pos.x-second_pos.x)*acceleration*-1, z=(first_pos.z-second_pos.z)*acceleration*-1, y=(first_pos.y-second_pos.y)*acceleration*-1}
-
- --some additional positions to determine orientation
- local aposfwd=gp.path[math.floor(index+2)]
- local aposbwd=gp.path[math.floor(index-1)]
-
- local yaw
- if aposfwd and aposbwd then
- yaw=advtrains.get_wagon_yaw(aposfwd, second_pos, first_pos, aposbwd, factor)+math.pi--TODO remove when cleaning up
- else
- yaw=math.atan2((first_pos.x-second_pos.x), (second_pos.z-first_pos.z))
- end
- if self.wagon_flipped then
- yaw=yaw+math.pi
- end
-
- self.updatepct_timer=(self.updatepct_timer or 0)-dtime
- if not self.old_velocity_vector
- or not vector.equals(velocityvec, self.old_velocity_vector)
- or not self.old_acceleration_vector
- or not vector.equals(accelerationvec, self.old_acceleration_vector)
- or self.old_yaw~=yaw
- or self.updatepct_timer<=0 then--only send update packet if something changed
- self.object:setpos(actual_pos)
- self.object:setvelocity(velocityvec)
- self.object:setacceleration(accelerationvec)
- self.object:setyaw(yaw)
- self.updatepct_timer=2
- if self.update_animation then
- self:update_animation(gp.velocity)
- end
- end
-
-
- self.old_velocity_vector=velocityvec
- self.old_acceleration_vector=accelerationvec
- self.old_yaw=yaw
- atprintbm("wagon step", t)
- end)
-end
-
-function advtrains.get_real_path_index(train, pit)
- local pos_in_train_left=pit
- local index=train.index
- if pos_in_train_left>(index-math.floor(index))*(train.path_dist[math.floor(index)] or 1) then
- pos_in_train_left=pos_in_train_left - (index-math.floor(index))*(train.path_dist[math.floor(index)] or 1)
- index=math.floor(index)
- while pos_in_train_left>(train.path_dist[index-1] or 1) do
- pos_in_train_left=pos_in_train_left - (train.path_dist[index-1] or 1)
- index=index-1
- end
- index=index-(pos_in_train_left/(train.path_dist[index-1] or 1))
- else
- index=index-(pos_in_train_left/(train.path_dist[math.floor(index-1)] or 1))
- end
- return index
-end
-
-function wagon:on_rightclick(clicker)
- return advtrains.pcall(function()
- if not self:ensure_init() then return end
- if not clicker or not clicker:is_player() then
- return
- end
- if clicker:get_player_control().aux1 then
- --advtrains.dumppath(self:train().path)
- --minetest.chat_send_all("at index "..(self:train().index or "nil"))
- --advtrains.invert_train(self.train_id)
- atprint(dump(self))
- return
- end
- local pname=clicker:get_player_name()
- local no=self:get_seatno(pname)
- if no then
- if self.seat_groups then
- local poss={}
- local sgr=self.seats[no].group
- for _,access in ipairs(self.seat_groups[sgr].access_to) do
- if self:check_seat_group_access(pname, access) then
- poss[#poss+1]={name=self.seat_groups[access].name, key="sgr_"..access}
- end
- end
- if self.has_inventory and self.get_inventory_formspec then
- poss[#poss+1]={name=attrans("Show Inventory"), key="inv"}
- end
- if self.owner==pname then
- poss[#poss+1]={name=attrans("Wagon properties"), key="prop"}
- end
- if not self.seat_groups[sgr].require_doors_open or self:train().door_open~=0 then
- poss[#poss+1]={name=attrans("Get off"), key="off"}
- else
- if clicker:get_player_control().sneak then
- poss[#poss+1]={name=attrans("Get off (forced)"), key="off"}
- else
- poss[#poss+1]={name=attrans("(Doors closed)"), key="dcwarn"}
- end
- end
- if #poss==0 then
- --can't do anything.
- elseif #poss==1 then
- self:seating_from_key_helper(pname, {[poss[1].key]=true}, no)
- else
- local form = "size[5,"..1+(#poss).."]"
- for pos,ent in ipairs(poss) do
- form = form .. "button_exit[0.5,"..(pos-0.5)..";4,1;"..ent.key..";"..ent.name.."]"
- end
- minetest.show_formspec(pname, "advtrains_seating_"..self.unique_id, form)
- end
- else
- self:get_off(no)
- end
- else
- --do not attach if already on a train
- if advtrains.player_to_train_mapping[pname] then return end
- if self.seat_groups then
- if #self.seats==0 then
- if self.has_inventory and self.get_inventory_formspec then
- minetest.show_formspec(pname, "advtrains_inv_"..self.unique_id, self:get_inventory_formspec(pname))
- end
- return
- end
-
- local doors_open = self:train().door_open~=0 or clicker:get_player_control().sneak
- for _,sgr in ipairs(self.assign_to_seat_group) do
- if self:check_seat_group_access(pname, sgr) then
- for seatid, seatdef in ipairs(self.seats) do
- if seatdef.group==sgr and not self.seatp[seatid] and (not self.seat_groups[sgr].require_doors_open or doors_open) then
- self:get_on(clicker, seatid)
- return
- end
- end
- end
- end
- minetest.chat_send_player(pname, attrans("Can't get on: wagon full or doors closed!"))
- minetest.chat_send_player(pname, attrans("Use Sneak+rightclick to bypass closed doors!"))
- else
- self:show_get_on_form(pname)
- end
- end
- end)
-end
-
-function wagon:get_on(clicker, seatno)
- if not self.seatp then self.seatp={}end
- if not self.seatpc then self.seatpc={}end--player controls in driver stands
-
- if not self.seats[seatno] then return end
- local oldno=self:get_seatno(clicker:get_player_name())
- if oldno then
- atprint("get_on: clearing oldno",seatno)
- advtrains.player_to_train_mapping[clicker:get_player_name()]=nil
- advtrains.clear_driver_hud(clicker:get_player_name())
- self.seatp[oldno]=nil
- end
- if self.seatp[seatno] and self.seatp[seatno]~=clicker:get_player_name() then
- atprint("get_on: throwing off",self.seatp[seatno],"from seat",seatno)
- self:get_off(seatno)
- end
- atprint("get_on: attaching",clicker:get_player_name())
- self.seatp[seatno] = clicker:get_player_name()
- self.seatpc[seatno] = clicker:get_player_control_bits()
- advtrains.player_to_train_mapping[clicker:get_player_name()]=self.train_id
- clicker:set_attach(self.object, "", self.seats[seatno].attach_offset, {x=0,y=0,z=0})
- clicker:set_eye_offset(self.seats[seatno].view_offset, self.seats[seatno].view_offset)
-end
-function wagon:get_off_plr(pname)
- local no=self:get_seatno(pname)
- if no then
- self:get_off(no)
- end
-end
-function wagon:get_seatno(pname)
- for no, cont in pairs(self.seatp) do
- if cont==pname then
- return no
- end
- end
- return nil
-end
-function wagon:get_off(seatno)
- if not self.seatp[seatno] then return end
- local pname = self.seatp[seatno]
- local clicker = minetest.get_player_by_name(pname)
- advtrains.player_to_train_mapping[pname]=nil
- advtrains.clear_driver_hud(pname)
- self.seatp[seatno]=nil
- self.seatpc[seatno]=nil
- if clicker then
- atprint("get_off: detaching",clicker:get_player_name())
- clicker:set_detach()
- clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
- local gp=self:train()
- --code as in step - automatic get on
- if self.door_entry and gp.door_open and gp.door_open~=0 and gp.velocity==0 and gp.index and gp.path then
- local index=advtrains.get_real_path_index(gp, self.pos_in_train)
- --using the mapping created by the trainlogic globalstep
- for i, ino in ipairs(self.door_entry) do
- local aci = index + ino*(self.wagon_flipped and -1 or 1)
- local ix1=gp.path[math.floor(aci)]
- local ix2=gp.path[math.floor(aci+1)]
- -- the two wanted positions are ix1 and ix2 + (2nd-1st rotated by 90deg)
- -- (x z) rotated by 90deg is (-z x) (http://stackoverflow.com/a/4780141)
- -- multiplied by 2 here, to place off on platform, y of add is 1.
- local add = { x = (ix2.z-ix1.z)*gp.door_open, y = 0, z = (ix1.x-ix2.x)*gp.door_open}
- local oadd = { x = (ix2.z-ix1.z)*gp.door_open*2, y = 1, z = (ix1.x-ix2.x)*gp.door_open*2}
- local platpos=vector.round(vector.add(ix1, add))
- local offpos=vector.round(vector.add(ix1, oadd))
- atprint("platpos:", platpos, "offpos:", offpos)
- if minetest.get_item_group(minetest.get_node(platpos).name, "platform")>0 then
- minetest.after(0.2, function() clicker:setpos(offpos) end)
- return
- end
- end
- else--if not door_entry, or paths missing, fall back to old method
- local objpos=advtrains.round_vector_floor_y(self.object:getpos())
- local yaw=self.object:getyaw()
- local isx=(yaw < math.pi/4) or (yaw > 3*math.pi/4 and yaw < 5*math.pi/4) or (yaw > 7*math.pi/4)
- --abuse helper function
- for _,r in ipairs({-1, 1}) do
- local p=vector.add({x=isx and r or 0, y=0, z=not isx and r or 0}, objpos)
- local offp=vector.add({x=isx and r*2 or 0, y=1, z=not isx and r*2 or 0}, objpos)
- if minetest.get_item_group(minetest.get_node(p).name, "platform")>0 then
- minetest.after(0.2, function() clicker:setpos(offp) end)
- return
- end
- end
- end
- end
-end
-function wagon:show_get_on_form(pname)
- if not self.initialized then return end
- if #self.seats==0 then
- if self.has_inventory and self.get_inventory_formspec then
- minetest.show_formspec(pname, "advtrains_inv_"..self.unique_id, self:get_inventory_formspec(pname))
- end
- return
- end
- local form, comma="size[5,8]label[0.5,0.5;"..attrans("Select seat:").."]textlist[0.5,1;4,6;seat;", ""
- for seatno, seattbl in ipairs(self.seats) do
- local addtext, colorcode="", ""
- if self.seatp and self.seatp[seatno] then
- colorcode="#FF0000"
- addtext=" ("..self.seatp[seatno]..")"
- end
- form=form..comma..colorcode..seattbl.name..addtext
- comma=","
- end
- form=form..";0,false]"
- if self.has_inventory and self.get_inventory_formspec then
- form=form.."button_exit[1,7;3,1;inv;"..attrans("Show Inventory").."]"
- end
- minetest.show_formspec(pname, "advtrains_geton_"..self.unique_id, form)
-end
-function wagon:show_wagon_properties(pname)
- local numsgr=0
- if self.seat_groups then
- numsgr=#self.seat_groups
- end
- if not self.seat_access then
- self.seat_access={}
- end
- --[[
- fields: seat access: empty: everyone
- checkbox: lock couples
- button: save
- ]]
- local form="size[5,"..(numsgr*1.5+7).."]"
- local at=0
- if self.seat_groups then
- for sgr,sgrdef in pairs(self.seat_groups) do
- local text = attrans("Access to @1",sgrdef.name)
- form=form.."field[0.5,"..(0.5+at*1.5)..";4,1;sgr_"..sgr..";"..text..";"..(self.seat_access[sgr] or "").."]"
- at=at+1
- end
- end
- form=form.."checkbox[0,"..(at*1.5)..";lock_couples;"..attrans("Lock couples")..";"..(self.lock_couples and "true" or "false").."]"
- if self:train() then --just in case
- form=form.."field[0.5,"..(1.5+at*1.5)..";4,1;text_outside;"..attrans("Text displayed outside on train")..";"..(self:train().text_outside or "").."]"
- form=form.."field[0.5,"..(2.5+at*1.5)..";4,1;text_inside;"..attrans("Text displayed inside train")..";"..(self:train().text_inside or "").."]"
- end
- form=form.."button_exit[0.5,"..(3+at*1.5)..";4,1;save;"..attrans("Save wagon properties").."]"
- minetest.show_formspec(pname, "advtrains_prop_"..self.unique_id, form)
-end
-minetest.register_on_player_receive_fields(function(player, formname, fields)
- return advtrains.pcall(function()
- local uid=string.match(formname, "^advtrains_geton_(.+)$")
- if uid then
- for _,wagon in pairs(minetest.luaentities) do
- if wagon.is_wagon and wagon.initialized and wagon.unique_id==uid then
- if fields.inv then
- if wagon.has_inventory and wagon.get_inventory_formspec then
- minetest.show_formspec(player:get_player_name(), "advtrains_inv_"..uid, wagon:get_inventory_formspec(player:get_player_name()))
- end
- elseif fields.seat then
- local val=minetest.explode_textlist_event(fields.seat)
- if val and val.type~="INV" and not wagon.seatp[player:get_player_name()] then
- --get on
- wagon:get_on(player, val.index)
- --will work with the new close_formspec functionality. close exactly this formspec.
- minetest.show_formspec(player:get_player_name(), formname, "")
- end
- end
- end
- end
- end
- uid=string.match(formname, "^advtrains_seating_(.+)$")
- if uid then
- for _,wagon in pairs(minetest.luaentities) do
- if wagon.is_wagon and wagon.initialized and wagon.unique_id==uid then
- local pname=player:get_player_name()
- local no=wagon:get_seatno(pname)
- if no then
- if wagon.seat_groups then
- wagon:seating_from_key_helper(pname, fields, no)
- end
- end
- end
- end
- end
- uid=string.match(formname, "^advtrains_prop_(.+)$")
- if uid then
- for _,wagon in pairs(minetest.luaentities) do
- if wagon.is_wagon and wagon.initialized and wagon.unique_id==uid then
- local pname=player:get_player_name()
- if pname~=wagon.owner then
- return true
- end
- if fields.save or not fields.quit then
- for sgr,sgrdef in pairs(wagon.seat_groups) do
- if fields["sgr_"..sgr] then
- local fcont = fields["sgr_"..sgr]
- wagon.seat_access[sgr] = fcont~="" and fcont or nil
- end
- end
- if fields.lock_couples then
- wagon.lock_couples = fields.lock_couples == "true"
- end
- if fields.text_outside then
- if fields.text_outside~="" then
- wagon:train().text_outside=fields.text_outside
- else
- wagon:train().text_outside=nil
- end
- end
- if fields.text_inside then
- if fields.text_inside~="" then
- wagon:train().text_inside=fields.text_inside
- else
- wagon:train().text_inside=nil
- end
- end
-
- end
- end
- end
- end
- end)
-end)
-function wagon:seating_from_key_helper(pname, fields, no)
- local sgr=self.seats[no].group
- for _,access in ipairs(self.seat_groups[sgr].access_to) do
- if fields["sgr_"..access] and self:check_seat_group_access(pname, access) then
- for seatid, seatdef in ipairs(self.seats) do
- if seatdef.group==access and not self.seatp[seatid] then
- self:get_on(minetest.get_player_by_name(pname), seatid)
- return
- end
- end
- end
- end
- if fields.inv and self.has_inventory and self.get_inventory_formspec then
- minetest.show_formspec(player:get_player_name(), "advtrains_inv_"..self.unique_id, wagon:get_inventory_formspec(player:get_player_name()))
- end
- if fields.prop and self.owner==pname then
- self:show_wagon_properties(pname)
- end
- if fields.dcwarn then
- minetest.chat_send_player(pname, attrans("Doors are closed! Use Sneak+rightclick to ignore the closed doors and get off!"))
- end
- if fields.off then
- self:get_off(no)
- end
-end
-function wagon:check_seat_group_access(pname, sgr)
- if not self.seat_access then
- return true
- end
- local sae=self.seat_access[sgr]
- if not sae or sae=="" then
- return true
- end
- for name in string.gmatch(sae, "%S+") do
- if name==pname then
- return true
- end
- end
- return false
-end
-function wagon:reattach_all()
- if not self.seatp then self.seatp={} end
- for seatno, pname in pairs(self.seatp) do
- local p=minetest.get_player_by_name(pname)
- if p then
- self:get_on(p ,seatno)
- end
- end
-end
-
-function advtrains.register_wagon(sysname, prototype, desc, inv_img)
- setmetatable(prototype, {__index=wagon})
- minetest.register_entity(":advtrains:"..sysname,prototype)
-
- minetest.register_craftitem(":advtrains:"..sysname, {
- description = desc,
- inventory_image = inv_img,
- wield_image = inv_img,
- stack_max = 1,
-
- on_place = function(itemstack, placer, pointed_thing)
- return advtrains.pcall(function()
- if not pointed_thing.type == "node" then
- return
- end
-
-
- local node=minetest.get_node_or_nil(pointed_thing.under)
- if not node then atprint("[advtrains]Ignore at placer position") return itemstack end
- local nodename=node.name
- if(not advtrains.is_track_and_drives_on(nodename, prototype.drives_on)) then
- atprint("no track here, not placing.")
- return itemstack
- end
- if not minetest.check_player_privs(placer, {train_place = true }) and minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
- minetest.record_protection_violation(pointed_thing.under, placer:get_player_name())
- return
- end
- local conn1=advtrains.get_track_connections(node.name, node.param2)
- local id=advtrains.create_new_train_at(pointed_thing.under, advtrains.dirCoordSet(pointed_thing.under, conn1))
-
- local ob=minetest.add_entity(pointed_thing.under, "advtrains:"..sysname)
- if not ob then
- atprint("couldn't add_entity, aborting")
- end
- local le=ob:get_luaentity()
-
- le.owner=placer:get_player_name()
-
- local wagon_uid=le:init_new_instance(id, {})
-
- advtrains.add_wagon_to_train(le, id)
- if not minetest.settings:get_bool("creative_mode") then
- itemstack:take_item()
- end
- return itemstack
-
- end)
- end,
- })
-end
-
---[[
- wagons can define update_animation(self, velocity) if they have a speed-dependent animation
- this function will be called when the velocity vector changes or every 2 seconds.
-]]
-
-