Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

prevent fallingblocks from being created in the first place? #57

Open
VierEck opened this issue Jul 8, 2023 · 0 comments
Open

prevent fallingblocks from being created in the first place? #57

VierEck opened this issue Jul 8, 2023 · 0 comments
Assignees
Labels
priority Important

Comments

@VierEck
Copy link

VierEck commented Jul 8, 2023

current method only prevents fallingblocks from being rendered.

how about we dont create fallingblocks to begin with?
this will prevent fallingblocks from being created and updated completely which will save a bit of computing and might boost performance a bit.

BlocksFell() creates the falling blocks entities

void Client::BlocksFell(std::vector<IntVector3> blocks) {
SPADES_MARK_FUNCTION();
if (blocks.empty())
return;
AddLocalEntity(stmp::make_unique<FallingBlock>(this, blocks));
if (!IsMuted()) {
IntVector3 v = blocks[0];
Vector3 o;
o.x = v.x;
o.y = v.y;
o.z = v.z;
o += .5f;
Handle<IAudioChunk> c = audioDevice->RegisterSound("Sounds/Misc/BlockFall.opus");
audioDevice->Play(c.GetPointerOrNull(), o, AudioParam());
}
}

then check for p_fallingblocks and serverlimits for permission to call AddLocalEntity (creates the fallingblocks entity)

AddLocalEntity(stmp::make_unique<FallingBlock>(this, blocks));

if we still want the tear sound to play then move these lines up before AddLocalEntity

if (!IsMuted()) {
IntVector3 v = blocks[0];
Vector3 o;
o.x = v.x;
o.y = v.y;
o.z = v.z;
o += .5f;
Handle<IAudioChunk> c = audioDevice->RegisterSound("Sounds/Misc/BlockFall.opus");
audioDevice->Play(c.GetPointerOrNull(), o, AudioParam());
}

@nonperforming nonperforming self-assigned this Jul 10, 2023
@nonperforming nonperforming added the priority Important label Jul 10, 2023
@nonperforming nonperforming pinned this issue Jul 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority Important
Projects
None yet
Development

No branches or pull requests

2 participants