aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
Commit message (Expand)AuthorAge
...
* Find nodes in area (under air): Raise volume limit and document itparamat2018-02-21
* Check argument types inside MetaDataRef Lua API (#7045)sfan52018-02-18
* Node definition manager refactor (#7016)Dániel Juhász2018-02-10
* Add minetest.bulk_set_node call + optimize Environment::set_node call (#6958)Loïc Blot2018-01-30
* CSM: Remove screenshot APIred-0012018-01-23
* [CSM] Add functions to create particles and particlespawners. (#6072)red-0012018-01-20
* [CSM] Add basic HUD manipulation. (#6067)red-0012018-01-20
* Biomes: Add 'get heat', 'get humidity', 'get biome data' APIsparamat2018-01-16
* Fix buffer parameter not working in LuaPerlinNoiseMap::l_getMapSlice()Pedro Gimeno2018-01-08
* Fix naming conventions of noise userdatarubenwardy2018-01-07
* Biomes: Add vertical biome blend (#6853)Paramat2018-01-05
* Tool.cpp/.h, lua_api/l_util.cpp: Tidy up code and remove dead codeHybrid Dog2018-01-03
* Line_of_sight: Improve using VoxelLineIteratorDániel Juhász2017-12-26
* Allow 'default' parameter in 'settings:get_bool' functionJordan Irwin2017-12-17
* Clearobjects: Send progress messages to terminal using actionstreamparamat2017-11-24
* Stratum ore: Add option for a constant thickness stratumparamat2017-11-19
* Load files from subfolders in texturepacksnumber Zero2017-11-17
* Move files to subdirectories (#6599)Vitaliy2017-11-08
* Add minetest.safe_write_file() to script APIsfan52017-11-08
* Add sha1 to lua utils. (#6563)Rob Blanckaert2017-10-30
* CSM: Add a way to get current locale from CSMlisacvuk2017-10-29
* Allow overriding tool capabilities through itemstack metadataraymoo2017-10-29
* Improvements/fixes for noise parameter input in advanced settingsMuhammad Rifqi Priyo Susanto2017-10-23
* Simple decorations: Make 'place_offset_y' usable with simple decorationsparamat2017-10-10
* Simple decorations: Add 'param2_max' parameter for random param2paramat2017-10-09
* Stratum ore: Allow use with no noise for simple horizontal strataparamat2017-10-01
* Make Player::peer_id server-side only and add getters and setters (#6478)Loïc Blot2017-09-30
* Update JsonCPP to 1.8.3 (#6466)Loïc Blot2017-09-26
* Implement mod communication channels (#6351)Loïc Blot2017-09-26
* Set placer to nil instead of a non-functional one in item_OnPlace (#6449)DTA72017-09-21
* ServerEnv: Clean up object lifecycle handling (#6414)sfan52017-09-15
* Network: Remove large parts of deprecated legacy code (#6404)SmallJoker2017-09-12
* Make INodeDefManager::getIds return a vector, not a setKahrl2017-09-12
* Schematic decorations: Add 'place_offset_y' placement parameterparamat2017-09-10
* Ores: Add stratum ore (#6352)Paramat2017-09-03
* Fix animation frame_speed and blend loosing precision due to incorrec… (#6357)sapier2017-09-01
* Clientevent refactor (#6320)Loïc Blot2017-08-28
* core.get_objects_inside_radius: Omit removed objects (#6318)you2017-08-27
* Respect object property hp_max field for players (#6287)SmallJoker2017-08-23
* Minimap: Add new HUD flag for minimap radar modeparamat2017-08-20
* Modernize code: very last fixes (#6290)Loïc Blot2017-08-20
* Modernize source code: last part (#6285)Loïc Blot2017-08-20
* Code modernization: subfolders (#6283)Loïc Blot2017-08-19
* Optimize headers (part 2) (#6272)Loïc Blot2017-08-18
* C++ modernize: Pragma once (#6264)Loïc Blot2017-08-17
* l_server, clientenvironment, clientiface: code modernizationLoic Blot2017-08-17
* Cleanup various headers to reduce compilation times (#6255)Loïc Blot2017-08-16
* Clouds API: change speed from 'y' to 'z', ColorSpecs in Lua docs (#6164)Ben Deutsch2017-07-24
* [CSM] Add flavour limits controlled by server (#5930)Loïc Blot2017-07-18
* Chat protocol rewrite (#5117)Loïc Blot2017-07-16
>) if type(index) ~= "number" or index < 2 then return false end local new_id = advtrains.split_train_at_index(train, index) if new_id then minetest.after(1,advtrains.atc.train_set_command,advtrains.trains[new_id], cmd, atc_arrow) return true end return false end, split_at_fc = function(cmd, len) assertt(cmd, "string") if not train_id then return false end local new_id, fc = advtrains.split_train_at_fc(train, false, len) if new_id then minetest.after(1,advtrains.atc.train_set_command,advtrains.trains[new_id], cmd, atc_arrow) end return fc or "" end, split_off_locomotive = function(cmd, len) assertt(cmd, "string") if not train_id then return false end local new_id, fc = advtrains.split_train_at_fc(train, true, len) if new_id then minetest.after(1,advtrains.atc.train_set_command,advtrains.trains[new_id], cmd, atc_arrow) end end, train_length = function () if not train_id then return false end return #train.trainparts end, step_fc = function() if not train_id then return false end advtrains.train_step_fc(train) end, get_fc = function() if not train_id then return end local fc_list = {} for index,wagon_id in ipairs(train.trainparts) do fc_list[index] = table.concat(advtrains.wagons[wagon_id].fc,"!") or "" end return fc_list end, set_fc = function(fc_list,reset_index) assertt(fc_list, "table") if not train_id then return false end -- safety type-check for entered values for _,v in ipairs(fc_list) do if v and type(v) ~= "string" then error("FC entries must be a string") return end end for index,wagon_id in ipairs(train.trainparts) do if fc_list[index] then -- has FC to enter to this wagon local data = advtrains.wagons[wagon_id] if data then -- wagon actually exists --effectively copyied from wagons.lua, allowing for the :split function and reset_index data.fc = fc_list[index]:split("!") if reset_index or not data.fcind then data.fcind = 1 elseif data.fcind > #data.fc then data.fcind = #data.fc end end end end end, set_shunt = function() -- enable shunting mode if not train_id then return false end train.is_shunt = true end, unset_shunt = function() if not train_id then return false end train.is_shunt = nil end, set_autocouple = function () if not train_id then return false end train.autocouple = true end, unset_autocouple = function () if not train_id then return false end train.autocouple = nil end, set_line = function(line) if type(line)~="string" and type(line)~="number" then return false end train.line = line .. "" minetest.after(0, advtrains.invalidate_path, train_id) return true end, get_line = function() return train.line end, set_rc = function(rc) if type(rc)~="string"then return false end train.routingcode = rc minetest.after(0, advtrains.invalidate_path, train_id) return true end, get_rc = function() return train.routingcode end, atc_reset = function() if not train_id then return false end advtrains.atc.train_reset_command(train) return true end, atc_arrow = atc_arrow, atc_id = train_id, atc_speed = tvel, atc_set_text_outside = function(text) if not train_id then return false end if text then assertt(text, "string") end advtrains.trains[train_id].text_outside=text return true end, atc_set_text_inside = function(text) if not train_id then return false end if text then assertt(text, "string") end advtrains.trains[train_id].text_inside=text return true end, atc_get_text_outside = function() if not train_id then return false end return advtrains.trains[train_id].text_outside end, atc_get_text_inside = function(text) if not train_id then return false end return advtrains.trains[train_id].text_inside end, atc_set_lzb_tsr = function(speed) if not appr_internal then error("atc_set_lzb_tsr() can only be used during 'approach' events!") end assert(tonumber(speed), "Number expected!") local index = appr_internal.index advtrains.lzb_add_checkpoint(train, index, speed, nil) return true end, } -- interlocking specific if advtrains.interlocking then customfct.atc_set_ars_disable = function(value) advtrains.interlocking.ars_set_disable(train, value) end end atlatc.active.run_in_env(pos, evtdata, customfct) end advtrains.register_tracks("default", { nodename_prefix="advtrains_luaautomation:dtrack", texture_prefix="advtrains_dtrack_atc", models_prefix="advtrains_dtrack", models_suffix=".b3d", shared_texture="advtrains_dtrack_shared_atc.png", description=atltrans("LuaATC Track"), formats={}, get_additional_definiton = function(def, preset, suffix, rotation) return { after_place_node = atlatc.active.after_place_node, after_dig_node = atlatc.active.after_dig_node, on_receive_fields = function(pos, ...) atlatc.active.on_receive_fields(pos, ...) --set arrowconn (for ATC) local ph=minetest.pos_to_string(pos) local _, conns=advtrains.get_rail_info_at(pos, advtrains.all_tracktypes) local nodeent = atlatc.active.nodes[ph] if nodeent then nodeent.arrowconn=conns[1].c end end, advtrains = { on_train_enter = function(pos, train_id, train, index) --do async. Event is fired in train steps atlatc.interrupt.add(0, pos, {type="train", train=true, id=train_id, _train_id = train_id, _train_arrow = (train.path_cn[index] == 1)}) end, on_train_approach = function(pos, train_id, train, index, has_entered, lzbdata) -- Insert an event only if the rail indicated that it supports approach callbacks local ph=minetest.pos_to_string(pos) local railtbl = atlatc.active.nodes[ph] -- uses a "magic variable" in the local environment of the node -- This hack is necessary because code might not be prepared to get approach events... if railtbl and railtbl.data and railtbl.data.__approach_callback_mode then local acm = railtbl.data.__approach_callback_mode local in_arrow = (train.path_cn[index] == 1) if acm==2 or (acm==1 and in_arrow) then local evtdata = {type="approach", approach=true, id=train_id, has_entered = has_entered, _train_id = train_id, _train_arrow = in_arrow} -- reuses code from train_enter -- This event is *required* to run synchronously, because it might set the ars_disable flag on the train and add LZB checkpoints, -- although this is generally discouraged because this happens right in a train step -- At this moment, I am not aware whether this may cause side effects, and I must encourage users not to do expensive calculations here. r.fire_event(pos, evtdata, {train_id = train_id, train = train, index = index, lzbdata = lzbdata}) end end end, }, luaautomation = { fire_event=r.fire_event }, digiline = { receptor = {}, effector = { action = atlatc.active.on_digiline_receive }, }, } end, }, advtrains.trackpresets.t_30deg_straightonly) atlatc.rail = r