Some updates

master
Andrey01 2017-04-29 19:19:53 +03:00 committed by GitHub
parent e2ad344b3b
commit 3ae71b73ce
100 changed files with 2691 additions and 0 deletions

BIN
advtrains.zip Normal file

Binary file not shown.

View File

@ -0,0 +1,2 @@
advtrains
intllib?

View File

@ -0,0 +1,113 @@
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
advtrains.register_wagon("engine_BBOE_1080", {
mesh="advtrains_engine_BBOE_1080.b3d",
textures = {"advtrains_engine_BBOE_1080.png"},
drives_on={default=true},
max_speed=20,
seats = {
{
name=S("Driver stand"),
attach_offset={x=0, y=8, z=13},
view_offset={x=0, y=0, z=0},
driving_ctrl_access=true,
group="dstand",
},
{
name="1",
attach_offset={x=-4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="2",
attach_offset={x=4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="3",
attach_offset={x=-4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="4",
attach_offset={x=4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
},
seat_groups = {
dstand={
name = "Driver Stand",
access_to = {"pass"},
require_doors_open=true,
},
pass={
name = "Engenier's area",
access_to = {"dstand"},
require_doors_open=true,
},
},
assign_to_seat_group = {"dstand"},
doors={
open={
[-1]={frames={x=0, y= 20}, time=1},
[1]={frames={x=40, y=60}, time=1}
},
close={
[-1]={frames={x=20, y=40}, time=1},
[1]={frames={x=60, y=80}, time=1}
}
},
door_entry={-1},
visual_size = {x=1, y=1},
wagon_span=3.0,
is_locomotive=true,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"advtrains_engine_BBÖ_1080"},
}, S("BBÖ 1080 "), "advtrains_engine_BBOE_1080_inv.png")
minetest.register_craft({
output = 'advtrains:engine_BBOE_1080',
recipe = {
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
{'dye:dark_green', 'dye:dark_green', 'dye:dark_green'},
{'default:steelblock', 'dye:dark_green', 'default:steelblock'},
},
})
advtrains.register_wagon("wagon_ware", {
mesh="advtrains_wagon_BBOE_ware.b3d",
textures = {"advtrains_wagon_BBOE_ware.png"},
drives_on={default=true},
max_speed=10,
seats = {},
visual_size = {x=1, y=1},
wagon_span=2.8,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"advtrains:wagon_coal"},
has_inventory = true,
get_inventory_formspec = function(self)
return "size[8,11]"..
"list[detached:advtrains_wgn_"..self.unique_id..";box;0,0;8,6;]"..
"list[current_player;main;0,7;8,4;]"..
"listring[]"
end,
inventory_list_sizes = {
box=8*2,
},
}, S("Ware Wagon(BBÖ)"), "advtrains_wagon_BBOE_ware_inv.png")
minetest.register_craft({
output = 'advtrains:wagon_BBOE_ware',
recipe = {
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
{'default:steelblock', 'dye:dark_brown', 'default:steelblock'},
{'default:steelblock', 'dye:dark_brown', 'default:steelblock'},
},
})

View File

@ -0,0 +1,4 @@
Driver Stand = Führerstand
Japanese Train Engine = Japanische Personenzug-Lokomotive
Default Seat = Standardsitzplatz
Japanese Train Wagon = Japanischer Personenzug-Passagierwaggon

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

View File

@ -0,0 +1,2 @@
advtrains
intllib?

83
advtrains_db_160/init.lua Normal file
View File

@ -0,0 +1,83 @@
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
advtrains.register_wagon("engine_DB_160", {
mesh="advtrains_DB_160.b3d",
textures = {"advtrains_DB_160.png"},
drives_on={default=true},
max_speed=20,
seats = {
{
name=S("Driver stand"),
attach_offset={x=0, y=8, z=13},
view_offset={x=0, y=0, z=0},
driving_ctrl_access=true,
group="dstand",
},
{
name="1",
attach_offset={x=-4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="2",
attach_offset={x=4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="3",
attach_offset={x=-4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="4",
attach_offset={x=4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
},
seat_groups = {
dstand={
name = "Driver Stand",
access_to = {"pass"},
require_doors_open=true,
},
pass={
name = "Engenier's area",
access_to = {"dstand"},
require_doors_open=true,
},
},
assign_to_seat_group = {"dstand"},
doors={
open={
[-1]={frames={x=0, y= 20}, time=1},
[1]={frames={x=40, y=60}, time=1}
},
close={
[-1]={frames={x=20, y=40}, time=1},
[1]={frames={x=60, y=80}, time=1}
}
},
door_entry={-1},
visual_size = {x=1, y=1},
wagon_span=3.0,
is_locomotive=true,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"advtrains_engine_DB_160"},
}, S("DB 160 "), "advtrains_DB_160_inv.png")
minetest.register_craft({
output = 'advtrains:engine_DB_160',
recipe = {
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
{'dye:red', 'dye:red', 'dye:red'},
{'default:steelblock', 'dye:red', 'default:steelblock'},
},
})

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

View File

@ -0,0 +1 @@
advtrains

View File

@ -0,0 +1,147 @@
local map_def={
example = {
p1x=168,
p1z=530,
p2x=780,
p2z=1016,
background="itm_example.png",
},
}
local itm_cache={}
local itm_pdata={}
local itm_conf_mindia=0.1
minetest.register_privilege("itm", { description = "Allows to display train map", give_to_singleplayer = true, default = false })
local function create_map_form_with_bg(d)
local minx, minz, maxx, maxz = math.min(d.p1x, d.p2x), math.min(d.p1z, d.p2z), math.max(d.p1x, d.p2x), math.max(d.p1z, d.p2z)
local form_x, form_z=10,10
local edge_x, edge_z = form_x/(maxx-minx), form_z/(maxz-minz)
local len_x, len_z=math.max(edge_x, itm_conf_mindia), math.max(edge_z, itm_conf_mindia)
local form="size["..(form_x+edge_x)..","..(form_z+edge_z).."] background[0,0;0,0;"..d.background..";true] "
local lbl={}
for pts, tid in pairs(advtrains.detector.on_node) do
local pos=minetest.string_to_pos(pts)
form=form.."box["..(edge_x*(pos.x-minx))..","..(form_z-(edge_z*(pos.z-minz)))..";"..len_x..","..len_z..";red]"
lbl[sid(tid)]=pos
end
for t_id, xz in pairs(lbl) do
form=form.."label["..(edge_x*(xz.x-minx))..","..(form_x-(edge_z*(xz.z-minz)))..";"..t_id.."]"
end
return form
end
local function create_map_form(d)
if d.background then
return create_map_form_with_bg(d)
end
local minx, minz, maxx, maxz = math.min(d.p1x, d.p2x), math.min(d.p1z, d.p2z), math.max(d.p1x, d.p2x), math.max(d.p1z, d.p2z)
local form_x, form_z=10,10
local edge_x, edge_z = form_x/(maxx-minx), form_z/(maxz-minz)
local len_x, len_z=math.max(edge_x, itm_conf_mindia), math.max(edge_z, itm_conf_mindia)
local form="size["..(form_x+edge_x)..","..(form_z+edge_z).."]"
local lbl={}
for x,itx in pairs(itm_cache) do
if x>=minx and x<=maxx then
for z,y in pairs(itx) do
if z>=minz and z<=maxz then
local adn=advtrains.detector.on_node[minetest.pos_to_string({x=x, y=y, z=z})]
local color="gray"
if adn then
color="red"
lbl[sid(adn)]={x=x, z=z}
end
form=form.."box["..(edge_x*(x-minx))..","..(form_z-(edge_z*(z-minz)))..";"..len_x..","..len_z..";"..color.."]"
end
end
end
end
for t_id, xz in pairs(lbl) do
form=form.."label["..(edge_x*(xz.x-minx))..","..(form_x-(edge_z*(xz.z-minz)))..";"..t_id.."]"
end
return form
end
local function cache_ndb()
itm_cache={}
local ndb_nodes=advtrains.ndb.get_nodes()
for y, xzt in pairs(ndb_nodes) do
for x, zt in pairs(xzt) do
for z, _ in pairs(zt) do
if not itm_cache[x] then
itm_cache[x]={}
end
itm_cache[x][z]=y
end
end
end
end
minetest.register_chatcommand("itm", {
params="[x1 z1 x2 z2] or [mdef]",
description="Display advtrains train map of given area.\nFirst form:[x1 z1 x2 z2] - specify area directly.\nSecond form:[mdef] - Use a predefined map background(see init.lua)\nThird form: No parameters - use WorldEdit position markers.",
privs={itm=true},
func = function(name, param)
local mdef=string.match(param, "^(%S+)$")
if mdef then
local d=map_def[mdef]
if not d then
return false, "Map definiton not found: "..mdef
end
itm_pdata[name]=map_def[mdef]
minetest.show_formspec(name, "itrainmap", create_map_form(d))
return true, "Showing train map: "..mdef
end
local x1, z1, x2, z2=string.match(param, "^(%S+) (%S+) (%S+) (%S+)$")
if not (x1 and z1 and x2 and z2) then
if worldedit then
local wep1, wep2=worldedit.pos1[name], worldedit.pos2[name]
if wep1 and wep2 then
x1, z1, x2, z2=wep1.x, wep1.z, wep2.x, wep2.z
end
end
end
if not (x1 and z1 and x2 and z2) then
return false, "Invalid parameters and no WE positions set"
end
local d={p1x=x1, p1z=z1, p2x=x2, p2z=z2}
itm_pdata[name]=d
minetest.show_formspec(name, "itrainmap", create_map_form(d))
return true, "Showing ("..x1..","..z1..")-("..x2..","..z2..")"
end,
})
minetest.register_chatcommand("itm_cache_ndb", {
params="",
description="Cache advtrains node database again. Run when tracks changed.",
privs={itm=true},
func = function(name, param)
cache_ndb()
return true, "Done caching node database."
end,
})
local timer=0
minetest.register_globalstep(function(dtime)
timer=timer-math.min(dtime, 0.1)
if timer<=0 then
for pname,d in pairs(itm_pdata) do
minetest.show_formspec(pname, "itrainmap", create_map_form(d))
end
timer=2
end
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname=="itrainmap" and fields.quit then
itm_pdata[player:get_player_name()]=nil
end
end)
--automatically run itm_cache_ndb
minetest.after(2, cache_ndb)

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

View File

@ -0,0 +1,165 @@
#### 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.
### atlatc
The mod is sometimes abbreviated as '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.
### Privilege
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.
### Active and passive
Active components are these who have LUA code running in them. They are triggered on specific events. Passive components are dumb, they only have a state and can be set to another state, they can't perform actions themselves.
### Environments
Each active component is assigned to an environment. This is where all data are 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.
/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.
### Active components
The code of every active component is run on specific events which are explained soon. When run, every variable written that is not local and is no function or userdata is saved over code re-runs and over server restarts. Additionally, the following global variables are defined:
# event
The variable 'event' contains a table with information on the current event. How this table can look is explained below.
# 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.
Example:
Component 1: S.stuff="foo"
Component 2: print(S.stuff)
-> foo
# 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.
# Standard Lua functions
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
Every attempt to overwrite any of the predefined values results in an error.
# LuaAutomation-specific global functions
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'. See section on passive components for more info.
pos can be either a position vector (created by POS()) or a string, the name of this passive component.
setstate(pos, newstate)
Set the state of the passive component at position 'pos'.
pos can be either a position vector (created by POS()) or a string, the name of this passive component.
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.
Not available in init code!
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.
## Components and events
The event table is a table of the following format:
{
type = "<type>",
<type> = true,
... additional content ...
}
You can check for the event type by either using
if event.type == "wanted" then ...do stuff... end
or
if event.wanted then ...do stuff... end
(if 'wanted' is the event type to check for)
# 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.
Examples:
A function to define behavior for trains in subway stations:
function F.station()
if event.train then atc_send("B0WOL") end
if event.int and event.message="depart" then atc_send("OCD1SM") end
end
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.
Functions are run in the environment of the currently active node, regardless of where they were defined. So, the 'event' table always reflects the state of the calling node.
The 'event' table of the init code is always {type="init", init=true}.
# ATC rails
The Lua-controlled ATC rails are the only components that can actually interface with trains. The following event types are generated:
{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 a long string (generated by concatenating os.time() and os.clock() at creation time). The Itrainmap mod displays the last 4 digits of this ID.
{type="int", int=true, message=<message>}
Fired when an interrupt set by the 'interrupt' function runs out. 'message' is the message passed to the interrupt function.
{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.
In addition to the default environment functions, the following functions are available:
atc_send(<atc_command>)
Sends the specified ATC command to the train and returns true. If there is no train, returns false and does nothing.
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.
atc_set_text_inside(text)
Set text shown to train passengers. Pass nil to show no text.
# 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.
The event fired is {type="punch", punch=true} by default. In case of an interrupt, the events are similar to the ones of the ATC rail.
### Passive components
All passive components can be interfaced with the setstate and getstate functions(see above).
Below, each apperance is mapped to the "state" of that node.
## Signals
The light signals are interfaceable, the analog signals are not.
"green" - Signal shows green light
"red" - Signal shows red light
## Switches
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.
## Mesecon Switch
The Mesecon switch can be switched using LuaAutomation. Note that this is not possible on levers, only the full-node 'Switch' block.
"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, like this:
(Imagine a signal that you have named "Stn_P1_out" at position (1,2,3) )
setstate("Stn_P1_out", "green") instead of setstate(POS(1,2,3), "green")
This way, you don't need to memorize positions.

View File

@ -0,0 +1,134 @@
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.after_place_node(pos, player)
advtrains.ndb.update(pos)
local meta=minetest.get_meta(pos)
meta:set_string("formspec", ac.getform(pos, meta))
meta:set_string("infotext", "LuaAutomation component, unconfigured.")
local ph=minetest.pos_to_string(pos)
--just get first available key!
for en,_ in pairs(atlatc.envs) do
ac.nodes[ph]={env=en}
return
end
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]=n
if n==env then
sel=#envs_asvalues
end
end
local form = "size[10,10]dropdown[0,0;3;env;"..table.concat(envs_asvalues, ",")..";"..sel.."]"
.."button[4,0;2,1;save;Save]button[7,0;2,1;cle;Clear local env] textarea[0.2,1;10,10;code;Code;"..minetest.formspec_escape(code).."]"
.."label[0,9.8;"..err.."]"
return form
end
function ac.after_dig_node(pos, node, player)
advtrains.invalidate_all_paths()
advtrains.ndb.clear(pos)
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(), "Missing privilege: atlatc - Operation cancelled!")
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
nodetbl.err=nil
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", "LuaAutomation component, assigned to environment '"..nodetbl.env.."'")
else
meta:set_string("infotext", "LuaAutomation component, invalid enviroment set!")
end
end
function ac.run_in_env(pos, evtdata, customfct_p)
local ph=minetest.pos_to_string(pos)
local nodetbl = ac.nodes[ph]
if not nodetbl then
atwarn("LuaAutomation component at",ph,": Data not in memory! Please visit component and click 'Save'!")
return
end
local meta
if minetest.get_node_or_nil(pos) then
meta=minetest.get_meta(pos)
end
if not nodetbl.env or not atlatc.envs[nodetbl.env] then
atwarn("LuaAutomation component at",ph,": Not an existing environment: "..(nodetbl.env or "<nil>"))
return false
end
if not nodetbl.code or nodetbl.code=="" then
atwarn("LuaAutomation component at",ph,": No code to run! (insert -- to suppress warning)")
return false
end
local customfct=customfct_p or {}
customfct.interrupt=function(t, imesg)
atlatc.interrupt.add(t, pos, {type="int", int=true, message=imesg})
end
local datain=nodetbl.data or {}
local succ, dataout = atlatc.envs[nodetbl.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
atwarn("LuaAutomation ATC interface rail at",ph,": LUA Error:",dataout)
if meta then
meta:set_string("infotext", "LuaAutomation ATC interface rail, ERROR:"..dataout)
end
end
if meta then
meta:set_string("formspec", ac.getform(pos, meta))
end
end
atlatc.active=ac

View File

@ -0,0 +1,120 @@
-- 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.
--Using subtable
local r={}
function r.fire_event(pos, evtdata)
local ph=minetest.pos_to_string(pos)
local railtbl = atlatc.active.nodes[ph]
if not railtbl then
atwarn("LuaAutomation ATC interface rail at",ph,": Data not in memory! Please visit position and click 'Save'!")
return
end
local arrowconn = railtbl.arrowconn
--prepare ingame API for ATC. Regenerate each time since pos needs to be known
--If no train, then return false.
local train_id=advtrains.detector.on_node[ph]
local train, atc_arrow, tvel
if train_id then train=advtrains.trains[train_id] end
if train then
if not train.path then
--we happened to get in between an invalidation step
--delay
atlatc.interrupt.add(0,pos,evtdata)
return
end
for index, ppos in pairs(train.path) do
if vector.equals(advtrains.round_vector_floor_y(ppos), pos) then
atc_arrow =
vector.equals(
advtrains.dirCoordSet(pos, arrowconn),
advtrains.round_vector_floor_y(train.path[index+train.movedir])
)
end
end
if atc_arrow==nil then
atwarn("LuaAutomation ATC rail at", pos, ": Rail not on train's path! Can't determine arrow direction. Assuming +!")
atc_arrow=true
end
tvel=train.velocity
end
local customfct={
atc_send = function(cmd)
if not train_id then return false end
assertt(cmd, "string")
advtrains.atc.train_reset_command(train_id)
train.atc_command=cmd
train.atc_arrow=atc_arrow
return true
end,
atc_reset = function(cmd)
if not train_id then return false end
assertt(cmd, "string")
advtrains.atc.train_reset_command(train_id)
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,
}
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=atltrans("LuaAutomation ATC Rail"),
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 _, conn1=advtrains.get_rail_info_at(pos, advtrains.all_tracktypes)
atlatc.active.nodes[ph].arrowconn=conn1
end,
advtrains = {
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,
},
luaautomation = {
fire_event=r.fire_event
}
}
end
}, advtrains.trackpresets.t_30deg_straightonly)
atlatc.rail = r

View File

@ -0,0 +1,84 @@
--chatcmds.lua
--Registers commands to modify the init and step code for LuaAutomation
--position helper.
--punching a node will result in that position being saved and inserted into a text field on the top of init form.
local punchpos={}
minetest.register_on_punchnode(function(pos, node, player, pointed_thing)
local pname=player:get_player_name()
punchpos[pname]=pos
end)
local function get_init_form(env, pname)
local err = env.init_err or ""
local code = env.init_code or ""
local ppos=punchpos[pname]
local pp=""
if ppos then
pp="POS"..minetest.pos_to_string(ppos)
end
local form = "size[10,10]button[0,0;2,1;run;Run InitCode]button[2,0;2,1;cls;Clear S]"
.."button[4,0;2,1;save;Save] button[6,0;2,1;del;Delete Env.] field[8.1,0.5;2,1;punchpos;Last punched position;"..pp.."]"
.."textarea[0.2,1;10,10;code;Environment initialization code;"..minetest.formspec_escape(code).."]"
.."label[0,9.8;"..err.."]"
return form
end
core.register_chatcommand("env_setup", {
params = "<environment name>",
description = "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,"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 = "Create an AdvTrains LuaAutomation environment",
privs = {atlatc=true},
func = function(name, param)
if not param or param=="" then return false, "Name required!" end
if atlatc.envs[param] then return false, "Environment already exists!" end
atlatc.envs[param] = atlatc.env_new(param)
return true, "Created environment '"..param.."'. Use '/env_setup "..param.."' to define global initialization code, or start building LuaATC components!"
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, "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("SURE TO DELETE ENVIRONMENT "..envname.."? Type YES (all uppercase) to continue or just quit form to cancel.")..";]")
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)

View File

@ -0,0 +1,2 @@
advtrains
mesecons_switch?

View File

@ -0,0 +1,270 @@
-------------
-- lua sandboxed environment
-- 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.step_code=data.step_code 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, step_code=self.step_code}
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"
}
--print is actually minetest.chat_send_all()
--using advtrains.print_concat_table because it's cool
local function safe_print(t, ...)
local str=advtrains.print_concat_table({t, ...})
minetest.log("action", "[atlatc] "..str)
minetest.chat_send_all(str)
end
local function safe_date()
return(os.date("*t",os.time()))
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 p_api_getstate, p_api_setstate = dofile(mp.."/passive.lua")
local static_env = {
--core LUA functions
print = safe_print,
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 = p_api_getstate,
setstate = p_api_setstate,
--interrupts are handled per node, position unknown.
--however external interrupts can be set here.
interrupt_pos = function(pos, imesg)
if not type(pos)=="table" or not pos.x or not pos.y or not pos.z then
debug.sethook()
error("Invalid position supplied to interrupt_pos")
end
atlatc.interrupt.add(0, pos, {type="ext_int", ext_int=true, message=imesg})
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)
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]
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
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
atwarn("[atlatc]Executing InitCode for '"..self.name.."' failed:"..err)
self.init_err=err
end
end
end
function env_proto:run_stepcode()
if self.step_code and self.step_code~="" then
local succ, err = self:execute_code({}, self.step_code, nil, {})
if not succ then
--TODO
end
end
end
--- class interface
function atlatc.env_new(name)
local newenv={
name=name,
init_code="",
step_code="",
sdata={}
}
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
function atlatc.run_stepcode()
for envname, env in pairs(atlatc.envs) do
env:run_stepcode()
end
end

View File

@ -0,0 +1,114 @@
-- advtrains_luaautomation/init.lua
-- Lua automation features for advtrains
-- Uses global table 'atlatc' (AdvTrains_LuaATC)
-- Boilerplate to support localized strings if intllib mod is installed.
if minetest.get_modpath("intllib") then
atltrans = intllib.Getter()
else
atltrans = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
--Privilege
--Only trusted players should be enabled to build stuff which can break the server.
atlatc = { envs = {}}
minetest.register_privilege("atlatc", { description = "Player can place and modify LUA ATC components. Grant with care! Allows to execute bad LUA code.", give_to_singleplayer = false, default= false })
--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")
dofile(mp.."/pcnaming.lua")
if mesecon then
dofile(mp.."/p_mesecon_iface.lua")
end
dofile(mp.."/chatcmds.lua")
local filename=minetest.get_worldpath().."/advtrains_luaautomation"
local file, err = io.open(filename, "r")
if not file then
minetest.log("error", " Failed to read advtrains_luaautomation save data from file "..filename..": "..(err or "Unknown Error"))
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()
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(),
}
local datastr = minetest.serialize(save_tbl)
if not datastr then
minetest.log("error", " Failed to save advtrains_luaautomation save data to file "..filename..": Can't serialize!")
return
end
local file, err = io.open(filename, "w")
if err then
minetest.log("error", " Failed to save advtrains_luaautomation save data to file "..filename..": "..(err or "Unknown Error"))
return
end
file:write(datastr)
file:close()
end
minetest.register_on_shutdown(atlatc.save)
-- globalstep for step code
local timer, step_int=0, 2
local stimer, sstep_int=0, 10
minetest.register_globalstep(function(dtime)
timer=timer+dtime
if timer>step_int then
timer=0
atlatc.run_stepcode()
end
stimer=stimer+dtime
if stimer>sstep_int then
stimer=0
atlatc.save()
end
end)

View File

@ -0,0 +1,48 @@
-- 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.add(t, pos, evtdata)
queue[#queue+1]={t=t+timer, p=pos, e=evtdata}
run=true
end
minetest.register_globalstep(function(dtime)
if run then
timer=timer + math.min(dtime, 0.2)
for i=1,#queue do
local qe=queue[i]
if not qe then
table.remove(queue, i)
i=i-1
elseif timer>qe.t then
local pos, evtdata=queue[i].p, queue[i].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)
end
table.remove(queue, i)
i=i-1
end
end
end
end)
atlatc.interrupt=iq

View File

@ -0,0 +1,23 @@
local function on_punch(pos, player)
atlatc.interrupt.add(0, pos, {type="punch", punch=true})
end
minetest.register_node("advtrains_luaautomation:oppanel", {
drawtype = "normal",
tiles={"atlatc_oppanel.png"},
description = "LuaAutomation operation panel",
groups = {
choppy = 1,
save_in_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
}
})

View File

@ -0,0 +1,53 @@
-- p_mesecon_iface.lua
-- Mesecons interface by overriding the switch
if not mesecon then return end
minetest.override_item("mesecons_switch:mesecon_switch_off", {
groups = {
dig_immediate=2,
save_in_nodedb=1,
},
on_rightclick = function (pos, node)
advtrains.ndb.swap_node(pos, {name="mesecons_switch:mesecon_switch_on", param2=node.param2})
mesecon.receptor_on(pos)
minetest.sound_play("mesecons_switch", {pos=pos})
end,
on_updated_from_nodedb = function(pos, node)
mesecon.receptor_off(pos)
end,
luaautomation = {
getstate = "off",
setstate = function(pos, node, newstate)
if newstate=="on" then
advtrains.ndb.swap_node(pos, {name="mesecons_switch:mesecon_switch_on", param2=node.param2})
mesecon.receptor_on(pos)
end
end,
},
})
minetest.override_item("mesecons_switch:mesecon_switch_on", {
groups = {
dig_immediate=2,
save_in_nodedb=1,
not_in_creative_inventory=1,
},
on_rightclick = function (pos, node)
advtrains.ndb.swap_node(pos, {name="mesecons_switch:mesecon_switch_off", param2=node.param2})
mesecon.receptor_off(pos)
minetest.sound_play("mesecons_switch", {pos=pos})
end,
on_updated_from_nodedb = function(pos, node)
mesecon.receptor_on(pos)
end,
luaautomation = {
getstate = "on",
setstate = function(pos, node, newstate)
if newstate=="off" then
advtrains.ndb.swap_node(pos, {name="mesecons_switch:mesecon_switch_off", param2=node.param2})
mesecon.receptor_off(pos)
end
end,
},
})

View File

@ -0,0 +1,39 @@
-- passive.lua
-- API to passive components, as described in passive_api.txt
local function getstate(parpos)
local pos=atlatc.pcnaming.resolve_pos(parpos)
if type(pos)~="table" or (not pos.x or not pos.y or not pos.z) then
debug.sethook()
error("Invalid position supplied to getstate")
end
local node=advtrains.ndb.get_node(pos)
local ndef=minetest.registered_nodes[node.name]
if ndef and ndef.luaautomation and ndef.luaautomation.getstate then
local st=ndef.luaautomation.getstate
if type(st)=="function" then
return st(pos, node)
else
return st
end
end
return nil
end
local function setstate(parpos, newstate)
local pos=atlatc.pcnaming.resolve_pos(parpos)
if type(pos)~="table" or (not pos.x or not pos.y or not pos.z) then
debug.sethook()
error("Invalid position supplied to setstate")
end
local node=advtrains.ndb.get_node(pos)
local ndef=minetest.registered_nodes[node.name]
if ndef and ndef.luaautomation and ndef.luaautomation.setstate then
local st=ndef.luaautomation.setstate
st(pos, node, newstate)
end
end
-- gets called from environment.lua
-- return the values here to keep them local
return getstate, setstate

View File

@ -0,0 +1,23 @@
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
All passive components have a table called 'luaautomation' in their node definition and have the group 'save_in_nodedb' set, so they work in unloaded chunks.
Example for a switch:
luaautomation = {
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
}

View File

@ -0,0 +1,74 @@
--pcnaming.lua
--a.k.a Passive component naming
--Allows to assign names to passive components, so they can be called like:
--setstate("iamasignal", "green")
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(posorname)
if type(posorname)=="table" then return posorname end
return atlatc.pcnaming.name_map[posorname]
end
minetest.register_craftitem("advtrains_luaautomation:pcnaming",{
description = attrans("Passive Component Naming Tool\n\nRight-click to name a passive component."),
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, "Missing 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=minetest.get_node(pos)
local ndef=minetest.registered_nodes[node.name]
if ndef then
if ndef.luaautomation 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
minetest.show_formspec(pname, "atlatc_naming_"..minetest.pos_to_string(pos), "field[pn;Set name of component (empty to clear);"..pn.."]")
end
end
end
end,
})
minetest.register_on_player_receive_fields(function(player, formname, fields)
local pts=string.match(formname, "^atlatc_naming_(.+)")
if pts then
local pos=minetest.string_to_pos(pts)
if fields.pn 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

View File

@ -0,0 +1,2 @@
advtrains
intllib?

View File

@ -0,0 +1,83 @@
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
advtrains.register_wagon("engine_railbus", {
mesh="advtrains_railbus.b3d",
textures = {"advtrains_railbus.png"},
drives_on={default=true},
max_speed=20,
seats = {
{
name=S("Driver stand"),
attach_offset={x=0, y=8, z=13},
view_offset={x=0, y=0, z=0},
driving_ctrl_access=true,
group="dstand",
},
{
name="1",
attach_offset={x=-4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="2",
attach_offset={x=4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="3",
attach_offset={x=-4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="4",
attach_offset={x=4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
},
seat_groups = {
dstand={
name = "Driver Stand",
access_to = {"pass"},
require_doors_open=true,
},
pass={
name = "Passenger area",
access_to = {"dstand"},
require_doors_open=true,
},
},
assign_to_seat_group = {"dstand", "pass"},
doors={
open={
[-1]={frames={x=0, y=20}, time=1},
[1]={frames={x=40, y=60}, time=1}
},
close={
[-1]={frames={x=20, y=40}, time=1},
[1]={frames={x=60, y=80}, time=1}
}
},
door_entry={-1},
visual_size = {x=1, y=1},
wagon_span=2.5,
is_locomotive=true,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"advtrains:railbus"},
}, S("railbus"), "advtrains_railbus_inv.png")
minetest.register_craft({
output = 'advtrains:engine_railbus',
recipe = {
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
{'dye:red', 'dye:red', 'dye:yellow'},
{'default:steelblock', 'dye:yellow', 'default:steelblock'},
},
})

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B

View File

@ -0,0 +1,2 @@
advtrains
intllib?

View File

@ -0,0 +1,83 @@
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
advtrains.register_wagon("engine_BBOE_1080", {
mesh="advtrains_engine_BBOE_1080.b3d",
textures = {"advtrains_engine_BBOE_1080.png"},
drives_on={default=true},
max_speed=20,
seats = {
{
name=S("Driver stand"),
attach_offset={x=0, y=8, z=13},
view_offset={x=0, y=0, z=0},
driving_ctrl_access=true,
group="dstand",
},
{
name="1",
attach_offset={x=-4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="2",
attach_offset={x=4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="3",
attach_offset={x=-4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="4",
attach_offset={x=4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
},
seat_groups = {
dstand={
name = "Driver Stand",
access_to = {"pass"},
require_doors_open=true,
},
pass={
name = "Engenier's area",
access_to = {"dstand"},
require_doors_open=true,
},
},
assign_to_seat_group = {"dstand"},
doors={
open={
[-1]={frames={x=0, y=20}, time=1},
[1]={frames={x=40, y=60}, time=1}
},
close={
[-1]={frames={x=20, y=40}, time=1},
[1]={frames={x=60, y=80}, time=1}
}
},
door_entry={-1},
visual_size = {x=1, y=1},
wagon_span=2.5,
is_locomotive=true,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"advtrains_engine_BBÖ_1080"},
}, S("BBÖ 1080 "), "advtrains_engine_BBÖ_1080_inv.png")
minetest.register_craft({
output = 'advtrains:engine_BBOE_1080',
recipe = {
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
{'dye:dark_red', 'dye:dark_red', 'dye:dark_red'},
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
},
})

View File

@ -0,0 +1,4 @@
Driver Stand = Führerstand
Japanese Train Engine = Japanische Personenzug-Lokomotive
Default Seat = Standardsitzplatz
Japanese Train Wagon = Japanischer Personenzug-Passagierwaggon

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

View File

@ -0,0 +1,2 @@
advtrains
intllib?

View File

@ -0,0 +1,84 @@
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
advtrains.register_wagon("engine_industrial", {
mesh="advtrains_engine_industrial.b3d",
textures = {"advtrains_engine_industrial.png"},
drives_on={default=true},
max_speed=20,
seats = {
{
name=S("Driver Stand (left)"),
attach_offset={x=-5, y=10, z=-10},
view_offset={x=0, y=10, z=0},
driving_ctrl_access=true,
group = "dstand",
},
{
name=S("Driver Stand (right)"),
attach_offset={x=5, y=10, z=-10},
view_offset={x=0, y=10, z=0},
driving_ctrl_access=true,
group = "dstand",
},
},
seat_groups = {
dstand={
name = "Driver Stand",
access_to = {},
},
},
assign_to_seat_group = {"dstand"},
visual_size = {x=1, y=1},
wagon_span=2.6,
is_locomotive=true,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"default:steelblock 4"},
}, S("Industrial Train Engine"), "advtrains_engine_industrial_inv.png")
advtrains.register_wagon("wagon_tank", {
mesh="advtrains_wagon_tank.b3d",
textures = {"advtrains_wagon_tank.png"},
seats = {},
drives_on={default=true},
max_speed=20,
visual_size = {x=1, y=1},
wagon_span=2.2,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"default:steelblock 4"},
has_inventory = true,
get_inventory_formspec = function(self)
return "size[8,11]"..
"list[detached:advtrains_wgn_"..self.unique_id..";box;0,0;8,6;]"..
"list[current_player;main;0,7;8,4;]"..
"listring[]"
end,
inventory_list_sizes = {
box=8*6,
},
}, S("Industrial tank wagon"), "advtrains_wagon_tank_inv.png")
advtrains.register_wagon("wagon_wood", {
mesh="advtrains_wagon_wood.b3d",
textures = {"advtrains_wagon_wood.png"},
seats = {},
drives_on={default=true},
max_speed=20,
visual_size = {x=1, y=1},
wagon_span=1.8,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"default:steelblock 4"},
has_inventory = true,
get_inventory_formspec = function(self)
return "size[8,11]"..
"list[detached:advtrains_wgn_"..self.unique_id..";box;0,0;8,6;]"..
"list[current_player;main;0,7;8,4;]"..
"listring[]"
end,
inventory_list_sizes = {
box=8*6,
},
}, S("Industrial wood wagon"), "advtrains_wagon_wood_inv.png")

View File

@ -0,0 +1,5 @@
Driver Stand (left) = Führerstand Links
Driver Stand (right) = Führerstand Rechts
Industrial Train Engine = Industrielle Lokomotive
Industrial tank wagon = Tankwaggon
Industrial wood wagon = Holztransportwaggon

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

View File

@ -0,0 +1,2 @@
advtrains
intllib?

View File

@ -0,0 +1,144 @@
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
advtrains.register_wagon("engine_japan", {
mesh="advtrains_engine_japan.b3d",
textures = {"advtrains_engine_japan.png"},
drives_on={default=true},
max_speed=20,
seats = {
{
name=S("Driver stand"),
attach_offset={x=0, y=8, z=13},
view_offset={x=0, y=0, z=0},
driving_ctrl_access=true,
group="dstand",
},
{
name="1",
attach_offset={x=-4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="2",
attach_offset={x=4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="3",
attach_offset={x=-4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="4",
attach_offset={x=4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
},
seat_groups = {
dstand={
name = "Driver Stand",
access_to = {"pass"},
require_doors_open=true,
},
pass={
name = "Passenger area",
access_to = {"dstand"},
require_doors_open=true,
},
},
assign_to_seat_group = {"dstand", "pass"},
doors={
open={
[-1]={frames={x=0, y=20}, time=1},
[1]={frames={x=40, y=60}, time=1}
},
close={
[-1]={frames={x=20, y=40}, time=1},
[1]={frames={x=60, y=80}, time=1}
}
},
door_entry={-1},
visual_size = {x=1, y=1},
wagon_span=2.5,
is_locomotive=true,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"default:steelblock 4"},
}, S("Japanese Train Engine"), "advtrains_engine_japan_inv.png")
advtrains.register_wagon("wagon_japan", {
mesh="advtrains_wagon_japan.b3d",
textures = {"advtrains_wagon_japan.png"},
drives_on={default=true},
max_speed=20,
seats = {
{
name="1",
attach_offset={x=-4, y=8, z=8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="2",
attach_offset={x=4, y=8, z=8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="1a",
attach_offset={x=-4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="2a",
attach_offset={x=4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="3",
attach_offset={x=-4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="4",
attach_offset={x=4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
},
seat_groups = {
pass={
name = "Passenger area",
access_to = {},
require_doors_open=true,
},
},
assign_to_seat_group = {"pass"},
doors={
open={
[-1]={frames={x=0, y=20}, time=1},
[1]={frames={x=40, y=60}, time=1}
},
close={
[-1]={frames={x=20, y=40}, time=1},
[1]={frames={x=60, y=80}, time=1}
}
},
door_entry={-1, 1},
visual_size = {x=1, y=1},
wagon_span=2.3,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"default:steelblock 4"},
}, S("Japanese Train Wagon"), "advtrains_wagon_japan_inv.png")

View File

@ -0,0 +1,4 @@
Driver Stand = Führerstand
Japanese Train Engine = Japanische Personenzug-Lokomotive
Default Seat = Standardsitzplatz
Japanese Train Wagon = Japanischer Personenzug-Passagierwaggon

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

View File

@ -0,0 +1,2 @@
advtrains
intllib?

View File

@ -0,0 +1,242 @@
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
advtrains.register_wagon("newlocomotive", {
mesh="advtrains_engine_steam.b3d",
textures = {"advtrains_engine_steam.png"},
is_locomotive=true,
drives_on={default=true},
max_speed=10,
seats = {
{
name=S("Driver Stand (left)"),
attach_offset={x=-5, y=10, z=-10},
view_offset={x=0, y=6, z=0},
driving_ctrl_access=true,
group = "dstand",
},
{
name=S("Driver Stand (right)"),
attach_offset={x=5, y=10, z=-10},
view_offset={x=0, y=6, z=0},
driving_ctrl_access=true,
group = "dstand",
},
},
seat_groups = {
dstand={
name = "Driver Stand",
access_to = {},
},
},
assign_to_seat_group = {"dstand"},
visual_size = {x=1, y=1},
wagon_span=1.85,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
update_animation=function(self, velocity)
if self.old_anim_velocity~=advtrains.abs_ceil(velocity) then
self.object:set_animation({x=1,y=80}, advtrains.abs_ceil(velocity)*15, 0, true)
self.old_anim_velocity=advtrains.abs_ceil(velocity)
end
end,
custom_on_activate = function(self, staticdata_table, dtime_s)
minetest.add_particlespawner({
amount = 10,
time = 0,
-- ^ If time is 0 has infinite lifespan and spawns the amount on a per-second base
minpos = {x=0, y=2, z=1.2},
maxpos = {x=0, y=2, z=1.2},
minvel = {x=-0.2, y=1.8, z=-0.2},
maxvel = {x=0.2, y=2, z=0.2},
minacc = {x=0, y=-0.1, z=0},
maxacc = {x=0, y=-0.3, z=0},
minexptime = 2,
maxexptime = 4,
minsize = 1,
maxsize = 5,
-- ^ The particle's properties are random values in between the bounds:
-- ^ minpos/maxpos, minvel/maxvel (velocity), minacc/maxacc (acceleration),
-- ^ minsize/maxsize, minexptime/maxexptime (expirationtime)
collisiondetection = true,
-- ^ collisiondetection: if true uses collision detection
vertical = false,
-- ^ vertical: if true faces player using y axis only
texture = "smoke_puff.png",
-- ^ Uses texture (string)
attached = self.object,
})
end,
drops={"default:steelblock 4"},
}, S("Steam Engine"), "advtrains_engine_steam_inv.png")
advtrains.register_wagon("detailed_steam_engine", {
mesh="advtrains_detailed_steam_engine.b3d",
textures = {"advtrains_detailed_steam_engine.png"},
is_locomotive=true,
drives_on={default=true},
max_speed=10,
seats = {
{
name=S("Driver Stand (left)"),
attach_offset={x=-5, y=10, z=-10},
view_offset={x=0, y=6, z=0},
driving_ctrl_access=true,
group = "dstand",
},
{
name=S("Driver Stand (right)"),
attach_offset={x=5, y=10, z=-10},
view_offset={x=0, y=6, z=0},
driving_ctrl_access=true,
group = "dstand",
},
},
seat_groups = {
dstand={
name = "Driver Stand",
access_to = {},
},
},
assign_to_seat_group = {"dstand"},
visual_size = {x=1, y=1},
wagon_span=2.05,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
update_animation=function(self, velocity)
if self.old_anim_velocity~=advtrains.abs_ceil(velocity) then
self.object:set_animation({x=1,y=80}, advtrains.abs_ceil(velocity)*15, 0, true)
self.old_anim_velocity=advtrains.abs_ceil(velocity)
end
end,
custom_on_activate = function(self, staticdata_table, dtime_s)
minetest.add_particlespawner({
amount = 10,
time = 0,
-- ^ If time is 0 has infinite lifespan and spawns the amount on a per-second base
minpos = {x=0, y=2.3, z=1.45},
maxpos = {x=0, y=2.3, z=1.4},
minvel = {x=-0.2, y=1.8, z=-0.2},
maxvel = {x=0.2, y=2, z=0.2},
minacc = {x=0, y=-0.1, z=0},
maxacc = {x=0, y=-0.3, z=0},
minexptime = 2,
maxexptime = 4,
minsize = 1,
maxsize = 5,
-- ^ The particle's properties are random values in between the bounds:
-- ^ minpos/maxpos, minvel/maxvel (velocity), minacc/maxacc (acceleration),
-- ^ minsize/maxsize, minexptime/maxexptime (expirationtime)
collisiondetection = true,
-- ^ collisiondetection: if true uses collision detection
vertical = false,
-- ^ vertical: if true faces player using y axis only
texture = "smoke_puff.png",
-- ^ Uses texture (string)
attached = self.object,
})
end,
drops={"default:steelblock 4"},
}, S("Detailed Steam Engine"), "advtrains_detailed_engine_steam_inv.png")
advtrains.register_wagon("wagon_default", {
mesh="advtrains_passenger_wagon.b3d",
textures = {"advtrains_wagon.png"},
drives_on={default=true},
max_speed=10,
seats = {
{
name="1",
attach_offset={x=-4, y=8, z=8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="2",
attach_offset={x=4, y=8, z=8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="3",
attach_offset={x=-4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="4",
attach_offset={x=4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
},
seat_groups = {
pass={
name = "Passenger area",
access_to = {},
},
},
assign_to_seat_group = {"pass"},
visual_size = {x=1, y=1},
wagon_span=3.1,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"default:steelblock 4"},
}, S("Passenger Wagon"), "advtrains_wagon_inv.png")
advtrains.register_wagon("wagon_box", {
mesh="advtrains_wagon.b3d",
textures = {"advtrains_wagon_box.png"},
drives_on={default=true},
max_speed=10,
seats = {},
visual_size = {x=1, y=1},
wagon_span=1.8,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"default:steelblock 4"},
has_inventory = true,
get_inventory_formspec = function(self)
return "size[8,11]"..
"list[detached:advtrains_wgn_"..self.unique_id..";box;0,0;8,6;]"..
"list[current_player;main;0,7;8,4;]"..
"listring[]"
end,
inventory_list_sizes = {
box=8*6,
},
}, S("Box Wagon"), "advtrains_wagon_box_inv.png")
minetest.register_craft({
output = 'advtrains:newlocomotive',
recipe = {
{'', '', 'advtrains:chimney'},
{'advtrains:driver_cab', 'dye:black', 'advtrains:boiler'},
{'advtrains:wheel', 'advtrains:wheel', 'advtrains:wheel'},
},
})
minetest.register_craft({
output = 'advtrains:detailed_steam_engine',
recipe = {
{'', '', 'advtrains:chimney'},
{'advtrains:driver_cab', 'dye:green', 'advtrains:boiler'},
{'advtrains:wheel', 'advtrains:wheel', 'advtrains:wheel'},
},
})
minetest.register_craft({
output = 'advtrains:wagon_default',
recipe = {
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
{'default:glass', 'dye:dark_green', 'default:glass'},
{'advtrains:wheel', 'advtrains:wheel', 'advtrains:wheel'},
},
})
minetest.register_craft({
output = 'advtrains:wagon_box',
recipe = {
{'group:wood', 'group:wood', 'group:wood'},
{'group:wood', 'default:chest', 'group:wood'},
{'advtrains:wheel', '', 'advtrains:wheel'},
},
})

View File

@ -0,0 +1,6 @@
Driver Stand (left) = Führerstand Links
Driver Stand (right) = Führerstand Rechts
Steam Engine = Dampflokomotive
Detailed Steam Engine = detaillierte Dampflokomotive
Passenger Wagon = Passagierwaggon
Box wagon = Güterwaggon

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 709 B

View File

@ -0,0 +1,2 @@
advtrains
intllib?

View File

@ -0,0 +1,90 @@
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
advtrains.register_wagon("subway_wagon", {
mesh="advtrains_subway_wagon.b3d",
textures = {"advtrains_subway_wagon.png"},
drives_on={default=true},
max_speed=15,
seats = {
{
name="Driver stand",
attach_offset={x=0, y=10, z=0},
view_offset={x=0, y=0, z=0},
driving_ctrl_access=true,
group="dstand",
},
{
name="1",
attach_offset={x=-4, y=8, z=8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="2",
attach_offset={x=4, y=8, z=8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="3",
attach_offset={x=-4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="4",
attach_offset={x=4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
},
seat_groups = {
dstand={
name = "Driver Stand",
access_to = {"pass"},
require_doors_open=true,
},
pass={
name = "Passenger area",
access_to = {"dstand"},
require_doors_open=true,
},
},
assign_to_seat_group = {"pass","dstand"},
doors={
open={
[-1]={frames={x=0, y=20}, time=1},
[1]={frames={x=40, y=60}, time=1}
},
close={
[-1]={frames={x=20, y=40}, time=1},
[1]={frames={x=60, y=80}, time=1}
}
},
door_entry={-1, 1},
visual_size = {x=1, y=1},
wagon_span=2,
--collisionbox = {-1.0,-0.5,-1.8, 1.0,2.5,1.8},
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
is_locomotive=true,
drops={"default:steelblock 4"},
--custom_on_activate = function(self, dtime_s)
-- atprint("subway custom_on_activate")
-- self.object:set_animation({x=1,y=80}, 15, 0, true)
--end,
}, S("Subway Passenger Wagon"), "advtrains_subway_wagon_inv.png")
--wagons
minetest.register_craft({
output = 'advtrains:subway_wagon',
recipe = {
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
{'default:steelblock', 'dye:yellow', 'default:steelblock'},
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
},
})

View File

@ -0,0 +1,2 @@
Default Seat (driver stand) = Standardsitzplatz (Führerstand)
Subway Passenger Wagon = U-Bahn-Waggon

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

View File

@ -0,0 +1,2 @@
advtrains
intllib?

112
advtrains_transib/init.lua Normal file
View File

@ -0,0 +1,112 @@
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
advtrains.register_wagon("engine_transib", {
mesh="advtrains_engine_transib.b3d",
textures = {"advtrains_engine_transib.png"},
drives_on={default=true},
max_speed=20,
seats = {
{
name=S("Driver stand"),
attach_offset={x=0, y=8, z=13},
view_offset={x=0, y=0, z=0},
driving_ctrl_access=true,
group="dstand",
},
{
name="1",
attach_offset={x=-4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="2",
attach_offset={x=4, y=8, z=0},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="3",
attach_offset={x=-4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
{
name="4",
attach_offset={x=4, y=8, z=-8},
view_offset={x=0, y=0, z=0},
group="pass",
},
},
seat_groups = {
dstand={
name = "Driver Stand",
access_to = {"pass"},
require_doors_open=true,
},
pass={
name = "Passenger area",
access_to = {"dstand"},
require_doors_open=true,
},
},
assign_to_seat_group = {"dstand", "pass"},
doors={
open={
[-1]={frames={x=0, y=20}, time=1},
[1]={frames={x=40, y=60}, time=1}
},
close={
[-1]={frames={x=20, y=40}, time=1},
[1]={frames={x=60, y=80}, time=1}
}
},
door_entry={-1},
visual_size = {x=1, y=1},
wagon_span=3.4,
is_locomotive=true,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"advtrains:transib"},
}, S("transib "), "advtrains_engine_transib_inv.png")
minetest.register_craft({
output = 'advtrains:engine_transib',
recipe = {
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
{'dye:blue', 'dye:blue', 'dye:blue'},
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
},
})
advtrains.register_wagon("wagon_coal", {
mesh="advtrains_wagon_coal.b3d",
textures = {"advtrains_wagon_coal.png"},
drives_on={default=true},
max_speed=10,
seats = {},
visual_size = {x=1, y=1},
wagon_span=2.2,
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"advtrains:wagon_coal"},
has_inventory = true,
get_inventory_formspec = function(self)
return "size[8,11]"..
"list[detached:advtrains_wgn_"..self.unique_id..";box;0,0;8,6;]"..
"list[current_player;main;0,7;8,4;]"..
"listring[]"
end,
inventory_list_sizes = {
box=8*6,
},
}, S("Coal Wagon(for transib)"), "advtrains_wagon_coal_inv.png")
minetest.register_craft({
output = 'advtrains:wagon_coal',
recipe = {
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
{'dye:red', 'dye:red', 'dye:red'},
{'default:steelblock', 'dye:black', 'default:steelblock'},
},
})

View File

@ -0,0 +1,4 @@
Driver Stand = Führerstand
Japanese Train Engine = Japanische Personenzug-Lokomotive
Default Seat = Standardsitzplatz
Japanese Train Wagon = Japanischer Personenzug-Passagierwaggon

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 B

83
atc_command.txt Normal file
View File

@ -0,0 +1,83 @@
ATC Command Syntax
A train runs the current ATC command once it receives it, including delayed instructions. If the train receives a new command, the current command is discarded.
Spaces can be inserted into commands as needed and are ignored.
# simple commands:
S<[0-9]+ speed or 'M'>
Set target speed of train to <speed>. Accelerates if slower, rolls if faster. 'M' means maximum speed.
Execution of command continues immediately.
B<[0-9]+ speed>
Brake until speed is reached. If faster, apply brakes, if slower, do nothing.
Execution of command continues immediately.
Examples:
SM : accelerate to maximum speed
S0 : roll to stand
B0 : brake to stand
S0B3 or B3S0: brake to 3, then roll to stand.
W
Wait until S and/or B commands reached the desired speed before continuing execution.
D<[0-9]+ time>
Delay: Wait for time seconds before continuing execution.
R
Reverse: change movement direction of train. ONLY WORKS WHEN TRAIN STANDS, else no-op.
Use B0WR to definitely change direction.
Examples:
B0 W R D10 SM
Subway train stopping in dead end station and returning in opposite direction
OL
Open left doors
OR
Open right doors
OC
Close Doors
All door commands are relative to the arrow direction, so if a train drives to opposite arrow direction, L will open its right doors from driver perspective.
Execution continues immediately, there is no way to wait for all doors to be opened/closed.
Example:
B0 W OL D10 OC D1 SM
Subway train: stop in station and open doors, depart after 10 seconds.
# conditional statements:
I<condition><code>;
Execute code only if condition applies
I<condition><code1>E<code2>;
Execute code1 only if condition applies, else execute code2
Conditions:
+ / -
Tests the train's movement direction against the arrow on the ATC rail: M+ is true when train drives in direction of arrow.
[</>/<=/>=][speed]
Test if train's speed is greater or smaller than the given value
Examples:
I- B0 W R ; S8
If the train drives in the 'wrong' direction, stop and reverse; independently accelerate to speed 8 afterwards.
I<8 S8 ;
If the train is slower than 8, accelerate to 8.
# ATC controller operation modes
static: Only give 1 static command.
mesecon: Give 2 different commands depending on if the controller is mesecon-powered or not
digiline: Don't give any commands by itself. When a train passes, a digiline message in the form of "[+/-][speed]" is sent on the set channel (where +/- means the same as with conditions). Any digiline message sent to the controller will be interpreted as ATC command and sent to the train.
** the latter two are not yet implemented.
# Persistence
ATC controllers that are configured as 'static' or 'mesecon' are persistent over mapblock unloads and will even command the train when the mapblock is unloaded. This is not possible with digilines since these do not work in unloaded mapchunks.
# LUA ATC controller (in development)
The LUA ATC Controller will operate by using LUA code. All operations shown above will have a function equivalent. Additionally all LUA ATC controllers share an environment and setting signal and switch status will be possible to allow for complicated railway systems/fully automated subways a.s.o.
Also planned:
- digicompute add-on to allow computer access to the ATC environment (railway maps... ... ... ... ...)

142
license.txt Normal file
View File

@ -0,0 +1,142 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.
To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.
Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.
When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.
We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.
For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.
Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.
(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.
In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.
If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:
a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.
e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.
b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.
11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

63
license_media.txt Normal file
View File

@ -0,0 +1,63 @@
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
1. Definitions
"Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License.
"Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(g) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License.
"Distribute" means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership.
"License Elements" means the following high-level license attributes as selected by Licensor and indicated in the title of this License: Attribution, Noncommercial, ShareAlike.
"Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License.
"Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast.
"Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work.
"You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
"Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
"Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium.
2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws.
3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections;
to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified.";
to Distribute and Publicly Perform the Work including as incorporated in Collections; and,
to Distribute and Publicly Perform Adaptations.
The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved, including but not limited to the rights described in Section 4(e).
4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(d), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(d), as requested.
You may Distribute or Publicly Perform an Adaptation only under: (i) the terms of this License; (ii) a later version of this License with the same License Elements as this License; (iii) a Creative Commons jurisdiction license (either this or a later license version) that contains the same License Elements as this License (e.g., Attribution-NonCommercial-ShareAlike 3.0 US) ("Applicable License"). You must include a copy of, or the URI, for Applicable License with every copy of each Adaptation You Distribute or Publicly Perform. You may not offer or impose any terms on the Adaptation that restrict the terms of the Applicable License or the ability of the recipient of the Adaptation to exercise the rights granted to that recipient under the terms of the Applicable License. You must keep intact all notices that refer to the Applicable License and to the disclaimer of warranties with every copy of the Work as included in the Adaptation You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Adaptation, You may not impose any effective technological measures on the Adaptation that restrict the ability of a recipient of the Adaptation from You to exercise the rights granted to that recipient under the terms of the Applicable License. This Section 4(b) applies to the Adaptation as incorporated in a Collection, but this does not require the Collection apart from the Adaptation itself to be made subject to the terms of the Applicable License.
You may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or directed toward commercial advantage or private monetary compensation. The exchange of the Work for other copyrighted works by means of digital file-sharing or otherwise shall not be considered to be intended for or directed toward commercial advantage or private monetary compensation, provided there is no payment of any monetary compensation in con-nection with the exchange of copyrighted works.
If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and, (iv) consistent with Section 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4(d) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.
For the avoidance of doubt:
Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License if Your exercise of such rights is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(c) and otherwise waives the right to collect royalties through any statutory or compulsory licensing scheme; and,
Voluntary License Schemes. The Licensor reserves the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License that is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(c).
Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise.
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING AND TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO THIS EXCLUSION MAY NOT APPLY TO YOU.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
8. Miscellaneous
Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law.

BIN
manual.pdf Normal file

Binary file not shown.

25
readme.txt Normal file
View File

@ -0,0 +1,25 @@
## ADVTRAINS ## realistic trains in Minetest!
by orwell96 and contributors(see below)
For up-to-date information, visit https://forum.minetest.net/viewtopic.php?f=9&t=14726
Manual:
If manual.pdf is not present (which is the case when you downloaded the zip file), see https://github.com/orwell96/advtrains/blob/master/manual.pdf
License of code: LGPL 2.1
License of media: CC-BY-NC-SA 3.0
Contributions:
Gravel Texture : from Minetest Game
Initial rail model/texture : DS-minetest
Models for signals/bumpers : mbb
Steam engine / wagon texture: mbb
Detailed Steam engine : mbb / Krokoschlange(animation)
Industrial engine/wagons : mbb
Inventory images : mbb
Small code contributions : NaruTrey / gpcf
Mod Description : hajo
If I forgot someone please punish me for that.

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 435 KiB