| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch exposes train.staticdata that can be used by other modders to
save data in trains across restarts. It additionally exposes two new
APIs for modders where this is relevant:
* advtrains.te_register_on_couple(function(init_train, stat_train)):
registers a callback for train coupling, where stat_train is couple
into init_train and is subsequently removed. This callback is run
before the actual coupling takes place; in particular, it is run
before stat_train is removed.
* advtrains.te_register_on_decouple(function(train, newtrain, index)):
registers a callback for train decoupling, where newtrain is created
by splitting the train at the given index (the wagon at the index is
part of the new train). This callback is run after decoupling takes
place.
advtrains.te_register_on_decouple(function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As it turns out, not fully testing new features is not necessarily a
good idea ...
This patch follows up 1F616EMO's patch by
* Making get_wagon_prototype return the resolved alias,
* Handling recursive wagon alises (in particular, loops), and
* Adding (partial) unittest for the wagon aliasing system. [v2]: The
testcases are complemented a bit more to cover situations where the
alias resolution system should return nil.
[v2]: This patch should hopefully also warn about not spawning wagons.
Note that this only warns about the missing wagon entity and does _not_
actually fix the issue.
How to test:
* In a world with both advtrains_train_subway and advtrains_train_japan
enabled, place a subway wagon, a Japanese engine, and a regular
Japanese wagon.
* Add the test mod to the world; do NOT remove advtrains_train_japan.
* Restart the world. Notice that the Japanese wagons still appear as
Japanese wagons despite being aliased to subway wagons.
* Restart the world without the advtrains_train_japan mod. Notice that
the engine appears as the subway wagon while the regular Japanese
wagon appears as the wagon placeholder. [v2]: Also note that the
warning message about the missing wagon prototype still mentions the
regular Japanese wagon.
* Restart the world again with the advtrains_train_japan mod. Notice
that both type of Japanese wagons reappear as Japanese wagons.
* Observe that unittests work.
Test mod:
advtrains.register_wagon_alias("advtrains:engine_japan", "advtrains:subway_wagon")
advtrains.register_wagon_alias("advtrains:wagon_japan", "advtrains:wagon_japan")
|
| |
|
| |
|
|
|
|
| |
reverse_lookup_sel() to select appropriate index out of multiple based on a heuristic
|
|
|
|
| |
Related issue: https://forum.minetest.net/viewtopic.php?p=414307#p414307
|
|
|
|
| |
Previously, statement was always false because train_id is no longer in the luaentity
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
split_at_index() from LuaATC
Issue was that train thought it would collide with the newly added back portion although it was already long past this train. Added additional check that current train index is not further than the collision point.
|
|
|
|
| |
is kept, add ATC Cpl command
|
|
|
|
| |
(such as single minecarts) to solve #155
|
|
|
|
|
|
|
| |
- Adds a separate collision system for trains sharing a path
- Moved some coupling-related code to couple.lua and refactor it
- Handle coupling in a way that the initiating train always keeps its ID
- As a side effect, engine has its direction reversed after coupling
|
|
|
|
|
|
|
|
| |
If the advtrains_forgiving_collision setting is set to true, then the
train only collides with nodes that do not have normal
drawtype. Otherwise the old behavior is restored. This change is being
made because there were users and mods relying on the old behavior,
such as the railroad_paraphernalia mod's track blocker.
|
|
|
|
|
|
|
| |
As per discussion on the forum (https://forum.minetest.net/viewtopic.php?p=396745#p396745), changes the train-world collision logic to make trains only collide with nodes that are solid cubes.
This allows for more creative freedom, but shifts the responsibility of building realistic railways to the players.
In the future, a more sophisticated environment collision system might be invented, but this is low-priority and should be optional to save CPU.
|
|
|
|
| |
Reported by VanessaE
|
| |
|
| |
|
| |
|
|
|
|
| |
Reported by Vanessa Dannenberg
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
distance-based approach or minetest.is_block_active() if available
See also https://github.com/minetest/minetest/pull/10897
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
This command splits the train at the second non-empty FC it
encounters, taking with it the first few freight cars that all go to
the same destination.
|
| |
|
|
|
|
|
|
|
| |
The shunting mode no longer makes trains couple, since it was meant
for other purposes. For autocoupling, the new autocoupling mode is
used. If trains are in autocouple mode, they couple when they collide
with another train.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This might fix #31 by clearing the HUD entry for the player when
joining
|
| |
|
| |
|
|
|
|
| |
Trains now get coupled when one of them is in coupling mode.
|
| |
|
| |
|