mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Improved single-tick projectile wall/entity collision bug
This commit is contained in:
parent
a475357dba
commit
73dcc7cd00
@ -32,7 +32,7 @@
|
||||
),
|
||||
column: (
|
||||
cold_grass: (0.0, 0.3, 0.1),
|
||||
warm_grass: (0.3, 0.25, -0.8),
|
||||
warm_grass: (0.5, 0.55, 0.0),
|
||||
dark_grass: (0.15, 0.4, 0.1),
|
||||
wet_grass: (0.1, 0.8, 0.2),
|
||||
cold_stone: (0.4, 0.67, 0.8),
|
||||
|
@ -126,10 +126,6 @@ impl<'a> System<'a> for Sys {
|
||||
// already possible with poorly-defined hitboxes anyway so it's not too
|
||||
// much of a concern.
|
||||
//
|
||||
// Actually, the aforementioned case can't happen, but only because wall
|
||||
// collision is checked prior to entity collision in the projectile
|
||||
// code.
|
||||
//
|
||||
// If this situation becomes a problem, this code should be integrated with the
|
||||
// terrain collision code below, although that's not trivial to do since
|
||||
// it means the step needs to take into account the speeds of both
|
||||
|
@ -61,27 +61,6 @@ impl<'a> System<'a> for Sys {
|
||||
)
|
||||
.join()
|
||||
{
|
||||
// Hit something solid
|
||||
if physics.on_wall.is_some() || physics.on_ground || physics.on_ceiling {
|
||||
for effect in projectile.hit_solid.drain(..) {
|
||||
match effect {
|
||||
projectile::Effect::Explode { power } => {
|
||||
server_emitter.emit(ServerEvent::Explosion {
|
||||
pos: pos.0,
|
||||
power,
|
||||
owner: projectile.owner,
|
||||
friendly_damage: false,
|
||||
reagent: None,
|
||||
})
|
||||
},
|
||||
projectile::Effect::Vanish => server_emitter.emit(ServerEvent::Destroy {
|
||||
entity,
|
||||
cause: HealthSource::World,
|
||||
}),
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Hit entity
|
||||
for other in physics.touch_entities.iter().copied() {
|
||||
if projectile.owner == Some(other) {
|
||||
@ -97,8 +76,7 @@ impl<'a> System<'a> for Sys {
|
||||
source: DamageSource::Projectile,
|
||||
};
|
||||
|
||||
let other_entity =
|
||||
uid_allocator.retrieve_entity_internal(other.into());
|
||||
let other_entity = uid_allocator.retrieve_entity_internal(other.into());
|
||||
if let Some(loadout) = other_entity.and_then(|e| loadouts.get(e)) {
|
||||
damage.modify_damage(false, loadout);
|
||||
}
|
||||
@ -142,12 +120,10 @@ impl<'a> System<'a> for Sys {
|
||||
reagent: None,
|
||||
})
|
||||
},
|
||||
projectile::Effect::Vanish => {
|
||||
server_emitter.emit(ServerEvent::Destroy {
|
||||
projectile::Effect::Vanish => server_emitter.emit(ServerEvent::Destroy {
|
||||
entity,
|
||||
cause: HealthSource::World,
|
||||
})
|
||||
},
|
||||
}),
|
||||
projectile::Effect::Possess => {
|
||||
if other != projectile.owner.unwrap() {
|
||||
if let Some(owner) = projectile.owner {
|
||||
@ -160,13 +136,34 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
}
|
||||
|
||||
// Hit something solid
|
||||
if physics.on_wall.is_some() || physics.on_ground || physics.on_ceiling {
|
||||
for effect in projectile.hit_solid.drain(..) {
|
||||
match effect {
|
||||
projectile::Effect::Explode { power } => {
|
||||
server_emitter.emit(ServerEvent::Explosion {
|
||||
pos: pos.0,
|
||||
power,
|
||||
owner: projectile.owner,
|
||||
friendly_damage: false,
|
||||
reagent: None,
|
||||
})
|
||||
},
|
||||
projectile::Effect::Vanish => server_emitter.emit(ServerEvent::Destroy {
|
||||
entity,
|
||||
cause: HealthSource::World,
|
||||
}),
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(dir) = velocities
|
||||
.get(entity)
|
||||
.and_then(|vel| vel.0.try_normalized())
|
||||
{
|
||||
ori.0 = dir.into();
|
||||
}
|
||||
}
|
||||
|
||||
if projectile.time_left == Duration::default() {
|
||||
server_emitter.emit(ServerEvent::Destroy {
|
||||
|
Loading…
x
Reference in New Issue
Block a user