werfdefdgre
This commit is contained in:
+10
-4
@@ -384,16 +384,17 @@ void Engine::Initiate()
|
||||
pos.z - size.z * 0.5f, pos.z + size.z * 0.5f });
|
||||
};
|
||||
// Concentric stack of square tiers, widest at the bottom (stands in for dome / cone)
|
||||
auto AddTiers = [&](const char* name, glm::vec2 pos, float baseWidth, float tierHeight, int tiers) {
|
||||
// xStretch scales the stack along x only (left/right); height and depth are unchanged
|
||||
auto AddTiers = [&](const char* name, glm::vec2 pos, float baseWidth, float tierHeight, int tiers, float xStretch = 1.0f) {
|
||||
for (int i = 0; i < tiers; ++i) {
|
||||
const float w = baseWidth * (1.0f - float(i) / float(tiers));
|
||||
AddBlock(name, { pos.x, tierHeight * i, pos.y }, { w, tierHeight, w });
|
||||
AddBlock(name, { pos.x, tierHeight * i, pos.y }, { w * xStretch, tierHeight, w });
|
||||
}
|
||||
};
|
||||
|
||||
// Map is a rectangle: x in [-60, 60], z in [-30, 30] (authored at 1x, scaled by mapScale)
|
||||
// Centre dome
|
||||
AddTiers("dome", { 0.0f, 0.0f }, 18.0f, 2.0f, 5);
|
||||
AddTiers("dome", { 0.0f, 0.0f }, 18.0f, 2.0f, 5, 0.5f);
|
||||
// Cones, opposite corners of the dome
|
||||
AddTiers("cone", { -12.0f, -13.0f }, 6.0f, 1.0f, 5);
|
||||
AddTiers("cone", { 12.0f, 13.0f }, 6.0f, 1.0f, 5);
|
||||
@@ -575,7 +576,7 @@ void Engine::Initiate()
|
||||
const int maxHealth = 100;
|
||||
const int bodyDamage = 50;
|
||||
const int punchDamage = 25;
|
||||
const float headFraction = 0.8f;
|
||||
const float headFraction = 0.93f; // top 7% of the hitbox counts as the head
|
||||
|
||||
// Random respawn spot on the floor (NPC and player), kept clear of every map prop
|
||||
std::mt19937 respawnRng(std::random_device{}());
|
||||
@@ -1089,6 +1090,10 @@ void Engine::Initiate()
|
||||
m->t.ScaleTo(1.0f);
|
||||
m->BindToRenderSystem();
|
||||
mainf->AddChild(m);
|
||||
// Solid for the local player, but moved only by the host's stream (like the floor, never simulated here)
|
||||
p* cubeBody = new p(m);
|
||||
cubeBody->velocity = false;
|
||||
physicsengine->AddObject(cubeBody);
|
||||
it = puppetCubes.emplace(nc.id, PuppetCube{ m, now }).first;
|
||||
}
|
||||
it->second.mesh->t.TranslateTo(nc.position);
|
||||
@@ -1098,6 +1103,7 @@ void Engine::Initiate()
|
||||
for (auto it = puppetCubes.begin(); it != puppetCubes.end();) {
|
||||
if (now - it->second.lastSeen > 1.5) {
|
||||
rendersystem->RemoveRenderable(it->second.mesh);
|
||||
physicsengine->RemoveObject(it->second.mesh);
|
||||
it->second.mesh->Delete();
|
||||
it = puppetCubes.erase(it);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user