Commit Graph

90 Commits

Author SHA1 Message Date
Y. Wang b5d2c23b32
Add tracy annotations 2024-09-15 15:45:41 +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
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 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
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
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 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 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
Maverick2797 43c85ab8cf readme atc_set_ars_disable typo 2021-11-09 21:45:33 +01:00
Maverick2797 4cf9e5283b split_at_index where index=1
Splitting at index=1 results in multiple empty trains being created.
Can be prevented by an atc_speed > 0 check by the user, but easier just to return false and do nothing.
2021-11-08 22:58:23 +01:00
orwell96 f046cfc2d3 LuaATC: remove accidental mesecons hard-dependency 2021-11-04 20:10:55 +01:00
orwell96 5e27bbdcfe LuaATC: Fix position of error label, use consistent name "LuaATC" instead of "LuaAutomation" 2021-11-02 23:22:30 +01:00
orwell96 ae152bf5bb LuaATC: Add Mesecons LuaATC Controller (similar to Mesecons Luacontroller) 2021-11-02 23:15:16 +01:00
orwell96 35d5106a21 LuaATC PCNaming: Allow naming active components using the tool 2021-11-02 23:14:28 +01:00
orwell96 09bba2c57f Hopefully fix #177 2021-04-25 21:59:02 +02:00
orwell96 112e3ff255 Fix undeclared globals warnings (#176)
Reported by Vanessa Dannenberg
2021-04-25 21:54:51 +02:00
orwell96 5d372b1cf1 Increase size of LuaATC code input forms to 15x12 units
The current size of the code form is rather limiting as it fills only a small part of the screen.
Also adds global constant in init.lua so this can easily adapted in the future
2021-03-22 11:23:42 +01:00
hlqkj 4fcc552770 Remove "Last punched" from LuaATC init code fs
Also removed the now-dead last punch pos helper code.
Resized buttons accordinghly.
2021-03-22 11:06:34 +01:00
hlqkj b9c824db00 Rework active_common formspec layout
- Aligned stuff
- Added style to use monospaced font in the code editor textarea
- Added label to the environment dropdown
2021-03-22 11:06:26 +01:00
hlqkj 75474ec07e Rework envsetup formspec layout
- Aligned stuff
- Added style to use monospaced font in the code editor textarea
2021-03-22 11:06:22 +01:00
orwell96 682ff59906 Replace deprecated depends.txt's by mod.conf and organize dependencies consistently, add modpack.conf 2021-03-13 11:13:13 +01:00
orwell96 6135f8a23b LuaATC: add sending atc command to train by ID, and getters for in/out text (solves #124 and #166) 2021-03-02 19:51:56 +01:00
orwell96 04c78373f1 LuaATC: add interrupt_safe() and clear_interrupts(), fix queue mainloop 2021-02-17 19:45:52 +01:00
orwell96 1e4156d0a4 LuaATC: Improve error/print logging, log only to subscribed players 2021-02-17 19:15:20 +01:00
orwell96 d13a610c2e Clean up structure of atlatc README.md after rebase 2021-02-17 18:16:22 +01:00
Maverick2797 27a1474963 Updated atlac readme to consistently use Markdown formatting 2021-02-17 18:16:09 +01:00
orwell96 5569849401 Restore LuaATC autocouple interface accidentally lost in 74a2199
During rebase, this part of the autocouple feature must have been accidentally lost
2021-02-15 16:52:54 +01:00
orwell96 4d13b15842 luaatc: Train event: also remember arrow connection in enter callback, remove obsolete code 2021-02-10 16:39:46 +01:00
orwell96 41568a3e2e luaatc: don't fail train event when train has already passed the rail at event time 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 aee7f0d419 Fix things, rework signal aspect select dialog, transform old aspects on-the-fly 2021-02-10 16:36:24 +01:00
orwell96 119a09b784 Simplify Signal Aspect Table (H#132) [breaks compatibility with signal API] 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 816245588d Disable ARS train flag and surrounding uses 2021-02-10 16:35:45 +01:00
orwell96 74a219937d Add approach callback mechanism to LuaATC 2021-02-10 16:34:34 +01:00
orwell96 e935136d58 Make is_node_loaded() checks also for mesecon interactions and digiline_send(), move on_updated_from_nodedb to advtrains table 2021-02-04 12:35:24 +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
orwell96 e42fbf9dcc Make advtrains use serialize_lib (save version 4)
Old save format will be gracefully migrated
2021-01-12 13:27:00 +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 c7ea09ed59 Complete Documentation on return value of split_at_fc() 2020-07-28 20:10:08 +02:00
Gabriel Pérez-Cerezo 3b9b884988 Document new luaatc commands 2020-07-28 12:00:27 +02:00
Gabriel Pérez-Cerezo 549db4737f add train_length command to luaatc 2020-07-27 21:50:22 +02:00
Gabriel Pérez-Cerezo 45413ee5c0 Add function to step through freight codes 2020-07-26 23:30:07 +02:00