aboutsummaryrefslogtreecommitdiff
path: root/games/minimal
Commit message (Collapse)AuthorAge
* Add lua exception handling test codesapier2014-08-23
| | | | Catch some error situations when mod used without thinking about it
* Minimal game: add /dummyball <count> commandKahrl2014-08-23
|
* Add minetest.swap_nodeNovatux2013-11-30
|
* Change default value of is_ground_content to truekwolekr2013-11-30
| | | | Most modders would otherwise forget to explicitly define this, and generated nodes aliased from mods would wall-off caves
* Fix possible crash with grass ABM.Novatux2013-11-02
|
* Fix grass adding/removing ABM.Novatux2013-11-02
|
* Move the sapling growing and grass adding/removing ABMs to LuaNovatux2013-11-02
|
* Remove mapgen_air alias (#935)0gb.us2013-10-05
|
* Add mapgen_stair_cobble alias to minimalSfan52013-09-06
|
* Add support for different drowning damage and allow drowning in other nodetypesBlockMen2013-08-06
|
* Add drowningPilzAdam2013-06-19
|
* Compress texturesDavid Gumberg2013-06-18
|
* 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)
* Use the group "soil" for nodes that saplings grow onShadowNinja2013-05-20
|
* games/minimal: Add menu/background.png and menu/icon.pngPerttu Ahola2013-05-02
|
* Add Mapgen V7, reorganize biomeskwolekr2013-04-07
|
* unkn own block -> unkn own nodekhonkhortisan2013-04-05
|
* Add different place sound for nodesPilzAdam2013-03-29
|
* Use minetest.register_ore() in minimalPilzAdam2013-03-24
|
* Mapgen indev: float islands, larger far biomesproller2013-03-24
|
* Liquid fine tuningproller2013-03-14
|
* new adjustable finite liquidproller2013-02-24
|
* Readded and optimized mapgen V6kwolekr2013-01-21
|
* Add initial Lua biomedef support, fixed biome selectionkwolekr2013-01-21
|
* Add the group attached_nodePilzAdam2012-12-01
| | | | Nodes in this group will be dropped as items if the node under them or the node in the wallmounted direction is not walkable.
* Swap out pixel-perfect nyan cat by request of Chris TorresPerttu Ahola2012-11-09
|
* Add functions to the default mod of minimal game to support old codePilzAdam2012-11-01
|
* Move falling to builtinPilzAdam2012-10-31
|
* Fix crash when furnace is full (minimal game)Perttu Ahola2012-08-12
|
* Deprecate minetest.add_to_creative_inventory and use group ↵Perttu Ahola2012-07-25
| | | | not_in_creative_inventory instead
* Add notice in the minimal gamePerttu Ahola2012-07-25
|
* Improve inventory callbacks a bitPerttu Ahola2012-07-25
|
* Detached inventory callbacks and reworked node metadata callbacksPerttu Ahola2012-07-25
|
* Detached inventoriesPerttu Ahola2012-07-24
|
* Add node timer test in minimal/experimentalPerttu Ahola2012-07-24
|
* Move /give, /giveme, /spawnentity and /pulverize to builtin/chatcommands.luaPerttu Ahola2012-07-23
|
* Formspec button_exit[] and image_button_exit[]Perttu Ahola2012-07-22
|
* Add /test1 command to minimal for testing a more complicated player ↵Perttu Ahola2012-07-22
| | | | inventory form
* Implement formspecdarkrose2012-07-22
|
* Actually fix facedir-rotated nodes placed using minetest.env:place_node()Perttu Ahola2012-07-21
|
* Make lava buckets work as fuel in minimal gamedarkrose2012-07-21
|
* Allow defining player's inventory form in LuaPerttu Ahola2012-07-19
|
* Custom boxy nodes (stairs, slabs) and collision changesKahrl2012-06-17
|
* Revert back proper crack texturePerttu Ahola2012-06-16
|
* Allow node cracking animations of any lengthPerttu Ahola2012-06-16
|
* Update field names to non-deprecated ones in node definition prototypePerttu Ahola2012-06-16
|
* Use new field names and reorder fields a bit in minimal gamePerttu Ahola2012-06-16
|
* Node texture animationPerttu Ahola2012-06-16
|
* Add experimental_tester_tool_1.png to minimal game (was accidentally left out)Perttu Ahola2012-06-08
|
* Allow groups in crafting recipesPerttu Ahola2012-06-06
|
class="hl opt">(); ++i) { QueuedMeshUpdate *q = *i; if (q->p == p) { // NOTE: We are not adding a new position to the queue, thus // refcount_from_queue stays the same. if(ack_block_to_server) q->ack_block_to_server = true; q->crack_level = m_client->getCrackLevel(); q->crack_pos = m_client->getCrackPos(); return; } } /* Add the block */ QueuedMeshUpdate *q = new QueuedMeshUpdate; q->p = p; q->ack_block_to_server = ack_block_to_server; q->crack_level = m_client->getCrackLevel(); q->crack_pos = m_client->getCrackPos(); m_queue.push_back(q); // This queue entry is a new reference to the cached blocks for (size_t i=0; i<cached_blocks.size(); i++) { cached_blocks[i]->refcount_from_queue++; } } // Returned pointer must be deleted // Returns NULL if queue is empty QueuedMeshUpdate *MeshUpdateQueue::pop() { MutexAutoLock lock(m_mutex); bool must_be_urgent = !m_urgents.empty(); for (std::vector<QueuedMeshUpdate*>::iterator i = m_queue.begin(); i != m_queue.end(); ++i) { QueuedMeshUpdate *q = *i; if(must_be_urgent && m_urgents.count(q->p) == 0) continue; m_queue.erase(i); m_urgents.erase(q->p); fillDataFromMapBlockCache(q); return q; } return NULL; } CachedMapBlockData* MeshUpdateQueue::cacheBlock(Map *map, v3s16 p, UpdateMode mode, size_t *cache_hit_counter) { std::map<v3s16, CachedMapBlockData*>::iterator it = m_cache.find(p); if (it != m_cache.end()) { // Already in cache CachedMapBlockData *cached_block = it->second; if (mode == SKIP_UPDATE_IF_ALREADY_CACHED) { if (cache_hit_counter) (*cache_hit_counter)++; return cached_block; } MapBlock *b = map->getBlockNoCreateNoEx(p); if (b) { if (cached_block->data == NULL) cached_block->data = new MapNode[MAP_BLOCKSIZE * MAP_BLOCKSIZE * MAP_BLOCKSIZE]; memcpy(cached_block->data, b->getData(), MAP_BLOCKSIZE * MAP_BLOCKSIZE * MAP_BLOCKSIZE * sizeof(MapNode)); } else { delete[] cached_block->data; cached_block->data = NULL; } return cached_block; } else { // Not yet in cache CachedMapBlockData *cached_block = new CachedMapBlockData(); m_cache[p] = cached_block; MapBlock *b = map->getBlockNoCreateNoEx(p); if (b) { cached_block->data = new MapNode[MAP_BLOCKSIZE * MAP_BLOCKSIZE * MAP_BLOCKSIZE]; memcpy(cached_block->data, b->getData(), MAP_BLOCKSIZE * MAP_BLOCKSIZE * MAP_BLOCKSIZE * sizeof(MapNode)); } return cached_block; } } CachedMapBlockData* MeshUpdateQueue::getCachedBlock(const v3s16 &p) { std::map<v3s16, CachedMapBlockData*>::iterator it = m_cache.find(p); if (it != m_cache.end()) { return it->second; } return NULL; } void MeshUpdateQueue::fillDataFromMapBlockCache(QueuedMeshUpdate *q) { MeshMakeData *data = new MeshMakeData(m_client, m_cache_enable_shaders, m_cache_use_tangent_vertices); q->data = data; data->fillBlockDataBegin(q->p); int t_now = time(0); // Collect data for 3*3*3 blocks from cache v3s16 dp; for (dp.X = -1; dp.X <= 1; dp.X++) for (dp.Y = -1; dp.Y <= 1; dp.Y++) for (dp.Z = -1; dp.Z <= 1; dp.Z++) { v3s16 p = q->p + dp; CachedMapBlockData *cached_block = getCachedBlock(p); if (cached_block) { cached_block->refcount_from_queue--; cached_block->last_used_timestamp = t_now; if (cached_block->data) data->fillBlockData(dp, cached_block->data); } } data->setCrack(q->crack_level, q->crack_pos); data->setSmoothLighting(m_cache_smooth_lighting); } void MeshUpdateQueue::cleanupCache() { const int mapblock_kB = MAP_BLOCKSIZE * MAP_BLOCKSIZE * MAP_BLOCKSIZE * sizeof(MapNode) / 1000; g_profiler->avg("MeshUpdateQueue MapBlock cache size kB", mapblock_kB * m_cache.size()); // The cache size is kept roughly below cache_soft_max_size, not letting // anything get older than cache_seconds_max or deleted before 2 seconds. const int cache_seconds_max = 10; const int cache_soft_max_size = m_meshgen_block_cache_size * 1000 / mapblock_kB; int cache_seconds = MYMAX(2, cache_seconds_max - m_cache.size() / (cache_soft_max_size / cache_seconds_max)); int t_now = time(0); for (std::map<v3s16, CachedMapBlockData*>::iterator it = m_cache.begin(); it != m_cache.end(); ) { CachedMapBlockData *cached_block = it->second; if (cached_block->refcount_from_queue == 0 && cached_block->last_used_timestamp < t_now - cache_seconds) { m_cache.erase(it++); } else { ++it; } } } /* MeshUpdateThread */ MeshUpdateThread::MeshUpdateThread(Client *client): UpdateThread("Mesh"), m_queue_in(client) { m_generation_interval = g_settings->getU16("mesh_generation_interval"); m_generation_interval = rangelim(m_generation_interval, 0, 50); } void MeshUpdateThread::updateBlock(Map *map, v3s16 p, bool ack_block_to_server, bool urgent) { // Allow the MeshUpdateQueue to do whatever it wants m_queue_in.addBlock(map, p, ack_block_to_server, urgent); deferUpdate(); } void MeshUpdateThread::doUpdate() { QueuedMeshUpdate *q; while ((q = m_queue_in.pop())) { if (m_generation_interval) sleep_ms(m_generation_interval); ScopeProfiler sp(g_profiler, "Client: Mesh making"); MapBlockMesh *mesh_new = new MapBlockMesh(q->data, m_camera_offset); MeshUpdateResult r; r.p = q->p; r.mesh = mesh_new; r.ack_block_to_server = q->ack_block_to_server; m_queue_out.push_back(r); delete q; } }