aboutsummaryrefslogtreecommitdiff
path: root/builtin/modstore.lua
Commit message (Collapse)AuthorAge
* Replace pause and message menu by formspec onessapier2014-03-05
|
* Fix error on mod download failureShadowNinja2014-01-24
|
* Implement search tab and version pickersapier2013-12-11
|
* Fix modstore/favourites hang by adding asynchronous lua job supportsapier2013-11-29
|
* Reworked formspecs and kahrl's hexcolor parserBlockMen2013-11-03
|
* Change mainmenu texture handling + small misc changesKahrl2013-09-11
| | | | | | | | | | | | | | Texture names must now be escaped in formspec elements image[], background[], image_button[], image_button_exit[]. Instead of special-case handling of texture loading (and unloading which was missing) in guiFormSpecMenu.cpp, use the newly created ISimpleTextureSource interface which is a minimal subset of ITextureSource. There is an implementation of this interface used by GUIEngine (MenuTextureSource). Fix an off-by-one bug in unescape_string; it caused requests for a texture called "\0".
* Add translation for main menusapier2013-08-17
| | | | Add engine.gettext() and remove gettext() calls in guiFormspecMenu.cpp
* Fix modstore pagecountNovatux2013-08-16
|
* Use get_texturepath() instead of get_gamepath()/../texturesNovatux2013-08-16
|
* Fix formspec escaping, add escaping to info.txt for texture packs.Novatux2013-08-15
|
* Dont download modstore info if its isnt neededPilzAdam2013-08-10
|
* Remove debug outputsapier2013-07-22
|
* Add support for modstore screenshotssapier2013-07-22
| | | | Add error output on invalid mmdb entries
* Fix many formspec menu bugssapier2013-07-07
|
* Use hexadecimal RRGGBB instead of colorkeys, rename getColor to parseColorSfan52013-07-06
|
* Replace C++ mainmenu by formspec powered onesapier2013-07-02
ring.byte(file:read(1)) local conn1=string.byte(file:read(1)) if not advtrains.trackdb[tt][y] then advtrains.trackdb[tt][y]={} end if not advtrains.trackdb[tt][y][x] then advtrains.trackdb[tt][y][x]={} end local rest=file.read("*l") if rest~="" then local rely1, rely2, railheight=string.match(rest, "([^|]+)|([^|]+)|([^|]+)") if rely1 and rely2 and railheight then advtrains.trackdb[tt][y][x][z]={ conn1=conn1, conn2=conn2, rely1=rely1, rely2=rely2, railheight=railheight } else advtrains.trackdb[tt][y][x][z]={ conn1=conn1, conn2=conn2 } end else advtrains.trackdb[tt][y][x][z]={ conn1=conn1, conn2=conn2 } end end file:close() end end --end minetest.after end) function advtrains.save_trackdb() for tt, _ in pairs(advtrains.all_traintypes) do local pl_fpath=minetest.get_worldpath().."/advtrains_trackdb_"..tt local file, err = io.open(pl_fpath, "w") if not file then local er=err or "Unknown Error" print("[advtrains]Failed saving advtrains trackdb save file "..er) else --custom format to save memory for y,tyl in pairs(advtrains.trackdb[tt]) do for x,txl in pairs(tyl) do for z,rail in pairs(txl) do print("write "..x.." "..y.." "..z.." "..minetest.serialize(rail)) file:write(string.char(math.floor(x/256)+128)..string.char((x%256))) file:write(string.char(math.floor(y/256)+128)..string.char((y%256))) file:write(string.char(math.floor(z/256)+128)..string.char((z%256))) file:write(string.char(rail.conn1)) file:write(string.char(rail.conn2)) if (rail.rely1 and rail.rely1~=0) or (rail.rely2 and rail.rely2~=0) or (rail.railheight and rail.railheight~=0) then file:write(rail.rely1.."|"..rail.rely2.."|"..rail.railheight) end file:write("\n") end end end file:close() end end end ]]--end temp outcomment advtrains.trackdb={} advtrains.fpath_tdb=minetest.get_worldpath().."/advtrains_trackdb" local file, err = io.open(advtrains.fpath_tdb, "r") if not file then local er=err or "Unknown Error" print("[advtrains]Failed loading advtrains save file "..er) else local tbl = minetest.deserialize(file:read("*a")) if type(tbl) == "table" then advtrains.trackdb=tbl end file:close() end function advtrains.save_trackdb() local datastr = minetest.serialize(advtrains.trackdb) if not datastr then minetest.log("error", "[advtrains] Failed to serialize trackdb data!") return end local file, err = io.open(advtrains.fpath_tdb, "w") if err then return err end file:write(datastr) file:close() end --get_node with pseudoload. --returns: --true, conn1, conn2, rely1, rely2, railheight in case everything's right. --false if it's not a rail or the train does not drive on this rail, but it is loaded or --nil if the node is neither loaded nor in trackdb --the distraction between false and nil will be needed only in special cases.(train initpos) function advtrains.get_rail_info_at(pos, traintype) local node=minetest.get_node_or_nil(pos) if not node then --try raildb local rdp=vector.round(pos) local dbe=(advtrains.trackdb[traintype] and advtrains.trackdb[traintype][rdp.y] and advtrains.trackdb[traintype][rdp.y][rdp.x] and advtrains.trackdb[traintype][rdp.y][rdp.x][rdp.z]) if dbe then return true, dbe.conn1, dbe.conn2, dbe.rely1 or 0, dbe.rely2 or 0, dbe.railheight or 0 else return nil end end local nodename=node.name if(not advtrains.is_track_and_drives_on(nodename, advtrains.all_traintypes[traintype].drives_on)) then return false end local conn1, conn2, rely1, rely2, railheight=advtrains.get_track_connections(node.name, node.param2) --already in trackdb? local rdp=vector.round(pos) if not (advtrains.trackdb[traintype] and advtrains.trackdb[traintype][rdp.y] and advtrains.trackdb[traintype][rdp.y][rdp.x] and advtrains.trackdb[traintype][rdp.y][rdp.x][rdp.z]) then--TODO is this necessary? if not advtrains.trackdb[traintype] then advtrains.trackdb[traintype]={} end if not advtrains.trackdb[traintype][rdp.y] then advtrains.trackdb[traintype][rdp.y]={} end if not advtrains.trackdb[traintype][rdp.y][rdp.x] then advtrains.trackdb[traintype][rdp.y][rdp.x]={} end advtrains.trackdb[traintype][rdp.y][rdp.x][rdp.z]={ conn1=conn1, conn2=conn2, rely1=rely1, rely2=rely2, railheight=railheight } end return true, conn1, conn2, rely1, rely2, railheight end function advtrains.reset_trackdb_position(pos) local rdp=vector.round(pos) for tt, _ in pairs(advtrains.all_traintypes) do if not advtrains.trackdb[tt] then advtrains.trackdb[tt]={} end if not advtrains.trackdb[tt][rdp.y] then advtrains.trackdb[tt][rdp.y]={} end if not advtrains.trackdb[tt][rdp.y][rdp.x] then advtrains.trackdb[tt][rdp.y][rdp.x]={} end advtrains.trackdb[tt][rdp.y][rdp.x][rdp.z]=nil advtrains.get_rail_info_at(pos, tt)--to restore it. end end