aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_vmanip.cpp
Commit message (Expand)AuthorAge
* Add LuaVoxelManip methods: get_node_at() and set_node_at()kwolekr2014-09-01
* Update Mapgen VoxelManipulator on buffer invalidationkwolekr2014-09-01
* Fix issue 1527Craig Robbins2014-07-29
* Huge overhaul of the entire MapgenParams systemkwolekr2014-02-03
* LuaVoxelManip: Add get_param2_data and set_param2_datakwolekr2014-01-19
* 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
* LuaVoxelManip: Update parameter index of set_lighting()kwolekr2013-11-21
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
* LuaVoxelManip: Allow liquid updates in non-mapgen VoxelManip objectskwolekr2013-07-06
* LuaVoxelManip: Fix minor bug with set_lighting, remove coordinate params for ...kwolekr2013-06-29
* Apply various fixes to several thingskwolekr2013-06-27
* LuaVoxelManip: Separate VoxelManip data get/set from emerging/blitting data b...kwolekr2013-06-27
* Add minetest.get_mapgen_object to APIkwolekr2013-06-27
* Add LuaVoxelManipkwolekr2013-06-27
clude "voxelalgorithms.h" #include "emerge.h" MapgenSinglenode::MapgenSinglenode(MapgenParams *params, EmergeParams *emerge) : Mapgen(MAPGEN_SINGLENODE, params, emerge) { const NodeDefManager *ndef = emerge->ndef; c_node = ndef->getId("mapgen_singlenode"); if (c_node == CONTENT_IGNORE) c_node = CONTENT_AIR; MapNode n_node(c_node); set_light = (ndef->get(n_node).sunlight_propagates) ? LIGHT_SUN : 0x00; } //////////////////////// Map generator void MapgenSinglenode::makeChunk(BlockMakeData *data) { // Pre-conditions assert(data->vmanip); assert(data->nodedef); this->generating = true; this->vm = data->vmanip; this->ndef = data->nodedef; v3s16 blockpos_min = data->blockpos_min; v3s16 blockpos_max = data->blockpos_max; // Area of central chunk v3s16 node_min = blockpos_min * MAP_BLOCKSIZE; v3s16 node_max = (blockpos_max + v3s16(1, 1, 1)) * MAP_BLOCKSIZE - v3s16(1, 1, 1); blockseed = getBlockSeed2(node_min, data->seed); MapNode n_node(c_node); for (s16 z = node_min.Z; z <= node_max.Z; z++) for (s16 y = node_min.Y; y <= node_max.Y; y++) { u32 i = vm->m_area.index(node_min.X, y, z); for (s16 x = node_min.X; x <= node_max.X; x++) { if (vm->m_data[i].getContent() == CONTENT_IGNORE) vm->m_data[i] = n_node; i++; } } // Add top and bottom side of water to transforming_liquid queue updateLiquid(&data->transforming_liquid, node_min, node_max); // Set lighting if ((flags & MG_LIGHT) && set_light == LIGHT_SUN) setLighting(LIGHT_SUN, node_min, node_max); this->generating = false; } int MapgenSinglenode::getSpawnLevelAtPoint(v2s16 p) { return 0; }