aboutsummaryrefslogtreecommitdiff
path: root/advtrains_train_track
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2018-12-04 19:27:44 +0100
committerorwell96 <orwell@bleipb.de>2018-12-04 19:27:44 +0100
commite37f4f9188808c3a91be55ba90b9b666341af3cf (patch)
tree053df6526e0e13f57fde063d2cb32277d722d5ba /advtrains_train_track
parente1a8a2e974205c7a0ad2da2c3284a2a782865528 (diff)
downloadadvtrains-e37f4f9188808c3a91be55ba90b9b666341af3cf.tar.gz
advtrains-e37f4f9188808c3a91be55ba90b9b666341af3cf.tar.bz2
advtrains-e37f4f9188808c3a91be55ba90b9b666341af3cf.zip
Apply speed restriction 0.5 indexes later, do not cap tarvelocity by speed_restriction
Diffstat (limited to 'advtrains_train_track')
0 files changed, 0 insertions, 0 deletions
an> 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)