Commit Graph

870 Commits

Author SHA1 Message Date
Y. Wang c7ff2958a6
More tracy wrappers for path/LZB-related functions 2024-09-16 00:43:27 +02:00
Y. Wang b5d2c23b32
Add tracy annotations 2024-09-15 15:45:41 +02:00
Y. Wang 9ada994d5b Avoid unnecessarily updating the driver HUD
This patch avoids sending the driver HUD if it contains the same text
that was previously sent.
2024-09-13 19:56:40 +02:00
1F616EMO 882108e8bf Alias for wagon types 2024-09-03 00:04:04 +02:00
1F616EMO fe7e25c995 Add direct recipe for every orientation of wallmounted signals 2024-09-02 22:51:43 +02:00
Y. Wang dd883c5b5e Clear tcbs.route_rsn when a route is set
This appears to fix the issue where route_rsn is not cleared and later
shown on the train HUD even when the route is set.

Note that this only works if the route is (successfully) set after this
patch is applied - it does not clear route_rsn for routes that are
already set.

How to test:
* Set a conflicting route for the train.
* Set a route for the train. Note that a message appears on the train
  HUD explaining that the route cannot be set (this is also the current
  behavior without the patch).
* Cancel the conflicting route. Note that the message on the train HUD
  is cleared.
2024-09-02 22:50:22 +02:00
1F616EMO fcfe21f197 Fix Ks Shunting Signal collision box 2024-09-02 22:25:51 +02:00
Maverick2797 852e2f4219 LuaATC add trainparts(train_id)
Returns a copy of the trainparts table to allow tracking individual wagon ids
Also fixed a couple of file permissions from previous commits
2024-09-02 22:25:05 +02:00
Maverick2797 55108ae38e LuaATC set_fc(): add argument to reset fc index to 1 2024-09-02 22:22:38 +02:00
Maverick2797 3b83580fac Fix LuaATC set_fc() only working on loaded entites 2024-09-02 22:20:42 +02:00
erstazi 0c7e0f322b Move the Train ID information to a textarea[] without a name attribute so it remains transparent and the player can copy the Train ID. 2024-09-02 22:19:48 +02:00
gpcf 46fbf89acf Fix privilege check when using the PC naming tool
This fix prevents malicious modified clients from using the PC tool
without the necessary privileges.
2024-08-11 23:22:36 +02:00
Maverick2797 9d7cec6151 Add Wagon Properties Tool
Also added the Wagon ID to the Wagon Properties formspec
2024-08-09 14:15:42 +02:00
gpcf 45e5ad3b37 Fix boardcom train id display, add command to teleport to train by id 2024-08-08 23:53:29 +02:00
erstazi 3526fc2e4a Adding Train ID to Onboard Computer formspec so we know what the Train ID is without LuaATC 2024-08-08 23:42:07 +02:00
gpcf 2458e986e8 Fix minetest server test run 2024-08-08 23:12:19 +02:00
Y. Wang e9aad541cc Fix incorrect speed indicator; include routing info in text HUD 2024-08-08 22:48:23 +02:00
Y. Wang 0bfc7bbe09 Rework graphical train HUD code
- A basic texture manipulation API is added; currently this is only a
  (selected) subset of texture modifiers provided by MT; the goal is to
  avoid writing (potentially incorrect) texture strings by hand;
- The graphical HUD code is cleaned up; in particular, most code used
  for generating texture patterns are moved to texture.lua so that the
  code can be used outside of the HUD;
- Inactive elements are given the darkslategray background.

A basic unittest is added; however, it needs to be expanded for better
coverage.

Reported-by: Lars Müller <appgurulars@gmx.de>
2024-08-08 22:48:23 +02:00
orwell 4cfd07e992 Remove superfluous train_id check from reverse_lookup
Reported by Sebastien F4GRX, thank you!
2024-08-01 22:13:26 +02:00
Maverick2797 216f28e51a Fix set_aspect()
Actually send aspect to advtrains.interlocking.signal_set_aspect() from LuaATC set_aspect()
2024-08-01 22:03:44 +02:00
Blockhead 7c4f1377e4 Fix section_occupancy: Return empty table
Fixes the functioning of the LuaATC function section_occupancy in
the presence of no trains.

Currently, if there is no train in the section,
advtrains.interlocking.db.get_ts will return a table with a nil entry.
When that nil value is passed to table.copy, Minetest throws out an error.
Instead of passing nil to table.copy, just make a new empty table.
2024-08-01 22:02:50 +02:00
1F616EMO a820318ecf Fix crossing bell positional stereo 2024-08-01 22:01:54 +02:00
1F616EMO ae394a43b8 Remove TCB marker on TCB removal
This patch fixes the following problem:

* TCB marker is not removed on TCB removal
* TCB marker is recreated on removal
2024-08-01 21:59:41 +02:00
orwell 0a51d57138 Fix for broken get_trains_at, fixing LuaATC/Lines Scheduler execution 2024-05-06 20:20:36 +02:00
Y. Wang 64776ba60e Fix use_texture_alpha for tracks
The use of textures with transparent pixels (for the default tracks: the
"features" on the track) without specifying use_texture_alpha (at least
for the mesh drawtype) has been deprecated in a PR from August 2020[1]
(i.e. since 5.4.0[2]) and removed in the latest dev version[3]. As a
consequence, regular tracks are now rendered with black markers at the
same position where e.g. the blue (Lua)ATC marker would be found.

This commit fixes the issue by enabling use_texture_alpha by default for
all tracks.

[1] https://github.com/minetest/minetest/pull/10122
[2] https://dev.minetest.net/Changelog#5.3.0_.E2.86.92_5.4.0
[3] https://github.com/minetest/minetest/pull/13929
2024-02-25 16:27:30 +01:00
gpcf b28ceaa2b4 Add register_function command so mods can register their own functons, low-level interface for departure boards 2024-02-06 23:13:13 +01:00
orwell 2ea4a8cff1 Add chatcommand and luaatc function to get global_slowdown 2024-02-06 23:06:38 +01:00
orwell 9fac1db45f Set maximum train length and prevent coupling if it would exceed 2023-12-20 00:20:56 +01:00
orwell96 2884ed3e27 advtrains_techage: Liquid infotext display needs to be added in core 2023-07-20 21:36:06 +02:00
orwell96 8b5903a729 Fix path_invalidate_ahead after recent commit 2023-07-01 22:37:09 +02:00
Maverick2797 21ed1d23b5 Turn loading tracks into loading ramps when within the loaded area
- Partially addresses Hemiptera #165 / Notabug #6
 - Will recalculate wagon textures when the inventory is modified
 - Only acts as a loading ramp when in a loaded area.
 - Retains previous flood loading of entire train when area unloaded
2023-06-24 21:34:56 +02:00
orwell96 2d7640d424 Occupation system: store multiple indices for the same train, introduce reverse_lookup_sel() to select appropriate index out of multiple based on a heuristic 2023-06-24 14:37:52 +02:00
orwell96 283efc44ce Add function to get wagon in train from index
Can be used to determine which wagon is at a certain world position
Testing: use debugitems.lua
2023-05-27 12:09:10 +02:00
Maverick2797 bbe3856e35 Add craft recipes for the new ks speed indicators 2023-04-12 22:07:13 +02:00
Blockhead 793210f7c2 Make selection boxes of track nodes larger
This reduces the difficulty of having to point at the centre of the
correct track node, and hopefully does not prevent placing tracks in
more than a couple of cases.  Three-way turnouts on an angle may be
an exception but they may be worth it. User feedback is needed.
2023-04-12 21:52:34 +02:00
Y. Wang 4f241b06b1 Report coordinates of wagons with unregistered prototypes
Related issue: https://forum.minetest.net/viewtopic.php?p=414307#p414307
2023-04-12 21:32:32 +02:00
Maverick2797 3a6b1ca850 Add get_fc() and set_fc() commands
get_fc: returns a table of each wagon's FC codes
set_fc: set a table to overwrite the FC codes of a train's wagons
2023-03-17 20:03:12 +01:00
Maverick2797 82987b1a4f small security fixes in advtrains_luaautomation/
- fixed file permissions of advtrains_luaautomation/README.md (755->644)
 - fixed file permissions of advtrains_luaautomation/environment.lua (755->644)
 - prevented LuaATC section_occupancy() from having direct access to the interlocking section id occupancy table
 - simplify section_occupancy() logic
2023-03-17 19:57:43 +01:00
Maverick2797 cad4809b99 Add punchers name to ops panel punch event
event={type="punch", punch=true, name="foo"}
2023-03-12 17:24:27 +01:00
orwell96 2b21817b4f On_Joinplayer: fix train ID check for attachment update
Previously, statement was always false because train_id is no longer in the luaentity
2022-06-13 14:17:24 +02:00
Antonia 744aee2cdd Minor change to README
45 degree platform design is not a sound
2022-03-03 00:12:43 +01:00
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
orwell96 ef8391a60d atc_reset(): Removed unused string parameter and also clear ATC autocouple flag (Cpl)
Fixes H#189 and H#190
2021-12-31 16:04:04 +01:00
Maverick2797 78e0c650e3 Load/Unload Track FC Integration
- Set a freight code in the track to whitelist only wagons with that FC as the current one

 - Set as # to disable the track

 - Set as a blank field (default) to allow all wagons to activate, irrespective of their FC
2021-12-29 21:21:37 +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
Maverick2797 23d524df71 Luaautomation: add section_occupancy()
Returns a table of train ids for the specified section.
Returns nil if the section id is not provided..
Returns false if the section id is invalid.
Returns an empty table if the section id is valid but empty of trains.
2021-12-29 21:16:32 +01:00
Y. Wang 5912f778e1 Fix speed sign allowing v>max_speed 2021-12-16 22:24:05 +01:00
1F616EMO 0b9441c289 Add C&C Servers into the testing server list, since we are using the latest commit 2021-11-26 12:33:28 +01:00
ywang f27640ee27 Trivial fixup for train decoupling regression 2021-11-20 01:59:26 +01:00