aboutsummaryrefslogtreecommitdiff
path: root/src/script
Commit message (Expand)AuthorAge
* Add error handler to async stepShadowNinja2013-11-30
* Optimize table creationShadowNinja2013-11-30
* Add minetest.swap_nodeNovatux2013-11-30
* Fix MSVC build.Ilya Zhuravlev2013-11-30
* LuaVoxelManip: Add area parameters back to calc_lighting and set_lighting, ma...kwolekr2013-11-30
* LuaVoxelManip: Add get_light_data() and set_light_data()kwolekr2013-11-30
* Fixed potential NULL pointer and leak when setting node metadataMetaDucky2013-11-29
* Fix broken thread stop handlingsapier2013-11-30
* Fix old gcc buildsapier2013-11-29
* Fix modstore/favourites hang by adding asynchronous lua job supportsapier2013-11-29
* Rollback fixes and get_node_actionsShadowNinja2013-11-27
* Fix line_of_sight (AGAIN)sapier2013-11-25
* Fix possible implicit conversion of NULL to std::stringkwolekr2013-11-21
* LuaVoxelManip: Update parameter index of set_lighting()kwolekr2013-11-21
* Fix issue #1009 (minetest.get_connected_players() returns non-existing players)kwolekr2013-11-17
* Decoration: Stop DecoSimple::resolveNodeNames from complaining about no node ...kwolekr2013-11-17
* Fix invalid listname and listsize not handled correctly in set_sizesapier2013-11-16
* fixed array limit check when reading Lua specialtiles tableMetaDucky2013-11-16
* Pass a errfunc to lua_pcall to get a tracebackShadowNinja2013-11-15
* Fix invalid usage of temporary object in mainmenu json conversionsapier2013-11-11
* Add a callback: minetest.register_on_craft(itemstack, player,Novatux2013-11-01
* Add set_name(), set_count(), set_wear() and set_metadata() to Lua ItemStackPilzAdam2013-09-28
* Show git hash in version string at top left corner of windowKahrl2013-09-28
* Re-fix hud_change stat argument retrievalkwolekr2013-09-26
* Fix some warnings and other minor detailskwolekr2013-09-16
* Weather: Clean up getHeat/getHumidity somewhatkwolekr2013-09-16
* Always use builtin JThread librarykwolekr2013-09-15
* Add offset to automatic_face_movement_dirPilzAdam2013-09-10
* Allow non-string arguments for minetest.is_yes()PilzAdam2013-09-10
* Add Settings interface for LuaPilzAdam2013-09-10
* Add minetest.get_gametime() API function, that returns the number of seconds ...Novatux2013-09-08
* Use player:set_hotbar_image() instead of hardcoded hotbar.pngPilzAdam2013-09-05
* Add minetest.parse_json, engine.parse_jsonKahrl2013-09-02
* Fix umlauts/special character issue in lua gettextBlockMen2013-08-19
* Allow SIGINT to kill mainmenu againKahrl2013-08-19
* Add translation for main menusapier2013-08-17
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
* Add support for entities to automatic face movement directionsapier2013-08-13
* Decoration: Fix schematic probability mess with new MTS file versionkwolekr2013-08-11
* Add support for different drowning damage and allow drowning in other nodetypesBlockMen2013-08-06
* Allow mods to listen to cheat detections using minetest.register_on_cheat()Perttu Ahola2013-08-04
* Add replacements to schematicsPilzAdam2013-08-03
* Allow multiple 'wherein' nodes in oredefPilzAdam2013-08-02
* Add support for setting stepheight for entitiessapier2013-07-30
* Better snow fall, finite liquid transform, leveled nodes apiproller2013-07-28
* Weather supportproller2013-07-27
* Add an option to disable object <-> object collision for Lua entitiesPilzAdam2013-07-20
* Add liquid_range to nodedefPilzAdam2013-07-20
* Make range of tools configureablePilzAdam2013-07-20
* Add set_breath and get_breath to lua API.RealBadAngel2013-07-20
pt">:resize(w, h):colorize(color) end -- Most texture modifiers tx_lib.colorize = xmkmodifier(function(c, a) local str = ("[colorize:%s"):format(tx.escape(c)) if a then str = str .. ":" .. a end return str end) tx_lib.multiply = mkmodifier("[multiply:%s", {tx.escape}) tx_lib.resize = mkmodifier("[resize:%dx%d", {}) tx_lib.transform = mkmodifier("[transform%s", {tx.escape}) -- [combine local combine = {} function combine:add(x, y, ent) table.insert(self.st, ([[%d,%d=%s]]):format(x, y, tx.escape(tostring(ent)))) return self end local combine_mt = { __index = combine, __tostring = function(self) return table.concat(self.st, ":") end, } function tx.combine(w, h, bg) local base = ("[combine:%dx%d"):format(w, h) local obj = setmetatable({width = w, height = h, st = {base}}, combine_mt) if bg then obj:add_fill(0, 0, w, h, bg) end return obj end function combine:add_fill(x, y, ...) return self:add(x, y, tx.fill(...)) end local function add_multicolor_fill(n, self, x, y, w, h, ...) local argc, argv = getargs(...) local t = 0 for k = 1, argc, 2 do t = t + argv[k] end local newargs = {x, y, w, h} local sk, wk = n, n+2 local s = newargs[wk]/t for k = 1, argc, 2 do local v = argv[k] * s newargs[wk] = v newargs[5] = argv[k+1] self:add_fill(unpack(newargs)) newargs[sk] = newargs[sk] + v end return self end combine.add_multicolor_fill_topdown = curry(add_multicolor_fill, 2) combine.add_multicolor_fill_leftright = curry(add_multicolor_fill, 1) local function add_segmentbar(n, self, x, y, w, h, m, c, ...) local argc, argv = getargs(...) local baseargs = {x, y, w, h} local ss = (baseargs[n+2]+m)/c local bs = ss - m for k = 1, argc, 3 do local lower, upper, fill = argv[k], argv[k+1], argv[k+2] lower = math.max(0, math.floor(lower))+1 upper = math.min(c, math.floor(upper)) if lower <= upper then local args = {x, y, w, h, fill} args[n+2] = bs args[n] = args[n] + ss*(lower-1) for i = lower, upper do self:add_fill(unpack(args)) args[n] = args[n] + ss end end end return self end combine.add_segmentbar_topdown = curry(add_segmentbar, 2) combine.add_segmentbar_leftright = curry(add_segmentbar, 1) local function add_lever(n, self, x, y, w, h, hs, ss, val, hf, sf) local baseargs = {x, y, w, h} local sargs = {x, y, w, h, sf} sargs[5-n] = ss sargs[n+2] = baseargs[n+2] + ss - hs for k = 1, 2 do sargs[k] = baseargs[k] + (baseargs[k+2] - sargs[k+2])/2 end self:add_fill(unpack(sargs)) local hargs = {x, y, w, h, hf} hargs[n+2] = hs hargs[n] = baseargs[n] + (baseargs[n+2]-hs)*val self:add_fill(unpack(hargs)) return self end combine.add_lever_topdown = curry(add_lever, 2) combine.add_lever_leftright = curry(add_lever, 1) --[[ Seven-segment display -1- 6 2 -7- 5 3 -4- --]] local sevenseg_digits = { ["0"] = {1, 2, 3, 4, 5, 6}, ["1"] = {2, 3}, ["2"] = {1, 2, 4, 5, 7}, ["3"] = {1, 2, 3, 4, 7}, ["4"] = {2, 3, 6, 7}, ["5"] = {1, 3, 4, 6, 7}, ["6"] = {1, 3, 4, 5, 6, 7}, ["7"] = {1, 2, 3}, ["8"] = {1, 2, 3, 4, 5, 6, 7}, ["9"] = {1, 2, 3, 4, 6, 7}, } function combine:add_str7seg(x0, y0, tw, th, str, fill) --[[ w and h (as width/height of individual (horizontal) segments) have the following properties: tw = n(w+3h)-h th = 2w+3h --]] local len = #str local h = (2*tw-len*th)/(3*len-2) local w = (th-3*h)/2 local ws = w+3*h local segs = { {h, 0, w, h}, {w+h, h, h, w}, {w+h, w+2*h, h, w}, {h, 2*(w+h), w, h}, {0, w+2*h, h, w}, {0, h, h, w}, {h, w+h, w, h}, } for i = 1, len do for _, k in pairs(sevenseg_digits[string.sub(str, i, i)] or {}) do local s = segs[k] self:add_fill(s[1]+x0, s[2]+y0, s[3], s[4], fill) end x0 = x0 + ws end return self end function combine:add_n7seg(x, y, w, h, n, prec, ...) if not (type(n) == "number" and type(prec) == "number") then error("passed non-numeric value or precision to numeric display") elseif prec < 0 then error("negative length") end local pfx = "" if n >= 0 then n = math.min(10^prec-1, n) else n = math.min(10^(prec-1)-1, -n) pfx = "-" end local str = ("%d"):format(n) return self:add_str7seg(x, y, w, h, pfx .. ("0"):rep(prec-#str-#pfx) .. str, ...) end return tx