Proper town logic; needs lots of fixing
This commit is contained in:
@@ -395,17 +395,6 @@ void Roads::add_scene_element(Node *root, Node *xnode, const Vector3 &p2, Ref<Co
|
||||
Transform xform(Basis(), p2);
|
||||
assert(xmi->get_mesh().is_valid() && xmi->get_mesh()->get_surface_count() > 0);
|
||||
xmi->set_global_transform(xform);
|
||||
printf("trimesh collision\n");
|
||||
#if 0
|
||||
Node *c = xmi->create_trimesh_collision();
|
||||
assert(c);
|
||||
add_child(c);
|
||||
#if 0
|
||||
CollisionShape *cs = memnew(CollisionShape);
|
||||
cs->set_shape(shape);
|
||||
body->add_child(cs);
|
||||
#endif
|
||||
#endif
|
||||
StaticBody *sb = memnew(StaticBody);
|
||||
CollisionShape *cs = memnew(CollisionShape);
|
||||
assert(sb);
|
||||
@@ -573,9 +562,14 @@ void RoadsData::_bind_methods()
|
||||
ClassDB::bind_method(D_METHOD("get_site_pos", "site"), &RoadsData::get_site_pos);
|
||||
ClassDB::bind_method(D_METHOD("get_site_polygon_2d", "site"), &RoadsData::get_site_polygon_2d);
|
||||
ClassDB::bind_method(D_METHOD("get_site_polygon_3d", "site"), &RoadsData::get_site_polygon_3d);
|
||||
ClassDB::bind_method(D_METHOD("get_here_sites", "site"), &RoadsData::get_here_sites);
|
||||
ClassDB::bind_method(D_METHOD("get_here_sites", "position"), &RoadsData::get_here_sites);
|
||||
ClassDB::bind_method(D_METHOD("get_site_avg_height", "site"), &RoadsData::get_site_avg_height);
|
||||
ClassDB::bind_method(D_METHOD("get_site_border", "site"), &RoadsData::get_site_border);
|
||||
ClassDB::bind_method(D_METHOD("site_is_town", "site"), &RoadsData::site_is_town);
|
||||
ClassDB::bind_method(D_METHOD("site_is_farm", "site"), &RoadsData::site_is_farm);
|
||||
ClassDB::bind_method(D_METHOD("get_site_count"), &RoadsData::get_site_count);
|
||||
ClassDB::bind_method(D_METHOD("save_json", "path"), &RoadsData::save_json);
|
||||
ClassDB::bind_method(D_METHOD("get_site_type", "site"), &RoadsData::get_site_type);
|
||||
}
|
||||
void RoadsData::set_noise(Ref<FastNoiseLite> noise)
|
||||
{
|
||||
@@ -599,12 +593,12 @@ float RoadsData::get_sdf(int x, int y, int z)
|
||||
Vector2 ifl = rg->get_influence(x, z, 32.0f);
|
||||
if (ifl.x > 0.0f) {
|
||||
sdf_mutex.lock();
|
||||
if (n <= ifl.y - 0.5f) {
|
||||
ret = (float)y - ifl.y - 0.6f;
|
||||
sdf_data[x * 50000 + z] = ifl.y + 0.6f;
|
||||
if (n <= ifl.y) {
|
||||
ret = (float)y - ifl.y - 2.1f;
|
||||
sdf_data[x * 50000 + z] = ifl.y + 2.1f;
|
||||
} else {
|
||||
ret = (float)y - ifl.y;
|
||||
sdf_data[x * 50000 + z] = ifl.y;
|
||||
ret = (float)y - ifl.y - 2.1f;
|
||||
sdf_data[x * 50000 + z] = ifl.y + 2.1f;
|
||||
}
|
||||
sdf_mutex.unlock();
|
||||
goto out;
|
||||
@@ -640,3 +634,13 @@ PoolVector<int> RoadsData::get_here_sites(const Vector3 &position)
|
||||
{
|
||||
return rg->get_here_sites(position);
|
||||
}
|
||||
bool RoadsData::site_is_town(int site) const
|
||||
{
|
||||
return rg->site_is_town(site);
|
||||
}
|
||||
bool RoadsData::site_is_farm(int site) const
|
||||
{
|
||||
return rg->site_is_farm(site);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user