mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
spawn frost gigas
This commit is contained in:
parent
c36e3693be
commit
40832456f2
@ -730,7 +730,7 @@ impl ProjectileConstructor {
|
||||
let explosion = Explosion {
|
||||
effects: vec![
|
||||
RadiusEffect::Attack(attack),
|
||||
RadiusEffect::TerrainDestruction(30.0, Rgb::new(255.0, 255.0, 255.0)),
|
||||
RadiusEffect::TerrainDestruction(30.0, Rgb::new(0.0, 191.0, 255.0)),
|
||||
],
|
||||
radius,
|
||||
reagent: Some(Reagent::White),
|
||||
|
@ -264,6 +264,34 @@ impl Data {
|
||||
));
|
||||
}
|
||||
}
|
||||
// Spawn one monster Gigasfrost into the world
|
||||
// Try a few times to find a location that's not underwater
|
||||
if let Some((wpos, chunk)) = (0..10)
|
||||
.map(|_| world.sim().get_size().map(|sz| rng.gen_range(0..sz as i32)))
|
||||
.find_map(|pos| Some((pos, world.sim().get(pos).filter(|c| !c.is_underwater())?)))
|
||||
.map(|(pos, chunk)| {
|
||||
let wpos2d = pos.cpos_to_wpos_center();
|
||||
(
|
||||
wpos2d
|
||||
.map(|e| e as f32 + 0.5)
|
||||
.with_z(world.sim().get_alt_approx(wpos2d).unwrap_or(0.0)),
|
||||
chunk,
|
||||
)
|
||||
})
|
||||
{
|
||||
let species = Some(comp::body::biped_large::Species::Gigasfrost)
|
||||
.filter(|_| chunk.temp < CONFIG.snow_temp)
|
||||
.unwrap_or(comp::body::biped_large::Species::Gigasfrost);
|
||||
|
||||
this.npcs.create_npc(Npc::new(
|
||||
rng.gen(),
|
||||
wpos,
|
||||
Body::BipedLarge(comp::body::biped_large::Body::random_with(
|
||||
&mut rng, &species,
|
||||
)),
|
||||
Role::Monster,
|
||||
));
|
||||
}
|
||||
|
||||
info!("Generated {} rtsim NPCs.", this.npcs.len());
|
||||
|
||||
|
@ -860,7 +860,13 @@ pub fn handle_explosion(server: &Server, pos: Vec3<f32>, explosion: Explosion, o
|
||||
for block_pos in touched_blocks {
|
||||
if let Ok(block) = terrain.get(block_pos) {
|
||||
if !matches!(block.kind(), BlockKind::Lava | BlockKind::GlowingRock)
|
||||
&& settings.gameplay.explosion_burn_marks
|
||||
&& (
|
||||
// Check that owner is not player or explosion_burn_marks by players
|
||||
// is enabled
|
||||
owner_entity
|
||||
.map_or(true, |e| ecs.read_storage::<Player>().get(e).is_none())
|
||||
|| settings.gameplay.explosion_burn_marks
|
||||
)
|
||||
{
|
||||
let diff2 = block_pos.map(|b| b as f32).distance_squared(pos);
|
||||
let fade = (1.0 - diff2 / color_range.powi(2)).max(0.0);
|
||||
|
@ -184,6 +184,9 @@ fn get_npc_entity_info(npc: &Npc, sites: &Sites, index: IndexRef) -> EntityInfo
|
||||
comp::biped_large::Species::Blueoni => "common.entity.wild.aggressive.blue_oni",
|
||||
comp::biped_large::Species::Redoni => "common.entity.wild.aggressive.red_oni",
|
||||
comp::biped_large::Species::Tursus => "common.entity.wild.aggressive.tursus",
|
||||
comp::biped_large::Species::Gigasfrost => {
|
||||
"common.entity.world.world_bosses.gigas_frost"
|
||||
},
|
||||
species => unimplemented!("rtsim spawning for {:?}", species),
|
||||
},
|
||||
body => unimplemented!("rtsim spawning for {:?}", body),
|
||||
|
@ -82,6 +82,7 @@ pub struct GameplaySettings {
|
||||
#[serde(default)]
|
||||
pub battle_mode: ServerBattleMode,
|
||||
#[serde(default)]
|
||||
// explosion_burn_marks by players
|
||||
pub explosion_burn_marks: bool,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user