Commit Graph

105 Commits (master)

Author SHA1 Message Date
orwell96 8beacdc508 Fix new wagon positioning when wheel positions are asymmetric, and remove leftover train.debug 2022-02-24 22:04:39 +01:00
orwell96 3cb21a80dc Wagons: Add two-pos wheel positioning logic for more realistic look of long wagons
Adds field "wheel_positions" in wagon definition
2022-02-09 23:06:02 +01:00
Maverick2797 7db61e9890 Automatically group wagons and locomotives based on definition values
Based on the advtrains wiki groups:
  Type		Group			Classifier
- Locomotives:	group:at_loco		is_locomotive = true
- Controllable:	group:at_control	seat_groups.dstand
- Passengers:	group:at_pax		seat_groups.pass
- Freight:	group:at_freight	has_inventory = true
2021-12-29 21:17:34 +01: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
orwell96 112e3ff255 Fix undeclared globals warnings (#176)
Reported by Vanessa Dannenberg
2021-04-25 21:54:51 +02:00
orwell96 556e0782f7 Replace deprecated object:getxxx()/setxxx() by get_xxx()/set_xxx() 2021-02-10 16:42:15 +01:00
orwell96 0cef88ba7f Add global slowdown factor instead of hard dtime limiting 2021-02-10 16:39:46 +01:00
orwell96 080b8fb273 Add IGNORE_WORLD mode to test using only the advtrains save data 2021-02-10 16:39:45 +01:00
orwell96 a3247dea28 Fix HUD position and Remote Routesetting button 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 816245588d Disable ARS train flag and surrounding uses 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 e9c76100a1 Add ATC "K" command
This command kicks out all passengers when the train is stopped and
its doors are open. In addtion, a wagon:is_driver_stand(seat) function
was added to allow finding out easily if a seat is the driver stand of
the wagon.
2021-01-07 23:58:05 +01:00
Blockhead 8d58bd51cd Workaround to destroy looping sounds
Needed for linetrack boat sound bug
2020-11-02 12:12:41 +01:00
Gabriel Pérez-Cerezo 964b0a7ab6 Remove couple entities when out of range from players
Work around the entity flood bug caused by improper engine handling of
static_save=false
2020-10-12 15:41:27 +02:00
Gabriel Pérez-Cerezo dcf5b8670e Remove last files with CR-LF line endings. 2020-10-11 12:36:06 +02:00
orwell96 a73236d7eb Don't allow wagons with non-empty inventories to be destroyed (H#164) 2020-10-07 15:19:55 +02:00
Gabriel Pérez-Cerezo 606fc83465 localize split function to prevent conflicts with the builtin one 2020-09-04 20:25:12 +02:00
orwell96 0aa83e4932 Escape fields in wagon properties (H#158) 2020-09-04 16:15:27 +02:00
Relatio e4ccf8ffce Fix seating_from_key_helper: use pname instead of player:get_player_name() 2020-08-27 19:18:52 +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
Gabriel Pérez-Cerezo de8add139c add Freightcodes to wagon properties formspec 2020-07-26 23:30:07 +02:00
orwell96 00031064a5 Do not unload wagons when a player that is logged in sits in it 2020-07-26 18:53:16 +02:00
Gabriel Pérez-Cerezo 8c66f1caf4 Fix error in workaround causing train entities to despawn. 2020-07-19 23:00: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
Blockhead eb2e5f4cdf Fix access control to wagon properties
Previously, players were able to open the wagon properties of any wagon at all
through the wagon properties button on the inventory formspec and through the
wagon buttons on the onboard computer. Add a check for ownership before
allowing players to open wagon properties.
2020-06-29 01:37:35 +02:00
Gabriel Pérez-Cerezo d61c2145a0 Merge branch 'wagon_prop_formspec' of https://github.com/Montandalar/advtrains 2020-06-08 13:50:08 +02:00
Gabriel Pérez-Cerezo 943e5208a9 Fix trains flipping when autocoupling 2020-06-08 00:25:29 +02:00
Blockhead e57c1eaa7f Remove debugging print statement 2020-04-12 18:44:57 +10:00
Blockhead f43254c282 Add road numbers to wagon properties, bordcom
A road number is used to allow users to set their own wagon numbers
other than the internal IDs assigned by advtrains. A railway company
would typically keep a roster of what rollingstock it has in road
numbers.

The road number can be set on the wagon properties formspec. It is
displayed above the wagon's inventory icon in the onboard computer as a
button, which will then open the wagon properties on that wagon.

Road numbers might be displayable as additional text entities on the
wagon like signs.

Currently opening the wagon properties (and sometimes onboard computer)
formspecs can be quite unreliable (at least on windows), so I hope that
closing the wagon 'main menu' before opening other formspecs helps that
reliability. It seems to be an upstream bug.
2020-04-07 14:16:47 +10:00
Blockhead d0629469aa Show the wagon properties button only to the owner 2020-03-18 01:13:06 +11:00
Blockhead 2da11c5a49 Use a standard wagon inventory formspec
This new formspec also allows access to the wagon properties. Once
whitelisted in the wagon properties, other players can access its
inventory.

Note on 'useless use' of OO: I tried passing just the wagon ID and
avoiding using the `self` object in order to bypass the need to look up
the lua entitie out of the list, but it ended up retrieving nil data.
The best way to solve this overhead might be to wait for some kind of
better way upstream in minetest's lua API to get entities, or to keep a
central record of entities. Either way, the solution is outside the
scope of this commit.
2020-03-18 00:35:30 +11:00
Blockhead c0c6fcf00b Apply minetest.formspec_escape() to prevent formspec injection (H#143) 2020-01-04 18:33:57 +01:00
Gabriel Pérez-Cerezo 25a335203f Allow painting coupled wagons 2019-12-01 12:25:06 +01:00
Gabriel Pérez-Cerezo 0518fbbf3a Merge branch 'master' of https://git.bananach.space/advtrains 2019-12-01 12:09:04 +01:00
Gabriel Pérez-Cerezo b71c72b4ab Add experimental liveries feature
Please do not use this in your train mods yet, this may be subject to
changes!
2019-12-01 12:08:28 +01:00
orwell96 4ff8e05755 Fix trains not stopping when colliding with environment H#122 2019-11-26 15:49:36 +01:00
Gabriel Pérez-Cerezo ca4d65050c Add wagon_width attribute
This allows for wider vehicles than trains, such as boats to discharge
the passengers onto the platforms.
2019-11-22 20:29:57 +01:00
orwell96 ff94129761 Fix occurences of old lzb_invalidate 2019-04-23 22:30:33 +02:00
orwell96 b56cda8695 Fix remote routesetting 2019-04-16 12:59:17 +02:00
orwell96 ea33ad9de0 Move LZB system to core and unify approach callback mechanism 2019-04-16 09:16:44 +02:00
Pedro Gimeno c50224e05c Set wagon pitch on slopes 2019-04-06 13:38:00 +02:00
orwell96 bc31f205cd Configurable interval for get_off setpos and door pos fix for japanese train 2019-03-09 11:17:14 +01:00
orwell96 e7dcee1127 Force LZB Halt setting 2019-02-05 11:23:17 +01:00
orwell96 97a2ff7db0 Fix dropping of items on wagon destroy 2019-01-22 12:31:18 +01:00
orwell96 c3c96274be Add "routingcode" property
Used for ARS and stop points
2019-01-09 16:10:56 +01:00
orwell96 36357bd444 Fix player_to_train_mapping (H#74)
Entries were not inserted, thus neither damage protection nor teleport-to-train did work
2018-12-16 20:39:55 +01:00