mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-21 11:55:43 +02:00
Properly remove SAO when worldedges are overtaken (#5889)
* LuaEntitySAO: Remove beyond outermost mapchunk edges Based on a commit by, and with help from, nerzhul. Add 2 functions to class Mapgen: A function to calculate actual mapgen edges, called from the Mapgen constructor. A function called indirectly from content_sao.cpp per entity step to check SAO position is within mapgen edges. * Calculate borders from params not mapgen, which is not available everytime
This commit is contained in:
13
src/mapgen.h
13
src/mapgen.h
@@ -138,7 +138,10 @@ struct MapgenParams {
|
||||
water_level(1),
|
||||
mapgen_limit(MAX_MAP_GENERATION_LIMIT),
|
||||
flags(MG_CAVES | MG_LIGHT | MG_DECORATIONS),
|
||||
bparams(NULL)
|
||||
bparams(NULL),
|
||||
m_sao_limit_min(MAX_MAP_GENERATION_LIMIT * BS),
|
||||
m_sao_limit_max(MAX_MAP_GENERATION_LIMIT * BS),
|
||||
m_sao_limit_calculated(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -146,6 +149,14 @@ struct MapgenParams {
|
||||
|
||||
virtual void readParams(const Settings *settings);
|
||||
virtual void writeParams(Settings *settings) const;
|
||||
|
||||
bool saoPosOverLimit(const v3f &p);
|
||||
private:
|
||||
void calcMapgenEdges();
|
||||
|
||||
float m_sao_limit_min;
|
||||
float m_sao_limit_max;
|
||||
bool m_sao_limit_calculated;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user