Skip to content

Commit

Permalink
refactor: address IntelliJ QAPlug plugin findings (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrueckert authored Nov 27, 2023
1 parent 335d6d7 commit b2eefa7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
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

0 comments on commit b2eefa7

Please sign in to comment.