summaryrefslogtreecommitdiff
path: root/src/content_mapblock.cpp
Commit message (Collapse)AuthorAge
* Add new ContentParamType2 "CPT2_DEGROTATE"est312015-10-04
| | | | | | | | | This might break some mods, but it is important for all uses of the param2 to be documented. This doesn't need a serialisation version or network protocol version change, as old clients will still work on new servers, and it is bearable to have new clients getting non rotated plants on old servers.
* Firelike drawtype: Improve codeparamat2015-09-14
| | | | | | Remove unusable fine rotation by param2 Remove unused and redundant code Fix code style issues
* Change i++ to ++iDavid Jones2015-08-25
|
* Move globals from main.cpp to more sane locationsCraig Robbins2015-04-01
| | | | | | | | | | | | Move debug streams to log.cpp|h Move GUI-related globals to clientlauncher Move g_settings and g_settings_path to settings.cpp|h Move g_menuclouds to clouds.cpp|h Move g_profiler to profiler.cpp|h
* Move texture_min_size even further down the pipe. Now, textures are ↵Aaron Suen2015-03-31
| | | | JIT-upscaled using an image transformation, right at the time they're added to a mesh or particle; images used in 2D elements are left unscaled. This should fix any remaining issues with HUD elements.
* Connect rails with connect_to_raillike and shorten the codesSmallJoker2015-03-21
|
* For usages of assert() that are meant to persist in Release builds (when ↵Craig Robbins2015-03-07
| | | | NDEBUG is defined), replace those usages with persistent alternatives
* Improve group-based connection between raillike nodesBlockMen2015-03-05
|
* Replace std::list to std::vector into tile.cpp (m_texture_trash) and move ↵Loic Blot2015-03-05
| | | | tile.hpp to src/client/
* Fix some rendering glitchesBlockMen2015-03-05
| | | | | - Fixes particle draworder - Fixes nodehighlighting
* Fix NDT_GLASSLIKE normalsKahrl2015-01-31
| | | | Remove inventorycube() workaround for default:glass in minimal game
* Fix visual_scale for plantlike nodes (again)Vanessa Ezekowitz2014-12-19
| | | | | | fixes #1989 move the plant to the bottom of its node properly, without affecting its scale. See isue #1989
* Fix visual_scale for NDT_PLANTLIKE being set too smallCraig Robbins2014-12-18
|
* Fix raillike bug (currently manifests itself on Android), and minor ↵Kodexky2014-11-20
| | | | | | improvement to readability. NB: Minor edits to patch made by Zeno- (int to short and minor formatting)
* Fix wallmounted mesh rotationsShadowNinja2014-11-19
|
* Add option to enable mesh caching, add wallmounted for meshes.RealBadAngel2014-10-29
|
* Fix broken plantlike drawtype.RealBadAngel2014-10-22
|
* Recalculate normals for cached meshes.RealBadAngel2014-10-21
| | | | | | Check if mesh is here before adding to meshcollector. Fix deleting the meshes.
* Various uninitialised variable fixesCraig Robbins2014-10-19
| | | | | | sky.cpp: m_bgcolor.getAlpha() was being used before initialised mesh related: m_highlight_mesh_color was being used uninitialised
* Add meshnode drawtype.RealBadAngel2014-10-18
|
* Add optional framed glasslike drawtypeBlockMen2014-10-02
|
* Add firelike drawtypeTriBlade92014-09-21
|
* Split settings into seperate source and header filesShadowNinja2014-09-21
| | | | This also cleans up settings a bit
* Bugfix: don't highlight air nodes.RealBadAngel2014-09-18
|
* Node highlighting.RealBadAngel2014-09-17
|
* Pass light sources in blue channel of vertex color instead of decoded light ↵RealBadAngel2014-08-21
| | | | | | for all special drawtypes. Plus some style fixes and optimizations.
* Dont display interior of glasslike_framed node when its not defined.RealBadAngel2014-07-24
| | | | Fixes https://github.com/minetest/minetest/issues/1514
* Allow full circle rotation with 2degs step for plantlike drawtype.RealBadAngel2014-07-24
|
* Add rotation for plantlike drawtype.RealBadAngel2014-07-22
|
* Bugfix in makeCuboid - apply rotations to all faces when 1 tile is given.RealBadAngel2014-07-20
|
* Fix texture glitches for plants with visual scale > 1.0 (jungle grass).RealBadAngel2014-07-17
|
* Fix texture hack in fences.RealBadAngel2014-07-17
|
* Fix flipped textures for drawtype "glasslike"sapier2014-07-16
|
* Glasslike_framed drawtype rework.RealBadAngel2014-06-29
|
* Pass pointer to nodedef directly to avoid recalculation in quite often ↵sapier2014-04-06
| | | | called function
* Fix liquid_rangePilzAdam2013-11-02
| | | | | | * Prevent graphical glitches on old servers * Fix flowing of liquids with viscosity != 1 and range != 8 * Fix range = 0, no flowing nodes will appear
* Add support for parameter 'visual_scale' for drawtypes 'signlike' and ↵Sokomine2013-10-14
| | | | 'torchlike' like used for drawtype 'plantlike'
* Diagonal liquid animationKahrl2013-08-17
|
* Add liquid_range to nodedefPilzAdam2013-07-20
|
* Remove texture atlas / AtlasPointer, rename getTextureRaw to getTextureKahrl2013-07-02
|
* Make raillike nodes connect to any other raillike nodes if both are in the ↵Jeija2013-05-22
| | | | group connect_to_raillike
* Add new drawtype GLASSLIKE_FRAMEDRealBadAngel2013-04-24
|
* 6d facedirRealBadAngel2013-03-23
|
* Fix new_style_waterPilzAdam2013-03-17
|
* Liquid fine tuningproller2013-03-14
|
* Migrate to STL containers/algorithms.Ilya Zhuravlev2013-03-11
|
* Merge pull request #482 from proller/liquidkwolekr2013-02-25
|\ | | | | finite liquid
| * new adjustable finite liquidproller2013-02-24
| |
* | Update Copyright YearsSfan52013-02-24
| |
* | Change Minetest-c55 to MinetestPilzAdam2013-02-24
|/
d(r1, r2) while r1>pi2 do r1=r1-pi2 end while r1<0 do r1=r1+pi2 end while r2>pi2 do r2=r2-pi2 end while r1<0 do r2=r2+pi2 end local try1=r2-r1 local try2=r2+pi2-r1 local try3=r2-pi2-r1 local minabs = math.min(math.abs(try1), math.abs(try2), math.abs(try3)) if minabs==math.abs(try1) then return try1 end if minabs==math.abs(try2) then return try2 end if minabs==math.abs(try3) then return try3 end end -- Takes 2 connections (0...AT_CMAX) as argument -- Returns the angle median of those 2 positions from the pov -- of standing on the cdir1 side and looking towards cdir2 -- cdir1 - >NODE> - cdir2 function advtrains.conn_angle_median(cdir1, cdir2) local ang1 = advtrains.dir_to_angle(advtrains.oppd(cdir1)) local ang2 = advtrains.dir_to_angle(cdir2) return ang1 + advtrains.minAngleDiffRad(ang1, ang2)/2 end -- TODO removed dumppath, where is this used? function advtrains.merge_tables(a, ...) local new={} for _,t in ipairs({a,...}) do for k,v in pairs(t) do new[k]=v end end return new end function advtrains.save_keys(tbl, keys) local new={} for _,key in ipairs(keys) do new[key] = tbl[key] end return new end -- TODO yaw_from_3_positions and get_wagon_yaw removed function advtrains.get_real_index_position(path, index) if not path or not index then return end local first_pos=path[math.floor(index)] local second_pos=path[math.floor(index)+1] if not first_pos or not second_pos then return nil end local factor=index-math.floor(index) local actual_pos={x=first_pos.x-(first_pos.x-second_pos.x)*factor, y=first_pos.y-(first_pos.y-second_pos.y)*factor, z=first_pos.z-(first_pos.z-second_pos.z)*factor,} return actual_pos end function advtrains.pos_median(pos1, pos2) return {x=pos1.x-(pos1.x-pos2.x)*0.5, y=pos1.y-(pos1.y-pos2.y)*0.5, z=pos1.z-(pos1.z-pos2.z)*0.5} end function advtrains.abs_ceil(i) return math.ceil(math.abs(i))*math.sign(i) end function advtrains.serialize_inventory(inv) local ser={} local liszts=inv:get_lists() for lisztname, liszt in pairs(liszts) do ser[lisztname]={} for idx, item in ipairs(liszt) do local istring=item:to_string() if istring~="" then ser[lisztname][idx]=istring end end end return minetest.serialize(ser) end function advtrains.deserialize_inventory(sers, inv) local ser=minetest.deserialize(sers) if ser then inv:set_lists(ser) return true end return false end --is_protected wrapper that checks for protection_bypass privilege function advtrains.is_protected(pos, name) if not name then error("advtrains.is_protected() called without name parameter!") end if minetest.check_player_privs(name, {protection_bypass=true}) then --player can bypass protection return false end return minetest.is_protected(pos, name) end function advtrains.is_creative(name) if not name then error("advtrains.is_creative() called without name parameter!") end if minetest.check_player_privs(name, {creative=true}) then return true end return minetest.settings:get_bool("creative_mode") end function advtrains.ms_to_kmh(speed) return speed * 3.6 end -- 4 possible inputs: -- integer: just do that modulo calculation -- table with c set: rotate c -- table with tables: rotate each -- table with integers: rotate each (probably no use case) function advtrains.rotate_conn_by(conn, rotate) if tonumber(conn) then return (conn+rotate)%AT_CMAX elseif conn.c then return { c = (conn.c+rotate)%AT_CMAX, y = conn.y} end local tmp={} for connid, data in ipairs(conn) do tmp[connid]=advtrains.rotate_conn_by(data, rotate) end return tmp end --TODO use this function advtrains.oppd(dir) return advtrains.rotate_conn_by(dir, AT_CMAX/2) end --conn_to_match like rotate_conn_by --other_conns have to be a table of conn tables! function advtrains.conn_matches_to(conn, other_conns) if tonumber(conn) then for connid, data in ipairs(other_conns) do if advtrains.oppd(conn) == data.c then return connid end end return false elseif conn.c then for connid, data in ipairs(other_conns) do local cmp = advtrains.oppd(conn) if cmp.c == data.c and (cmp.y or 0) == (data.y or 0) then return connid end end return false end local tmp={} for connid, data in ipairs(conn) do local backmatch = advtrains.conn_matches_to(data, other_conns) if backmatch then return backmatch, connid end --returns <connid of other rail> <connid of this rail> end return false end -- returns: <adjacent pos>, <conn index of adjacent>, <my conn index>, <railheight of adjacent> function advtrains.get_adjacent_rail(this_posnr, this_conns_p, conn_idx, drives_on) local this_pos = advtrains.round_vector_floor_y(this_posnr) local this_conns = this_conns_p if not this_conns then _, this_conns = advtrains.get_rail_info_at(this_pos) end if not conn_idx then for coni, _ in ipairs(this_conns) do local adj_pos, adj_conn_idx, _, nry, nco = advtrains.get_adjacent_rail(this_pos, this_conns, coni) if adj_pos then return adj_pos,adj_conn_idx,coni,nry, nco end end return nil end local conn = this_conns[conn_idx] local conn_y = conn.y or 0 local adj_pos = advtrains.dirCoordSet(this_pos, conn.c); while conn_y>=1 do conn_y = conn_y - 1 adj_pos.y = adj_pos.y + 1 end local nextnode_ok, nextconns, nextrail_y=advtrains.get_rail_info_at(adj_pos, drives_on) if not nextnode_ok then adj_pos.y = adj_pos.y - 1 conn_y = conn_y + 1 nextnode_ok, nextconns, nextrail_y=advtrains.get_rail_info_at(adj_pos, drives_on) if not nextnode_ok then return nil end end local adj_connid = advtrains.conn_matches_to({c=conn.c, y=conn_y}, nextconns) if adj_connid then return adj_pos, adj_connid, conn_idx, nextrail_y, nextconns end return nil end local connlku={[2]={2,1}, [3]={2,1,1}, [4]={2,1,4,3}} function advtrains.get_matching_conn(conn, nconns) return connlku[nconns][conn] end function advtrains.random_id() local idst="" for i=0,5 do idst=idst..(math.random(0,9)) end return idst end