aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_nodemeta.cpp
Commit message (Collapse)AuthorAge
* Push error handler afresh each time lua_pcall is usedKahrl2015-08-27
| | | | | Fixes "double fault" / "error in error handling" messages (issue #1423) and instead shows a complete backtrace.
* Improve Script CPP API diagnosticskwolekr2015-08-05
|
* Fix object reference pushing functions when called from coroutinesShadowNinja2014-10-07
|
* Only push the Lua error handler onceShadowNinja2014-04-27
|
* Remove lua_State parameter from LuaError::LuaErrorShadowNinja2014-03-15
|
* Revert "Make sure we get a stacktrace for as many lua errors as possible"ShadowNinja2014-03-15
| | | | | | | | This reverts commit 362ef5f6ced862daa4733034810d0b07e2ad5d89. Stack tracebacks couldn't be generated in LuaError::LuaError anyway and this caused a second, empty traceback in most cases. In cases where there wasn't annother traceback the stack had already unwound and the traceback was empty.
* Make sure we get a stacktrace for as many lua errors as possibleSfan52014-03-15
|
* Log guilty node name when allow_metadata_inventory_move/put/take failsKahrl2013-12-18
|
* Handle LuaErrors in Lua -> C++ calls on LuaJITShadowNinja2013-12-18
|
* Pass a errfunc to lua_pcall to get a tracebackShadowNinja2013-11-15
|
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
|
* Move scriptapi to separate folder (by sapier)sapier2013-05-25
On the lua side, notably minetest.env:<function>(<args>) should now be replaced by minetest.<function>(<args>). The old way is and will stay supported for a long time. Also: Update and clean up lua_api.txt (by celeron55) Move EnvRef to lua and remove add_rat and add_firefly (by kahrl) Add separate src/util/CMakeLists.txt, other minor fixes (by kahrl)
opt">; z++) for(s32 y=a.MinEdge.Y; y<=a.MaxEdge.Y; y++) { v3s16 p(x,y,z); MapNode &n = v.getNodeRefUnsafe(p); n.setLight(LIGHTBANK_DAY, light, ndef); n.setLight(LIGHTBANK_NIGHT, light, ndef); } } void clearLightAndCollectSources(VoxelManipulator &v, VoxelArea a, enum LightBank bank, INodeDefManager *ndef, std::set<v3s16> & light_sources, std::map<v3s16, u8> & unlight_from) { // The full area we shall touch VoxelArea required_a = a; required_a.pad(v3s16(0,0,0)); // Make sure we have access to it v.emerge(a); for(s32 x=a.MinEdge.X; x<=a.MaxEdge.X; x++) for(s32 z=a.MinEdge.Z; z<=a.MaxEdge.Z; z++) for(s32 y=a.MinEdge.Y; y<=a.MaxEdge.Y; y++) { v3s16 p(x,y,z); MapNode &n = v.getNodeRefUnsafe(p); u8 oldlight = n.getLight(bank, ndef); n.setLight(bank, 0, ndef); // If node sources light, add to list u8 source = ndef->get(n).light_source; if(source != 0) light_sources.insert(p); // Collect borders for unlighting if((x==a.MinEdge.X || x == a.MaxEdge.X || y==a.MinEdge.Y || y == a.MaxEdge.Y || z==a.MinEdge.Z || z == a.MaxEdge.Z) && oldlight != 0) { unlight_from[p] = oldlight; } } } SunlightPropagateResult propagateSunlight(VoxelManipulator &v, VoxelArea a, bool inexistent_top_provides_sunlight, std::set<v3s16> & light_sources, INodeDefManager *ndef) { // Return values bool bottom_sunlight_valid = true; // The full area we shall touch extends one extra at top and bottom VoxelArea required_a = a; required_a.pad(v3s16(0,1,0)); // Make sure we have access to it v.emerge(a); s16 max_y = a.MaxEdge.Y; s16 min_y = a.MinEdge.Y; for(s32 x=a.MinEdge.X; x<=a.MaxEdge.X; x++) for(s32 z=a.MinEdge.Z; z<=a.MaxEdge.Z; z++) { v3s16 p_overtop(x, max_y+1, z); bool overtop_has_sunlight = false; // If overtop node does not exist, trust heuristics if(!v.exists(p_overtop)) overtop_has_sunlight = inexistent_top_provides_sunlight; else if(v.getNodeRefUnsafe(p_overtop).getContent() == CONTENT_IGNORE) overtop_has_sunlight = inexistent_top_provides_sunlight; // Otherwise refer to it's light value else overtop_has_sunlight = (v.getNodeRefUnsafe(p_overtop).getLight( LIGHTBANK_DAY, ndef) == LIGHT_SUN); // Copy overtop's sunlight all over the place u8 incoming_light = overtop_has_sunlight ? LIGHT_SUN : 0; for(s32 y=max_y; y>=min_y; y--) { v3s16 p(x,y,z); MapNode &n = v.getNodeRefUnsafe(p); if(incoming_light == 0){ // Do nothing } else if(incoming_light == LIGHT_SUN && ndef->get(n).sunlight_propagates){ // Do nothing } else if(ndef->get(n).sunlight_propagates == false){ incoming_light = 0; } else { incoming_light = diminish_light(incoming_light); } u8 old_light = n.getLight(LIGHTBANK_DAY, ndef); if(incoming_light > old_light) n.setLight(LIGHTBANK_DAY, incoming_light, ndef); if(diminish_light(incoming_light) != 0) light_sources.insert(p); } // Check validity of sunlight at top of block below if it // hasn't already been proven invalid if(bottom_sunlight_valid) { bool sunlight_should_continue_down = (incoming_light == LIGHT_SUN); v3s16 p_overbottom(x, min_y-1, z); if(!v.exists(p_overbottom) || v.getNodeRefUnsafe(p_overbottom ).getContent() == CONTENT_IGNORE){ // Is not known, cannot compare } else { bool overbottom_has_sunlight = (v.getNodeRefUnsafe(p_overbottom ).getLight(LIGHTBANK_DAY, ndef) == LIGHT_SUN); if(sunlight_should_continue_down != overbottom_has_sunlight){ bottom_sunlight_valid = false; } } } } return SunlightPropagateResult(bottom_sunlight_valid); } } // namespace voxalgo