Commit Graph

113 Commits (e7d0a5fac2d87b468199059f1dd5bffb8bbcb327)

Author SHA1 Message Date
orwell96 e7d0a5fac2 Train Coupling: Change behavior so that train direction of initiating train is kept, add ATC Cpl command 2021-10-25 21:04:45 +02:00
orwell96 4989da3663 Disable position-based collision and coupling system for very short trains (such as single minecarts) to solve #155 2021-07-07 22:58:10 +02:00
orwell96 1f3a4c3bfc Rework train same-track collision system and deterministic coupling
- 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
2021-07-07 22:42:14 +02:00
Gabriel Pérez-Cerezo 30f4e342fd Make the collision mode configurable
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.
2021-06-30 23:46:00 +02:00
orwell96 9b0ec771d7 Train-World collisions: Collide only with 'normal'-drawtype nodes.
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.
2021-06-29 16:12:29 +02:00
orwell96 0efe7ef1f3 Entity Damage: Correct sign entity name
Reported by VanessaE
2021-06-29 16:01:10 +02:00
orwell96 e5b053c0d8 Trains splitting: retain important properties (door state, line, texts etc) 2021-05-22 19:42:15 +02:00
orwell96 5aa700c3ab Deregister player from train on death in all cases (fixes #119) 2021-04-25 22:13:24 +02:00
orwell96 571a5cd19b Prevent splitting trains when they're off track (fixes #178) 2021-04-25 22:07:44 +02:00
orwell96 112e3ff255 Fix undeclared globals warnings (#176)
Reported by Vanessa Dannenberg
2021-04-25 21:54:51 +02:00
orwell96 737eb4987f LZB: Look ahead before movement, not after 2021-02-12 11:55:57 +01:00
orwell96 fad6f88bab Fix hud and trainlogic to work together 2021-02-10 16:45:29 +01:00
orwell96 556e0782f7 Replace deprecated object:getxxx()/setxxx() by get_xxx()/set_xxx() 2021-02-10 16:42:15 +01:00
orwell96 672b4a422c Remove debug facilities 2021-02-10 16:39:46 +01:00
orwell96 4f7c1b1b5d Rewrite movement logic again 2021-02-10 16:39:46 +01:00
orwell96 8f4c90c5a5 Add debug prints, modify LZB to fix problems with look_ahead 2021-02-10 16:39:46 +01:00
orwell96 61329c11a2 Start using path_invalidate_ahead() 2021-02-10 16:36:24 +01:00
orwell96 b5f8737095 More debug info to hopefully gain more info on the bug 2021-02-10 16:36:24 +01:00
orwell96 aee7f0d419 Fix things, rework signal aspect select dialog, transform old aspects on-the-fly 2021-02-10 16:36:24 +01:00
orwell96 573d6b06b2 Always do zero-barrier check and prevent LZB 0 overruns in movement logic 2021-02-10 16:36:24 +01:00
orwell96 8660794ef8 Fix lots of things around new LZB 2021-02-10 16:36:24 +01:00
orwell96 5c2534cc35 Remove pcall wrappers completely, add command to disable advtrains mainloop 2021-02-10 16:36:24 +01:00
orwell96 b59b0d587d Implement a LZB speed lookup table for the path and rewrite velocity controls 2021-02-10 16:35:45 +01:00
orwell96 8ae405f00f Discard get_node_or_nil() for area-loaded check and use either a distance-based approach or minetest.is_block_active() if available
See also https://github.com/minetest/minetest/pull/10897
2021-02-03 09:30:44 +01:00
Gabriel Pérez-Cerezo b23d346ace add maximum length parameter to split_at_fc and split_off_locomotive 2020-08-21 15:58:12 +02:00
Gabriel Pérez-Cerezo 36d8c8b716 Add command to split off locomotive 2020-07-28 20:39:35 +02:00
Gabriel Pérez-Cerezo 45413ee5c0 Add function to step through freight codes 2020-07-26 23:30:07 +02:00
Gabriel Pérez-Cerezo c54e0b341a add split_train_at_fc luaatc command
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.
2020-07-26 23:30:07 +02:00
orwell96 19509acf56 Add workaround to unload wagons that are too far away from players 2020-07-12 20:37:51 +02:00
Gabriel Pérez-Cerezo 0b14d8ddb1 Add autocouple mode
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.
2020-06-29 01:30:27 +02:00
orwell96 b13c725976 Workaround to handle split points (dt. aufgefahrene Weichen), fixing H#77 2020-06-10 20:56:35 +02:00
Gabriel Pérez-Cerezo 943e5208a9 Fix trains flipping when autocoupling 2020-06-08 00:25:29 +02:00
orwell96 a8ae0a5332 Simplify and optimize path_get_index_by_offset (cherrypicked) 2019-12-09 11:00:21 +01:00
Gabriel Pérez-Cerezo 3db3f24857 Tentative fix for #31
This might fix #31 by clearing the HUD entry for the player when
joining
2019-12-03 21:35:42 +01:00
orwell96 7082038f75 Don't spawn couple entities when not loaded 2019-11-26 16:43:47 +01:00
orwell96 cf2179dea5 remove obsolete code/comments 2019-11-26 16:01:51 +01:00
Gabriel Pérez-Cerezo 2d8c13885a Shunting mode now couples trains on collision.
Trains now get coupled when one of them is in coupling mode.
2019-08-11 20:16:11 +02:00
Gabriel Pérez-Cerezo 1f6038c75a Add decoupling to luaatc 2019-08-11 17:42:30 +02:00
Gabriel Pérez-Cerezo d074d3223a Change API to return the id of a newly created train when discoupling 2019-08-09 19:11:26 +02:00
orwell96 d6cfa7dbf6 Run entity overrun checking only in loaded areas 2019-06-05 15:49:53 +02:00
orwell96 ea33ad9de0 Move LZB system to core and unify approach callback mechanism 2019-04-16 09:16:44 +02:00
orwell96 7149137990 Add setting for death behavior and implement damage checks better 2019-03-09 11:29:22 +01:00
orwell96 391a57f90c Prioritize LZB callback (possible bugfix for H#100) 2019-02-19 15:49:01 +01:00
orwell96 2976bae452 Point speed restriction rails 2019-01-24 13:43:22 +01:00
orwell96 1c3ea96041 Possible fix for braking problems + debug outputs 2019-01-23 15:37:18 +01:00
orwell96 9bdddb619b output step distance in train (debugging purposes) 2019-01-22 21:42:07 +01:00
orwell96 6c18d5b89a Make "Can't restore train" a log message instead of atwarn() 2019-01-22 17:14:32 +01:00
orwell96 240e7dd091 Warn when something clears the path winthin train step 2019-01-22 12:26:31 +01:00
orwell96 e2ae763dba Revert "Correct last commit"
This reverts commit 5f290819cd.
2019-01-22 12:11:35 +01:00
orwell96 dac65af983 Revert "Debugging code to trace down path_invalidate within callbacks error"
This reverts commit 1965e846b6.
2019-01-22 12:11:14 +01:00