diff options
Diffstat (limited to 'advtrains_luaautomation')
29 files changed, 5630 insertions, 0 deletions
diff --git a/advtrains_luaautomation/README.md b/advtrains_luaautomation/README.md new file mode 100644 index 0000000..275653c --- /dev/null +++ b/advtrains_luaautomation/README.md @@ -0,0 +1,466 @@ + +# Advtrains - Lua Automation features + +This mod offers components that run LUA code and interface with each other through a global environment. It makes complex automated railway systems possible. The mod is sometimes abbreviated as 'LuaATC' or 'atlatc'. This stands for AdvTrainsLuaATC. This short name has been chosen for user convenience, since the name of this mod ('advtrains_luaautomation') is very long. + +A probably more complete documentation of LuaATC is found on the [Advtrains Wiki](http://advtrains.de/wiki/doku.php?id=usage:atlatc:start) + +## Privileges +To perform any operations using this mod (except executing operation panels), players need the "atlatc" privilege. +This privilege should never be granted to anyone except trusted administrators. Even though the LUA environment is sandboxed, it is still possible to DoS the server by coding infinite loops or requesting expotentially growing interrupts. + +## Environments + +Each active component is assigned to an environment where all atlac data is held. Components in different environments can't inferface with each other. +This system allows multiple independent automation systems to run simultaneously without polluting each other's environment. + + - `/env_create <env_name>`: +Create environment with the given name. To be able to do anything, you first need to create an environment. Choose the name wisely, you can't change it afterwards without deleting the environment and starting again. + + - `/env_setup <env_name>`: +Invoke the form to edit the environment's initialization code. For more information, see the section on active components. You can also delete an environment from here. + + - `/env_subscribe <env_name>`, `/env_unsubscribe <env_name>`: +Subscribe or unsubscribe from log/error messages originating from this environment + + - `/env_subscriptions [env_name]`: +List your subscriptions or players subscribed to an environment. + + +## Functions and variables +### General Functions and Variables +The following standard Lua libraries are available: + - `string` + - `math` + - `table` + - `os` + +The following standard Lua functions are available: + - `assert` + - `error` + - `ipairs` + - `pairs` + - `next` + - `select` + - `tonumber` + - `tostring` + - `type` + - `unpack` + +Any attempt to overwrite the predefined values results in an error. + +### LuaAutomation Global Variables + - `S` +The variable 'S' contains a table which is shared between all components of the environment. Its contents are persistent over server restarts. May not contain functions, every other value is allowed. + + - `F` +The variable 'F' also contains a table which is shared between all components of the environment. Its contents are discarded on server shutdown or when the init code gets re-run. Every data type is allowed, even functions. +The purpose of this table is not to save data, but to provide static value and function definitions. The table should be populated by the init code. + +### LuaAutomation Global Functions +> Note: in the following functions, all parameters named `pos` designate a position. You can use the following: +> - a default Minetest position vector (eg. {x=34, y=2, z=-18}) +> - the POS(34,2,-18) shorthand below. +> - A string, the passive component name. See 'passive component naming'. + + + + - `POS(x,y,z)` +Shorthand function to create a position vector {x=?, y=?, z=?} with less characters. + + - `getstate(pos)` +Get the state of the passive component at position `pos`. + + - `setstate(pos, newstate)` +Set the state of the passive component at position `pos`. + + - `is_passive(pos)` +Checks whether there is a passive component at the position pos (and/or whether a passive component with this name exists) + + - `interrupt(time, message)` +Cause LuaAutomation to trigger an `int` event on this component after the given time in seconds with the specified `message` field. `message` can be of any Lua data type. Returns true. *Not available in init code.* + + - `interrupt_safe(time, message)` +Like `interrupt()`, but does not add an interrupt and returns false when an interrupt (of any type) is already present for this component. Returns true when interrupt was successfully added. + + - `interrupt_pos(pos, message)` +Immediately trigger an `ext_int` event on the active component at position pos. `message` is like in interrupt(). Use with care, or better **_don't use_**! Incorrect use can result in **_expotential growth of interrupts_**. + + - `clear_interrupts()` +Removes any pending interrupts of this node. + + - `digiline_send(channel, message)` +Make this active component send a digiline message on the specified channel. +Not available in init code. + + - `trainparts(train_id)` + returns a table with the ids of the cars the train is composed of, or false if `train_id` is invalid. `train_id` can be replaced with `atc_id` when used in LuaATC Rails. + + - `atc_send_to_train(<train_id>, <atc_command>)` + Sends the specified ATC command to the train specified by its train id. This happens regardless of where the train is in the world, and can be used to remote-control trains. Returns true on success. If the train ID does not exist, returns false and does nothing. See [atc_command.txt](../atc_command.txt) for the ATC command syntax. + +#### Interlocking Route Management Functions +If `advtrains_interlocking` is enabled, the following aditional functions can be used: + + - `can_set_route(pos, route_name)` +Returns whether it is possible to set the route designated by route_name from the signal at pos. + + - `set_route(pos, route_name)` +Requests the given route from the signal at pos. Has the same effect as clicking "Set Route" in the signalling dialog. + + - `cancel_route(pos)` +Cancels the route that is set from the signal at pos. Has the same effect as clicking "Cancel Route" in the signalling dialog. + + - `get_aspect(pos)` +Returns the signal aspect of the signal at pos. A signal aspect has the following format: +```lua +asp = { + main = <int speed>, + -- Main signal aspect, tells state and permitted speed of next section + -- 0 = section is blocked + -- >0 = section is free, speed limit is this value + -- -1 = section is free, maximum speed permitted + -- false = Signal doesn't provide main signal information, retain current speed limit. + shunt = <boolean>, + -- Whether train may proceed as shunt move, on sight + -- main aspect takes precedence over this + -- When main==0, train switches to shunt move and is restricted to speed 8 + proceed_as_main = <boolean>, + -- If an approaching train is a shunt move and 'shunt' is false, + -- the train may proceed as a train move under the "main" aspect + -- if the main aspect permits it (i.e. main!=0) + -- If this is not set, shunt moves are NOT allowed to switch to + -- a train move, and must stop even if "main" would permit passing. + -- This is intended to be used for "Halt for shunt moves" signs. + + dst = <int speed>, + -- Distant signal aspect, tells state and permitted speed of the section after next section + -- The character of these information is purely informational + -- At this time, this field is not actively used + -- 0 = section is blocked + -- >0 = section is free, speed limit is this value + -- -1 = section is free, maximum speed permitted + -- false = Signal doesn't provide distant signal information. + + -- the character of call_on and dead_end is purely informative + call_on = <boolean>, -- Call-on route, expect train in track ahead (not implemented yet) + dead_end = <boolean>, -- Route ends on a dead end (e.g. bumper) (not implemented yet) +} +``` +As of September 2024, the 'dst', 'call_on' and 'dead_end' fields are not used. + +#### Lines + +The advtrains_line_automation component adds a few contraptions that should make creating timeable systems easier. +Part of its functionality is also available in LuaATC: + +- `rwt.*` - all Railway Time functions are included as documented in [the wiki](https://advtrains.de/wiki/doku.php?id=dev:api:railway_time_api) + + - `schedule(rw_time, msg)`, `schedule_in(rw_dtime, msg)` +Schedules an event of type {type="schedule", schedule=true, msg=msg} at (resp. after) the specified railway time (which can be in any format). You can only schedule one event this way. (uses the new lines-internal scheduler) + +Note: Using the lines scheduler is preferred over using `interrupt()`, as it's more performant and safer to use. + +## Events +The event table is a variable created locally by the component being triggered. It is a table with the following format: +```lua +event = { + type = "<event type>", + <event type> = true, + --additional event-specific content +} +``` +You can check the event type by using the following: +```lua +if event.type == "wanted" then + --do stuff +end +``` +or +```lua +if event.wanted then + --do stuff +end +``` +where `wanted` is the event type to check for. +See the "Active Components" section below for details on the various event types as not all of them are applicable to all components. + +## Components +Atlac components introduce automation-capable components that fall within two categories: + - Active Components are components that are able to run Lua code, triggered by specific events. + - Passive Components can't perform actions themselves. Their state can be read and set by active components or manually by the player. + +### Lua ATC Rails +Lua ATC rails are the only components that can actually interface with trains. The following event types are available to the Lua ATC rails: + - `{type="train", train=true, id="<train_id>"}` + * This event is fired when a train enters the rail. The field `id` is the unique train ID, which is 6-digit random numerical string. + * If the world contains trains from an older advtrains version, this string may be longer and contain a dot `.` + + - `{type="int", int=true, msg=<message>}` + * Fired when an interrupt set by the `interrupt` function runs out. `<message>` is the message passed to the interrupt function. + * For backwards compatiblity reasons, `<message>` is also contained in an `event.message` variable. + + - `{type="ext_int", ext_int=true, message=<message>}` + * Fired when another node called `interrupt_pos` on this position. `message` is the message passed to the interrupt_pos function. + + - `{type="digiline", digiline=true, channel=<channel>, msg=<message>}` + * Fired when the controller receives a digiline message. + +#### Basic Lua Rail Functions and Variables +In addition to the above environment functions, the following functions are available to whilst the train is in contact with the LuaATC rail: + + - `atc_send(<atc_command>)` + Sends the specified ATC command to the train (a string) and returns true. If there is no train, returns false and does nothing. See [atc_command.txt](../atc_command.txt) for the ATC command syntax. + + - `atc_reset()` + Resets the train's current ATC command. If there is no train, returns false and does nothing. + + - `atc_arrow` + Boolean, true when the train is driving in the direction of the arrows of the ATC rail. Nil if there is no train. + + - `atc_id` + Train ID of the train currently passing the controller. Nil if there's no train. + + - `atc_speed` + Speed of the train, or nil if there is no train. + + - `atc_set_text_outside(text)` + Set text shown on the outside of the train. Pass nil to show no text. `text` must be a string. + + - `atc_set_text_inside(text)` + Set text shown to train passengers. Pass nil to show no text. `text` must be a string. + + - `atc_set_text_inside(text) / atc_set_text_outside(text)` + Getters for inside/outside text, return nil when no train is there. + + - `get_line()` + Returns the "Line" property of the train (a string). + This can be used to distinguish between trains of different lines and route them appropriately. + The interlocking system also uses this property for Automatic Routesetting. + + - `set_line(line)` + Sets the "Line" property of the train (a string). + If the first digit of this string is a number (0-9), any subway wagons on the train (from advtrains_train_subway) will have this one displayed as line number + (where "0" is actually shown as Line 10 on the train) + + - `get_rc()` + Returns the "Routingcode" property of the train (a string). + The interlocking system uses this property for Automatic Routesetting. + + - `set_rc(routingcode)` + Sets the "Routingcode" property of the train (a string). + The interlocking system uses this property for Automatic Routesetting. + +#### Shunting Functions and Variables +There are several functions available especially for shunting operations. +Some of these functions make use of Freight Codes (FC) set in the Wagon Properties of each wagon and/or locomotive. +FCs are composed of codes separated by exclamation marks (`!`), for instance `"foo!bar!baz"`. +Each wagon has a current FC, indicating its next destination. + + - `split_at_index(index, atc_command)` + Splits the train at the specified index, into a train with index-1 wagons and a second train starting with the index-th wagon. The `atc_command` specified is sent to the second train after decoupling. `"S0"` or `"B0"` is common to ensure any locomotives in the remaining train don't continue to move. + + `index` must be more than 1 to avoid trying to decouple the very front of a train. + + Example: train has wagons `"foo","foo","foo","bar","bar","bar"` + Command: `split_at_index(4,"S0")` + Result: first train (continues at previous speed): `"foo","foo","foo"`, second train (slows at S0): `"bar","bar","bar"` + + - `get_fc()` + Returns a table with the entire FC list for each wagon in the train. + Command: `get_fc()` + Result: `{"", "foo!bar", "testing", "fc_1!fc_2!fc_3!?", "hello_world"}` + + - `get_fc_index()` + Returns a table with the current FC index for each wagon in the train. Use in conjunction with the result from `get_fc()` to find a the current FC for a wagon. + Command: `get_fc_index()` + Result: `{1, 1, 1, 2, 1}` + + - `set_fc(fc_list, reset_index)` + Overwrites the FC list according to a table `fc_list`. A false or nil entry will leave the wagon unaffected, however all others will be overwritten. + Useful for mass-programming freight trains that use FC-shunting instead of walking to each wagon individually. If the new FC entry for a wagon is shorter than the old entry, the index will clip to the last FC in the new entry. + If `reset_index` is true, all Current FC values will reset to the first entry in the list, instead of remaining at the current index. + + Example: train has FC lists: `"", "foo!bar", "testing", "fc_1!fc_2!fc_3!?", "hello_world"` + Command: `set_fc({"", "foo!turtle", nil, "4tehlulz", false})` + Result: `""` `"foo!turtle"` `"testing"` `"4tehlulz"` `"hello_world"` + + - `split_at_fc(atc_command, len)` + Splits the train in such a way that all cars with non-empty current FC of the first part of the train have the same FC. The + `atc_command` specified is sent to the rear part, as with split_at_index. It returns the fc of the cars of the first part. + + Example : Train has current FCs `"" "" "bar" "foo" "bar"` + Command: `split_at_fc(<atc_command>)` + Result: `train "" "" "bar"` and `train "foo" "bar"` + The function returns `"bar"` in this case. + + The optional argument `len` specifies the maximum length for the + first part of the train. + Example: Train has current FCs `"foo" "foo" "foo" "foo" "bar" "bar"` + Command: `split_at_fc(<atc_command>,3)` + Result: `"foo" "foo" "foo"` and `"foo" "bar" "bar"` + The function returns `"foo"` in this case. + + - `split_off_locomotive(command, len)` + Splits off the locomotives at the front of the train, which are + identified by an empty FC. `command` specifies the ATC command to be + executed by the rear half of the train. The optional argument `len` specifies the maximum length for the + first part of the train as above. + + - `step_fc()` + Steps the FCs of all train cars forward, selecting the next + code after the `!`. If the end of the string is reached, then the + first code is selected, except if the string ends with a question + mark (`?`), then the order is reversed. + + - `train_length()` + returns the number of cars the train is composed of. + + - `set_autocouple()` + Sets the train into autocouple mode. The train will couple to the next train it collides with. + + - `unset_autocouple()` + Unsets autocouple mode + +Deprecated: + + - `set_shunt()`, `unset_shunt()` + deprecated aliases for set_autocouple() and unset_autocouple(), will be removed from a later release. + + +#### Interlocking +These additional functions are available when advtrains_interlocking is enabled: + + - `atc_set_ars_disable(boolean)` + Disables (true) or enables (false) the use of ARS for this train. The train will not trigger ARS (automatic route setting) on signals then. + + Note: If you want to disable ARS from an approach callback, the call to `atc_set_ars_disable(true)` *must* happen during the approach callback, and may not be deferred to an interrupt(). Else the train might trigger an ARS before the interrupt fires. + + - `section_occupancy(section_id)` + Returns a table of train ids for the specified section, nil if no section id is provided, false if the section id is invalid, an empty table if the section id is valid but empty of trains. + +#### Approach callbacks +The LuaATC interface provides a way to hook into the approach callback system, which is for example used in the TSR rails (provided by advtrains_interlocking) or the station tracks (provided by advtrains_lines). However, for compatibility reasons, this behavior needs to be explicitly enabled. + +Enabling the receiving of approach events works by setting a variable in the local environment of the ATC rail, by inserting the following code: + +```lua +__approach_callback_mode = 1 +-- to receive approach callbacks only in arrow direction +-- or alternatively +__approach_callback_mode = 2 +-- to receive approach callbacks in both directions +``` + +The following event will be emitted when a train approaches: +```lua +{type="approach", approach=true, id="<train_id>"} +``` + +Please note these important considerations when using approach callbacks: + + - Approach events might be generated multiple times for the same approaching train. If you are using atc_set_lzb_tsr(), you need to call this function on every run of the approach callback, even if you issued it before for the same train. + - A reference to the train is available while executing this event, so that functions such as atc_send() or atc_set_text_outside() can be called. On any consecutive interrupts, that reference will no longer be available until the train enters the track ("train" event) + - Unlike all other callbacks, approach callbacks are executed synchronous during the train step. This may cause unexpected side effects when performing certain actions (such as switching turnouts, setting signals/routes) from inside such a callback. I strongly encourage you to only run things that are absolutely necessary at this point in time, and defer anything else to an interrupt(). Be aware that certain things might trigger unexpected behavior. + +Operations that are safe to execute in approach callbacks: + + - anything related only to the global environment (setting things in S) + - digiline_send() + - atc_set_text_*() + - atc_set_lzb_tsr() (see below) + +In the context of approach callbacks, one more function is available: + + - `atc_set_lzb_tsr(speed)` +Impose a Temporary Speed Restriction at the location of this rail, making the train pass this rail at the specified speed. (Causes the same behavior as the TSR rail) + +#### Timetable Automation + +The advtrains_line_automation component adds a few contraptions that should make creating timeable systems easier. +Part of its functionality is also available in LuaATC: + +- `rwt.*` +All Railway Time functions are included as documented in https://advtrains.de/wiki/doku.php?id=dev:lines:rwt + +- `schedule(rw_time, msg)` +- `schedule_in(rw_dtime, msg)` +Schedules the following event `{type="schedule", schedule=true, msg=msg}` at (resp. after) the specified railway time (which can be in any format). You can only schedule one event this way. Uses the new lines-internal scheduler. + +### Operator panel +This simple node executes its actions when punched. It can be used to change a switch and update the corresponding signals or similar applications. It can also be connected to by the`digilines` mod. + +The event fired is `{type="punch", punch=true}` by default. In case of an interrupt or a digiline message, the events are similar to the ones of the ATC rail. + +### Init code +The initialization code is not a component as such, but rather a part of the whole environment. It can (and should) be used to make definitions that other components can refer to. +A basic example function to define behavior for trains in stations: +```lua +function F.station(station_name) + if event.train then + atc_send("B0WOL") + atc_set_text_inside(station_name) + interrupt(10,"depart") + end + if event.int and event.message="depart" then + atc_set_text_inside("") --an empty string clears the displayed text + atc_send("OCD1SM") + end +end +``` + +The corresponding Lua ATC Rail(s) would then contain the following or similar: +```lua +F.station("Main Station") +``` + +The init code is run whenever the F table needs to be refilled with data. This is the case on server startup and whenever the init code is changed and you choose to run it. +The event table of the init code is always `{type="init", init=true}` and can not be anything else. +Functions are run in the environment of the currently active node, regardless of where they were defined. + +### Passive components + +All passive components can be interfaced with the `setstate()` and `getstate()` functions (see above). +Each node below has been mapped to specific "states": + +#### Signals +The red/green light signals `advtrains:signal_on/off` are interfaceable. Others such as `advtrains:retrosignal_on/off` are not. If advtrains_interlocking is enabled, trains will obey the signal if the influence point is set. + + - "green" - Signal shows green light + - "red" - Signal shows red light + +#### Switches/Turnouts +All default rail switches are interfaceable, independent of orientation. + + - "cr" The switch is set in the direction that is not straight. + - "st" The switch is set in the direction that is straight. + +The "Y" and "3-Way" switches have custom states. Looking from the convergence point: + + - "l" The switch is set towards the left. + - "c" The switch is set towards the center (3-way only). + - "r" The switch is set towards the right. + + +#### Mesecon Switch +The Mesecon switch can be switched using LuaAutomation. Note that this is not possible on levers or protected mesecon switches, only the unprotected full-node 'Switch' block `mesecons_switch:mesecon_switch_on/off`. + + - "on" - the switch is switched on. + - "off" - the switch is switched off. + +#### Andrew's Cross + + - "on" - it blinks. + - "off" - it does not blink. + +#### Passive Component Naming +You can assign names to passive components using the Passive Component Naming tool. +Once you set a name for any component, you can reference it by that name in the `getstate()` and `setstate()` functions. +This way, you don't need to memorize positions. + +Example: signal named `"Stn_P1_out"` at `(1,2,3)` +Use `setstate("Stn_P1_out", "green")` instead of `setstate(POS(1,2,3), "green")` + +If `advtrains_interlocking` is enabled, PC-Naming can also be used to name interlocking signals for route setting via the `set_route()` functions. +**Important**: The "Signal Name" field in the signalling formspec is completely independent from PC-Naming and can't be used to look up the position. You need to explicitly use the PC-Naming tool. + diff --git a/advtrains_luaautomation/active_common.lua b/advtrains_luaautomation/active_common.lua new file mode 100644 index 0000000..311ec04 --- /dev/null +++ b/advtrains_luaautomation/active_common.lua @@ -0,0 +1,284 @@ +-- Get current translator +local S = atlatc.translate + +local ac = {nodes={}} + +function ac.load(data) + if data then + ac.nodes=data.nodes + end +end +function ac.save() + return {nodes = ac.nodes} +end + +function ac.get_player_default_environment(player) + local meta = player:get_meta() + local env = meta:get_string("atlatc_default_env") + + if not atlatc.envs[env] then + -- Set the first key for the user as default environment + for envname, _ in pairs(atlatc.envs) do + meta:set_string("atlatc_default_env", envname) + return envname + end + + -- We don't have any environments + return nil + end + + return env +end +function ac.set_player_default_environment(player, env) + if atlatc.envs[env] then + local meta = player:get_meta() + meta:set_string("atlatc_default_env", env) + return true + end + return false +end + +function ac.after_place_node(pos, player) + local env = ac.get_player_default_environment(player) + if env then + local ph = minetest.pos_to_string(pos) + ac.nodes[ph] = { env = env } + end + + local meta=minetest.get_meta(pos) + meta:set_string("formspec", ac.getform(pos, meta)) + meta:set_string("infotext", S("Unconfigured LuaATC component")) +end +function ac.getform(pos, meta_p) + local meta = meta_p or minetest.get_meta(pos) + local envs_asvalues={} + + local ph=minetest.pos_to_string(pos) + local nodetbl = ac.nodes[ph] + local env, code, err = nil, "", "" + if nodetbl then + code=nodetbl.code or "" + err=nodetbl.err or "" + env=nodetbl.env or "" + end + local sel = 1 + for n,_ in pairs(atlatc.envs) do + envs_asvalues[#envs_asvalues+1]=minetest.formspec_escape(n) + if n==env then + sel=#envs_asvalues + end + end + local form = "size["..atlatc.CODE_FORM_SIZE.."]" + .."style[code;font=mono]" + .."label[0,-0.1;"..S("LuaATC Environment").."]" + .."dropdown[0,0.3;3;env;"..table.concat(envs_asvalues, ",")..";"..sel.."]" + .."button[5,0.2;2,1;save;"..S("Save").."]" + .."button[7,0.2;3,1;cle;"..S("Clear Local Environment").."]" + .."textarea[0.3,1.5;"..atlatc.CODE_FORM_SIZE..";code;"..S("Code")..";"..minetest.formspec_escape(code).."]" + .."label["..atlatc.CODE_FORM_ERRLABELPOS..";"..err.."]" + return form +end + +function ac.after_dig_node(pos, node, player) + advtrains.invalidate_all_paths(pos) + advtrains.ndb.clear(pos) + atlatc.interrupt.clear_ints_at_pos(pos) + if advtrains.lines and advtrains.lines.sched then + advtrains.lines.sched.discard_all(advtrains.encode_pos(pos)) + end + local ph=minetest.pos_to_string(pos) + ac.nodes[ph]=nil +end + +function ac.on_receive_fields(pos, formname, fields, player) + if not minetest.check_player_privs(player:get_player_name(), {atlatc=true}) then + minetest.chat_send_player(player:get_player_name(), S("You are not allowed to configure this LuaATC component without the @1 privilege.", "atlatc")) + return + end + + local meta=minetest.get_meta(pos) + local ph=minetest.pos_to_string(pos) + local nodetbl = ac.nodes[ph] or {} + --if fields.quit then return end + if fields.env then + nodetbl.env=fields.env + end + if fields.code then + nodetbl.code=fields.code + end + if fields.save then + -- reset certain things + nodetbl.err=nil + if advtrains.lines and advtrains.lines.sched then + -- discard all schedules for this node + advtrains.lines.sched.discard_all(advtrains.encode_pos(pos)) + end + + -- Parse code headers + --[[ + Valid code headers: + * ADVT-Environment-Name: <env name> + * ADVT-Approach-Callback-Mode: <0/1/2> + ]] + local errmsg_lines = {} + local code_headers = {} + for k, v in nodetbl.code:gmatch("%-%- ADVT%-([%w%-]+): ([^\n\r]*)") do + code_headers[k] = v + end + + if code_headers["Environment-Name"] then + local env = code_headers["Environment-Name"]:trim() + if not atlatc.envs[env] then + errmsg_lines[#errmsg_lines+1] = S("Invalid environment name in header: @1", env) + else + nodetbl.env = env + end + code_headers["Environment-Name"] = nil + end + + if code_headers["Approach-Callback-Mode"] then + local mode_raw = code_headers["Approach-Callback-Mode"]:trim() + if mode_raw == "0" or mode_raw == "1" or mode_raw == "2" then + nodetbl.data = nodetbl.data or {} + nodetbl.data.__approach_callback_mode = tonumber(mode_raw) + else + errmsg_lines[#errmsg_lines+1] = S("Invalid approach callback mode in header: @1", mode_raw) + end + code_headers["Approach-Callback-Mode"] = nil + end + + local invalid_headers = {} + for k in pairs(code_headers) do + invalid_headers[#invalid_headers+1] = k + end + if #invalid_headers > 0 then + table.sort(invalid_headers) + errmsg_lines[#errmsg_lines+1] = S("Invalid attribute headers: @1", table.concat(invalid_headers, ", ")) + end + + if #errmsg_lines > 0 then + nodetbl.err = core.formspec_escape(table.concat(errmsg_lines, "; ")) + end + end + if fields.cle then + nodetbl.data={} + end + + ac.nodes[ph]=nodetbl + + meta:set_string("formspec", ac.getform(pos, meta)) + if nodetbl.env then + meta:set_string("infotext", S("LuaATC component assigned to environment '@1'", nodetbl.env)) + else + meta:set_string("infotext", S("LuaATC component assigned to an invalid environment")) + end +end + +function ac.run_in_env(pos, evtdata, customfct_p, ignore_no_code) + local ph=minetest.pos_to_string(pos) + local nodetbl = ac.nodes[ph] + if not nodetbl then + atwarn("LuaATC component at",ph,": Data not in memory! Please visit component and click 'Save'!") + return + end + + local meta + if advtrains.is_node_loaded(pos) then + meta=minetest.get_meta(pos) + end + + if not nodetbl.env or not atlatc.envs[nodetbl.env] then + atwarn("LuaATC component at",ph,": Not an existing environment: "..(nodetbl.env or "<nil>")) + return false + end + local env = atlatc.envs[nodetbl.env] + if not nodetbl.code or nodetbl.code=="" then + if not ignore_no_code then + env:log("warning", "LuaATC component at",ph,": No code to run! (insert -- to suppress warning)") + end + return false + end + + local customfct=customfct_p or {} + -- add interrupt function + customfct.interrupt=function(t, imesg) + assertt(t, "number") + assert(t >= 0) + atlatc.interrupt.add(t, pos, {type="int", int=true, message=imesg, msg=imesg}) --Compatiblity "message" field. + end + customfct.interrupt_safe=function(t, imesg) + assertt(t, "number") + assert(t >= 0) + if atlatc.interrupt.has_at_pos(pos) then + return false + end + atlatc.interrupt.add(t, pos, {type="int", int=true, message=imesg, msg=imesg}) --Compatiblity "message" field. + return true + end + customfct.clear_interrupts=function() + atlatc.interrupt.clear_ints_at_pos(pos) + end + customfct.atc_pos = { + x = pos.x, + y = pos.y, + z = pos.z, + } + -- add digiline_send function, if digiline is loaded + if minetest.global_exists("digiline") then + customfct.digiline_send=function(channel, msg) + assertt(channel, "string") + if advtrains.is_node_loaded(pos) then + digiline:receptor_send(pos, digiline.rules.default, channel, msg) + end + end + end + -- add lines scheduler if enabled + if advtrains.lines and advtrains.lines.sched then + customfct.schedule = function(rwtime, msg) + return advtrains.lines.sched.enqueue(rwtime, "atlatc_env", {pos=pos, msg=msg}, advtrains.encode_pos(pos), 1) + end + customfct.schedule_in = function(rwtime, msg) + return advtrains.lines.sched.enqueue_in(rwtime, "atlatc_env", {pos=pos, msg=msg}, advtrains.encode_pos(pos), 1) + end + end + + local datain=nodetbl.data or {} + local succ, dataout = env:execute_code(datain, nodetbl.code, evtdata, customfct) + if succ then + atlatc.active.nodes[ph].data=atlatc.remove_invalid_data(dataout) + else + atlatc.active.nodes[ph].err=dataout + env:log("error", "LuaATC component at",ph,": LUA Error:",dataout) + if meta then + meta:set_string("infotext", S("LuaATC component with error: @1", dataout)) + end + --TODO temporary + --if customfct.atc_id then + -- advtrains.drb_dump(customfct.atc_id) + -- error("Debug: LuaATC error hit!") + --end + end + if meta then + meta:set_string("formspec", ac.getform(pos, meta)) + end +end + +function ac.on_digiline_receive(pos, node, channel, msg) + atlatc.interrupt.add(0, pos, {type="digiline", digiline=true, channel = channel, msg = msg}) +end + +if advtrains.lines and advtrains.lines.sched then + advtrains.lines.sched.register_callback("atlatc_env", function(data) + -- This adds another interrupt to the atlatc queue... there might be a better way + atlatc.interrupt.add(0, data.pos, {type="schedule",schedule=true, msg=data.msg}) + end) +end + +ac.trackdef_advtrains_defs = { + on_train_enter = function(pos, train_id) + --do async. Event is fired in train steps + atlatc.interrupt.add(0, pos, {type="train", train=true, id=train_id}) + end, +} + +atlatc.active=ac diff --git a/advtrains_luaautomation/atc_rail.lua b/advtrains_luaautomation/atc_rail.lua new file mode 100644 index 0000000..c784b20 --- /dev/null +++ b/advtrains_luaautomation/atc_rail.lua @@ -0,0 +1,294 @@ +-- atc_rail.lua +-- registers and handles the ATC rail. Active component. +-- This is the only component that can interface with trains, so train interface goes here too. + +-- Get current translator +local S = atlatc.translate + +--Using subtable +local r={} + +-- Note on appr_internal: +-- The Approach callback is a special corner case: the train is not on the node, and it is executed synchronized +-- (in the train step right during LZB traversal). We therefore need access to the train id and the lzbdata table +function r.fire_event(pos, evtdata, appr_internal) + + local ph=minetest.pos_to_string(pos) + local railtbl = atlatc.active.nodes[ph] + + if not railtbl then + atwarn("LuaATC interface rail at",ph,": Data not in memory! Please visit position and click 'Save'!") + return + end + + --prepare ingame API for ATC. Regenerate each time since pos needs to be known + --If no train, then return false. + + -- try to get the train from the event data + -- This workaround is required because the callback is one step delayed, and a fast train may have already left the node. + -- Also used for approach callback + local train_id = evtdata._train_id + local atc_arrow = evtdata._train_arrow + local train, tvel + + if train_id then + train=advtrains.trains[train_id] + -- speed + tvel=train.velocity + -- if still no train_id available, try to get the train at my position + else + train_id=advtrains.get_train_at_pos(pos) + if train_id then + train=advtrains.trains[train_id] + advtrains.train_ensure_init(train_id, train) + -- look up atc_arrow + local index = advtrains.path_lookup(train, pos) + atc_arrow = (train.path_cn[index] == 1) + -- speed + tvel=train.velocity + end + end + + local customfct={ + atc_send = function(cmd) + if not train_id then return false end + assertt(cmd, "string") + advtrains.atc.train_set_command(train, cmd, atc_arrow) + return true + end, + split_at_index = function(index, cmd) + if not train_id then return false end + assertt(cmd, "string") + if type(index) ~= "number" or index < 2 then + return false + end + local new_id = advtrains.split_train_at_index(train, index) + if new_id then + minetest.after(1,advtrains.atc.train_set_command,advtrains.trains[new_id], cmd, atc_arrow) + return new_id + end + return false + end, + split_at_fc = function(cmd, len) + assertt(cmd, "string") + if not train_id then return false end + local new_id, fc = advtrains.split_train_at_fc(train, false, len) + if new_id then + minetest.after(1,advtrains.atc.train_set_command,advtrains.trains[new_id], cmd, atc_arrow) + end + return (fc or ""), new_id + end, + split_off_locomotive = function(cmd, len) + assertt(cmd, "string") + if not train_id then return false end + local new_id, fc = advtrains.split_train_at_fc(train, true, len) + if new_id then + minetest.after(1,advtrains.atc.train_set_command,advtrains.trains[new_id], cmd, atc_arrow) + end + return (fc or ""), new_id + end, + train_length = function () + if not train_id then return false end + return #train.trainparts + end, + step_fc = function() + if not train_id then return false end + advtrains.train_step_fc(train) + end, + get_fc = function() + if not train_id then return end + local fc_list = {} + for index,wagon_id in ipairs(train.trainparts) do + fc_list[index] = table.concat(advtrains.wagons[wagon_id].fc or {},"!") + end + return fc_list + end, + get_fc_index = function() + if not train_id then return end + local fc_index_list = {} + for widx, wagon_id in ipairs(train.trainparts) do + fc_index_list[widx] = advtrains.wagons[wagon_id].fcind or 1 + end + return fc_index_list + end, + set_fc = function(fc_list,reset_index) + assertt(fc_list, "table") + if not train_id then return false end + -- safety type-check for entered values + for _,v in ipairs(fc_list) do + if v and type(v) ~= "string" then + error("FC entries must be a string") + return + end + end + for index,wagon_id in ipairs(train.trainparts) do + if fc_list[index] then -- has FC to enter to this wagon + local data = advtrains.wagons[wagon_id] + if data then -- wagon actually exists + --effectively copyied from wagons.lua, allowing for the :split function and reset_index + data.fc = fc_list[index]:split("!") + if reset_index or not data.fcind then + data.fcind = 1 + elseif data.fcind > #data.fc then + data.fcind = #data.fc + end + end + end + end + end, + set_shunt = function() + -- enable shunting mode + if not train_id then return false end + train.is_shunt = true + end, + unset_shunt = function() + if not train_id then return false end + train.is_shunt = nil + end, + set_autocouple = function () + if not train_id then return false end + train.autocouple = true + end, + unset_autocouple = function () + if not train_id then return false end + train.autocouple = nil + end, + set_line = function(line) + if type(line)~="string" and type(line)~="number" then + return false + end + train.line = line .. "" + minetest.after(0, advtrains.invalidate_path, train_id) + return true + end, + get_line = function() + return train.line + end, + set_rc = function(rc) + if type(rc)~="string"then + return false + end + train.routingcode = rc + minetest.after(0, advtrains.invalidate_path, train_id) + return true + end, + get_rc = function() + return train.routingcode + end, + atc_reset = function() + if not train_id then return false end + advtrains.atc.train_reset_command(train) + return true + end, + atc_arrow = atc_arrow, + atc_id = train_id, + atc_speed = tvel, + atc_set_text_outside = function(text) + if not train_id then return false end + if text then assertt(text, "string") end + advtrains.trains[train_id].text_outside=text + return true + end, + atc_set_text_inside = function(text) + if not train_id then return false end + if text then assertt(text, "string") end + advtrains.trains[train_id].text_inside=text + return true + end, + atc_get_text_outside = function() + if not train_id then return false end + return advtrains.trains[train_id].text_outside + end, + atc_get_text_inside = function(text) + if not train_id then return false end + return advtrains.trains[train_id].text_inside + end, + atc_set_lzb_tsr = function(speed) + if not appr_internal then + error("atc_set_lzb_tsr() can only be used during 'approach' events!") + end + speed = assert(tonumber(speed), "Number expected!") + + local index = appr_internal.index + advtrains.lzb_add_checkpoint(train, index, speed, nil) + + return true + end, + } + -- interlocking specific + if advtrains.interlocking then + customfct.atc_set_ars_disable = function(value) + advtrains.interlocking.ars_set_disable(train, value) + end + end + + atlatc.active.run_in_env(pos, evtdata, customfct) + +end + +advtrains.register_tracks("default", { + nodename_prefix="advtrains_luaautomation:dtrack", + texture_prefix="advtrains_dtrack_atc", + models_prefix="advtrains_dtrack", + models_suffix=".b3d", + shared_texture="advtrains_dtrack_shared_atc.png", + description=S("LuaATC Track"), + formats={}, + get_additional_definiton = function(def, preset, suffix, rotation) + return { + after_place_node = atlatc.active.after_place_node, + after_dig_node = atlatc.active.after_dig_node, + + on_receive_fields = function(pos, ...) + atlatc.active.on_receive_fields(pos, ...) + + --set arrowconn (for ATC) + local ph=minetest.pos_to_string(pos) + local _, conns=advtrains.get_rail_info_at(pos, advtrains.all_tracktypes) + local nodeent = atlatc.active.nodes[ph] + if nodeent then + nodeent.arrowconn=conns[1].c + end + end, + + advtrains = { + on_train_enter = function(pos, train_id, train, index) + --do async. Event is fired in train steps + atlatc.interrupt.add(0, pos, {type="train", train=true, id=train_id, + _train_id = train_id, _train_arrow = (train.path_cn[index] == 1)}) + end, + on_train_approach = function(pos, train_id, train, index, has_entered, lzbdata) + -- Insert an event only if the rail indicated that it supports approach callbacks + local ph=minetest.pos_to_string(pos) + local railtbl = atlatc.active.nodes[ph] + -- uses a "magic variable" in the local environment of the node + -- This hack is necessary because code might not be prepared to get approach events... + if railtbl and railtbl.data and railtbl.data.__approach_callback_mode then + local acm = railtbl.data.__approach_callback_mode + local in_arrow = (train.path_cn[index] == 1) + if acm==2 or (acm==1 and in_arrow) then + local evtdata = {type="approach", approach=true, id=train_id, has_entered = has_entered, + _train_id = train_id, _train_arrow = in_arrow} -- reuses code from train_enter + -- This event is *required* to run synchronously, because it might set the ars_disable flag on the train and add LZB checkpoints, + -- although this is generally discouraged because this happens right in a train step + -- At this moment, I am not aware whether this may cause side effects, and I must encourage users not to do expensive calculations here. + r.fire_event(pos, evtdata, {train_id = train_id, train = train, index = index, lzbdata = lzbdata}) + end + end + end, + }, + luaautomation = { + fire_event=r.fire_event + }, + digiline = { + receptor = {}, + effector = { + action = atlatc.active.on_digiline_receive + }, + }, + } + end, +}, advtrains.trackpresets.t_30deg_straightonly) + + +atlatc.rail = r diff --git a/advtrains_luaautomation/chatcmds.lua b/advtrains_luaautomation/chatcmds.lua new file mode 100644 index 0000000..5f0da13 --- /dev/null +++ b/advtrains_luaautomation/chatcmds.lua @@ -0,0 +1,173 @@ +--chatcmds.lua +--Registers commands to modify the init and step code for LuaAutomation + +-- Get current translator +local S = atlatc.translate + +local function get_init_form(env, pname) + local err = env.init_err or "" + local code = env.init_code or "" + + local form = "size["..atlatc.CODE_FORM_SIZE.."]" + .."style[code;font=mono]" + .."button[0.0,0.2;2.5,1;run;"..S("Run Init Code").."]" + .."button[2.5,0.2;2.5,1;cls;"..S("Clear S").."]" + .."button[5.0,0.2;2.5,1;save;"..S("Save").."]" + .."button[7.5,0.2;2.5,1;del;"..S("Delete Env.").."]" + .."textarea[0.3,1.5;"..atlatc.CODE_FORM_SIZE..";code;"..S("Environment initialization code")..";"..minetest.formspec_escape(code).."]" + .."label[0.0,9.7;"..err.."]" + return form +end + +core.register_chatcommand("env_setup", { + params = "<environment name>", + description = S("Set up and modify AdvTrains LuaAutomation environment"), + privs = {atlatc=true}, + func = function(name, param) + local env=atlatc.envs[param] + if not env then return false,S("Invalid environment name!") end + minetest.show_formspec(name, "atlatc_envsetup_"..param, get_init_form(env, name)) + return true + end, +}) + +core.register_chatcommand("env_create", { + params = "<environment name>", + description = S("Create an AdvTrains LuaAutomation environment"), + privs = {atlatc=true}, + func = function(name, param) + if not param or param=="" then return false, S("Name required!") end + if string.find(param, "[^a-zA-Z0-9-_]") then return false, S("Invalid name (only common characters)") end + if atlatc.envs[param] then return false, S("Environment already exists!") end + atlatc.envs[param] = atlatc.env_new(param) + atlatc.envs[param].subscribers = {name} + return true, S("Created environment '@1'. Use '/env_setup @2' to define global initialization code, or start building LuaATC components!", param, param) + end, +}) +core.register_chatcommand("env_subscribe", { + params = "<environment name>", + description = S("Subscribe to the log of an Advtrains LuaATC environment"), + privs = {atlatc=true}, + func = function(name, param) + local env=atlatc.envs[param] + if not env then return false,S("Invalid environment name!") end + for _,pname in ipairs(env.subscribers) do + if pname==name then + return false, S("Already subscribed!") + end + end + table.insert(env.subscribers, name) + return true, S("Subscribed to environment '@1'.", param) + end, +}) +core.register_chatcommand("env_unsubscribe", { + params = "<environment name>", + description = S("Unubscribe to the log of an Advtrains LuaATC environment"), + privs = {atlatc=true}, + func = function(name, param) + local env=atlatc.envs[param] + if not env then return false,S("Invalid environment name!") end + for index,pname in ipairs(env.subscribers) do + if pname==name then + table.remove(env.subscribers, index) + return true, S("Successfully unsubscribed!") + end + end + return false, S("Not subscribed!") + end, +}) +core.register_chatcommand("env_subscriptions", { + params = "[environment name]", + description = S("List Advtrains LuaATC environments you are subscribed to (no parameters) or subscribers of an environment (giving an env name)."), + privs = {atlatc=true}, + func = function(name, param) + if not param or param=="" then + local none=true + for envname, env in pairs(atlatc.envs) do + for _,pname in ipairs(env.subscribers) do + if pname==name then + none=false + minetest.chat_send_player(name, envname) + end + end + end + if none then + return false, S("Not subscribed to any!") + end + return true + end + local env=atlatc.envs[param] + if not env then return false,S("Invalid environment name!") end + local none=true + for index,pname in ipairs(env.subscribers) do + none=false + minetest.chat_send_player(name, pname) + end + if none then + return false, S("No subscribers!") + end + return true + end, +}) + +core.register_chatcommand("env_default", { + params = "[environment name]", + description = S("Set or get your default LuaATC environment."), + privs = {atlatc=true}, + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, S("You're not online!") + end + + param = string.trim(param) + if param == "" then + local env = atlatc.active.get_player_default_environment(player) + if env then + return true, S("Your default environment is '@1'.", env) + else + return false, S("No avaliable environemnt! Create one with /env_create.") + end + end + + if atlatc.active.set_player_default_environment(player, param) then + return true, S("Default environment set to '@1'.", param) + else + return false, S("Invalid environment name!") + end + end, +}) + +minetest.register_on_player_receive_fields(function(player, formname, fields) + + local pname=player:get_player_name() + if not minetest.check_player_privs(pname, {atlatc=true}) then return end + + local envname=string.match(formname, "^atlatc_delconfirm_(.+)$") + if envname and fields.sure=="YES" then + atlatc.envs[envname]=nil + minetest.chat_send_player(pname, S("Environment deleted!")) + return + end + + envname=string.match(formname, "^atlatc_envsetup_(.+)$") + if not envname then return end + + local env=atlatc.envs[envname] + if not env then return end + + if fields.del then + minetest.show_formspec(pname, "atlatc_delconfirm_"..envname, "field[sure;" + ..minetest.formspec_escape(S("SURE TO DELETE ENVIRONMENT @1? Type YES (all uppercase) to continue or just quit form to cancel.", envname))..";]") + return + end + + env.init_err=nil + if fields.code then + env.init_code=fields.code + end + if fields.run then + env:run_initcode() + minetest.show_formspec(pname, formname, get_init_form(env, pname)) + end +end) diff --git a/advtrains_luaautomation/environment.lua b/advtrains_luaautomation/environment.lua new file mode 100644 index 0000000..93614ef --- /dev/null +++ b/advtrains_luaautomation/environment.lua @@ -0,0 +1,420 @@ +------------- +-- lua sandboxed environment + +local S = atlatc.translate + +-- function to cross out functions and userdata. +-- modified from dump() +function atlatc.remove_invalid_data(o, nested) + if o==nil then return nil end + local valid_dt={["nil"]=true, boolean=true, number=true, string=true} + if type(o) ~= "table" then + --check valid data type + if not valid_dt[type(o)] then + return nil + end + return o + end + -- Contains table -> true/nil of currently nested tables + nested = nested or {} + if nested[o] then + return nil + end + nested[o] = true + for k, v in pairs(o) do + v = atlatc.remove_invalid_data(v, nested) + end + nested[o] = nil + return o +end + + +local env_proto={ + load = function(self, envname, data) + self.name=envname + self.sdata=data.sdata and atlatc.remove_invalid_data(data.sdata) or {} + self.fdata={} + self.init_code=data.init_code or "" + self.subscribers=data.subscribers or {} + end, + save = function(self) + -- throw any function values out of the sdata table + self.sdata = atlatc.remove_invalid_data(self.sdata) + return {sdata = self.sdata, init_code=self.init_code, subscribers=self.subscribers} + end, +} + +--Environment +--Code modified from mesecons_luacontroller (credit goes to Jeija and mesecons contributors) + +local safe_globals = { + "assert", "error", "ipairs", "next", "pairs", "select", + "tonumber", "tostring", "type", "unpack", "_VERSION" +} + +local function safe_date(f, t) + if not f then + -- fall back to old behavior + return(os.date("*t",os.time())) + else + --pass parameters + return os.date(f,t) + end +end + +-- string.rep(str, n) with a high value for n can be used to DoS +-- the server. Therefore, limit max. length of generated string. +local function safe_string_rep(str, n) + if #str * n > 2000 then + debug.sethook() -- Clear hook + error("string.rep: string length overflow", 2) + end + + return string.rep(str, n) +end + +-- string.find with a pattern can be used to DoS the server. +-- Therefore, limit string.find to patternless matching. +-- Note: Disabled security since there are enough security leaks and this would be unneccessary anyway to DoS the server +local function safe_string_find(...) + --if (select(4, ...)) ~= true then + -- debug.sethook() -- Clear hook + -- error("string.find: 'plain' (fourth parameter) must always be true for security reasons.") + --end + + return string.find(...) +end + +local mp=minetest.get_modpath("advtrains_luaautomation") + +local static_env = { + --core LUA functions + string = { + byte = string.byte, + char = string.char, + format = string.format, + len = string.len, + lower = string.lower, + upper = string.upper, + rep = safe_string_rep, + reverse = string.reverse, + sub = string.sub, + find = safe_string_find, + }, + math = { + abs = math.abs, + acos = math.acos, + asin = math.asin, + atan = math.atan, + atan2 = math.atan2, + ceil = math.ceil, + cos = math.cos, + cosh = math.cosh, + deg = math.deg, + exp = math.exp, + floor = math.floor, + fmod = math.fmod, + frexp = math.frexp, + huge = math.huge, + ldexp = math.ldexp, + log = math.log, + log10 = math.log10, + max = math.max, + min = math.min, + modf = math.modf, + pi = math.pi, + pow = math.pow, + rad = math.rad, + random = math.random, + sin = math.sin, + sinh = math.sinh, + sqrt = math.sqrt, + tan = math.tan, + tanh = math.tanh, + }, + table = { + concat = table.concat, + insert = table.insert, + maxn = table.maxn, + remove = table.remove, + sort = table.sort, + }, + os = { + clock = os.clock, + difftime = os.difftime, + time = os.time, + date = safe_date, + }, + POS = function(x,y,z) return {x=x, y=y, z=z} end, + getstate = advtrains.getstate, + setstate = advtrains.setstate, + is_passive = advtrains.is_passive, + --interrupts are handled per node, position unknown. (same goes for digilines) + --however external interrupts can be set here. + interrupt_pos = function(parpos, imesg) + local pos=atlatc.pcnaming.resolve_pos(parpos, "interrupt_pos") + atlatc.interrupt.add(0, pos, {type="ext_int", ext_int=true, message=imesg}) + end, + train_parts = function(train_id) + if not train_id then return false end + local train = advtrains.trains[train_id] + if not train then return false end + return table.copy(train.trainparts or {}) + end, + get_wagon_train_id = function(wagon_id) + local wagon = advtrains.wagons[wagon_id] + return wagon and wagon.train_id or false + end, + -- sends an atc command to train regardless of where it is in the world + atc_send_to_train = function(train_id, command) + assertt(command, "string") + local train = advtrains.trains[train_id] + if train then + advtrains.atc.train_set_command(train, command, true) + return true + else + return false + end + end, + get_slowdown = function() + return advtrains.global_slowdown + end +} + +-- If interlocking is present, enable route setting functions +if advtrains.interlocking then + local function gen_checks(signal, route_name, noroutesearch) + assertt(route_name, "string") + local pos = atlatc.pcnaming.resolve_pos(signal) + local sigd = advtrains.interlocking.db.get_sigd_for_signal(pos) + if not sigd then + error("There's no signal at "..minetest.pos_to_string(pos)) + end + local tcbs = advtrains.interlocking.db.get_tcbs(sigd) + if not tcbs then + error("Inconsistent configuration, no tcbs for signal at "..minetest.pos_to_string(pos)) + end + + local routeid, route + if not noroutesearch then + for routeidt, routet in ipairs(tcbs.routes) do + if routet.name == route_name then + routeid = routeidt + route = routet + break + end + end + if not route then + error("No route called "..route_name.." at "..minetest.pos_to_string(pos)) + end + end + return pos, sigd, tcbs, routeid, route + end + + + static_env.can_set_route = function(signal, route_name) + local pos, sigd, tcbs, routeid, route = gen_checks(signal, route_name) + -- if route is already set on signal, return whether it's committed + if tcbs.routeset == routeid then + return tcbs.route_committed + end + -- actually try setting route (parameter 'true' designates try-run + local ok = advtrains.interlocking.route.set_route(sigd, route, true) + return ok + end + static_env.set_route = function(signal, route_name) + local pos, sigd, tcbs, routeid, route = gen_checks(signal, route_name) + return advtrains.interlocking.route.update_route(sigd, tcbs, routeid, nil, S("LuaATC component")) + end + static_env.cancel_route = function(signal) + local pos, sigd, tcbs, routeid, route = gen_checks(signal, "", true) + return advtrains.interlocking.route.update_route(sigd, tcbs, nil, true) + end + static_env.get_active_route = function(signal) + local pos, sigd, tcbs = gen_checks(signal, "", true) + return tcbs.routeset and tcbs.routes[tcbs.routeset] and tcbs.routes[tcbs.routeset].name or nil + end + static_env.list_routes = function(signal) + local pos, sigd, tcbs = gen_checks(signal, "", true) + local routes = {} + for _, route in ipairs(tcbs.routes) do + routes[#routes+1] = route.name + end + return routes + end + static_env.get_aspect = function(signal) + local pos = atlatc.pcnaming.resolve_pos(signal) + return advtrains.interlocking.signal.get_aspect_info(pos) + end + static_env.set_aspect = function(signal, main_asp, rem_signal) + if type(main_asp) == "table" then + error("set_aspect: Parameters of this method have changed to (signal, main_asp, rem_signal) with introduction of distant signalling: parameter 2 is now the main aspect name (a string)") + end + local pos = atlatc.pcnaming.resolve_pos(signal) + local rem_pos = rem_signal and atlatc.pcnaming.resolve_pos(rem_signal) + return advtrains.interlocking.signal_set_aspect(pos, main_asp, rem_pos) + end + + --section_occupancy() + static_env.section_occupancy = function(ts_id) + if not ts_id then return nil end + ts_id = tostring(ts_id) + local response = advtrains.interlocking.db.get_ts(ts_id) + if not response then return false end + return (response.trains and table.copy(response.trains)) or {} + end +end + +-- Lines-specific: +if advtrains.lines then + local atlrwt = advtrains.lines.rwt + static_env.rwt = { + now = atlrwt.now, + new_t = atlrwt.new_t, + new_i = atlrwt.new_i, + to_table = atlrwt.to_table, + t_sec = atlrwt.t_sec, + i_sec = atlrwt.i_sec, + to_secs = atlrwt.to_secs, -- deprecated + t_str = atlrwt.t_str, + i_str = atlrwt.i_str, + to_string = atlrwt.to_string, -- deprecated + add = atlrwt.add, + diff = atlrwt.diff, + sub = atlrwt.sub, + + is_after = atlrwt.is_after, + is_before = atlrwt.is_before, + + next_rpt = atlrwt.next_rpt, + last_rpt = atlrwt.last_rpt, + time_from_last_rpt = atlrwt.time_from_last_rpt, + time_to_next_rpt = atlrwt.time_to_next_rpt, + } +end + + +atlatc.register_function = function (name, f) + static_env[name] = f +end + +for _, name in pairs(safe_globals) do + static_env[name] = _G[name] +end + +--The environment all code calls get is a table that has set static_env as metatable. +--In general, every variable is local to a single code chunk, but kept persistent over code re-runs. Data is also saved, but functions and userdata and circular references are removed +--Init code and step code's environments are not saved +-- S - Table that can contain any save data global to the environment. Will be saved statically. Can't contain functions or userdata or circular references. +-- F - Table global to the environment, can contain volatile data that is deleted when server quits. +-- The init code should populate this table with functions and other definitions. + +local proxy_env={} +--proxy_env gets a new metatable in every run, but is the shared environment of all functions ever defined. + +-- returns: true, fenv if successful; nil, error if error +function env_proto:execute_code(localenv, code, evtdata, customfct) + -- create us a print function specific for this environment + if not self.safe_print_func then + local myenv = self + self.safe_print_func = function(...) + myenv:log("info", ...) + end + end + + local metatbl ={ + __index = function(t, i) + if i=="S" then + return self.sdata + elseif i=="F" then + return self.fdata + elseif i=="event" then + return evtdata + elseif customfct and customfct[i] then + return customfct[i] + elseif localenv and localenv[i] then + return localenv[i] + elseif i=="print" then + return self.safe_print_func + end + return static_env[i] + end, + __newindex = function(t, i, v) + if i=="S" or i=="F" or i=="event" or (customfct and customfct[i]) or static_env[i] then + debug.sethook() + error("Trying to overwrite environment contents") + end + localenv[i]=v + end, + } + setmetatable(proxy_env, metatbl) + local fun, err=loadstring(code) + if not fun then + return false, err + end + + setfenv(fun, proxy_env) + local succ, data = pcall(fun) + if succ then + data=localenv + end + return succ, data +end + +function env_proto:run_initcode() + if self.init_code and self.init_code~="" then + local old_fdata=self.fdata + self.fdata = {} + --atprint("[atlatc]Running initialization code for environment '"..self.name.."'") + local succ, err = self:execute_code({}, self.init_code, {type="init", init=true}) + if not succ then + self:log("error", "Executing InitCode for '"..self.name.."' failed:"..err) + self.init_err=err + if old_fdata then + self.fdata=old_fdata + self:log("warning", "The 'F' table has been restored to the previous state.") + end + end + end +end + +-- log to environment subscribers. severity can be "error", "warning" or "info" (used by internal print) +function env_proto:log(severity, ...) + local text=advtrains.print_concat_table({"[atlatc "..self.name.." "..severity.."]", ...}) + minetest.log("action", text) + for _, pname in ipairs(self.subscribers) do + minetest.chat_send_player(pname, text) + end +end + +-- env.subscribers table may be directly altered by callers. + + +--- class interface + +function atlatc.env_new(name) + local newenv={ + name=name, + init_code="", + sdata={}, + subscribers={}, + } + setmetatable(newenv, {__index=env_proto}) + return newenv +end +function atlatc.env_load(name, data) + local newenv={} + setmetatable(newenv, {__index=env_proto}) + newenv:load(name, data) + return newenv +end + +function atlatc.run_initcode() + for envname, env in pairs(atlatc.envs) do + env:run_initcode() + end +end + + + + diff --git a/advtrains_luaautomation/init.lua b/advtrains_luaautomation/init.lua new file mode 100644 index 0000000..8723837 --- /dev/null +++ b/advtrains_luaautomation/init.lua @@ -0,0 +1,124 @@ +-- advtrains_luaautomation/init.lua +-- Lua automation features for advtrains +-- Uses global table 'atlatc' (AdvTrains_LuaATC) + + + +atlatc = { envs = {}} + +-- ask engine for translator instance, this will load the translation files +atlatc.translate = core.get_translator("advtrains_luaautomation") + +-- Get current translator +local S = atlatc.translate + +--Privilege +--Only trusted players should be enabled to build stuff which can break the server. +minetest.register_privilege("atlatc", { description = S("Can place and configure LuaATC components, including execute potentially harmful Lua code"), give_to_singleplayer = false, default= false }) + +--Size of code input forms in X,Y notation. Must be at least 10x10 +atlatc.CODE_FORM_SIZE = "15,12" +--Position of Error Label in Code Form +atlatc.CODE_FORM_ERRLABELPOS = "0,12" + +--assertt helper. error if a variable is not of a type +function assertt(var, typ) + if type(var)~=typ then + error("Assertion failed, variable has to be of type "..typ) + end +end + +local mp=minetest.get_modpath("advtrains_luaautomation") +if not mp then + error("Mod name error: Mod folder is not named 'advtrains_luaautomation'!") +end +dofile(mp.."/environment.lua") +dofile(mp.."/interrupt.lua") +dofile(mp.."/active_common.lua") +dofile(mp.."/atc_rail.lua") +dofile(mp.."/operation_panel.lua") +if mesecon then + dofile(mp.."/mesecon_controller.lua") +end +dofile(mp.."/pcnaming.lua") + +dofile(mp.."/chatcmds.lua") + +if minetest.settings:get_bool("advtrains_luaautomation_enable_luaatc_recipes",false) == true then + dofile(mp.."/recipes.lua") +end + +local filename=minetest.get_worldpath().."/advtrains_luaautomation" + +function atlatc.load(tbl) + if tbl.version==1 then + for envname, data in pairs(tbl.envs) do + atlatc.envs[envname]=atlatc.env_load(envname, data) + end + atlatc.active.load(tbl.active) + atlatc.interrupt.load(tbl.interrupt) + atlatc.pcnaming.load(tbl.pcnaming) + end + -- run init code of all environments + atlatc.run_initcode() +end + +function atlatc.load_pre_v4() + minetest.log("action", "[atlatc] Loading pre-v4 save file") + local file, err = io.open(filename, "r") + if not file then + minetest.log("warning", " Failed to read advtrains_luaautomation save data from file "..filename..": "..(err or "Unknown Error")) + minetest.log("warning", " (this is normal when first enabling advtrains on this world)") + else + atprint("luaautomation reading file:",filename) + local tbl = minetest.deserialize(file:read("*a")) + if type(tbl) == "table" then + if tbl.version==1 then + for envname, data in pairs(tbl.envs) do + atlatc.envs[envname]=atlatc.env_load(envname, data) + end + atlatc.active.load(tbl.active) + atlatc.interrupt.load(tbl.interrupt) + atlatc.pcnaming.load(tbl.pcnaming) + end + else + minetest.log("error", " Failed to read advtrains_luaautomation save data from file "..filename..": Not a table!") + end + file:close() + end + -- run init code of all environments + atlatc.run_initcode() +end + + +atlatc.save = function() + --versions: + -- 1 - Initial save format. + + local envdata={} + for envname, env in pairs(atlatc.envs) do + envdata[envname]=env:save() + end + local save_tbl={ + version = 1, + envs=envdata, + active = atlatc.active.save(), + interrupt = atlatc.interrupt.save(), + pcnaming = atlatc.pcnaming.save(), + } + + return save_tbl +end + +--[[ +-- globalstep for step code +local timer, step_int=0, 2 + +function atlatc.mainloop_stepcode(dtime) + timer=timer+dtime + if timer>step_int then + timer=0 + atlatc.run_stepcode() + end +end +]] diff --git a/advtrains_luaautomation/interrupt.lua b/advtrains_luaautomation/interrupt.lua new file mode 100644 index 0000000..2e54ad8 --- /dev/null +++ b/advtrains_luaautomation/interrupt.lua @@ -0,0 +1,73 @@ +-- interrupt.lua +-- implements interrupt queue + +--to be saved: pos and evtdata +local iq={} +local queue={} +local timer=0 +local run=false + +function iq.load(data) + local d=data or {} + queue = d.queue or {} + timer = d.timer or 0 +end +function iq.save() + return {queue = queue, timer=timer} +end + +function iq.has_at_pos(pos) + for i=1,#queue do + local qe=queue[i] + if vector.equals(pos, qe.p) then + return true + end + end + return false +end + +function iq.clear_ints_at_pos(pos) + local i=1 + while i<=#queue do + local qe=queue[i] + if not qe then + table.remove(queue, i) + elseif vector.equals(pos, qe.p) and (qe.e.int or qe.e.ext_int) then + table.remove(queue, i) + else + i=i+1 + end + end +end + +function iq.add(t, pos, evtdata) + queue[#queue+1]={t=t+timer, p=pos, e=evtdata} + run=true +end + +function iq.mainloop(dtime) + timer=timer + math.min(dtime, 0.2) + local i=1 + while i<=#queue do + local qe=queue[i] + if not qe then + table.remove(queue, i) + elseif timer>qe.t then + table.remove(queue, i) + local pos, evtdata=qe.p, qe.e + local node=advtrains.ndb.get_node(pos) + local ndef=minetest.registered_nodes[node.name] + if ndef and ndef.luaautomation and ndef.luaautomation.fire_event then + ndef.luaautomation.fire_event(pos, evtdata) + else + atwarn("[atlatc][interrupt] Couldn't run event",evtdata.type,"on",pos,", something wrong with the node",node) + end + else + i=i+1 + end + end +end + + + +atlatc.interrupt=iq diff --git a/advtrains_luaautomation/locale/advtrains_luaautomation.de.po b/advtrains_luaautomation/locale/advtrains_luaautomation.de.po new file mode 100644 index 0000000..2cbb079 --- /dev/null +++ b/advtrains_luaautomation/locale/advtrains_luaautomation.de.po @@ -0,0 +1,747 @@ +msgid "" +msgstr "" +"Project-Id-Version: advtrains\n" +"Report-Msgid-Bugs-To: advtrains-discuss@lists.sr.ht\n" +"POT-Creation-Date: 2026-05-17 09:19+0800\n" +"PO-Revision-Date: 2026-05-17 09:29+0800\n" +"Last-Translator: Y. Wang <yw05@forksworld.de>\n" +"Language-Team: German\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.8\n" + +#: active_common.lua +msgid "Clear Local Environment" +msgstr "Lokale Umgebung leeren" + +#: active_common.lua +msgid "Code" +msgstr "Quellcode" + +#: active_common.lua +msgid "Invalid approach callback mode in header: @1" +msgstr "" + +#: active_common.lua +msgid "Invalid attribute headers: @1" +msgstr "" + +#: active_common.lua +#, fuzzy +msgid "Invalid environment name in header: @1" +msgstr "Ungültiger Umgebungsname!" + +#: active_common.lua +msgid "LuaATC Environment" +msgstr "LuaATC-Umgebung" + +#: active_common.lua +msgid "LuaATC component assigned to an invalid environment" +msgstr "LuaATC-Komponente zugewiesen an ungültige Umgebung" + +#: active_common.lua +msgid "LuaATC component assigned to environment '@1'" +msgstr "LuaATC-Komponente zugewiesen an Umgebung '@1'" + +#: active_common.lua +msgid "LuaATC component with error: @1" +msgstr "LuaATC-Bauteil mit Fehlermeldung: @1" + +#: active_common.lua chatcmds.lua +msgid "Save" +msgstr "Speichern" + +#: active_common.lua +msgid "Unconfigured LuaATC component" +msgstr "Nicht konfiguierter LuaATC-Bauteil" + +#: active_common.lua +msgid "" +"You are not allowed to configure this LuaATC component without the @1 " +"privilege." +msgstr "" +"Sie dürfen ohne das „@1“-Privileg diesen LuaATC-Bauteil nicht konfigurieren." + +#: atc_rail.lua +msgid "LuaATC Track" +msgstr "LuaATC-Gleis" + +#: chatcmds.lua +msgid "Already subscribed!" +msgstr "Bereits abonniert!" + +#: chatcmds.lua +msgid "Clear S" +msgstr "S leeren" + +#: chatcmds.lua +msgid "Create an AdvTrains LuaAutomation environment" +msgstr "Eine LuaATC-Umgebung erstellen" + +#: chatcmds.lua +msgid "" +"Created environment '@1'. Use '/env_setup @2' to define global " +"initialization code, or start building LuaATC components!" +msgstr "" +"Umgebung '@1' erstellt. Nutze '/env_setup @2' um Initialisierungscode zu " +"definieren, oder beginne, LuaATC-Komponenten einzubauen!" + +#: chatcmds.lua +#, fuzzy +msgid "Default environment set to '@1'." +msgstr "Meldungen von '@1' abonniert." + +#: chatcmds.lua +msgid "Delete Env." +msgstr "Umg. löschen" + +#: chatcmds.lua +msgid "Environment already exists!" +msgstr "Umgebung existiert bereits!" + +#: chatcmds.lua +msgid "Environment deleted!" +msgstr "Umgebung gelöscht!" + +#: chatcmds.lua +msgid "Environment initialization code" +msgstr "Umgebungs-Initialisierungscode" + +#: chatcmds.lua +msgid "Invalid environment name!" +msgstr "Ungültiger Umgebungsname!" + +#: chatcmds.lua +msgid "Invalid name (only common characters)" +msgstr "Ungültiger Name (nur Standardzeichen)" + +#: chatcmds.lua +msgid "" +"List Advtrains LuaATC environments you are subscribed to (no parameters) or " +"subscribers of an environment (giving an env name)." +msgstr "" +"Abonnierte LuaATC-Umgebungen auflisten (ohne Parameter) oder Abonnenten " +"einer bestimmten Umgebung anzeigen (Name angeben)" + +#: chatcmds.lua +msgid "Name required!" +msgstr "Name benötigt!" + +#: chatcmds.lua +msgid "No avaliable environemnt! Create one with /env_create." +msgstr "" + +#: chatcmds.lua +msgid "No subscribers!" +msgstr "Keine Abonnenten!" + +#: chatcmds.lua +msgid "Not subscribed to any!" +msgstr "Zu keiner Umgebung abonniert!" + +#: chatcmds.lua +msgid "Not subscribed!" +msgstr "Nicht abonniert!" + +#: chatcmds.lua +msgid "Run Init Code" +msgstr "Init.-Code ausführen" + +#: chatcmds.lua +msgid "" +"SURE TO DELETE ENVIRONMENT @1? Type YES (all uppercase) to continue or just " +"quit form to cancel." +msgstr "" +"UMGEBUNG @1 WIRKLICH LÖSCHEN? Geben Sie YES (in Großbuchstaben) ein. Um " +"abzubrechen einfach das Formular schließen." + +#: chatcmds.lua +#, fuzzy +msgid "Set or get your default LuaATC environment." +msgstr "Meldungen aus LuaATC-Umgebung abonnieren" + +#: chatcmds.lua +msgid "Set up and modify AdvTrains LuaAutomation environment" +msgstr "LuaATC-Umgebung einstellen und bearbeiten" + +#: chatcmds.lua +msgid "Subscribe to the log of an Advtrains LuaATC environment" +msgstr "Meldungen aus LuaATC-Umgebung abonnieren" + +#: chatcmds.lua +msgid "Subscribed to environment '@1'." +msgstr "Meldungen von '@1' abonniert." + +#: chatcmds.lua +msgid "Successfully unsubscribed!" +msgstr "Erfolgreich abgemeldet!" + +#: chatcmds.lua +msgid "Unubscribe to the log of an Advtrains LuaATC environment" +msgstr "Meldungen aus LuaATC-Umgebung nicht mehr empfangen" + +#: chatcmds.lua +msgid "You're not online!" +msgstr "" + +#: chatcmds.lua +#, fuzzy +msgid "Your default environment is '@1'." +msgstr "Meldungen von '@1' abonniert." + +#: environment.lua +#, fuzzy +msgid "LuaATC component" +msgstr "Nicht konfiguierter LuaATC-Bauteil" + +#: init.lua +msgid "" +"Can place and configure LuaATC components, including execute potentially " +"harmful Lua code" +msgstr "" +"Kann LuaATC-Bauteile platzieren und konfigurieren (auch evtl. schädliche " +"Programme ausführen)" + +#: mesecon_controller.lua +msgid "LuaATC Mesecon Controller" +msgstr "LuaATC Mesecon-Steuerung" + +#: operation_panel.lua +msgid "LuaATC Operation Panel" +msgstr "LuaATC-Steuerpanel" + +#: pcnaming.lua +msgid "Passive Component Naming Tool" +msgstr "PC-Benennungswerkzeug" + +#: pcnaming.lua +msgid "Right-click to name a passive component." +msgstr "Rechtsklick zur Benennung der passiven Komponente." + +#: pcnaming.lua +msgid "Set name of component (empty to clear)" +msgstr "Name der Komponente setzen (leer lassen um zu löschen)" + +#: pcnaming.lua +msgid "" +"You are not allowed to name LuaATC passive components without the @1 " +"privilege." +msgstr "" +"Sie dürfen ohne das „@1“ Privileg keinen passiven LuaATC-Bauteil benennen." + +#~ msgid "(Doors closed)" +#~ msgstr "(Türen geschlossen)" + +#~ msgid "3-way turnout" +#~ msgstr "Dreiwegweiche" + +#~ msgid "90+Angle Diamond Crossing Track" +#~ msgstr "Kreuzung mit einem achsenparallelen Gleis" + +#~ msgid "<No coupler>" +#~ msgstr "<Keine Kupplung vorhanden>" + +#~ msgid "@1 Platform (45 degree)" +#~ msgstr "Hoher @1-Bahnsteig (45°)" + +#~ msgid "@1 Platform (high)" +#~ msgstr "Hoher @1-Bahnsteig" + +#~ msgid "@1 Platform (low)" +#~ msgstr "Niedriger @1-Bahnsteig" + +#~ msgid "@1 Platform (low, 45 degree)" +#~ msgstr "Niedriger @1-Bahnsteig (45°)" + +#~ msgid "@1 Slope" +#~ msgstr "@1 Steigung" + +#~ msgid "ATC Kick command warning: doors are closed." +#~ msgstr "" +#~ "Zugbeeinflussung: Wegen geschlossener Türen werden Fahrgäste nicht zum " +#~ "Ausstieg gezwungen." + +#~ msgid "ATC Kick command warning: train moving." +#~ msgstr "" +#~ "Zugbeeinflussung: Der Zug befindet sich in Bewegung, Fahrgäste werden " +#~ "nicht zum Ausstieg gezwungen." + +#~ msgid "ATC Reverse command warning: didn't reverse train, train moving." +#~ msgstr "" +#~ "Zugbeeinflussung: Der Zug befindet sich in Bewegung und kann nicht " +#~ "umgekehrt werden." + +#~ msgid "ATC command parse error: Unknown command: @1" +#~ msgstr "Zugbeeinflussung: Unbekannter Befehl: @1" + +#~ msgid "ATC command syntax error: I statement not closed: @1" +#~ msgstr "Zugbeeinflussung: Unvollständiger I-Befehl: @1" + +#~ msgid "ATC controller" +#~ msgstr "Zugbeeinflussungsgleis" + +#~ msgid "" +#~ "ATC controller, mode @1\n" +#~ "Channel: @2" +#~ msgstr "" +#~ "Zugbeeinflussungsgleis in Betriebsart „@1“\n" +#~ "Kanal: @2" + +#~ msgid "" +#~ "ATC controller, mode @1\n" +#~ "Command: @2" +#~ msgstr "" +#~ "Zugbeeinflussungsgleis in Betriebsart „@1“\n" +#~ "Befehl: @2" + +#~ msgid "Access to @1" +#~ msgstr "Zugang zu @1" + +#~ msgid "Andrew's Cross" +#~ msgstr "Andreaskreuz" + +#~ msgid "Back of train would end up off track, cancelling." +#~ msgstr "Der hinterer Teil dez Zuges wäre nicht auf dem Gleis." + +#~ msgid "Big Industrial Train Engine" +#~ msgstr "Große Industrielle Lokomotive" + +#~ msgid "Box Wagon" +#~ msgstr "Güterwaggon" + +#~ msgid "Buffer and Chain Coupler" +#~ msgstr "Schraubenkupplung" + +#~ msgid "Bumper" +#~ msgstr "Prellbock" + +#~ msgid "Can not couple: The couplers of the trains do not match (@1 and @2)." +#~ msgstr "Die Kupplungen der Züge passen nicht zueinander (@1 und @2)." + +#~ msgid "Can't get on: wagon full or doors closed!" +#~ msgstr "" +#~ "Sie können nicht einsteigen: der Waggon ist voll oder die Türen sind " +#~ "geschlossen." + +#, fuzzy +#~ msgid "Can't place: Not enough slope items left (@1 required)" +#~ msgstr "" +#~ "Es kann nicht platziert werden: Sie haben nicht genug Steigungsblöcke, es " +#~ "werden insgesamt @1 benötigt." + +#, fuzzy +#~ msgid "Can't place: There's no slope of length @1" +#~ msgstr "" +#~ "Es kann nicht platziert werden: die Steigung der Länge @1 ist nicht " +#~ "definiert." + +#, fuzzy +#~ msgid "Can't place: no supporting node at upper end." +#~ msgstr "" +#~ "Es kann nicht platziert werden: es gibt keinen unterstützenden Block am " +#~ "Ende der Steigung." + +#, fuzzy +#~ msgid "Can't place: not pointing at node" +#~ msgstr "Es kann nicht platziert werden: Sie zeigen nicht auf einem Block." + +#~ msgid "Can't place: protected position!" +#~ msgstr "Es kann nicht platziert werden: diese Position ist geschützt." + +#, fuzzy +#~ msgid "Can't place: space occupied!" +#~ msgstr "Es kann nicht platziert werden: Diese Position ist besetzt." + +#~ msgid "Command" +#~ msgstr "Befehl" + +#~ msgid "Command (on)" +#~ msgstr "Befehl (wenn aktiviert)" + +#~ msgid "Default Seat" +#~ msgstr "Standardsitzplatz" + +#~ msgid "Default Seat (driver stand)" +#~ msgstr "Standardsitzplatz (Führerstand)" + +#~ msgid "Dep. Speed" +#~ msgstr "Zielgeschwindigkeit bei Abfahrt" + +#~ msgid "Deprecated Track" +#~ msgstr "ausrangiertes Gleis, nicht verwenden." + +#~ msgid "Detailed Steam Engine" +#~ msgstr "Detaillierte Dampflokomotive" + +#~ msgid "Detector Rail" +#~ msgstr "Detektorgleis" + +#~ msgid "Diagonal Diamond Crossing Track" +#~ msgstr "Diagonale Gleiskreuzung" + +#~ msgid "Digiline channel" +#~ msgstr "Digiline-Kanal" + +#~ msgid "Door Delay" +#~ msgstr "Zeit für die Türschließung" + +#~ msgid "Door Side" +#~ msgstr "Türseite" + +#~ msgid "Doors are closed! (Try holding sneak key!)" +#~ msgstr "Die Türen sind geschlossen." + +#~ msgid "" +#~ "Doors are closed. Use Sneak+rightclick to ignore the closed doors and get " +#~ "off." +#~ msgstr "" +#~ "Die Türen sind geschlossen. Nutzen Sie Schleichen+Rechtsklick, um trotz " +#~ "geschlossener Türen auszusteigen." + +#, fuzzy +#~ msgid "Driver Stand" +#~ msgstr "Führerstand" + +#~ msgid "Driver Stand (left)" +#~ msgstr "Führerstand Links" + +#~ msgid "Driver Stand (right)" +#~ msgstr "Führerstand Rechts" + +#~ msgid "Driver stand" +#~ msgstr "Führerstand" + +#~ msgid "Driver's cab" +#~ msgstr "Führerstand" + +#~ msgid "Get off" +#~ msgstr "Aussteigen" + +#~ msgid "Get off (forced)" +#~ msgstr "Ausstieg zwingen" + +#~ msgid "Industrial Train Engine" +#~ msgstr "Industrielle Lokomotive" + +#~ msgid "Industrial tank wagon" +#~ msgstr "Tankwaggon" + +#~ msgid "Industrial wood wagon" +#~ msgstr "Holztransportwaggon" + +#~ msgid "Japanese Train Engine" +#~ msgstr "Japanische Personenzug-Lokomotive" + +#~ msgid "Japanese Train Inter-Wagon Connection" +#~ msgstr "Waggonzwischenverbindung Japanischer Personenzüge" + +#~ msgid "Japanese Train Wagon" +#~ msgstr "Japanischer Personenzug-Passagierwaggon" + +#, fuzzy +#~ msgid "Japanese signal pole" +#~ msgstr "Japanischer Personenzug-Passagierwaggon" + +#~ msgid "Kick out passengers" +#~ msgstr "Fahrgäste zum Ausstieg zwingen" + +#~ msgid "Lampless Signal" +#~ msgstr "Mechanisches Signal" + +#~ msgid "Line" +#~ msgstr "Linie" + +#~ msgid "Lock couples" +#~ msgstr "Kupplungen sperren" + +#~ msgid "No such lua entity." +#~ msgstr "" +#~ "Sie zeigen nicht auf einem Objekt, das mit diesem Werkzeug kopiert werden " +#~ "kann." + +#~ msgid "No such train: @1." +#~ msgstr "Es gibt keinen mit „@1“ identifizierbaren Zug." + +#~ msgid "No such wagon: @1." +#~ msgstr "Es gibt keinen mit „@1“ identifizierbaren Waggon." + +#, fuzzy +#~ msgid "Not allowed to do this." +#~ msgstr "Sie dürfen dieses Gleis nicht konfigurieren." + +#~ msgid "Passenger Wagon" +#~ msgstr "Passagierwaggon" + +#, fuzzy +#~ msgid "Passenger area" +#~ msgstr "Passagierwaggon" + +#~ msgid "Perpendicular Diamond Crossing Track" +#~ msgstr "Kreuzung mit zueinander orthogonalen Gleisen" + +#~ msgid "Point Speed Restriction Track" +#~ msgstr "Geschwindigkeitskontrollgleis" + +#~ msgid "Point speed restriction: @1" +#~ msgstr "Geschwindigkeitskontrolle: @1" + +#~ msgid "Position is occupied by a train." +#~ msgstr "Ein Zug steht an dieser Position." + +#~ msgid "Reverse train" +#~ msgstr "Zug Umkehren" + +#~ msgid "Save wagon properties" +#~ msgstr "Waggon-Einstellungen speichern" + +#~ msgid "Scharfenberg Coupler" +#~ msgstr "Scharfenbergkupplung" + +#~ msgid "Select seat:" +#~ msgstr "Wählen Sie einen Sitzplatz aus:" + +#~ msgid "Show Inventory" +#~ msgstr "Inventar Zeigen" + +#~ msgid "Signal" +#~ msgstr "Lichtsignal" + +#~ msgid "Speed:" +#~ msgstr "Geschw.:" + +#~ msgid "Station Code" +#~ msgstr "Kennzeichen der Haltestelle" + +#~ msgid "Station Name" +#~ msgstr "Name der Haltestelle" + +#~ msgid "Station code \"@1\" already exists and is owned by @2." +#~ msgstr "" +#~ "Die Haltestelle mit dem Kennzeichen „@1“ ist bereits vorhanden und wird " +#~ "von @2 verwaltet." + +#~ msgid "Station/Stop Track" +#~ msgstr "Gleis zur Kennzeichnung einer Haltestelle" + +#~ msgid "Steam Engine" +#~ msgstr "Dampflokomotive" + +#~ msgid "Stop Time" +#~ msgstr "Wartezeit" + +#~ msgid "Subway Passenger Wagon" +#~ msgstr "U-Bahn-Waggon" + +#~ msgid "Target:" +#~ msgstr "Zielges.:" + +#~ msgid "Text displayed inside train" +#~ msgstr "Innere Anzeige" + +#~ msgid "Text displayed outside on train" +#~ msgstr "Äußere Anzeige" + +#, fuzzy +#~ msgid "That wagon does not exist!" +#~ msgstr "In diesem Waggon ist kein Sitzplatz vorhanden." + +#~ msgid "The clipboard couldn't access the metadata. Copy failed." +#~ msgstr "" +#~ "Wegen des fehlgeschlagenen Zugriffs auf die Metadaten konnte der Zug " +#~ "nicht kopiert werden." + +#~ msgid "The clipboard couldn't access the metadata. Paste failed." +#~ msgstr "" +#~ "Wegen des fehlgeschlagenen Zugriffs auf die Metadaten konnte eine Kopie " +#~ "des Zuges nicht eingefügt werden." + +#~ msgid "The clipboard is empty." +#~ msgstr "Das Clipboard ist leer." + +#, fuzzy +#~ msgid "The track you are trying to place the wagon on is not long enough!" +#~ msgstr "Das Gleis, auf dem der Waggon platziert werden woll, ist zu kurz." + +#~ msgid "The track you are trying to place the wagon on is not long enough." +#~ msgstr "Das Gleis, auf dem der Waggon platziert werden woll, ist zu kurz." + +#~ msgid "The wagon's inventory is not empty." +#~ msgstr "Das Inventar dieses Waggons ist nicht leer." + +#~ msgid "There's a Signal Influence Point here." +#~ msgstr "Hier ist ein Signal-Beeinflussungspunkt." + +#~ msgid "There's a Track Circuit Break here." +#~ msgstr "Hier ist eine Gleisabschnittsgrenze (TCB)." + +#, fuzzy +#~ msgid "This Wagon ID" +#~ msgstr "Der Waggon ist voll." + +#, fuzzy +#~ msgid "This node can't be changed using the trackworker!" +#~ msgstr "Dieser Block kann nicht mit dem Gleiswerkzeug bearbeitet werden." + +#, fuzzy +#~ msgid "This node can't be rotated using the trackworker!" +#~ msgstr "Dieser Block kann nicht mit dem Gleiswerkzeug gedreht werden." + +#~ msgid "This position is protected!" +#~ msgstr "Diese Position ist geschützt!" + +#~ msgid "This station is owned by @1. You are not allowed to edit its name." +#~ msgstr "" +#~ "Diese Haltestelle wird von @1 verwaltet. Sie dürfen sie nicht umbenennen." + +#~ msgid "This track can not be changed." +#~ msgstr "Dieses Gleis kann nicht geändert werden." + +#, fuzzy +#~ msgid "This track can not be removed!" +#~ msgstr "Dieses Gleis kann nicht entfernt werden." + +#, fuzzy +#~ msgid "This track can not be rotated!" +#~ msgstr "Dieses Gleis kann nicht gedreht werden." + +#~ msgid "This wagon has no seats." +#~ msgstr "In diesem Waggon ist kein Sitzplatz vorhanden." + +#~ msgid "This wagon is full." +#~ msgstr "Der Waggon ist voll." + +#~ msgid "This wagon is owned by @1, you can't destroy it." +#~ msgstr "Dieser Waggon gehört @1, Sie dürfen ihn nicht abbauen." + +#~ msgid "Track" +#~ msgstr "Gleis" + +#~ msgid "" +#~ "Track Worker Tool\n" +#~ "\n" +#~ "Left-click: change rail type (straight/curve/switch)\n" +#~ "Right-click: rotate object" +#~ msgstr "" +#~ "Gleiswerkzeug\n" +#~ "\n" +#~ "Linksklick: Gleistyp ändern\n" +#~ "Rechtsklick: Objekt drehen" + +#, fuzzy +#~ msgid "Train " +#~ msgstr "Der Zug wurde Kopiert." + +#~ msgid "Train copied." +#~ msgstr "Der Zug wurde Kopiert." + +#~ msgid "" +#~ "Train copy/paste tool\n" +#~ "\n" +#~ "Left-click: copy train\n" +#~ "Right-click: paste train" +#~ msgstr "" +#~ "Werkzeug zur Erstellung von Zugkopien\n" +#~ "\n" +#~ "Linksklick: Zug ins Clipboard kopieren\n" +#~ "Right-click: Kopierten Zug einfügen" + +#~ msgid "Unconfigured ATC controller" +#~ msgstr "Nicht konfiguiertes Zugbeeinflussungsgleis" + +#~ msgid "Unloading Track" +#~ msgstr "Abladungsgleis" + +#~ msgid "Use Sneak+rightclick to bypass closed doors!" +#~ msgstr "" +#~ "Nutzen Sie Schleichen+Rechtsklick, um trotz geschlossener Türen " +#~ "einzusteigen." + +#, fuzzy +#~ msgid "Wagon Properties Tool" +#~ msgstr "Waggon-Einstellungen" + +#~ msgid "" +#~ "Wagon needs to be decoupled from other wagons in order to destroy it." +#~ msgstr "Der Waggon muss abgekoppelt sein, damit Sie ihn abbauen können." + +#~ msgid "Wagon properties" +#~ msgstr "Waggon-Einstellungen" + +#~ msgid "Wallmounted Signal (left)" +#~ msgstr "An der linken Seite montiertes Signal" + +#~ msgid "Wallmounted Signal (right)" +#~ msgstr "An der rechten Seite montiertes Signal" + +#~ msgid "Wallmounted Signal (top)" +#~ msgstr "An der Decke montiertes Signal" + +#~ msgid "" +#~ "Warning: If you destroy this wagon, you only get some steel back! If you " +#~ "are sure, hold Sneak and left-click the wagon." +#~ msgstr "" +#~ "Warnung: Durch den Abbau des Waggons erhalten Sie nur etwas Stahl zurück. " +#~ "Nutzen Sie Schleichen+Linksklick, um dem Waggon abzubauen." + +#~ msgid "Y-turnout" +#~ msgstr "Y-Weiche" + +#~ msgid "You are not allowed to access the driver stand." +#~ msgstr "Sie haben keinen Zugang zum Führerstand." + +#~ msgid "You are not allowed to build near tracks at this protected position." +#~ msgstr "" +#~ "Sie dürfen an geschützten Stellen nicht in der Nähe von Gleisen bauen." + +#~ msgid "" +#~ "You are not allowed to build near tracks without the track_builder " +#~ "privilege." +#~ msgstr "" +#~ "Sie dürfen ohne das „track_builder“-Privileg nicht in der Nähe von " +#~ "Gleisen bauen." + +#~ msgid "You are not allowed to build tracks at this protected position." +#~ msgstr "Sie dürfen an geschützten Stellen kein Gleis bauen." + +#~ msgid "" +#~ "You are not allowed to build tracks without the track_builder privilege." +#~ msgstr "Sie dürfen ohne das „track_builder“-Privileg kein Gleis bauen." + +#~ msgid "" +#~ "You are not allowed to configure this track without the @1 privilege." +#~ msgstr "Sie dürfen ohne das „@1“-Privileg dieses Gleis nicht konfigurieren." + +#~ msgid "You are not allowed to configure this track." +#~ msgstr "Sie dürfen dieses Gleis nicht konfigurieren." + +#~ msgid "" +#~ "You are not allowed to couple trains without the train_operator privilege." +#~ msgstr "Sie dürfen ohne das „train_operator“-Privileg keine Züge ankuppeln." + +#, fuzzy +#~ msgid "You are not allowed to modify this protected track." +#~ msgstr "Sie dürfen an geschützten Stellen kein Gleis bauen." + +#~ msgid "" +#~ "You are not allowed to operate turnouts and signals without the " +#~ "railway_operator privilege." +#~ msgstr "" +#~ "Sie dürfen ohne das „railway_operator“-Privileg keine Bahnanlage " +#~ "operieren." + +#~ msgid "You can't get on this wagon." +#~ msgstr "Sie können nicht in diesen Waggon einsteigen." + +#~ msgid "You do not have the @1 privilege." +#~ msgstr "Ihnen fehlt das „@1“-Privileg." + +#, fuzzy +#~ msgid "You don't have the train_operator privilege." +#~ msgstr "Ihnen fehlt das „@1“-Privileg." + +#~ msgid "" +#~ "You need to own at least one neighboring wagon to destroy this couple." +#~ msgstr "" +#~ "Sie müssen Besitzer eines angrenzenden Waggons sein, um hier abzukuppeln." diff --git a/advtrains_luaautomation/locale/advtrains_luaautomation.fr.po b/advtrains_luaautomation/locale/advtrains_luaautomation.fr.po new file mode 100644 index 0000000..aa83e34 --- /dev/null +++ b/advtrains_luaautomation/locale/advtrains_luaautomation.fr.po @@ -0,0 +1,1023 @@ +msgid "" +msgstr "" +"Project-Id-Version: advtrains\n" +"Report-Msgid-Bugs-To: advtrains-discuss@lists.sr.ht\n" +"POT-Creation-Date: 2026-05-17 09:19+0800\n" +"PO-Revision-Date: 2026-05-17 09:29+0800\n" +"Last-Translator: Tanavit <tanavit@posto.ovh>\n" +"Language-Team: French\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.8\n" + +#: active_common.lua +msgid "Clear Local Environment" +msgstr "Effacer l'environnement LuaATC" + +#: active_common.lua +msgid "Code" +msgstr "Code" + +#: active_common.lua +msgid "Invalid approach callback mode in header: @1" +msgstr "" + +#: active_common.lua +msgid "Invalid attribute headers: @1" +msgstr "" + +#: active_common.lua +msgid "Invalid environment name in header: @1" +msgstr "" + +#: active_common.lua +msgid "LuaATC Environment" +msgstr "Environnement LuaATC" + +#: active_common.lua +msgid "LuaATC component assigned to an invalid environment" +msgstr "Composant LuaATC assigné à un environnement invalide" + +#: active_common.lua +msgid "LuaATC component assigned to environment '@1'" +msgstr "Composant LuaATC assigné à l'environnement '@1'" + +#: active_common.lua +msgid "LuaATC component with error: @1" +msgstr "Erreur @1 du composant LuaATC" + +#: active_common.lua chatcmds.lua +msgid "Save" +msgstr "Sauvegarder" + +#: active_common.lua +msgid "Unconfigured LuaATC component" +msgstr "Composant LuaATC non configuré" + +#: active_common.lua +msgid "" +"You are not allowed to configure this LuaATC component without the @1 " +"privilege." +msgstr "Vous ne pouvez configurer ce composant LuaATC sans le privilege @1." + +#: atc_rail.lua +#, fuzzy +msgid "LuaATC Track" +msgstr "Voie de Chargement" + +#: chatcmds.lua +msgid "Already subscribed!" +msgstr "" + +#: chatcmds.lua +msgid "Clear S" +msgstr "" + +#: chatcmds.lua +msgid "Create an AdvTrains LuaAutomation environment" +msgstr "" + +#: chatcmds.lua +msgid "" +"Created environment '@1'. Use '/env_setup @2' to define global " +"initialization code, or start building LuaATC components!" +msgstr "" + +#: chatcmds.lua +#, fuzzy +msgid "Default environment set to '@1'." +msgstr "Composant LuaATC assigné à l'environnement '@1'" + +#: chatcmds.lua +msgid "Delete Env." +msgstr "" + +#: chatcmds.lua +msgid "Environment already exists!" +msgstr "" + +#: chatcmds.lua +msgid "Environment deleted!" +msgstr "" + +#: chatcmds.lua +msgid "Environment initialization code" +msgstr "" + +#: chatcmds.lua +msgid "Invalid environment name!" +msgstr "" + +#: chatcmds.lua +msgid "Invalid name (only common characters)" +msgstr "" + +#: chatcmds.lua +msgid "" +"List Advtrains LuaATC environments you are subscribed to (no parameters) or " +"subscribers of an environment (giving an env name)." +msgstr "" + +#: chatcmds.lua +msgid "Name required!" +msgstr "" + +#: chatcmds.lua +msgid "No avaliable environemnt! Create one with /env_create." +msgstr "" + +#: chatcmds.lua +msgid "No subscribers!" +msgstr "" + +#: chatcmds.lua +msgid "Not subscribed to any!" +msgstr "" + +#: chatcmds.lua +msgid "Not subscribed!" +msgstr "" + +#: chatcmds.lua +msgid "Run Init Code" +msgstr "" + +#: chatcmds.lua +msgid "" +"SURE TO DELETE ENVIRONMENT @1? Type YES (all uppercase) to continue or just " +"quit form to cancel." +msgstr "" + +#: chatcmds.lua +msgid "Set or get your default LuaATC environment." +msgstr "" + +#: chatcmds.lua +msgid "Set up and modify AdvTrains LuaAutomation environment" +msgstr "" + +#: chatcmds.lua +msgid "Subscribe to the log of an Advtrains LuaATC environment" +msgstr "" + +#: chatcmds.lua +#, fuzzy +msgid "Subscribed to environment '@1'." +msgstr "Composant LuaATC assigné à l'environnement '@1'" + +#: chatcmds.lua +msgid "Successfully unsubscribed!" +msgstr "" + +#: chatcmds.lua +msgid "Unubscribe to the log of an Advtrains LuaATC environment" +msgstr "" + +#: chatcmds.lua +msgid "You're not online!" +msgstr "" + +#: chatcmds.lua +#, fuzzy +msgid "Your default environment is '@1'." +msgstr "Composant LuaATC assigné à l'environnement '@1'" + +#: environment.lua +#, fuzzy +msgid "LuaATC component" +msgstr "Composant LuaATC non configuré" + +#: init.lua +msgid "" +"Can place and configure LuaATC components, including execute potentially " +"harmful Lua code" +msgstr "" +"Permet le placement et la configuration de composants LuaATC avec risque " +"d'exécution de code Lua dangereux" + +#: mesecon_controller.lua +msgid "LuaATC Mesecon Controller" +msgstr "Commande Mesecon de LuaATC" + +#: operation_panel.lua +msgid "LuaATC Operation Panel" +msgstr "Panneau de commande de LuaATC" + +#: pcnaming.lua +msgid "Passive Component Naming Tool" +msgstr "Outil de nommage de composant passif" + +#: pcnaming.lua +msgid "Right-click to name a passive component." +msgstr "Clic-Droit pour nommer un composant passif." + +#: pcnaming.lua +msgid "Set name of component (empty to clear)" +msgstr "Nommer le composant (chaîne vide pour effacer)" + +#: pcnaming.lua +msgid "" +"You are not allowed to name LuaATC passive components without the @1 " +"privilege." +msgstr "Vous ne pouvez nommer un composant LuaATC passif sans le privilege @1." + +#~ msgid " does not exist or is invalid" +#~ msgstr " n'existe pas ou est invalide" + +#~ msgid " is at " +#~ msgstr " est à la position " + +#~ msgid " units" +#~ msgstr " Unités" + +#~ msgid " wagon:destroy(): data is not set!" +#~ msgstr " Appel de wagon:destroy() : données non définies !" + +#~ msgid "!!! Train off track !!!" +#~ msgstr "!!! Train hors voie !!!" + +#~ msgid "(Doors closed)" +#~ msgstr "(Portes closes)" + +#~ msgid "(log" +#~ msgstr "(log" + +#~ msgid ", using placeholder" +#~ msgstr ", dans un espace réservé" + +#~ msgid "3-way turnout" +#~ msgstr "Embranchement triple" + +#~ msgid "90+Angle Diamond Crossing Track" +#~ msgstr "Croisement perpendiculo-diagonal" + +#~ msgid "<No coupler>" +#~ msgstr "<Pas de coupleur>" + +#~ msgid "@1 Platform (45 degree)" +#~ msgstr "Quai @1 (haut, 45°)" + +#~ msgid "@1 Platform (high)" +#~ msgstr "Quai @1 (haut)" + +#~ msgid "@1 Platform (low)" +#~ msgstr "Quai @1 (bas)" + +#~ msgid "@1 Platform (low, 45 degree)" +#~ msgstr "Quai @1 (bas, 45°)" + +#~ msgid "@1 Slope" +#~ msgstr "Pente @1" + +#~ msgid "ATC Kick command warning: doors are closed." +#~ msgstr "Avertissement commande ATC Éjecter : portes closes." + +#~ msgid "ATC Kick command warning: train moving." +#~ msgstr "Avertissement commande ATC Éjecter : train en mouvement." + +#~ msgid "ATC Reverse command warning: didn't reverse train, train moving." +#~ msgstr "" +#~ "Attention : Commande ATC de renversement impossible car le train se " +#~ "déplace." + +#~ msgid "ATC command parse error: Unknown command: @1" +#~ msgstr "Erreur d'analyse de commande ATC : Commande inconnue : @1" + +#~ msgid "ATC command syntax error: I statement not closed: @1" +#~ msgstr "" +#~ "Erreur de syntaxe de commande ATC : instruction \"I\" incomplète : @1" + +#~ msgid "ATC controller" +#~ msgstr "Controlleur ATC" + +#~ msgid "" +#~ "ATC controller, mode @1\n" +#~ "Channel: @2" +#~ msgstr "" +#~ "Controlleur ATC, mode @1\n" +#~ "Canal : @2" + +#~ msgid "" +#~ "ATC controller, mode @1\n" +#~ "Command: @2" +#~ msgstr "" +#~ "Controlleur ATC, mode @1\n" +#~ "Commande : @2" + +#~ msgid "Access to @1" +#~ msgstr "Accès à @1" + +#~ msgid "Advtrains Status: no_action" +#~ msgstr "État d'advtrains : aucune action" + +#~ msgid "Advtrains is already running normally!" +#~ msgstr "Advtrains fonctionne déjà correctement !" + +#~ msgid "Allow these players to access your wagon:" +#~ msgstr "Autoriser ces joueurs à embarquer :" + +#~ msgid "Andrew's Cross" +#~ msgstr "Croix de Saint André" + +#~ msgid "Back of train would end up off track, cancelling." +#~ msgstr "La fin du train serait hors voie : annulation." + +#~ msgid "Big Industrial Train Engine" +#~ msgstr "Grosse locomotive industrielle" + +#~ msgid "Boiler" +#~ msgstr "Chaudière à vapeur" + +#~ msgid "Box Wagon" +#~ msgstr "Wagon de frêt" + +#~ msgid "Buffer and Chain Coupler" +#~ msgstr "Attelage à tampon et vis" + +#~ msgid "Bumper" +#~ msgstr "Heurtoir" + +#~ msgid "Can not couple: The couplers of the trains do not match (@1 and @2)." +#~ msgstr "" +#~ "Accouplement impossible: les attelages des trains ne concordent pas (@1 " +#~ "et @2)." + +#~ msgid "Can operate turnouts and signals in unprotected areas" +#~ msgstr "" +#~ "Possibilité d'opérer des embranchements et signaux dans les zones non " +#~ "protégées" + +#~ msgid "Can place and dig tracks in unprotected areas" +#~ msgstr "" +#~ "Possibilité de poser ou retirer des voies dans les zones non protégées" + +#~ msgid "" +#~ "Can place, remove and operate any train, regardless of owner, whitelist, " +#~ "or protection" +#~ msgstr "" +#~ "Possibilité de poser, retirer ou opérer un quelconque train, " +#~ "indépendamment du propriétaire, de la liste blanche ou de protection" + +#~ msgid "Can place, remove and operate trains" +#~ msgstr "Possibilité de poser, retirer ou opérer les trains" + +#~ msgid "Can't get on: wagon full or doors closed!" +#~ msgstr "" +#~ "Embarquement impossible : le wagon est plein ou ses portes sont closes !" + +#~ msgid "Can't place: Not enough slope items left (@1 required)" +#~ msgstr "" +#~ "Placement impossible : quantité insuffisante de voie pentue (@1 manquant)" + +#~ msgid "Can't place: There's no slope of length @1" +#~ msgstr "Placement impossible : il n'y a pas de voie pentue de longueur @1" + +#~ msgid "Can't place: no supporting node at upper end." +#~ msgstr "" +#~ "Placement impossible : pas de nœud d'appui à l'extrémité supérieure." + +#~ msgid "Can't place: not pointing at node" +#~ msgstr "Placement impossible : ne pointe pas un nœud" + +#~ msgid "Can't place: protected position!" +#~ msgstr "Placement impossible : emplacement protégé" + +#~ msgid "Can't place: space occupied!" +#~ msgstr "Placement impossible : espace occupé !" + +#~ msgid "Caution" +#~ msgstr "Attention" + +#~ msgid "Chimney" +#~ msgstr "Cheminée" + +#~ msgid "Clear 'Disable ARS' flag" +#~ msgstr "Effacer le drapeau \"Désactiver l'ARS\"" + +#~ msgid "Clear (proceed)" +#~ msgstr "Autorisation (procédez)" + +#~ msgid "Closed" +#~ msgstr "Fermé" + +#~ msgid "Command" +#~ msgstr "Commande" + +#~ msgid "Command (on)" +#~ msgstr "Commande (marche)" + +#~ msgid "" +#~ "Crash during advtrains main step - skipping the shutdown save operation " +#~ "to not save inconsistent data!" +#~ msgstr "" +#~ "Crash durant le pas principal d'advtrains - saut de l'opération de " +#~ "sauvegarde de terminaison pour éviter l'enregistrement de données " +#~ "corrompues !" + +#~ msgid "Current FC: " +#~ msgstr "Code de fret courant: " + +#~ msgid "Danger (halt)" +#~ msgstr "Danger (stop)" + +#~ msgid "" +#~ "Data is being saved. While saving, advtrains will remove the players from " +#~ "trains. Save files will be reloaded afterwards!" +#~ msgstr "" +#~ "Données en cours de sauvegarde. Durant cette phase, advtrains débarquera " +#~ "les joueurs des trains. Les fichiers de sauvegarde seront ultérieurement " +#~ "rechargés !" + +#~ msgid "Default Seat" +#~ msgstr "Siège par défaut" + +#~ msgid "Default Seat (driver stand)" +#~ msgstr "Siège par défaut (poste de pilotage)" + +# Routage est il le bon terme ? +#~ msgid "Delete all train routes, force them to recalculate" +#~ msgstr "Suppression et recalcul de tous les routages" + +#~ msgid "Dep. Speed" +#~ msgstr "Vit. de départ" + +#~ msgid "Deprecated Track" +#~ msgstr "Voie déconseillée" + +#~ msgid "" +#~ "Destroying wagon with inventory, but inventory is not found? Shouldn't " +#~ "happen!" +#~ msgstr "Desctruction d'un wagon avec inventaire introuvable ? Anomalie !" + +#~ msgid "" +#~ "Detach all players, especially the offline ones, from all trains. Use " +#~ "only when no one serious is on a train." +#~ msgstr "" +#~ "Débarque tous les joueurs, en particulier ceux déconnectés, de tous les " +#~ "trains. À n'utiliser que quand aucun joueur sérieux n'a embarqué." + +#~ msgid "Detailed Steam Engine" +#~ msgstr "Locomotive à vapeur complexe" + +#~ msgid "Detector Rail" +#~ msgstr "Voie détectrice" + +#~ msgid "Diagonal Diamond Crossing Track" +#~ msgstr "Croisement diagonal" + +#~ msgid "Digiline channel" +#~ msgstr "Canal Digiline" + +#~ msgid "Disable the advtrains globalstep temporarily" +#~ msgstr "Désactive temporairement le pas global d'advtrains" + +#~ msgid "Disabled advtrains successfully" +#~ msgstr "Succès de la désactivation d'advtrains" + +#~ msgid "Door Delay" +#~ msgstr "Durée d'ouverture des portes" + +#~ msgid "Door Side" +#~ msgstr "Ouv. des portes coté" + +#~ msgid "Doors are closed! (Try holding sneak key!)" +#~ msgstr "Portes closes : (Essayez la \"sneak key\"!\")" + +#~ msgid "" +#~ "Doors are closed. Use Sneak+rightclick to ignore the closed doors and get " +#~ "off." +#~ msgstr "" +#~ "Portes closes ! Utilisez \"Marcher lentement (Sneak)\" et Clic-Droit pour " +#~ "franchir les portes et débarquer." + +#~ msgid "Driver Stand" +#~ msgstr "Poste de pilotage" + +#~ msgid "Driver Stand (left)" +#~ msgstr "Poste de pilotage (gauche)" + +#~ msgid "Driver Stand (right)" +#~ msgstr "Poste de pilotage (droit)" + +#~ msgid "Driver stand" +#~ msgstr "Poste de pilotage" + +#~ msgid "Driver's cab" +#~ msgstr "Cabine de pilotage" + +#~ msgid "Freight Code:" +#~ msgstr "Code de frêt :" + +#~ msgid "Get off" +#~ msgstr "Débarquer" + +#~ msgid "Get off (forced)" +#~ msgstr "Débarquer (de force)" + +#~ msgid "Industrial Train Engine" +#~ msgstr "Locomotive industrielle" + +#~ msgid "Industrial tank wagon" +#~ msgstr "Wagon-citerne industriel" + +#~ msgid "Industrial wood wagon" +#~ msgstr "Wagon grumier industriel" + +#~ msgid "Instructed to save() but load() was never called!" +#~ msgstr "Appel de save() requis sans appel préalable de load() !" + +#~ msgid "Insufficient privileges to use this!" +#~ msgstr "Privilèges insuffisants pour utiliser ceci !" + +#~ msgid "Japanese Train Engine" +#~ msgstr "Motrice Japonaise" + +#~ msgid "Japanese Train Inter-Wagon Connection" +#~ msgstr "Passage inter-voiture de train Japonais" + +#~ msgid "Japanese Train Wagon" +#~ msgstr "Voiture Japonaise" + +#~ msgid "Japanese signal pole" +#~ msgstr "Voiture Japonaise" + +#~ msgid "Kick out passengers" +#~ msgstr "Éjecter les passagers" + +#~ msgid "Lampless Signal" +#~ msgstr "Sémaphore" + +#~ msgid "Left" +#~ msgstr "Gauche" + +#~ msgid "Left,Right,Closed;" +#~ msgstr "Gauche,Droit,Fermé;" + +#~ msgid "Line" +#~ msgstr "Ligne" + +#~ msgid "Liquid: " +#~ msgstr "Liquide : " + +#~ msgid "Liquid: empty" +#~ msgstr "Liquide : vide" + +#~ msgid "Lock couples" +#~ msgstr "Verrouiller l'accouplement" + +#~ msgid "Missing train_operator privilege" +#~ msgstr "Privilège \"train_operator\" manquant" + +#~ msgid "Munich U-Bahn Distant Signal (" +#~ msgstr "Signal distant métro de Munich (" + +#~ msgid "Munich U-Bahn Main Signal (" +#~ msgstr "Signal principal métro de Munich (" + +#~ msgid "Next FC:" +#~ msgstr "Code de fret suivant :" + +#~ msgid "Next Stop:\n" +#~ msgstr "Prochain arrêt :\n" + +#~ msgid "No callback to handle schedule" +#~ msgstr "Absence de fonction de gestion de planning" + +#~ msgid "No such lua entity." +#~ msgstr "Pas de telle entité lua." + +#~ msgid "No such train: @1." +#~ msgstr "Pas de tel train : @1." + +#~ msgid "No such wagon: @1." +#~ msgstr "Pas de tel wagon : @1." + +#~ msgid "Not a valid wagon id." +#~ msgstr "Identificateur de wagon invalide." + +#~ msgid "Not allowed to do this." +#~ msgstr "Vous n'êtes pas autorisé effectuer ceci." + +#~ msgid "" +#~ "OVERRUN RED SIGNAL! Examine situation and reverse train to move again." +#~ msgstr "" +#~ "Franchissement de signal rouge : examinez la situation et inversez le " +#~ "sens de marche du train." + +#~ msgid "Onboard Computer" +#~ msgstr "Ordinateur embarqué" + +#~ msgid "Passenger Wagon" +#~ msgstr "Voiture passager" + +#~ msgid "Passenger area" +#~ msgstr "Voiture Passager" + +#~ msgid "Perpendicular Diamond Crossing Track" +#~ msgstr "Croisement perpendiculaire" + +#~ msgid "Please specify a player name to transfer ownership to." +#~ msgstr "" +#~ "Spécifiez le nom du joueur à qui la propriété doit être transférée, SVP." + +#~ msgid "Point Speed Restriction Track" +#~ msgstr "Voie de point de limitation de vitesse" + +#~ msgid "Point speed restriction: @1" +#~ msgstr "Point de limitation de vitesse : @1" + +#~ msgid "Position is occupied by a train." +#~ msgstr "Cet emplacement est occupé par un train." + +#~ msgid "Prev FC" +#~ msgstr "Code de fret précédent" + +#~ msgid "Print advtrains status info" +#~ msgstr "Affiche les informations d'état d'advtrains" + +#~ msgid "Re-enabling advtrains globalstep..." +#~ msgstr "Réacivation du pas global d'advtrains..." + +#~ msgid "Reduced speed" +#~ msgstr "Vitesse réduite" + +#~ msgid "Reload successful!" +#~ msgstr "Succès du rechargement !" + +#~ msgid "Remote Routesetting" +#~ msgstr "Routage à distance" + +#~ msgid "Removing unused wagon" +#~ msgstr "Suppression d'un wagon inutilisé" + +#~ msgid "Restoring saved state in 1 second..." +#~ msgstr "Restauration du l'état sauvegardé dans une seconde..." + +#~ msgid "Restricted speed" +#~ msgstr "Vitesse limitée" + +#~ msgid "Returns the position of the train with the given id" +#~ msgstr "Affiche la position du train identifié" + +#~ msgid "Reverse train" +#~ msgstr "Inversion du sens de marche" + +#~ msgid "Right" +#~ msgstr "Droit" + +#~ msgid "Route state changed." +#~ msgstr "Changement d'état de l'itinéraire." + +#~ msgid "Routingcode" +#~ msgstr "Code de routage" + +#~ msgid "Save wagon properties" +#~ msgstr "Sauvegarder les propriétés du wagon" + +#~ msgid "Saving failed: " +#~ msgstr "Échec de sauvegarde : " + +#~ msgid "Scharfenberg Coupler" +#~ msgstr "Attelage Scharfenberg" + +#~ msgid "Select seat:" +#~ msgstr "Choisir le siège :" + +#~ msgid "Set point speed restriction:" +#~ msgstr "Placez un point de limitation de vitesse :" + +#~ msgid "Show Inventory" +#~ msgstr "Montrer le stock" + +#~ msgid "Signal" +#~ msgstr "Signal" + +#~ msgid "Speed:" +#~ msgstr "Vitesse : " + +#~ msgid "Station Code" +#~ msgstr "Code de Station" + +#~ msgid "Station Name" +#~ msgstr "Nom de Station" + +#~ msgid "Station code \"@1\" already exists and is owned by @2." +#~ msgstr "Le code de station \"@1\" existe et est possédé par @2." + +#~ msgid "Station/Stop Track" +#~ msgstr "Voie d'arrêt en station" + +#~ msgid "Steam Engine" +#~ msgstr "Locomotive à vapeur" + +#~ msgid "Stop Time" +#~ msgstr "Durée d'arrêt" + +#~ msgid "Subway Passenger Wagon" +#~ msgstr "Voiture de Métropolitain" + +# Routage est il le bon terme ? +#~ msgid "Successfully invalidated train routes" +#~ msgstr "Succès d'invalidation des routages des trains" + +#~ msgid "Target:" +#~ msgstr "Destination : " + +#~ msgid "Teleporting to train " +#~ msgstr "Téléportation au train " + +#~ msgid "Teleports you to the position of the train with the given id" +#~ msgstr "Vous téléporte à la position du train identifié" + +#~ msgid "Text displayed inside train" +#~ msgstr "Texte affiché à l'intérieur du train" + +#~ msgid "Text displayed outside on train" +#~ msgstr "Texte affiché à l'extérieur du train" + +#~ msgid "That player does not exist!" +#~ msgstr "Ce joueur n'existe pas !" + +#~ msgid "That wagon does not exist!" +#~ msgstr "Ce wagon n'a pas de siège !" + +#~ msgid "" +#~ "The advtrains globalstep has been disabled. Trains are not moving, and no " +#~ "data is saved! Run '/at_disable_step no' to enable again!" +#~ msgstr "" +#~ "Le pas global d'advtrains est désactivé. Les trains sont immobiles et " +#~ "aucune donnée n'est sauvegardée. Exécutez '/at_disable_step no ' pour le " +#~ "réactiver !" + +#~ msgid "The clipboard couldn't access the metadata. Copy failed." +#~ msgstr "" +#~ "Le presse-papier ne peut accéder aux métadonnées. Échec de la copie." + +#~ msgid "The clipboard couldn't access the metadata. Paste failed." +#~ msgstr "Le presse-papier ne peut accéder aux métadonnées. Échec du collage." + +#~ msgid "The clipboard is empty." +#~ msgstr "Le presse-papier est vide." + +#~ msgid "The track you are trying to place the wagon on is not long enough!" +#~ msgstr "" +#~ "La voie sur laquelle vous tentez de placer le wagon est trop courte !" + +#~ msgid "The track you are trying to place the wagon on is not long enough." +#~ msgstr "" +#~ "La voie sur laquelle vous tentez de placer le wagon est trop courte." + +#~ msgid "The wagon's inventory is not empty." +#~ msgstr "Le stock de ce wagon n'est pas vide." + +#~ msgid "There's a Signal Influence Point here." +#~ msgstr "Il y a un \"Signal Influence Point\" ici." + +#~ msgid "There's a Track Circuit Break here." +#~ msgstr "Il y a un \"Track Circuit Break\" ici." + +#~ msgid "This Wagon ID" +#~ msgstr "Identificateur du wagon" + +#~ msgid "This node can't be changed using the trackworker!" +#~ msgstr "Ce nœud ne peut être modifié avec l'outil \"Trackworker\" !" + +#~ msgid "This node can't be rotated using the trackworker!" +#~ msgstr "Ce nœud ne peut être tourné avec l'outil \"Trackworker\" !" + +#, fuzzy +#~ msgid "This node can't be rotated using the trackworker," +#~ msgstr "Ce nœud ne peut être tourné avec l'outil \"Trackworker\" !" + +#~ msgid "This position is protected!" +#~ msgstr "Cet emplacement est protégé !" + +#~ msgid "This station is owned by @1. You are not allowed to edit its name." +#~ msgstr "" +#~ "Cette station est la propriété de @1. Vous n'êtes pas autorisé à modifier " +#~ "son nom." + +#~ msgid "This track can not be changed." +#~ msgstr "Cette voie ne peut pas être modifiée." + +#~ msgid "This track can not be removed!" +#~ msgstr "Cette voie ne peut pas être enlevée !" + +#~ msgid "This track can not be rotated!" +#~ msgstr "Cette voie ne peut pas être tournée !" + +#~ msgid "This wagon has no seats." +#~ msgstr "Ce wagon n'a pas de siège." + +#~ msgid "This wagon is full." +#~ msgstr "Ce wagon est plein." + +#~ msgid "This wagon is owned by @1, you can't destroy it." +#~ msgstr "Ce wagon est la propriété de @1, vous ne pouvez pas le détruire." + +#~ msgid "Track" +#~ msgstr "Voie" + +#~ msgid "" +#~ "Track Worker Tool\n" +#~ "\n" +#~ "Left-click: change rail type (straight/curve/switch)\n" +#~ "Right-click: rotate object" +#~ msgstr "" +#~ "Outil \"Trackworker\"\n" +#~ "\n" +#~ "Clic-Gauche : change le type de rail (droit/courbé/aiguillage)\n" +#~ "\n" +#~ "Clic-Droit : tourne l'objet" + +#~ msgid "Train" +#~ msgstr "Identificateur du train" + +#~ msgid "Train " +#~ msgstr "Identificateur du train " + +#~ msgid "Train ID" +#~ msgstr "Identificateur du train" + +#~ msgid "Train copied." +#~ msgstr "Train copié." + +#~ msgid "" +#~ "Train copy/paste tool\n" +#~ "\n" +#~ "Left-click: copy train\n" +#~ "Right-click: paste train" +#~ msgstr "" +#~ "Outil de copie/collage de train\n" +#~ "\n" +#~ "Clic-Gauche : copie\n" +#~ "\n" +#~ "Clic-Droit : collage" + +#~ msgid "" +#~ "Train overview / coupling control is only shown when the train stands." +#~ msgstr "" +#~ "Aperçu du train / commande d'accouplement montré uniquement à l'arrêt du " +#~ "train." + +#~ msgid "Train overview /coupling control:" +#~ msgstr "Aperçu du train / commande d'accouplement :" + +#~ msgid "Trains stopping here (ARS rules)" +#~ msgstr "Trains marquant l'arrêt (règles ARS)" + +#~ msgid "Unable to load wagon type" +#~ msgstr "Impossible de charger le type du wagon" + +#~ msgid "Unconfigured ATC controller" +#~ msgstr "Controlleur ATC, non-configuré" + +#~ msgid "Uninitialized init=" +#~ msgstr "Variable init non initialisée" + +#~ msgid "Uninitialized, removing" +#~ msgstr "Non initialisé, retiré" + +#~ msgid "Unknown Station" +#~ msgstr "Gare inconnue" + +#~ msgid "Unloading Track" +#~ msgstr "Voie de Déchargement" + +#~ msgid "Use Sneak+rightclick to bypass closed doors!" +#~ msgstr "" +#~ "Utilisez \"Marcher lentement (Sneak)\" et Clic-Droit pour franchir les " +#~ "portes closes !" + +#~ msgid "Wagon @1 ownership changed from @2 to @3" +#~ msgstr "La propriété du wagon @1 a été transférée de @2 à @3" + +#~ msgid "Wagon Properties Tool" +#~ msgstr "Outil de propriété du wagon" + +#~ msgid "" +#~ "Wagon Properties Tool\n" +#~ "Punch a wagon to view and edit the Wagon Properties" +#~ msgstr "" +#~ "Outil de propriété du wagon\n" +#~ "Frappez un wagon pour voir et modifier ses propriétés" + +#~ msgid "" +#~ "Wagon needs to be decoupled from other wagons in order to destroy it." +#~ msgstr "" +#~ "Les wagons doivent être désaccouplés des autres pour pouvoir être " +#~ "détruits." + +#~ msgid "Wagon properties" +#~ msgstr "Propriétés du wagon" + +#~ msgid "Wagon road number:" +#~ msgstr "Immatriculation du wagon :" + +#~ msgid "Wait for signal to clear" +#~ msgstr "En attente de signal d'autorisation" + +#~ msgid "Wallmounted Signal (left)" +#~ msgstr "Signal mural (gauche)" + +#~ msgid "Wallmounted Signal (right)" +#~ msgstr "Signal mural (droit)" + +#~ msgid "Wallmounted Signal (top)" +#~ msgstr "Signal mural (plafond)" + +#~ msgid "" +#~ "Warning: If you destroy this wagon, you only get some steel back! If you " +#~ "are sure, hold Sneak and left-click the wagon." +#~ msgstr "" +#~ "Attention: Si vous détruisez ce wagon, vous ne récupérerez que de la " +#~ "ferraille ! Si vous êtes sûr de vous, appuyez la touche \"Marcher " +#~ "lentement (Sneak)\" et Clic-Gauche." + +#~ msgid "Wheel" +#~ msgstr "Roue" + +#~ msgid "Y-turnout" +#~ msgstr "Embranchement en Y" + +#~ msgid "You are not allowed to access the driver stand." +#~ msgstr "Accès interdit au poste de pilotage." + +#~ msgid "You are not allowed to build near tracks at this protected position." +#~ msgstr "" +#~ "Vous ne pouvez pas construire à proximité d'une voie à cet emplacement " +#~ "protégé." + +#~ msgid "" +#~ "You are not allowed to build near tracks without the track_builder " +#~ "privilege." +#~ msgstr "" +#~ "Vous ne pouvez pas construire à proximité d'une voie sans le privilège " +#~ "\"track_builder\" (?)" + +#~ msgid "You are not allowed to build tracks at this protected position." +#~ msgstr "Vous ne pouvez pas construire une voie à cet emplacement protégé." + +#~ msgid "" +#~ "You are not allowed to build tracks without the track_builder privilege." +#~ msgstr "" +#~ "Vous ne pouvez pas construire une voie sans le privilège " +#~ "\"track_builder\"." + +#~ msgid "" +#~ "You are not allowed to configure this track without the @1 privilege." +#~ msgstr "" +#~ "Vous n'êtes pas autorisé à configurer cette voie sans le privilège @1." + +#~ msgid "You are not allowed to configure this track." +#~ msgstr "Vous n'êtes pas autorisé à configurer cette voie." + +#~ msgid "" +#~ "You are not allowed to couple trains without the train_operator privilege." +#~ msgstr "" +#~ "Vous n'êtes pas autorisé à coupler des trains sans le privilège " +#~ "\"train_operator\"." + +#, fuzzy +#~ msgid "You are not allowed to modify this protected track." +#~ msgstr "Vous ne pouvez pas construire une voie à cet emplacement protégé" + +#~ msgid "" +#~ "You are not allowed to operate turnouts and signals without the " +#~ "railway_operator privilege." +#~ msgstr "" +#~ "Vous ne pouvez pas actionner les aiguillages ou les signaux (privilège " +#~ "\"railway_operator\" manquant)" + +#~ msgid "You can't get on this wagon." +#~ msgstr "Montée impossible dans ce wagon." + +#~ msgid "You do not have the @1 privilege." +#~ msgstr "Vous ne possédez pas le privilège \"@1\"." + +#~ msgid "You don't have the train_operator privilege." +#~ msgstr "Vous ne possédez pas le privilège \"train_operator\"." + +#~ msgid "You have been given ownership of wagon @1" +#~ msgstr "La propriété du wagon @1 vous a été transférée" + +#~ msgid "" +#~ "You need to own at least one neighboring wagon to destroy this couple." +#~ msgstr "" +#~ "Vous devez être propriétaire d'au moins un wagon voisin pour supprimer " +#~ "cet attelage." + +#~ msgid "from wagon_save table." +#~ msgstr "de la table wagon_save." + +#~ msgid "" +#~ "had no wagons left because of some bug. It is being deleted. Wave it " +#~ "goodbye!" +#~ msgstr "" +#~ "n'a plus de wagon à cause d'un bug quelconque. Il est détruit. Faites lui " +#~ "coucou !" + +#~ msgid "slowdown" +#~ msgstr "ralentissement" diff --git a/advtrains_luaautomation/locale/advtrains_luaautomation.pot b/advtrains_luaautomation/locale/advtrains_luaautomation.pot new file mode 100644 index 0000000..b9dcc71 --- /dev/null +++ b/advtrains_luaautomation/locale/advtrains_luaautomation.pot @@ -0,0 +1,222 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the advtrains_luaautomation package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: advtrains_luaautomation\n" +"Report-Msgid-Bugs-To: advtrains-discuss@lists.sr.ht\n" +"POT-Creation-Date: 2026-05-17 09:19+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: active_common.lua +msgid "Unconfigured LuaATC component" +msgstr "" + +#: active_common.lua +msgid "LuaATC Environment" +msgstr "" + +#: active_common.lua chatcmds.lua +msgid "Save" +msgstr "" + +#: active_common.lua +msgid "Clear Local Environment" +msgstr "" + +#: active_common.lua +msgid "Code" +msgstr "" + +#: active_common.lua +msgid "" +"You are not allowed to configure this LuaATC component without the @1 " +"privilege." +msgstr "" + +#: active_common.lua +msgid "Invalid environment name in header: @1" +msgstr "" + +#: active_common.lua +msgid "Invalid approach callback mode in header: @1" +msgstr "" + +#: active_common.lua +msgid "Invalid attribute headers: @1" +msgstr "" + +#: active_common.lua +msgid "LuaATC component assigned to environment '@1'" +msgstr "" + +#: active_common.lua +msgid "LuaATC component assigned to an invalid environment" +msgstr "" + +#: active_common.lua +msgid "LuaATC component with error: @1" +msgstr "" + +#: atc_rail.lua +msgid "LuaATC Track" +msgstr "" + +#: chatcmds.lua +msgid "Run Init Code" +msgstr "" + +#: chatcmds.lua +msgid "Clear S" +msgstr "" + +#: chatcmds.lua +msgid "Delete Env." +msgstr "" + +#: chatcmds.lua +msgid "Environment initialization code" +msgstr "" + +#: chatcmds.lua +msgid "Set up and modify AdvTrains LuaAutomation environment" +msgstr "" + +#: chatcmds.lua +msgid "Invalid environment name!" +msgstr "" + +#: chatcmds.lua +msgid "Create an AdvTrains LuaAutomation environment" +msgstr "" + +#: chatcmds.lua +msgid "Name required!" +msgstr "" + +#: chatcmds.lua +msgid "Invalid name (only common characters)" +msgstr "" + +#: chatcmds.lua +msgid "Environment already exists!" +msgstr "" + +#: chatcmds.lua +msgid "" +"Created environment '@1'. Use '/env_setup @2' to define global " +"initialization code, or start building LuaATC components!" +msgstr "" + +#: chatcmds.lua +msgid "Subscribe to the log of an Advtrains LuaATC environment" +msgstr "" + +#: chatcmds.lua +msgid "Already subscribed!" +msgstr "" + +#: chatcmds.lua +msgid "Subscribed to environment '@1'." +msgstr "" + +#: chatcmds.lua +msgid "Unubscribe to the log of an Advtrains LuaATC environment" +msgstr "" + +#: chatcmds.lua +msgid "Successfully unsubscribed!" +msgstr "" + +#: chatcmds.lua +msgid "Not subscribed!" +msgstr "" + +#: chatcmds.lua +msgid "" +"List Advtrains LuaATC environments you are subscribed to (no parameters) or " +"subscribers of an environment (giving an env name)." +msgstr "" + +#: chatcmds.lua +msgid "Not subscribed to any!" +msgstr "" + +#: chatcmds.lua +msgid "No subscribers!" +msgstr "" + +#: chatcmds.lua +msgid "Set or get your default LuaATC environment." +msgstr "" + +#: chatcmds.lua +msgid "You're not online!" +msgstr "" + +#: chatcmds.lua +msgid "Your default environment is '@1'." +msgstr "" + +#: chatcmds.lua +msgid "No avaliable environemnt! Create one with /env_create." +msgstr "" + +#: chatcmds.lua +msgid "Default environment set to '@1'." +msgstr "" + +#: chatcmds.lua +msgid "Environment deleted!" +msgstr "" + +#: chatcmds.lua +msgid "" +"SURE TO DELETE ENVIRONMENT @1? Type YES (all uppercase) to continue or just " +"quit form to cancel." +msgstr "" + +#: environment.lua +msgid "LuaATC component" +msgstr "" + +#: init.lua +msgid "" +"Can place and configure LuaATC components, including execute potentially " +"harmful Lua code" +msgstr "" + +#: mesecon_controller.lua +msgid "LuaATC Mesecon Controller" +msgstr "" + +#: operation_panel.lua +msgid "LuaATC Operation Panel" +msgstr "" + +#: pcnaming.lua +msgid "Passive Component Naming Tool" +msgstr "" + +#: pcnaming.lua +msgid "Right-click to name a passive component." +msgstr "" + +#: pcnaming.lua +msgid "" +"You are not allowed to name LuaATC passive components without the @1 " +"privilege." +msgstr "" + +#: pcnaming.lua +msgid "Set name of component (empty to clear)" +msgstr "" diff --git a/advtrains_luaautomation/locale/advtrains_luaautomation.zh_CN.po b/advtrains_luaautomation/locale/advtrains_luaautomation.zh_CN.po new file mode 100644 index 0000000..ad38174 --- /dev/null +++ b/advtrains_luaautomation/locale/advtrains_luaautomation.zh_CN.po @@ -0,0 +1,679 @@ +msgid "" +msgstr "" +"Project-Id-Version: advtrains\n" +"Report-Msgid-Bugs-To: advtrains-discuss@lists.sr.ht\n" +"POT-Creation-Date: 2026-05-17 09:19+0800\n" +"PO-Revision-Date: 2026-05-17 09:29+0800\n" +"Last-Translator: Y. Wang <yw05@forksworld.de>\n" +"Language-Team: Chinese (Simplified)\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.8\n" + +#: active_common.lua +msgid "Clear Local Environment" +msgstr "" + +#: active_common.lua +msgid "Code" +msgstr "" + +#: active_common.lua +msgid "Invalid approach callback mode in header: @1" +msgstr "" + +#: active_common.lua +msgid "Invalid attribute headers: @1" +msgstr "" + +#: active_common.lua +msgid "Invalid environment name in header: @1" +msgstr "" + +#: active_common.lua +msgid "LuaATC Environment" +msgstr "" + +#: active_common.lua +msgid "LuaATC component assigned to an invalid environment" +msgstr "" + +#: active_common.lua +msgid "LuaATC component assigned to environment '@1'" +msgstr "" + +#: active_common.lua +msgid "LuaATC component with error: @1" +msgstr "" + +#: active_common.lua chatcmds.lua +msgid "Save" +msgstr "保存" + +#: active_common.lua +msgid "Unconfigured LuaATC component" +msgstr "LuaATC 部件 (未配置)" + +#: active_common.lua +msgid "" +"You are not allowed to configure this LuaATC component without the @1 " +"privilege." +msgstr "您没有“@1”权限,不能配置这个 LuaATC 部件。" + +#: atc_rail.lua +#, fuzzy +msgid "LuaATC Track" +msgstr "装货轨道" + +#: chatcmds.lua +msgid "Already subscribed!" +msgstr "" + +#: chatcmds.lua +msgid "Clear S" +msgstr "" + +#: chatcmds.lua +msgid "Create an AdvTrains LuaAutomation environment" +msgstr "" + +#: chatcmds.lua +msgid "" +"Created environment '@1'. Use '/env_setup @2' to define global " +"initialization code, or start building LuaATC components!" +msgstr "" + +#: chatcmds.lua +msgid "Default environment set to '@1'." +msgstr "" + +#: chatcmds.lua +msgid "Delete Env." +msgstr "" + +#: chatcmds.lua +msgid "Environment already exists!" +msgstr "" + +#: chatcmds.lua +msgid "Environment deleted!" +msgstr "" + +#: chatcmds.lua +msgid "Environment initialization code" +msgstr "" + +#: chatcmds.lua +msgid "Invalid environment name!" +msgstr "" + +#: chatcmds.lua +msgid "Invalid name (only common characters)" +msgstr "" + +#: chatcmds.lua +msgid "" +"List Advtrains LuaATC environments you are subscribed to (no parameters) or " +"subscribers of an environment (giving an env name)." +msgstr "" + +#: chatcmds.lua +msgid "Name required!" +msgstr "" + +#: chatcmds.lua +msgid "No avaliable environemnt! Create one with /env_create." +msgstr "" + +#: chatcmds.lua +msgid "No subscribers!" +msgstr "" + +#: chatcmds.lua +msgid "Not subscribed to any!" +msgstr "" + +#: chatcmds.lua +msgid "Not subscribed!" +msgstr "" + +#: chatcmds.lua +msgid "Run Init Code" +msgstr "" + +#: chatcmds.lua +msgid "" +"SURE TO DELETE ENVIRONMENT @1? Type YES (all uppercase) to continue or just " +"quit form to cancel." +msgstr "" + +#: chatcmds.lua +msgid "Set or get your default LuaATC environment." +msgstr "" + +#: chatcmds.lua +msgid "Set up and modify AdvTrains LuaAutomation environment" +msgstr "" + +#: chatcmds.lua +msgid "Subscribe to the log of an Advtrains LuaATC environment" +msgstr "" + +#: chatcmds.lua +msgid "Subscribed to environment '@1'." +msgstr "" + +#: chatcmds.lua +msgid "Successfully unsubscribed!" +msgstr "" + +#: chatcmds.lua +msgid "Unubscribe to the log of an Advtrains LuaATC environment" +msgstr "" + +#: chatcmds.lua +msgid "You're not online!" +msgstr "" + +#: chatcmds.lua +msgid "Your default environment is '@1'." +msgstr "" + +#: environment.lua +#, fuzzy +msgid "LuaATC component" +msgstr "LuaATC 部件 (未配置)" + +#: init.lua +msgid "" +"Can place and configure LuaATC components, including execute potentially " +"harmful Lua code" +msgstr "" + +#: mesecon_controller.lua +msgid "LuaATC Mesecon Controller" +msgstr "" + +#: operation_panel.lua +msgid "LuaATC Operation Panel" +msgstr "" + +#: pcnaming.lua +msgid "Passive Component Naming Tool" +msgstr "被动元件命名工具" + +#: pcnaming.lua +msgid "Right-click to name a passive component." +msgstr "右键单击命名所选元件。" + +#: pcnaming.lua +msgid "Set name of component (empty to clear)" +msgstr "" + +#: pcnaming.lua +msgid "" +"You are not allowed to name LuaATC passive components without the @1 " +"privilege." +msgstr "您没有“@1”权限,不能命名被动元件。" + +#~ msgid "(Doors closed)" +#~ msgstr "(车门已关闭)" + +#~ msgid "3-way turnout" +#~ msgstr "三开道岔" + +#~ msgid "90+Angle Diamond Crossing Track" +#~ msgstr "交叉轨道 (其中一条轨道与坐标轴平行)" + +#~ msgid "<No coupler>" +#~ msgstr "<没有车钩>" + +#~ msgid "@1 Platform (45 degree)" +#~ msgstr "较高的@1站台 (45°)" + +#~ msgid "@1 Platform (high)" +#~ msgstr "较高的@1站台" + +#~ msgid "@1 Platform (low)" +#~ msgstr "较低的@1站台" + +#~ msgid "@1 Platform (low, 45 degree)" +#~ msgstr "较低的@1站台 (45°)" + +#~ msgid "@1 Slope" +#~ msgstr "@1斜坡" + +#~ msgid "ATC Kick command warning: doors are closed." +#~ msgstr "ATC 警告:车门已关闭,无法踢出乘客。" + +#~ msgid "ATC Kick command warning: train moving." +#~ msgstr "ATC 警告:火车正在移动,无法踢出乘客。" + +#~ msgid "ATC Reverse command warning: didn't reverse train, train moving." +#~ msgstr "ATC 警告:火车正在移动,无法改变行车方向。" + +#~ msgid "ATC command parse error: Unknown command: @1" +#~ msgstr "ATC 语法错误:未知命令:@1" + +#~ msgid "ATC command syntax error: I statement not closed: @1" +#~ msgstr "ATC 语法错误:“I”命令不完整:@1" + +#~ msgid "ATC controller" +#~ msgstr "ATC 控制器" + +#~ msgid "" +#~ "ATC controller, mode @1\n" +#~ "Channel: @2" +#~ msgstr "" +#~ "ATC 控制器\n" +#~ "模式:@1\n" +#~ "频道:@2" + +#~ msgid "" +#~ "ATC controller, mode @1\n" +#~ "Command: @2" +#~ msgstr "" +#~ "ATC 控制器\n" +#~ "模式:@1\n" +#~ "命令:@2" + +#~ msgid "Access to @1" +#~ msgstr "可前往@1" + +#~ msgid "Andrew's Cross" +#~ msgstr "铁路道口信号灯" + +#~ msgid "Back of train would end up off track, cancelling." +#~ msgstr "火车后部不在轨道上。" + +#~ msgid "Big Industrial Train Engine" +#~ msgstr "大型工业用火车头" + +#~ msgid "Boiler" +#~ msgstr "锅炉" + +#~ msgid "Box Wagon" +#~ msgstr "货运车厢" + +#~ msgid "Buffer and Chain Coupler" +#~ msgstr "链式车钩" + +#~ msgid "Bumper" +#~ msgstr "保险杠" + +#~ msgid "Can not couple: The couplers of the trains do not match (@1 and @2)." +#~ msgstr "您无法连接这两节车厢:这两节车厢使用不同的车钩 (@1和@2)。" + +#~ msgid "Can't get on: wagon full or doors closed!" +#~ msgstr "无法上车:车门已关闭或车厢已满。" + +#, fuzzy +#~ msgid "Can't place: Not enough slope items left (@1 required)" +#~ msgstr "无法放置斜坡:您没有足够的铁路斜坡放置工具 (您总共需要@1个)" + +#, fuzzy +#~ msgid "Can't place: There's no slope of length @1" +#~ msgstr "无法放置斜坡:advtrains 不支持长度为@1米的斜坡。" + +#, fuzzy +#~ msgid "Can't place: no supporting node at upper end." +#~ msgstr "无法放置斜坡:较高端没有支撑方块。" + +#, fuzzy +#~ msgid "Can't place: not pointing at node" +#~ msgstr "无法放置斜坡:您没有选择任何方块。" + +#~ msgid "Can't place: protected position!" +#~ msgstr "无法放置:此区域已被保护。" + +#, fuzzy +#~ msgid "Can't place: space occupied!" +#~ msgstr "无法放置斜坡:此区域已被占用。" + +#~ msgid "Chimney" +#~ msgstr "烟囱" + +#~ msgid "Command" +#~ msgstr "命令" + +#~ msgid "Command (on)" +#~ msgstr "命令 (激活时)" + +#~ msgid "Default Seat" +#~ msgstr "默认座位" + +#~ msgid "Default Seat (driver stand)" +#~ msgstr "默认座位 (司机座位)" + +#~ msgid "Dep. Speed" +#~ msgstr "出发速度" + +#~ msgid "Deprecated Track" +#~ msgstr "请不要使用" + +#~ msgid "Detailed Steam Engine" +#~ msgstr "精细的蒸汽机车" + +#~ msgid "Detector Rail" +#~ msgstr "探测轨道" + +#~ msgid "Diagonal Diamond Crossing Track" +#~ msgstr "交叉轨道" + +#~ msgid "Digiline channel" +#~ msgstr "Digiline 频道" + +#~ msgid "Door Delay" +#~ msgstr "车门关闭时间" + +#~ msgid "" +#~ "Doors are closed. Use Sneak+rightclick to ignore the closed doors and get " +#~ "off." +#~ msgstr "车门已关闭,请使用潜行+右键单击下车。" + +#, fuzzy +#~ msgid "Driver Stand" +#~ msgstr "司机座位" + +#~ msgid "Driver Stand (left)" +#~ msgstr "左侧司机座位" + +#~ msgid "Driver Stand (right)" +#~ msgstr "右侧司机座位" + +#~ msgid "Driver stand" +#~ msgstr "司机座位" + +#~ msgid "Driver's cab" +#~ msgstr "驾驶室" + +#~ msgid "Get off" +#~ msgstr "下车" + +#~ msgid "Get off (forced)" +#~ msgstr "强制下车" + +#~ msgid "Industrial Train Engine" +#~ msgstr "工业用火车头" + +#~ msgid "Industrial tank wagon" +#~ msgstr "液体运输车厢" + +#~ msgid "Industrial wood wagon" +#~ msgstr "木材运输车厢" + +#~ msgid "Japanese Train Engine" +#~ msgstr "高速列车车头" + +#~ msgid "Japanese Train Inter-Wagon Connection" +#~ msgstr "日本火车车钩" + +#~ msgid "Japanese Train Wagon" +#~ msgstr "高速列车车厢" + +#, fuzzy +#~ msgid "Japanese signal pole" +#~ msgstr "高速列车车厢" + +#~ msgid "Kick out passengers" +#~ msgstr "踢出乘客" + +#~ msgid "Lampless Signal" +#~ msgstr "臂板信号机" + +#~ msgid "Line" +#~ msgstr "火车线路" + +#~ msgid "Lock couples" +#~ msgstr "锁定连接处" + +#~ msgid "No such lua entity." +#~ msgstr "您没有指向一个可以用火车复制工具复制的物体。" + +#~ msgid "No such train: @1." +#~ msgstr "ID 为“@1”的列车不存在。" + +#~ msgid "No such wagon: @1." +#~ msgstr "ID 为“@1”的车厢不存在。" + +#, fuzzy +#~ msgid "Not allowed to do this." +#~ msgstr "您不能调整这段轨道。" + +#~ msgid "Passenger Wagon" +#~ msgstr "客车" + +#, fuzzy +#~ msgid "Passenger area" +#~ msgstr "客车" + +#~ msgid "Perpendicular Diamond Crossing Track" +#~ msgstr "垂直交叉轨道" + +#~ msgid "Reverse train" +#~ msgstr "改变行车方向" + +#~ msgid "Routingcode" +#~ msgstr "路由码" + +#~ msgid "Save wagon properties" +#~ msgstr "保存车厢属性" + +#~ msgid "Scharfenberg Coupler" +#~ msgstr "Scharfenberg 式车钩" + +#~ msgid "Select seat:" +#~ msgstr "请选择座位:" + +#~ msgid "Show Inventory" +#~ msgstr "显示物品栏" + +#~ msgid "Signal" +#~ msgstr "信号灯" + +#~ msgid "Speed:" +#~ msgstr "速度" + +#~ msgid "Station Code" +#~ msgstr "车站代码" + +#~ msgid "Station Name" +#~ msgstr "车站名称" + +#~ msgid "Station/Stop Track" +#~ msgstr "车站轨道" + +#~ msgid "Steam Engine" +#~ msgstr "蒸汽机车" + +#~ msgid "Stop Time" +#~ msgstr "停站时间" + +#~ msgid "Subway Passenger Wagon" +#~ msgstr "地铁车厢" + +#~ msgid "Target:" +#~ msgstr "目标速度" + +#~ msgid "Text displayed inside train" +#~ msgstr "车厢内部显示" + +#~ msgid "Text displayed outside on train" +#~ msgstr "车厢外部显示" + +#, fuzzy +#~ msgid "That wagon does not exist!" +#~ msgstr "这节车厢没有座位。" + +#~ msgid "The clipboard couldn't access the metadata. Copy failed." +#~ msgstr "无法复制:剪贴板无法访问元数据。" + +#~ msgid "The clipboard couldn't access the metadata. Paste failed." +#~ msgstr "无法粘贴:剪贴板无法访问元数据。" + +#~ msgid "The clipboard is empty." +#~ msgstr "剪贴板是空的。" + +#, fuzzy +#~ msgid "The track you are trying to place the wagon on is not long enough!" +#~ msgstr "轨道太短。" + +#~ msgid "The track you are trying to place the wagon on is not long enough." +#~ msgstr "轨道太短。" + +#, fuzzy +#~ msgid "This Wagon ID" +#~ msgstr "车厢已满。" + +#, fuzzy +#~ msgid "This node can't be changed using the trackworker!" +#~ msgstr "您不能使用铁路调整工具调整这个方块。" + +#, fuzzy +#~ msgid "This node can't be rotated using the trackworker!" +#~ msgstr "您不能使用铁路调整工具旋转这个方块。" + +#, fuzzy +#~ msgid "This node can't be rotated using the trackworker," +#~ msgstr "您不能使用铁路调整工具旋转这个方块。" + +#~ msgid "This position is protected!" +#~ msgstr "这里已被保护。" + +#~ msgid "This track can not be changed." +#~ msgstr "您不能调整这段轨道。" + +#, fuzzy +#~ msgid "This track can not be removed!" +#~ msgstr "您不能移除这段轨道。" + +#, fuzzy +#~ msgid "This track can not be rotated!" +#~ msgstr "您不能旋转这段轨道。" + +#~ msgid "This wagon has no seats." +#~ msgstr "这节车厢没有座位。" + +#~ msgid "This wagon is full." +#~ msgstr "车厢已满。" + +#~ msgid "This wagon is owned by @1, you can't destroy it." +#~ msgstr "这是 @1 的车厢,您不能摧毁它。" + +#~ msgid "Track" +#~ msgstr "轨道" + +#~ msgid "" +#~ "Track Worker Tool\n" +#~ "\n" +#~ "Left-click: change rail type (straight/curve/switch)\n" +#~ "Right-click: rotate object" +#~ msgstr "" +#~ "铁路调整工具\n" +#~ "\n" +#~ "左键单击:切换轨道类型\n" +#~ "右键单击:旋转方块" + +#, fuzzy +#~ msgid "Train " +#~ msgstr "已复制列车。" + +#~ msgid "Train copied." +#~ msgstr "已复制列车。" + +#~ msgid "" +#~ "Train copy/paste tool\n" +#~ "\n" +#~ "Left-click: copy train\n" +#~ "Right-click: paste train" +#~ msgstr "" +#~ "火车复制工具\n" +#~ "\n" +#~ "左键单击:复制\n" +#~ "右键单击:粘帖" + +#~ msgid "Unconfigured ATC controller" +#~ msgstr "ATC 控制器 (未配置)" + +#~ msgid "Unloading Track" +#~ msgstr "卸货轨道" + +#~ msgid "Use Sneak+rightclick to bypass closed doors!" +#~ msgstr "请使用潜行+右键上车。" + +#, fuzzy +#~ msgid "Wagon Properties Tool" +#~ msgstr "车厢属性" + +#~ msgid "Wagon properties" +#~ msgstr "车厢属性" + +#~ msgid "Wallmounted Signal (left)" +#~ msgstr "壁挂式信号灯 (左侧)" + +#~ msgid "Wallmounted Signal (right)" +#~ msgstr "壁挂式信号灯 (右侧)" + +#~ msgid "Wallmounted Signal (top)" +#~ msgstr "悬挂式信号灯" + +#~ msgid "" +#~ "Warning: If you destroy this wagon, you only get some steel back! If you " +#~ "are sure, hold Sneak and left-click the wagon." +#~ msgstr "" +#~ "警告:如果您摧毁此车厢,您只能拿到一些钢方块。如果您确定要摧毁这节车厢,请" +#~ "按潜行键并左键单击此车厢。" + +#~ msgid "Wheel" +#~ msgstr "车轮" + +#~ msgid "Y-turnout" +#~ msgstr "对称道岔" + +#~ msgid "You are not allowed to build near tracks at this protected position." +#~ msgstr "这里已被保护,您不能在这里的铁路附近建任何东西。" + +#~ msgid "" +#~ "You are not allowed to build near tracks without the track_builder " +#~ "privilege." +#~ msgstr "您没有“train_operator”权限,不能在铁路附近建任何东西。" + +#~ msgid "You are not allowed to build tracks at this protected position." +#~ msgstr "这里已被保护,您不能在这里建造铁路。" + +#~ msgid "" +#~ "You are not allowed to build tracks without the track_builder privilege." +#~ msgstr "您没有“train_operator”权限,不能在这里建造铁路。" + +#~ msgid "" +#~ "You are not allowed to configure this track without the @1 privilege." +#~ msgstr "您没有“@1”权限,不能调整这段轨道。" + +#~ msgid "You are not allowed to configure this track." +#~ msgstr "您不能调整这段轨道。" + +#~ msgid "" +#~ "You are not allowed to couple trains without the train_operator privilege." +#~ msgstr "您没有“train_operator”权限,不能连接这两节车厢。" + +#, fuzzy +#~ msgid "You are not allowed to modify this protected track." +#~ msgstr "这里已被保护,您不能在这里建造铁路。" + +#~ msgid "" +#~ "You are not allowed to operate turnouts and signals without the " +#~ "railway_operator privilege." +#~ msgstr "您没有“railway_operator”权限,不能控制铁路设施。" + +#~ msgid "You do not have the @1 privilege." +#~ msgstr "您没有“@1”权限。" + +#, fuzzy +#~ msgid "You don't have the train_operator privilege." +#~ msgstr "您没有“@1”权限。" + +#~ msgid "" +#~ "You need to own at least one neighboring wagon to destroy this couple." +#~ msgstr "您必须至少拥有其中一节车厢才能分开这两节车厢。" diff --git a/advtrains_luaautomation/locale/advtrains_luaautomation.zh_TW.po b/advtrains_luaautomation/locale/advtrains_luaautomation.zh_TW.po new file mode 100644 index 0000000..76795c6 --- /dev/null +++ b/advtrains_luaautomation/locale/advtrains_luaautomation.zh_TW.po @@ -0,0 +1,679 @@ +msgid "" +msgstr "" +"Project-Id-Version: advtrains\n" +"Report-Msgid-Bugs-To: advtrains-discuss@lists.sr.ht\n" +"POT-Creation-Date: 2026-05-17 09:19+0800\n" +"PO-Revision-Date: 2026-05-17 09:29+0800\n" +"Last-Translator: Y. Wang <yw05@forksworld.de>\n" +"Language-Team: Chinese (Traditional)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.8\n" + +#: active_common.lua +msgid "Clear Local Environment" +msgstr "" + +#: active_common.lua +msgid "Code" +msgstr "" + +#: active_common.lua +msgid "Invalid approach callback mode in header: @1" +msgstr "" + +#: active_common.lua +msgid "Invalid attribute headers: @1" +msgstr "" + +#: active_common.lua +msgid "Invalid environment name in header: @1" +msgstr "" + +#: active_common.lua +msgid "LuaATC Environment" +msgstr "" + +#: active_common.lua +msgid "LuaATC component assigned to an invalid environment" +msgstr "" + +#: active_common.lua +msgid "LuaATC component assigned to environment '@1'" +msgstr "" + +#: active_common.lua +msgid "LuaATC component with error: @1" +msgstr "" + +#: active_common.lua chatcmds.lua +msgid "Save" +msgstr "儲存" + +#: active_common.lua +msgid "Unconfigured LuaATC component" +msgstr "LuaATC 元件 (未配置)" + +#: active_common.lua +msgid "" +"You are not allowed to configure this LuaATC component without the @1 " +"privilege." +msgstr "您沒有「@1」許可權,不能配置這個 LuaATC 元件。" + +#: atc_rail.lua +#, fuzzy +msgid "LuaATC Track" +msgstr "裝貨軌道" + +#: chatcmds.lua +msgid "Already subscribed!" +msgstr "" + +#: chatcmds.lua +msgid "Clear S" +msgstr "" + +#: chatcmds.lua +msgid "Create an AdvTrains LuaAutomation environment" +msgstr "" + +#: chatcmds.lua +msgid "" +"Created environment '@1'. Use '/env_setup @2' to define global " +"initialization code, or start building LuaATC components!" +msgstr "" + +#: chatcmds.lua +msgid "Default environment set to '@1'." +msgstr "" + +#: chatcmds.lua +msgid "Delete Env." +msgstr "" + +#: chatcmds.lua +msgid "Environment already exists!" +msgstr "" + +#: chatcmds.lua +msgid "Environment deleted!" +msgstr "" + +#: chatcmds.lua +msgid "Environment initialization code" +msgstr "" + +#: chatcmds.lua +msgid "Invalid environment name!" +msgstr "" + +#: chatcmds.lua +msgid "Invalid name (only common characters)" +msgstr "" + +#: chatcmds.lua +msgid "" +"List Advtrains LuaATC environments you are subscribed to (no parameters) or " +"subscribers of an environment (giving an env name)." +msgstr "" + +#: chatcmds.lua +msgid "Name required!" +msgstr "" + +#: chatcmds.lua +msgid "No avaliable environemnt! Create one with /env_create." +msgstr "" + +#: chatcmds.lua +msgid "No subscribers!" +msgstr "" + +#: chatcmds.lua +msgid "Not subscribed to any!" +msgstr "" + +#: chatcmds.lua +msgid "Not subscribed!" +msgstr "" + +#: chatcmds.lua +msgid "Run Init Code" +msgstr "" + +#: chatcmds.lua +msgid "" +"SURE TO DELETE ENVIRONMENT @1? Type YES (all uppercase) to continue or just " +"quit form to cancel." +msgstr "" + +#: chatcmds.lua +msgid "Set or get your default LuaATC environment." +msgstr "" + +#: chatcmds.lua +msgid "Set up and modify AdvTrains LuaAutomation environment" +msgstr "" + +#: chatcmds.lua +msgid "Subscribe to the log of an Advtrains LuaATC environment" +msgstr "" + +#: chatcmds.lua +msgid "Subscribed to environment '@1'." +msgstr "" + +#: chatcmds.lua +msgid "Successfully unsubscribed!" +msgstr "" + +#: chatcmds.lua +msgid "Unubscribe to the log of an Advtrains LuaATC environment" +msgstr "" + +#: chatcmds.lua +msgid "You're not online!" +msgstr "" + +#: chatcmds.lua +msgid "Your default environment is '@1'." +msgstr "" + +#: environment.lua +#, fuzzy +msgid "LuaATC component" +msgstr "LuaATC 元件 (未配置)" + +#: init.lua +msgid "" +"Can place and configure LuaATC components, including execute potentially " +"harmful Lua code" +msgstr "" + +#: mesecon_controller.lua +msgid "LuaATC Mesecon Controller" +msgstr "" + +#: operation_panel.lua +msgid "LuaATC Operation Panel" +msgstr "" + +#: pcnaming.lua +msgid "Passive Component Naming Tool" +msgstr "被動元件命名工具" + +#: pcnaming.lua +msgid "Right-click to name a passive component." +msgstr "右鍵單擊命名所選元件。" + +#: pcnaming.lua +msgid "Set name of component (empty to clear)" +msgstr "" + +#: pcnaming.lua +msgid "" +"You are not allowed to name LuaATC passive components without the @1 " +"privilege." +msgstr "您沒有「@1」許可權,不能命名這個元件。" + +#~ msgid "(Doors closed)" +#~ msgstr "(車門已關閉)" + +#~ msgid "3-way turnout" +#~ msgstr "三開道岔" + +#~ msgid "90+Angle Diamond Crossing Track" +#~ msgstr "交叉軌道 (其中一條軌道與座標軸平行)" + +#~ msgid "<No coupler>" +#~ msgstr "<無連結器>" + +#~ msgid "@1 Platform (45 degree)" +#~ msgstr "較高的@1月臺 (45°)" + +#~ msgid "@1 Platform (high)" +#~ msgstr "較高的@1月臺" + +#~ msgid "@1 Platform (low)" +#~ msgstr "較低的@1月臺" + +#~ msgid "@1 Platform (low, 45 degree)" +#~ msgstr "較低的@1月臺 (45°)" + +#~ msgid "@1 Slope" +#~ msgstr "@1斜坡" + +#~ msgid "ATC Kick command warning: doors are closed." +#~ msgstr "ATC 警告:車門已關閉,無法踢出乘客。" + +#~ msgid "ATC Kick command warning: train moving." +#~ msgstr "ATC 警告:火車正在移動,無法踢出乘客。" + +#~ msgid "ATC Reverse command warning: didn't reverse train, train moving." +#~ msgstr "ATC 警告:火車正在移動,無法改變行車方向。" + +#~ msgid "ATC command parse error: Unknown command: @1" +#~ msgstr "ATC 語法錯誤:未知命令:@1" + +#~ msgid "ATC command syntax error: I statement not closed: @1" +#~ msgstr "ATC 語法錯誤:「I」命令不完整:@1" + +#~ msgid "ATC controller" +#~ msgstr "ATC 控制器" + +#~ msgid "" +#~ "ATC controller, mode @1\n" +#~ "Channel: @2" +#~ msgstr "" +#~ "ATC 控制器\n" +#~ "模式:@1\n" +#~ "頻道:@2" + +#~ msgid "" +#~ "ATC controller, mode @1\n" +#~ "Command: @2" +#~ msgstr "" +#~ "ATC 控制器\n" +#~ "模式:@1\n" +#~ "命令:@2" + +#~ msgid "Access to @1" +#~ msgstr "可前往@1" + +#~ msgid "Andrew's Cross" +#~ msgstr "平交道號誌燈" + +#~ msgid "Back of train would end up off track, cancelling." +#~ msgstr "火車後部不在軌道上。" + +#~ msgid "Big Industrial Train Engine" +#~ msgstr "大型工業用火車頭" + +#~ msgid "Boiler" +#~ msgstr "鍋爐" + +#~ msgid "Box Wagon" +#~ msgstr "貨運車廂" + +#~ msgid "Buffer and Chain Coupler" +#~ msgstr "鏈式連結器" + +#~ msgid "Bumper" +#~ msgstr "保險槓" + +#~ msgid "Can not couple: The couplers of the trains do not match (@1 and @2)." +#~ msgstr "您無法連結這兩節車廂:這兩節車廂使用不同的連結器 (@1和@2)。" + +#~ msgid "Can't get on: wagon full or doors closed!" +#~ msgstr "無法上車:車門已關閉或車廂已滿。" + +#, fuzzy +#~ msgid "Can't place: Not enough slope items left (@1 required)" +#~ msgstr "無法放置斜坡:您沒有足夠的鐵路斜坡放置工具 (您總共需要@1個)" + +#, fuzzy +#~ msgid "Can't place: There's no slope of length @1" +#~ msgstr "無法放置斜坡:advtrains 不支援長度為@1米的斜坡。" + +#, fuzzy +#~ msgid "Can't place: no supporting node at upper end." +#~ msgstr "無法放置斜坡:較高階沒有支撐方塊。" + +#, fuzzy +#~ msgid "Can't place: not pointing at node" +#~ msgstr "無法放置斜坡:您沒有選擇任何方塊。" + +#~ msgid "Can't place: protected position!" +#~ msgstr "無法放置:此區域已被保護。" + +#, fuzzy +#~ msgid "Can't place: space occupied!" +#~ msgstr "無法放置斜坡:此區域已被佔用。" + +#~ msgid "Chimney" +#~ msgstr "煙囪" + +#~ msgid "Command" +#~ msgstr "命令" + +#~ msgid "Command (on)" +#~ msgstr "命令 (啟用時)" + +#~ msgid "Default Seat" +#~ msgstr "預設座位" + +#~ msgid "Default Seat (driver stand)" +#~ msgstr "預設座位 (司機座位)" + +#~ msgid "Dep. Speed" +#~ msgstr "出發速度" + +#~ msgid "Deprecated Track" +#~ msgstr "請不要使用" + +#~ msgid "Detailed Steam Engine" +#~ msgstr "精細的蒸汽機車" + +#~ msgid "Detector Rail" +#~ msgstr "探測軌道" + +#~ msgid "Diagonal Diamond Crossing Track" +#~ msgstr "交叉軌道" + +#~ msgid "Digiline channel" +#~ msgstr "Digiline 頻道" + +#~ msgid "Door Delay" +#~ msgstr "車門關閉時間" + +#~ msgid "" +#~ "Doors are closed. Use Sneak+rightclick to ignore the closed doors and get " +#~ "off." +#~ msgstr "車門已關閉,請使用潛行+右鍵單擊下車。" + +#, fuzzy +#~ msgid "Driver Stand" +#~ msgstr "司機座位" + +#~ msgid "Driver Stand (left)" +#~ msgstr "左側司機座位" + +#~ msgid "Driver Stand (right)" +#~ msgstr "右側司機座位" + +#~ msgid "Driver stand" +#~ msgstr "司機座位" + +#~ msgid "Driver's cab" +#~ msgstr "駕駛室" + +#~ msgid "Get off" +#~ msgstr "下車" + +#~ msgid "Get off (forced)" +#~ msgstr "強制下車" + +#~ msgid "Industrial Train Engine" +#~ msgstr "工業用火車頭" + +#~ msgid "Industrial tank wagon" +#~ msgstr "液體運輸車廂" + +#~ msgid "Industrial wood wagon" +#~ msgstr "木材運輸車廂" + +#~ msgid "Japanese Train Engine" +#~ msgstr "高速列車車頭" + +#~ msgid "Japanese Train Inter-Wagon Connection" +#~ msgstr "日本火車連結器" + +#~ msgid "Japanese Train Wagon" +#~ msgstr "高速列車車廂" + +#, fuzzy +#~ msgid "Japanese signal pole" +#~ msgstr "高速列車車廂" + +#~ msgid "Kick out passengers" +#~ msgstr "踢出乘客" + +#~ msgid "Lampless Signal" +#~ msgstr "臂木式號誌機" + +#~ msgid "Line" +#~ msgstr "火車線路" + +#~ msgid "Lock couples" +#~ msgstr "鎖定連結處" + +#~ msgid "No such lua entity." +#~ msgstr "您沒有指向一個可以用火車複製工具複製的物體。" + +#~ msgid "No such train: @1." +#~ msgstr "ID 為「@1」的列車不存在。" + +#~ msgid "No such wagon: @1." +#~ msgstr "ID 為「@1」的車廂不存在。" + +#, fuzzy +#~ msgid "Not allowed to do this." +#~ msgstr "您不能調整這段軌道。" + +#~ msgid "Passenger Wagon" +#~ msgstr "客車" + +#, fuzzy +#~ msgid "Passenger area" +#~ msgstr "客車" + +#~ msgid "Perpendicular Diamond Crossing Track" +#~ msgstr "垂直交叉軌道" + +#~ msgid "Reverse train" +#~ msgstr "改變行車方向" + +#~ msgid "Routingcode" +#~ msgstr "路由碼" + +#~ msgid "Save wagon properties" +#~ msgstr "儲存車廂屬性" + +#~ msgid "Scharfenberg Coupler" +#~ msgstr "Scharfenberg 式連結器" + +#~ msgid "Select seat:" +#~ msgstr "請選擇座位:" + +#~ msgid "Show Inventory" +#~ msgstr "顯示物品欄" + +#~ msgid "Signal" +#~ msgstr "色燈號誌機" + +#~ msgid "Speed:" +#~ msgstr "速度" + +#~ msgid "Station Code" +#~ msgstr "車站碼" + +#~ msgid "Station Name" +#~ msgstr "車站名稱" + +#~ msgid "Station/Stop Track" +#~ msgstr "車站軌道" + +#~ msgid "Steam Engine" +#~ msgstr "蒸汽機車" + +#~ msgid "Stop Time" +#~ msgstr "停站時間" + +#~ msgid "Subway Passenger Wagon" +#~ msgstr "地鐵車廂" + +#~ msgid "Target:" +#~ msgstr "目標速度" + +#~ msgid "Text displayed inside train" +#~ msgstr "車廂內部顯示" + +#~ msgid "Text displayed outside on train" +#~ msgstr "車廂外部顯示" + +#, fuzzy +#~ msgid "That wagon does not exist!" +#~ msgstr "這節車廂沒有座位。" + +#~ msgid "The clipboard couldn't access the metadata. Copy failed." +#~ msgstr "無法複製:剪貼簿無法訪問元資料。" + +#~ msgid "The clipboard couldn't access the metadata. Paste failed." +#~ msgstr "無法貼上:剪貼簿無法訪問元資料。" + +#~ msgid "The clipboard is empty." +#~ msgstr "剪貼簿是空的。" + +#, fuzzy +#~ msgid "The track you are trying to place the wagon on is not long enough!" +#~ msgstr "軌道太短。" + +#~ msgid "The track you are trying to place the wagon on is not long enough." +#~ msgstr "軌道太短。" + +#, fuzzy +#~ msgid "This Wagon ID" +#~ msgstr "車廂已滿。" + +#, fuzzy +#~ msgid "This node can't be changed using the trackworker!" +#~ msgstr "您不能使用鐵路調整工具調整這個方塊。" + +#, fuzzy +#~ msgid "This node can't be rotated using the trackworker!" +#~ msgstr "您不能使用鐵路調整工具旋轉這個方塊。" + +#, fuzzy +#~ msgid "This node can't be rotated using the trackworker," +#~ msgstr "您不能使用鐵路調整工具旋轉這個方塊。" + +#~ msgid "This position is protected!" +#~ msgstr "這裡已被保護。" + +#~ msgid "This track can not be changed." +#~ msgstr "您不能調整這段軌道。" + +#, fuzzy +#~ msgid "This track can not be removed!" +#~ msgstr "您不能移除這段軌道。" + +#, fuzzy +#~ msgid "This track can not be rotated!" +#~ msgstr "您不能旋轉這段軌道。" + +#~ msgid "This wagon has no seats." +#~ msgstr "這節車廂沒有座位。" + +#~ msgid "This wagon is full." +#~ msgstr "車廂已滿。" + +#~ msgid "This wagon is owned by @1, you can't destroy it." +#~ msgstr "這是 @1 的車廂,您不能摧毀它。" + +#~ msgid "Track" +#~ msgstr "軌道" + +#~ msgid "" +#~ "Track Worker Tool\n" +#~ "\n" +#~ "Left-click: change rail type (straight/curve/switch)\n" +#~ "Right-click: rotate object" +#~ msgstr "" +#~ "鐵路調整工具\n" +#~ "\n" +#~ "左鍵單擊:切換軌道型別\n" +#~ "右鍵單擊:旋轉方塊" + +#, fuzzy +#~ msgid "Train " +#~ msgstr "已複製火車。" + +#~ msgid "Train copied." +#~ msgstr "已複製火車。" + +#~ msgid "" +#~ "Train copy/paste tool\n" +#~ "\n" +#~ "Left-click: copy train\n" +#~ "Right-click: paste train" +#~ msgstr "" +#~ "火車複製工具\n" +#~ "\n" +#~ "左鍵單擊:複製\n" +#~ "右鍵單擊:粘帖" + +#~ msgid "Unconfigured ATC controller" +#~ msgstr "ATC 控制器 (未配置)" + +#~ msgid "Unloading Track" +#~ msgstr "卸貨軌道" + +#~ msgid "Use Sneak+rightclick to bypass closed doors!" +#~ msgstr "請使用潛行+右鍵上車。" + +#, fuzzy +#~ msgid "Wagon Properties Tool" +#~ msgstr "車廂屬性" + +#~ msgid "Wagon properties" +#~ msgstr "車廂屬性" + +#~ msgid "Wallmounted Signal (left)" +#~ msgstr "壁掛式色燈號誌機 (左側)" + +#~ msgid "Wallmounted Signal (right)" +#~ msgstr "壁掛式色燈號誌機 (右側)" + +#~ msgid "Wallmounted Signal (top)" +#~ msgstr "懸掛式色燈號誌機" + +#~ msgid "" +#~ "Warning: If you destroy this wagon, you only get some steel back! If you " +#~ "are sure, hold Sneak and left-click the wagon." +#~ msgstr "" +#~ "警告:如果您摧毀此車廂,您只能拿到一些鋼方塊。如果您確定要摧毀這節車廂,請" +#~ "按潛行鍵並左鍵單擊此車廂。" + +#~ msgid "Wheel" +#~ msgstr "車輪" + +#~ msgid "Y-turnout" +#~ msgstr "對稱道岔" + +#~ msgid "You are not allowed to build near tracks at this protected position." +#~ msgstr "這裡已被保護,您不能在這裡的鐵路附近建任何東西。" + +#~ msgid "" +#~ "You are not allowed to build near tracks without the track_builder " +#~ "privilege." +#~ msgstr "您沒有「train_operator」許可權,不能在鐵路附近建任何東西。" + +#~ msgid "You are not allowed to build tracks at this protected position." +#~ msgstr "這裡已被保護,您不能在這裡建造鐵路。" + +#~ msgid "" +#~ "You are not allowed to build tracks without the track_builder privilege." +#~ msgstr "您沒有「train_operator」許可權,不能在這裡建造鐵路。" + +#~ msgid "" +#~ "You are not allowed to configure this track without the @1 privilege." +#~ msgstr "您沒有「@1」許可權,不能調整這段軌道。" + +#~ msgid "You are not allowed to configure this track." +#~ msgstr "您不能調整這段軌道。" + +#~ msgid "" +#~ "You are not allowed to couple trains without the train_operator privilege." +#~ msgstr "您沒有「train_operator」許可權,不能連結這兩節車廂。" + +#, fuzzy +#~ msgid "You are not allowed to modify this protected track." +#~ msgstr "這裡已被保護,您不能在這裡建造鐵路。" + +#~ msgid "" +#~ "You are not allowed to operate turnouts and signals without the " +#~ "railway_operator privilege." +#~ msgstr "您沒有「railway_operator」許可權,不能控制鐵路設施。" + +#~ msgid "You do not have the @1 privilege." +#~ msgstr "您沒有「@1」許可權。" + +#, fuzzy +#~ msgid "You don't have the train_operator privilege." +#~ msgstr "您沒有「@1」許可權。" + +#~ msgid "" +#~ "You need to own at least one neighboring wagon to destroy this couple." +#~ msgstr "您必須至少擁有其中一節車廂才能分開這兩節車廂。" diff --git a/advtrains_luaautomation/mesecon_controller.lua b/advtrains_luaautomation/mesecon_controller.lua new file mode 100644 index 0000000..9f1a931 --- /dev/null +++ b/advtrains_luaautomation/mesecon_controller.lua @@ -0,0 +1,261 @@ +-- mesecon_controller.lua +-- Mesecon-interfaceable Operation Panel alternative +-- Looks like a Mesecon Luacontroller + +-- Luacontroller Adapted Code +-- From Mesecons mod https://mesecons.net/ +-- (c) Jeija and Contributors + +-- Get current translator +local S = atlatc.translate +local BASENAME = "advtrains_luaautomation:mesecon_controller" + +local rules = { + a = {x = -1, y = 0, z = 0, name="A"}, + b = {x = 0, y = 0, z = 1, name="B"}, + c = {x = 1, y = 0, z = 0, name="C"}, + d = {x = 0, y = 0, z = -1, name="D"}, +} + +local function generate_name(ports) + local d = ports.d and 1 or 0 + local c = ports.c and 1 or 0 + local b = ports.b and 1 or 0 + local a = ports.a and 1 or 0 + return BASENAME..d..c..b..a +end + + +local function set_port(pos, rule, state) + if state then + mesecon.receptor_on(pos, {rule}) + else + mesecon.receptor_off(pos, {rule}) + end +end + +local function clean_port_states(ports) + ports.a = ports.a and true or false + ports.b = ports.b and true or false + ports.c = ports.c and true or false + ports.d = ports.d and true or false +end + +-- Local table for storing which Mesecons off events should be ignored +-- Indexed by hex encoded position +local ignored_off_events = {} + +local function set_port_states(pos, ports) + local node = advtrains.ndb.get_node(pos) + local name = node.name + clean_port_states(ports) + local vports = minetest.registered_nodes[name].virtual_portstates + local new_name = generate_name(ports) + + if name ~= new_name and vports then + -- Problem: + -- We need to place the new node first so that when turning + -- off some port, it won't stay on because the rules indicate + -- there is an onstate output port there. + -- When turning the output off then, it will however cause feedback + -- so that the luacontroller will receive an "off" event by turning + -- its output off. + -- Solution / Workaround: + -- Remember which output was turned off and ignore next "off" event. + local ph=minetest.pos_to_string(pos) + local railtbl = atlatc.active.nodes[ph] + if not railtbl then return end + + local ign = railtbl.ignored_off_events or {} + if ports.a and not vports.a and not mesecon.is_powered(pos, rules.a) then ign.A = true end + if ports.b and not vports.b and not mesecon.is_powered(pos, rules.b) then ign.B = true end + if ports.c and not vports.c and not mesecon.is_powered(pos, rules.c) then ign.C = true end + if ports.d and not vports.d and not mesecon.is_powered(pos, rules.d) then ign.D = true end + railtbl.ignored_off_events = ign + + advtrains.ndb.swap_node(pos, {name = new_name, param2 = node.param2}) + + -- Apply mesecon state only if node loaded + -- If node is not loaded, mesecon update will occur on next load via on_updated_from_nodedb + if advtrains.is_node_loaded(pos) then + if ports.a ~= vports.a then set_port(pos, rules.a, ports.a) end + if ports.b ~= vports.b then set_port(pos, rules.b, ports.b) end + if ports.c ~= vports.c then set_port(pos, rules.c, ports.c) end + if ports.d ~= vports.d then set_port(pos, rules.d, ports.d) end + end + end +end + +local function on_updated_from_nodedb(pos, newnode, oldnode) + -- Switch appropriate Mesecon receptors depending on the node change + local vports = minetest.registered_nodes[oldnode.name].virtual_portstates + local ports = minetest.registered_nodes[newnode.name].virtual_portstates + if ports.a ~= vports.a then set_port(pos, rules.a, ports.a) end + if ports.b ~= vports.b then set_port(pos, rules.b, ports.b) end + if ports.c ~= vports.c then set_port(pos, rules.c, ports.c) end + if ports.d ~= vports.d then set_port(pos, rules.d, ports.d) end +end + +local function ignore_offevent(pos, rule) + local ph=minetest.pos_to_string(pos) + local railtbl = atlatc.active.nodes[ph] + if not railtbl then return nil end + local ign = railtbl.ignored_off_events + if ign and ign[rule.name] then + ign[rule.name] = nil + return true + end + return false +end + +local valid_ports = {a=true, b=true, c=true, d=true} + +local function fire_event(pos, evtdata) + local customfct={ + set_mesecon_outputs = function(states) + assertt(states, "table") + set_port_states(pos, states) + end, + get_mesecon_input = function(port) + local portl = string.lower(port) + if not valid_ports[portl] then + error("get_mesecon_input: Invalid port (expected a,b,c,d)") + end + if mesecon.is_powered(pos, rules[portl]) then + return true + end + return false + end, + } + atlatc.active.run_in_env(pos, evtdata, customfct, true) + +end + +local output_rules = {} +local input_rules = {} + +local node_box = { + type = "fixed", + fixed = { + {-8/16, -8/16, -8/16, 8/16, -7/16, 8/16}, -- Bottom slab + {-5/16, -7/16, -5/16, 5/16, -6/16, 5/16}, -- Circuit board + {-3/16, -6/16, -3/16, 3/16, -5/16, 3/16}, -- IC + } +} + +local selection_box = { + type = "fixed", + fixed = { -8/16, -8/16, -8/16, 8/16, -5/16, 8/16 }, +} + +for a = 0, 1 do -- 0 = off 1 = on +for b = 0, 1 do +for c = 0, 1 do +for d = 0, 1 do + local cid = tostring(d)..tostring(c)..tostring(b)..tostring(a) + local node_name = BASENAME..cid + local top = "atlatc_luacontroller_top.png" + if a == 1 then + top = top.."^atlatc_luacontroller_LED_A.png" + end + if b == 1 then + top = top.."^atlatc_luacontroller_LED_B.png" + end + if c == 1 then + top = top.."^atlatc_luacontroller_LED_C.png" + end + if d == 1 then + top = top.."^atlatc_luacontroller_LED_D.png" + end + + local groups + if a + b + c + d ~= 0 then + groups = {dig_immediate=2, not_in_creative_inventory=1, save_in_at_nodedb=1} + else + groups = {dig_immediate=2, save_in_at_nodedb=1} + end + + output_rules[cid] = {} + input_rules[cid] = {} + if a == 1 then table.insert(output_rules[cid], rules.a) end + if b == 1 then table.insert(output_rules[cid], rules.b) end + if c == 1 then table.insert(output_rules[cid], rules.c) end + if d == 1 then table.insert(output_rules[cid], rules.d) end + + if a == 0 then table.insert( input_rules[cid], rules.a) end + if b == 0 then table.insert( input_rules[cid], rules.b) end + if c == 0 then table.insert( input_rules[cid], rules.c) end + if d == 0 then table.insert( input_rules[cid], rules.d) end + + local mesecons = { + effector = { + rules = input_rules[cid], + action_change = function (pos, _, rule_name, new_state) + if new_state == "off" then + -- check for ignored off event on this node + if ignore_offevent(pos, rule_name) then + return + end + end + --Note: rule_name is not a *name* but actually the full rule table (position + name field) + --Event format consistent with Mesecons Luacontroller event + atlatc.interrupt.add(0, pos, {type=new_state, [new_state]=true, pin=rule_name}) + end, + }, + receptor = { + state = mesecon.state.on, + rules = output_rules[cid] + }, + } + + minetest.register_node(node_name, { + description = S("LuaATC Mesecon Controller"), + drawtype = "nodebox", + tiles = { + top, + "atlatc_luacontroller_bottom.png", + "atlatc_luacontroller_sides.png", + "atlatc_luacontroller_sides.png", + "atlatc_luacontroller_sides.png", + "atlatc_luacontroller_sides.png" + }, + inventory_image = top, + paramtype = "light", + is_ground_content = false, + groups = groups, + drop = BASENAME.."0000", + sunlight_propagates = true, + selection_box = selection_box, + node_box = node_box, + mesecons = mesecons, + -- Virtual portstates are the ports that + -- the node shows as powered up (light up). + virtual_portstates = { + a = a == 1, + b = b == 1, + c = c == 1, + d = d == 1, + }, + after_dig_node = function (pos, node, player) + mesecon.receptor_off(pos, output_rules) + atlatc.active.after_dig_node(pos, node, player) + end, + after_place_node = atlatc.active.after_place_node, + on_receive_fields = atlatc.active.on_receive_fields, + advtrains = { + on_updated_from_nodedb = on_updated_from_nodedb + }, + luaautomation = { + fire_event=fire_event + }, + digiline = { + receptor = {}, + effector = { + action = atlatc.active.on_digiline_receive + }, + }, + }) +end +end +end +end diff --git a/advtrains_luaautomation/mod.conf b/advtrains_luaautomation/mod.conf new file mode 100644 index 0000000..a737603 --- /dev/null +++ b/advtrains_luaautomation/mod.conf @@ -0,0 +1,7 @@ +name=advtrains_luaautomation +title=Advanced Trains LuaATC +description=Lua control interface to Advanced Trains +author=orwell96 + +depends=advtrains +optional_depends=advtrains_interlocking,advtrains_line_automation,mesecons_switch diff --git a/advtrains_luaautomation/operation_panel.lua b/advtrains_luaautomation/operation_panel.lua new file mode 100644 index 0000000..adfaf09 --- /dev/null +++ b/advtrains_luaautomation/operation_panel.lua @@ -0,0 +1,30 @@ +-- Get current translator +local S = atlatc.translate + +local function on_punch(pos,node,player) + atlatc.interrupt.add(0, pos, {type="punch", punch=true, name=player:get_player_name()}) +end + + +minetest.register_node("advtrains_luaautomation:oppanel", { + drawtype = "normal", + tiles={"atlatc_oppanel.png"}, + description = S("LuaATC Operation Panel"), + groups = { + cracky = 1, + save_in_at_nodedb=1, + }, + after_place_node = atlatc.active.after_place_node, + after_dig_node = atlatc.active.after_dig_node, + on_receive_fields = atlatc.active.on_receive_fields, + on_punch = on_punch, + luaautomation = { + fire_event=atlatc.active.run_in_env + }, + digiline = { + receptor = {}, + effector = { + action = atlatc.active.on_digiline_receive + }, + }, +}) diff --git a/advtrains_luaautomation/p_display.lua b/advtrains_luaautomation/p_display.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/advtrains_luaautomation/p_display.lua diff --git a/advtrains_luaautomation/passive_api.txt b/advtrains_luaautomation/passive_api.txt new file mode 100644 index 0000000..5ae1df4 --- /dev/null +++ b/advtrains_luaautomation/passive_api.txt @@ -0,0 +1,24 @@ +Lua Automation - Passive Component API + +Passive components are nodes that do not have code running in them. However, active components can query these and request actions from them. Examples: +Switches +Signals +Displays +Mesecon Transmitter +Those passive components can also be used inside interlocking systems. + +All passive components have a table called 'advtrains' in their node definition and have the group 'save_in_at_nodedb' set, so they work in unloaded chunks. +Example for a switch: +advtrains = { + getstate = function(pos, node) + return "st" + end, + -- OR + getstate = "st", + + setstate = function(pos, node, newstate) + if newstate=="cr" then + advtrains.ndb.swap_node(pos, <corresponding switch alt>) + end + end +}
\ No newline at end of file diff --git a/advtrains_luaautomation/pcnaming.lua b/advtrains_luaautomation/pcnaming.lua new file mode 100644 index 0000000..6f9c2f2 --- /dev/null +++ b/advtrains_luaautomation/pcnaming.lua @@ -0,0 +1,95 @@ +--pcnaming.lua +--a.k.a Passive component naming +--Allows to assign names to passive components, so they can be called like: +--setstate("iamasignal", "green") +-- Get current translator +local S = atlatc.translate + +atlatc.pcnaming={name_map={}} +function atlatc.pcnaming.load(stuff) + if type(stuff)=="table" then + atlatc.pcnaming.name_map=stuff + end +end +function atlatc.pcnaming.save() + return atlatc.pcnaming.name_map +end + +function atlatc.pcnaming.resolve_pos(pos, func_name) + if type(pos)=="string" then + local e = atlatc.pcnaming.name_map[pos] + if e then return e end + elseif type(pos)=="table" and pos.x and pos.y and pos.z then + return pos + end + error("Invalid position supplied to " .. (func_name or "???")..": " .. dump(pos)) +end + + +local pcrename = {} + +minetest.register_craftitem("advtrains_luaautomation:pcnaming",{ + description = S("Passive Component Naming Tool") .. "\n\n" .. S("Right-click to name a passive component."), + short_description = S("Passive Component Naming Tool"), + groups = {cracky=1}, -- key=name, value=rating; rating=1..3. + inventory_image = "atlatc_pcnaming.png", + wield_image = "atlatc_pcnaming.png", + stack_max = 1, + on_place = function(itemstack, placer, pointed_thing) + local pname = placer:get_player_name() + if not pname then + return + end + if not minetest.check_player_privs(pname, {atlatc=true}) then + minetest.chat_send_player(pname, S("You are not allowed to name LuaATC passive components without the @1 privilege.", "atlatc")) + return + end + if pointed_thing.type=="node" then + local pos=pointed_thing.under + if advtrains.is_protected(pos, pname) then + minetest.record_protection_violation(pos, pname) + return + end + + local node = advtrains.ndb.get_node(pos) + local ndef = minetest.registered_nodes[node.name] + if node.name and ( + minetest.get_item_group(node.name, "advtrains_signal")>0 --is IL signal + or advtrains.is_passive(pos) -- is passive component + or (ndef and ndef.luaautomation) -- is active component + ) then + --look if this one already has a name + local pn="" + for name, npos in pairs(atlatc.pcnaming.name_map) do + if vector.equals(npos, pos) then + pn=name + end + end + pcrename[pname] = pos + minetest.show_formspec(pname, "atlatc_naming", "field[pn;"..S("Set name of component (empty to clear)")..";"..minetest.formspec_escape(pn).."]") + end + end + end, +}) +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname == "atlatc_naming" then + local pname = player:get_player_name() + local pos=pcrename[pname] + if fields.pn and pos then + --first remove all occurences + for name, npos in pairs(atlatc.pcnaming.name_map) do + if vector.equals(npos, pos) then + atlatc.pcnaming.name_map[name]=nil + end + end + if fields.pn~="" then + atlatc.pcnaming.name_map[fields.pn]=pos + end + end + end +end) +minetest.register_craft({ + output = "advtrains_luaautomation:pcnaming", + type = "shapeless", + recipe = {"dye:red","advtrains:trackworker"} +}) diff --git a/advtrains_luaautomation/recipes.lua b/advtrains_luaautomation/recipes.lua new file mode 100644 index 0000000..16121a8 --- /dev/null +++ b/advtrains_luaautomation/recipes.lua @@ -0,0 +1,27 @@ +-- depends on default, digilines and mesecons for crafting recipes +minetest.register_craft({ + output = "advtrains_luaautomation:dtrack_placer", + recipe = { + {"","mesecons_luacontroller:luacontroller0000",""}, + {"","advtrains:dtrack_atc_placer",""}, + {"","digilines:wire_std_00000000",""}, + } +}) + +minetest.register_craft({ + output = "advtrains_luaautomation:mesecon_controller0000", + recipe = { + {"","mesecons:wire_00000000_off",""}, + {"mesecons:wire_00000000_off","advtrains_luaautomation:dtrack_placer","mesecons:wire_00000000_off"}, + {"","mesecons:wire_00000000_off",""}, + } +}) + +minetest.register_craft({ + output = "advtrains_luaautomation:oppanel", + recipe = { + {"","mesecons_button:button_off",""}, + {"","advtrains_luaautomation:mesecon_controller0000",""}, + {"","default:stone",""}, + } +})
\ No newline at end of file diff --git a/advtrains_luaautomation/settingtypes.txt b/advtrains_luaautomation/settingtypes.txt new file mode 100644 index 0000000..641254a --- /dev/null +++ b/advtrains_luaautomation/settingtypes.txt @@ -0,0 +1,2 @@ +# Enable or disable craft recipes for LuaATC components +advtrains_luaautomation_enable_luaatc_recipes (Enable LuaATC component craft recipes) bool true diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_LED_A.png b/advtrains_luaautomation/textures/atlatc_luacontroller_LED_A.png Binary files differnew file mode 100644 index 0000000..c6182cc --- /dev/null +++ b/advtrains_luaautomation/textures/atlatc_luacontroller_LED_A.png diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_LED_B.png b/advtrains_luaautomation/textures/atlatc_luacontroller_LED_B.png Binary files differnew file mode 100644 index 0000000..04c2da0 --- /dev/null +++ b/advtrains_luaautomation/textures/atlatc_luacontroller_LED_B.png diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_LED_C.png b/advtrains_luaautomation/textures/atlatc_luacontroller_LED_C.png Binary files differnew file mode 100644 index 0000000..01f6ae4 --- /dev/null +++ b/advtrains_luaautomation/textures/atlatc_luacontroller_LED_C.png diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_LED_D.png b/advtrains_luaautomation/textures/atlatc_luacontroller_LED_D.png Binary files differnew file mode 100644 index 0000000..6c8a26f --- /dev/null +++ b/advtrains_luaautomation/textures/atlatc_luacontroller_LED_D.png diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_bottom.png b/advtrains_luaautomation/textures/atlatc_luacontroller_bottom.png Binary files differnew file mode 100644 index 0000000..7ae955c --- /dev/null +++ b/advtrains_luaautomation/textures/atlatc_luacontroller_bottom.png diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_sides.png b/advtrains_luaautomation/textures/atlatc_luacontroller_sides.png Binary files differnew file mode 100644 index 0000000..40f4b60 --- /dev/null +++ b/advtrains_luaautomation/textures/atlatc_luacontroller_sides.png diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_top.png b/advtrains_luaautomation/textures/atlatc_luacontroller_top.png Binary files differnew file mode 100644 index 0000000..a5059af --- /dev/null +++ b/advtrains_luaautomation/textures/atlatc_luacontroller_top.png diff --git a/advtrains_luaautomation/textures/atlatc_oppanel.png b/advtrains_luaautomation/textures/atlatc_oppanel.png Binary files differnew file mode 100644 index 0000000..96eb30e --- /dev/null +++ b/advtrains_luaautomation/textures/atlatc_oppanel.png diff --git a/advtrains_luaautomation/textures/atlatc_pcnaming.png b/advtrains_luaautomation/textures/atlatc_pcnaming.png Binary files differnew file mode 100644 index 0000000..3fccdfc --- /dev/null +++ b/advtrains_luaautomation/textures/atlatc_pcnaming.png |
