Fix mindflayer summoning minions inside pillars.

This commit is contained in:
Sam 2021-08-22 11:23:34 -04:00
parent 2c3b484567
commit 790c3669a0
2 changed files with 6 additions and 5 deletions

View File

@ -3,7 +3,7 @@ BasicSummon(
cast_duration: 1.0,
recover_duration: 0.5,
summon_amount: 6,
summon_distance: (3, 3),
summon_distance: (4, 4),
summon_info: (
body: BipedSmall((
species: Husk,

View File

@ -16,7 +16,7 @@ use crate::{
};
use rand::Rng;
use serde::{Deserialize, Serialize};
use std::{f32::consts::PI, time::Duration};
use std::{f32::consts::PI, ops::Sub, time::Duration};
use vek::*;
/// Separated out to condense update portions of character state
@ -129,16 +129,17 @@ impl CharacterBehavior for Data {
let ray_vector = Vec3::new(
(summon_frac * 2.0 * PI).sin() * length,
(summon_frac * 2.0 * PI).cos() * length,
data.body.eye_height(),
0.0,
);
// Check for collision on the xy plane
// Check for collision on the xy plane, subtract 1 to get point before block
let obstacle_xy = data
.terrain
.ray(data.pos.0, data.pos.0 + length * ray_vector)
.until(Block::is_solid)
.cast()
.0;
.0
.sub(1.0);
let collision_vector = Vec3::new(
data.pos.0.x + (summon_frac * 2.0 * PI).sin() * obstacle_xy,