Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: address IntelliJ QAPlug plugin findings #105

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,13 @@ public void onCrash(HorizontalCollisionEvent event, EntityRef entity, CharacterS
horizVelocity.y = 0;
float velocity = horizVelocity.length();

if (velocity > healthComponent.horizontalDamageSpeedThreshold) {
if (characterSounds.lastSoundTime + CharacterSoundSystem.MIN_TIME < time.getGameTimeInMs()) {
StaticSound sound = random.nextItem(characterSounds.landingSounds);
if (sound != null) {
entity.send(new PlaySoundEvent(sound, characterSounds.landingVolume));
characterSounds.lastSoundTime = time.getGameTimeInMs();
entity.saveComponent(characterSounds);
}
if (velocity > healthComponent.horizontalDamageSpeedThreshold
&& characterSounds.lastSoundTime + CharacterSoundSystem.MIN_TIME < time.getGameTimeInMs()) {
StaticSound sound = random.nextItem(characterSounds.landingSounds);
if (sound != null) {
entity.send(new PlaySoundEvent(sound, characterSounds.landingVolume));
characterSounds.lastSoundTime = time.getGameTimeInMs();
entity.saveComponent(characterSounds);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ public void onDamaged(OnDamagedEvent event, EntityRef blockEntity, BlockComponen
*/
@ReceiveEvent
public void onDamaged(OnDamagedEvent event, EntityRef entity, ActAsBlockComponent blockComponent, LocationComponent location) {
if (blockComponent.block != null) {
if (blockComponent.block != null && isEffectsEnabled(event)) {
//TODO: the BlockDamageModifierComponent also holds a modifier for `impulsePower` - should that influence the particle effect?
if (isEffectsEnabled(event)) {
createBlockParticleEffect(blockComponent.block, location.getWorldPosition(new Vector3f()));
}
createBlockParticleEffect(blockComponent.block, location.getWorldPosition(new Vector3f()));
}
}

Expand Down