Added bee hives

This commit is contained in:
Joshua Barretto 2020-08-30 21:10:56 +01:00
parent 88add8456f
commit 032ec9ef41
10 changed files with 53 additions and 6 deletions

View File

@ -46,6 +46,7 @@ const int FIREWORK_RED = 7;
const int FIREWORK_YELLOW = 8;
const int LEAF = 9;
const int FIREFLY = 10;
const int BEE = 11;
// meters per second squared (acceleration)
const float earth_gravity = 9.807;
@ -227,6 +228,18 @@ void main() {
vec4(vec3(5, 5, 1.1), 1),
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 5)
);
} else if (inst_mode == BEE) {
float lower = pow(sin(3.1416 * lifetime / inst_lifespan), 0.2);
attr = Attr(
vec3(0, 0, lower * -0.5) + vec3(
sin(lifetime * 2.0 + rand0) + sin(lifetime * 9.0 + rand3) * 0.3,
sin(lifetime * 3.0 + rand1) + sin(lifetime * 10.0 + rand4) * 0.3,
sin(lifetime * 4.0 + rand2) + sin(lifetime * 11.0 + rand5) * 0.3
) * 0.5,
lower,
vec4(vec3(1, 0.7, 0), 1),
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 5)
);
} else {
attr = Attr(
linear_motion(

BIN
assets/voxygen/voxel/sprite/beehive/beehive.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1959,4 +1959,16 @@ Reed: Some((
],
wind_sway: 0.65,
)),
// Beehive
Beehive: Some((
variations: [
(
model: "voxygen.voxel.sprite.beehive.beehive",
offset: (-5.5, -5.5, 0.0),
lod_axes: (1.0, 1.0, 1.0),
),
],
wind_sway: 0.1,
)),
)

View File

@ -94,6 +94,7 @@ make_case_elim!(
DropGateBottom = 0x51,
GrassSnow = 0x52,
Reed = 0x53,
Beehive = 0x54,
}
);
@ -202,6 +203,7 @@ impl BlockKind {
BlockKind::DropGateBottom => false,
BlockKind::GrassSnow => true,
BlockKind::Reed => true,
BlockKind::Beehive => true,
_ => false,
}
}
@ -299,6 +301,7 @@ impl BlockKind {
BlockKind::DropGateBottom => false,
BlockKind::GrassSnow => false,
BlockKind::Reed => false,
BlockKind::Beehive => false,
_ => true,
}
}
@ -506,7 +509,8 @@ impl Block {
| BlockKind::Chest
| BlockKind::DropGate
| BlockKind::DropGateBottom
| BlockKind::Door => Some(self.color[0] & 0b111),
| BlockKind::Door
| BlockKind::Beehive => Some(self.color[0] & 0b111),
_ => None,
}
}

View File

@ -119,7 +119,7 @@ pub fn handle_create_waypoint(server: &mut Server, pos: Vec3<f32>) {
.state
.create_object(Pos(pos), comp::object::Body::CampfireLit)
.with(LightEmitter {
col: Rgb::new(1.0, 0.6, 0.0),
col: Rgb::new(1.0, 0.3, 0.1),
strength: 5.0,
flicker: 1.0,
animated: true,

View File

@ -104,6 +104,7 @@ pub enum ParticleMode {
FireworkYellow = 8,
Leaf = 9,
Firefly = 10,
Bee = 11,
}
impl ParticleMode {

View File

@ -328,6 +328,14 @@ impl ParticleMgr {
ParticleMode::Firefly,
|sd| sd.state.get_day_period().is_dark(),
),
(
|boi| &boi.beehives,
3,
0.5,
30.0,
ParticleMode::Bee,
|sd| sd.state.get_day_period().is_light(),
),
];
let mut rng = thread_rng();

View File

@ -91,7 +91,6 @@ struct SpriteModelConfig<Model> {
lod_axes: (f32, f32, f32),
}
<<<<<<< HEAD
#[derive(Deserialize)]
/// Configuration data for a group of sprites (currently associated with a
/// particular BlockKind).

View File

@ -9,6 +9,7 @@ pub struct BlocksOfInterest {
pub leaves: Vec<Vec3<i32>>,
pub grass: Vec<Vec3<i32>>,
pub embers: Vec<Vec3<i32>>,
pub beehives: Vec<Vec3<i32>>,
}
impl BlocksOfInterest {
@ -16,6 +17,7 @@ impl BlocksOfInterest {
let mut leaves = Vec::new();
let mut grass = Vec::new();
let mut embers = Vec::new();
let mut beehives = Vec::new();
chunk
.vol_iter(
@ -33,6 +35,8 @@ impl BlocksOfInterest {
grass.push(pos);
} else if block.kind() == BlockKind::Ember {
embers.push(pos);
} else if block.kind() == BlockKind::Beehive {
beehives.push(pos);
}
});
@ -40,6 +44,7 @@ impl BlocksOfInterest {
leaves,
grass,
embers,
beehives,
}
}
}

View File

@ -574,10 +574,12 @@ pub fn block_from_structure(
// None of these BlockKinds has an orientation, so we just use zero for the other color
// bits.
StructureBlock::Liana => Some(Block::new(BlockKind::Liana, Rgb::zero())),
StructureBlock::Fruit => Some(if field.get(pos + structure_pos) % 3 > 0 {
Block::empty()
} else {
StructureBlock::Fruit => Some(if field.get(pos + structure_pos) % 24 == 0 {
Block::new(BlockKind::Beehive, Rgb::zero())
} else if field.get(pos + structure_pos + 1) % 3 == 0 {
Block::new(BlockKind::Apple, Rgb::zero())
} else {
Block::empty()
}),
StructureBlock::Coconut => Some(if field.get(pos + structure_pos) % 3 > 0 {
Block::empty()