mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'misc_fixes' into 'master'
Miscellaneous language and name fixes See merge request veloren/veloren!201
This commit is contained in:
commit
1ccaf9a7bd
@ -271,9 +271,9 @@ impl Client {
|
||||
self.state.read_storage().get(self.entity).cloned(),
|
||||
self.state.read_storage().get(self.entity).cloned(),
|
||||
) {
|
||||
(Some(pos), Some(vel), Some(dir)) => {
|
||||
(Some(pos), Some(vel), Some(ori)) => {
|
||||
self.postbox
|
||||
.send_message(ClientMsg::PlayerPhysics { pos, vel, dir });
|
||||
.send_message(ClientMsg::PlayerPhysics { pos, vel, ori });
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@ -341,12 +341,12 @@ impl Client {
|
||||
entity,
|
||||
pos,
|
||||
vel,
|
||||
dir,
|
||||
ori,
|
||||
} => match self.state.ecs().entity_from_uid(entity) {
|
||||
Some(entity) => {
|
||||
self.state.write_component(entity, pos);
|
||||
self.state.write_component(entity, vel);
|
||||
self.state.write_component(entity, dir);
|
||||
self.state.write_component(entity, ori);
|
||||
}
|
||||
None => {}
|
||||
},
|
||||
|
@ -92,6 +92,7 @@ pub enum PigHead {
|
||||
pub enum PigChest {
|
||||
Default,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum PigLegL {
|
||||
Default,
|
||||
@ -103,7 +104,7 @@ pub enum PigLegR {
|
||||
}
|
||||
/////
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WolfUpperHead {
|
||||
pub enum WolfHeadUpper {
|
||||
Default,
|
||||
}
|
||||
|
||||
@ -113,7 +114,7 @@ pub enum WolfJaw {
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WolfLowerHead {
|
||||
pub enum WolfHeadLower {
|
||||
Default,
|
||||
}
|
||||
|
||||
@ -126,30 +127,34 @@ pub enum WolfTail {
|
||||
pub enum WolfTorsoBack {
|
||||
Default,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WolfTorsoMid {
|
||||
Default,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WolfEars {
|
||||
Default,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WolfLFFoot {
|
||||
Default,
|
||||
}
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WolfRFFoot {
|
||||
Default,
|
||||
}
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WolfLBFoot {
|
||||
pub enum WolfFootLF {
|
||||
Default,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WolfRBFoot {
|
||||
pub enum WolfFootRF {
|
||||
Default,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WolfFootLB {
|
||||
Default,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WolfFootRB {
|
||||
Default,
|
||||
}
|
||||
|
||||
@ -276,33 +281,33 @@ const ALL_QMRACES: [Race; 6] = [
|
||||
Race::Undead,
|
||||
];
|
||||
const ALL_QMBODY_TYPES: [BodyType; 3] = [BodyType::Female, BodyType::Male, BodyType::Unspecified];
|
||||
const ALL_QMWOLF_UPPERHEADS: [WolfUpperHead; 1] = [WolfUpperHead::Default];
|
||||
const ALL_QMWOLF_HEADS_UPPER: [WolfHeadUpper; 1] = [WolfHeadUpper::Default];
|
||||
const ALL_QMWOLF_JAWS: [WolfJaw; 1] = [WolfJaw::Default];
|
||||
const ALL_QMWOLF_LOWERHEADS: [WolfLowerHead; 1] = [WolfLowerHead::Default];
|
||||
const ALL_QMWOLF_HEADS_LOWER: [WolfHeadLower; 1] = [WolfHeadLower::Default];
|
||||
const ALL_QMWOLF_TAILS: [WolfTail; 1] = [WolfTail::Default];
|
||||
const ALL_QMWOLF_TORSOBACKS: [WolfTorsoBack; 1] = [WolfTorsoBack::Default];
|
||||
const ALL_QMWOLF_TORSOMIDS: [WolfTorsoMid; 1] = [WolfTorsoMid::Default];
|
||||
const ALL_QMWOLF_TORSOS_BACK: [WolfTorsoBack; 1] = [WolfTorsoBack::Default];
|
||||
const ALL_QMWOLF_TORSOS_MID: [WolfTorsoMid; 1] = [WolfTorsoMid::Default];
|
||||
const ALL_QMWOLF_EARS: [WolfEars; 1] = [WolfEars::Default];
|
||||
const ALL_QMWOLF_LFFEET: [WolfLFFoot; 1] = [WolfLFFoot::Default];
|
||||
const ALL_QMWOLF_RFFEET: [WolfRFFoot; 1] = [WolfRFFoot::Default];
|
||||
const ALL_QMWOLF_LBFEET: [WolfLBFoot; 1] = [WolfLBFoot::Default];
|
||||
const ALL_QMWOLF_RBFEET: [WolfRBFoot; 1] = [WolfRBFoot::Default];
|
||||
const ALL_QMWOLF_FEET_LF: [WolfFootLF; 1] = [WolfFootLF::Default];
|
||||
const ALL_QMWOLF_FEET_RF: [WolfFootRF; 1] = [WolfFootRF::Default];
|
||||
const ALL_QMWOLF_FEET_LB: [WolfFootLB; 1] = [WolfFootLB::Default];
|
||||
const ALL_QMWOLF_FEET_RB: [WolfFootRB; 1] = [WolfFootRB::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub struct QuadrupedMediumBody {
|
||||
pub race: Race,
|
||||
pub body_type: BodyType,
|
||||
pub wolf_upperhead: WolfUpperHead,
|
||||
pub wolf_head_upper: WolfHeadUpper,
|
||||
pub wolf_jaw: WolfJaw,
|
||||
pub wolf_lowerhead: WolfLowerHead,
|
||||
pub wolf_head_lower: WolfHeadLower,
|
||||
pub wolf_tail: WolfTail,
|
||||
pub wolf_torsoback: WolfTorsoBack,
|
||||
pub wolf_torsomid: WolfTorsoMid,
|
||||
pub wolf_torso_back: WolfTorsoBack,
|
||||
pub wolf_torso_mid: WolfTorsoMid,
|
||||
pub wolf_ears: WolfEars,
|
||||
pub wolf_lffoot: WolfLFFoot,
|
||||
pub wolf_rffoot: WolfRFFoot,
|
||||
pub wolf_lbfoot: WolfLBFoot,
|
||||
pub wolf_rbfoot: WolfRBFoot,
|
||||
pub wolf_foot_lf: WolfFootLF,
|
||||
pub wolf_foot_rf: WolfFootRF,
|
||||
pub wolf_foot_lb: WolfFootLB,
|
||||
pub wolf_foot_rb: WolfFootRB,
|
||||
}
|
||||
|
||||
impl QuadrupedMediumBody {
|
||||
@ -310,17 +315,17 @@ impl QuadrupedMediumBody {
|
||||
Self {
|
||||
race: *thread_rng().choose(&ALL_QMRACES).unwrap(),
|
||||
body_type: *thread_rng().choose(&ALL_QMBODY_TYPES).unwrap(),
|
||||
wolf_upperhead: *thread_rng().choose(&ALL_QMWOLF_UPPERHEADS).unwrap(),
|
||||
wolf_head_upper: *thread_rng().choose(&ALL_QMWOLF_HEADS_UPPER).unwrap(),
|
||||
wolf_jaw: *thread_rng().choose(&ALL_QMWOLF_JAWS).unwrap(),
|
||||
wolf_lowerhead: *thread_rng().choose(&ALL_QMWOLF_LOWERHEADS).unwrap(),
|
||||
wolf_head_lower: *thread_rng().choose(&ALL_QMWOLF_HEADS_LOWER).unwrap(),
|
||||
wolf_tail: *thread_rng().choose(&ALL_QMWOLF_TAILS).unwrap(),
|
||||
wolf_torsoback: *thread_rng().choose(&ALL_QMWOLF_TORSOBACKS).unwrap(),
|
||||
wolf_torsomid: *thread_rng().choose(&ALL_QMWOLF_TORSOMIDS).unwrap(),
|
||||
wolf_torso_back: *thread_rng().choose(&ALL_QMWOLF_TORSOS_BACK).unwrap(),
|
||||
wolf_torso_mid: *thread_rng().choose(&ALL_QMWOLF_TORSOS_MID).unwrap(),
|
||||
wolf_ears: *thread_rng().choose(&ALL_QMWOLF_EARS).unwrap(),
|
||||
wolf_lffoot: *thread_rng().choose(&ALL_QMWOLF_LFFEET).unwrap(),
|
||||
wolf_rffoot: *thread_rng().choose(&ALL_QMWOLF_RFFEET).unwrap(),
|
||||
wolf_lbfoot: *thread_rng().choose(&ALL_QMWOLF_LBFEET).unwrap(),
|
||||
wolf_rbfoot: *thread_rng().choose(&ALL_QMWOLF_RBFEET).unwrap(),
|
||||
wolf_foot_lf: *thread_rng().choose(&ALL_QMWOLF_FEET_LF).unwrap(),
|
||||
wolf_foot_rf: *thread_rng().choose(&ALL_QMWOLF_FEET_RF).unwrap(),
|
||||
wolf_foot_lb: *thread_rng().choose(&ALL_QMWOLF_FEET_LB).unwrap(),
|
||||
wolf_foot_rb: *thread_rng().choose(&ALL_QMWOLF_FEET_RB).unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ impl Component for Vel {
|
||||
type Storage = VecStorage<Self>;
|
||||
}
|
||||
|
||||
// Direction
|
||||
// Orientation
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Dir(pub Vec3<f32>);
|
||||
pub struct Ori(pub Vec3<f32>);
|
||||
|
||||
impl Component for Dir {
|
||||
impl Component for Ori {
|
||||
type Storage = VecStorage<Self>;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ use specs::{Component, VecStorage};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Armor {
|
||||
//TODO: Don't make armor be a bodypart. Wearing enemy's head is funny but also creepy thing to do.
|
||||
//TODO: Don't make armor be a body part. Wearing enemy's head is funny but also creepy thing to do.
|
||||
Helmet(actor::Head),
|
||||
Shoulders(actor::Shoulder),
|
||||
Chestplate(actor::Chest),
|
||||
|
@ -22,7 +22,7 @@ pub enum ClientMsg {
|
||||
PlayerPhysics {
|
||||
pos: comp::phys::Pos,
|
||||
vel: comp::phys::Vel,
|
||||
dir: comp::phys::Dir,
|
||||
ori: comp::phys::Ori,
|
||||
},
|
||||
TerrainChunkRequest {
|
||||
key: Vec2<i32>,
|
||||
|
@ -19,7 +19,7 @@ sphynx::sum_type! {
|
||||
pub enum EcsCompPacket {
|
||||
Pos(comp::phys::Pos),
|
||||
Vel(comp::phys::Vel),
|
||||
Dir(comp::phys::Dir),
|
||||
Ori(comp::phys::Ori),
|
||||
Actor(comp::Actor),
|
||||
Player(comp::Player),
|
||||
Stats(comp::Stats),
|
||||
@ -33,7 +33,7 @@ sphynx::sum_type! {
|
||||
pub enum EcsCompPhantom {
|
||||
Pos(PhantomData<comp::phys::Pos>),
|
||||
Vel(PhantomData<comp::phys::Vel>),
|
||||
Dir(PhantomData<comp::phys::Dir>),
|
||||
Ori(PhantomData<comp::phys::Ori>),
|
||||
Actor(PhantomData<comp::Actor>),
|
||||
Player(PhantomData<comp::Player>),
|
||||
Stats(PhantomData<comp::Stats>),
|
||||
|
@ -27,7 +27,7 @@ pub enum ServerMsg {
|
||||
entity: u64,
|
||||
pos: comp::phys::Pos,
|
||||
vel: comp::phys::Vel,
|
||||
dir: comp::phys::Dir,
|
||||
ori: comp::phys::Ori,
|
||||
},
|
||||
EntityAnimation {
|
||||
entity: u64,
|
||||
|
@ -109,7 +109,7 @@ impl State {
|
||||
// Register components synced by other means
|
||||
ecs.register::<comp::phys::Pos>();
|
||||
ecs.register::<comp::phys::Vel>();
|
||||
ecs.register::<comp::phys::Dir>();
|
||||
ecs.register::<comp::phys::Ori>();
|
||||
ecs.register::<comp::AnimationInfo>();
|
||||
|
||||
// Register client-local components
|
||||
|
@ -5,7 +5,7 @@ use vek::*;
|
||||
// Crate
|
||||
use crate::{
|
||||
comp::{
|
||||
phys::{Dir, Pos, Vel},
|
||||
phys::{Ori, Pos, Vel},
|
||||
Animation, AnimationInfo, Attacking,
|
||||
},
|
||||
state::DeltaTime,
|
||||
@ -23,12 +23,12 @@ impl<'a> System<'a> for Sys {
|
||||
WriteStorage<'a, Attacking>,
|
||||
);
|
||||
|
||||
fn run(&mut self, (entities, dt, mut attackings): Self::SystemData) {
|
||||
for (entity, attacking) in (&entities, &mut attackings).join() {
|
||||
attacking.time += dt.0;
|
||||
fn run(&mut self, (entities, dt, mut attacks): Self::SystemData) {
|
||||
for (entity, attack) in (&entities, &mut attacks).join() {
|
||||
attack.time += dt.0;
|
||||
}
|
||||
|
||||
let finished_attack = (&entities, &mut attackings)
|
||||
let finished_attacks = (&entities, &mut attacks)
|
||||
.join()
|
||||
.filter(|(e, a)| {
|
||||
a.time > 0.25 // TODO: constant
|
||||
@ -36,8 +36,8 @@ impl<'a> System<'a> for Sys {
|
||||
.map(|(e, a)| e)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
for entity in finished_attack {
|
||||
attackings.remove(entity);
|
||||
for entity in finished_attacks {
|
||||
attacks.remove(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ impl<'a> System<'a> for Sys {
|
||||
|
||||
fn run(
|
||||
&mut self,
|
||||
(time, entities, mut agents, positions, mut controls, mut jumpings, mut attackings): Self::SystemData,
|
||||
(time, entities, mut agents, positions, mut controls, mut jumps, mut attacks): Self::SystemData,
|
||||
) {
|
||||
for (entity, agent, pos, control) in
|
||||
(&entities, &mut agents, &positions, &mut controls).join()
|
||||
@ -42,13 +42,13 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
}
|
||||
Agent::Pet { target, offset } => {
|
||||
// Run towards target
|
||||
// Run towards target.
|
||||
match positions.get(*target) {
|
||||
Some(tgt_pos) => {
|
||||
let tgt_pos = tgt_pos.0 + *offset;
|
||||
|
||||
if tgt_pos.z > pos.0.z + 1.0 {
|
||||
jumpings.insert(entity, Jumping);
|
||||
jumps.insert(entity, Jumping);
|
||||
}
|
||||
|
||||
// Move towards the target.
|
||||
@ -79,7 +79,7 @@ impl<'a> System<'a> for Sys {
|
||||
control.move_dir = Vec2::zero();
|
||||
|
||||
if rand::random::<f32>() < 0.2 {
|
||||
attackings.insert(entity, Attacking::start());
|
||||
attacks.insert(entity, Attacking::start());
|
||||
}
|
||||
|
||||
false
|
||||
|
@ -5,7 +5,7 @@ use vek::*;
|
||||
// Crate
|
||||
use crate::{
|
||||
comp::{
|
||||
phys::{Dir, ForceUpdate, Pos, Vel},
|
||||
phys::{ForceUpdate, Ori, Pos, Vel},
|
||||
Animation, AnimationInfo, Attacking, Control, Gliding, HealthSource, Jumping, Respawning,
|
||||
Stats,
|
||||
},
|
||||
@ -26,7 +26,7 @@ impl<'a> System<'a> for Sys {
|
||||
ReadExpect<'a, TerrainMap>,
|
||||
ReadStorage<'a, Pos>,
|
||||
WriteStorage<'a, Vel>,
|
||||
WriteStorage<'a, Dir>,
|
||||
WriteStorage<'a, Ori>,
|
||||
WriteStorage<'a, AnimationInfo>,
|
||||
WriteStorage<'a, Stats>,
|
||||
ReadStorage<'a, Control>,
|
||||
@ -47,23 +47,23 @@ impl<'a> System<'a> for Sys {
|
||||
terrain,
|
||||
positions,
|
||||
mut velocities,
|
||||
mut directions,
|
||||
mut orientations,
|
||||
mut animation_infos,
|
||||
mut stats,
|
||||
mut controls,
|
||||
mut jumpings,
|
||||
mut respawnings,
|
||||
mut glidings,
|
||||
mut attackings,
|
||||
mut jumps,
|
||||
mut respawns,
|
||||
mut glides,
|
||||
mut attacks,
|
||||
mut force_updates,
|
||||
): Self::SystemData,
|
||||
) {
|
||||
for (entity, pos, control, stats, mut dir, mut vel) in (
|
||||
for (entity, pos, control, stats, mut ori, mut vel) in (
|
||||
&entities,
|
||||
&positions,
|
||||
&controls,
|
||||
&stats,
|
||||
&mut directions,
|
||||
&mut orientations,
|
||||
&mut velocities,
|
||||
)
|
||||
.join()
|
||||
@ -85,7 +85,7 @@ impl<'a> System<'a> for Sys {
|
||||
// Apply physics to the player: acceleration and non-linear deceleration.
|
||||
vel.0 += Vec2::broadcast(dt.0) * control.move_dir * 200.0;
|
||||
|
||||
if jumpings.get(entity).is_some() {
|
||||
if jumps.get(entity).is_some() {
|
||||
vel.0.z += 16.0;
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ impl<'a> System<'a> for Sys {
|
||||
// Apply physics to the player: acceleration and non-linear deceleration.
|
||||
vel.0 += Vec2::broadcast(dt.0) * control.move_dir * 10.0;
|
||||
|
||||
if glidings.get(entity).is_some() && vel.0.z < 0.0 {
|
||||
if glides.get(entity).is_some() && vel.0.z < 0.0 {
|
||||
// TODO: Don't hard-code this.
|
||||
let anti_grav = 9.81 * 3.95 + vel.0.z.powf(2.0) * 0.2;
|
||||
vel.0.z +=
|
||||
@ -118,18 +118,18 @@ impl<'a> System<'a> for Sys {
|
||||
* Vec3::new(1.0, 1.0, 0.0);
|
||||
|
||||
if vel.0.magnitude_squared() != 0.0 {
|
||||
dir.0 = vel.0.normalized() * Vec3::new(1.0, 1.0, 0.0);
|
||||
ori.0 = vel.0.normalized() * Vec3::new(1.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
let animation = if on_ground {
|
||||
if control.move_dir.magnitude() > 0.01 {
|
||||
Animation::Run
|
||||
} else if attackings.get(entity).is_some() {
|
||||
} else if attacks.get(entity).is_some() {
|
||||
Animation::Attack
|
||||
} else {
|
||||
Animation::Idle
|
||||
}
|
||||
} else if glidings.get(entity).is_some() {
|
||||
} else if glides.get(entity).is_some() {
|
||||
Animation::Gliding
|
||||
} else {
|
||||
Animation::Jump
|
||||
@ -151,8 +151,8 @@ impl<'a> System<'a> for Sys {
|
||||
);
|
||||
}
|
||||
|
||||
for (entity, &uid, pos, dir, attacking) in
|
||||
(&entities, &uids, &positions, &directions, &mut attackings).join()
|
||||
for (entity, &uid, pos, ori, attacking) in
|
||||
(&entities, &uids, &positions, &orientations, &mut attacks).join()
|
||||
{
|
||||
if !attacking.applied {
|
||||
for (b, pos_b, mut stat_b, mut vel_b) in
|
||||
@ -162,7 +162,7 @@ impl<'a> System<'a> for Sys {
|
||||
if entity != b
|
||||
&& !stat_b.is_dead
|
||||
&& pos.0.distance_squared(pos_b.0) < 50.0
|
||||
&& dir.0.angle_between(pos_b.0 - pos.0).to_degrees() < 70.0
|
||||
&& ori.0.angle_between(pos_b.0 - pos.0).to_degrees() < 70.0
|
||||
{
|
||||
// Deal damage
|
||||
stat_b.hp.change_by(-10, HealthSource::Attack { by: uid }); // TODO: variable damage and weapon
|
||||
|
@ -85,13 +85,13 @@ lazy_static! {
|
||||
"pig",
|
||||
"{}",
|
||||
"/pig : Spawn a test pig NPC",
|
||||
handle_petpig
|
||||
handle_pet_pig
|
||||
),
|
||||
ChatCommand::new(
|
||||
"wolf",
|
||||
"{}",
|
||||
"/wolf : Spawn a test wolf NPC",
|
||||
handle_petwolf
|
||||
handle_pet_wolf
|
||||
),
|
||||
ChatCommand::new(
|
||||
"enemy",
|
||||
@ -218,7 +218,7 @@ fn handle_tp(server: &mut Server, entity: EcsEntity, args: String, action: &Chat
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_petpig(server: &mut Server, entity: EcsEntity, args: String, action: &ChatCommand) {
|
||||
fn handle_pet_pig(server: &mut Server, entity: EcsEntity, args: String, action: &ChatCommand) {
|
||||
match server
|
||||
.state
|
||||
.read_component_cloned::<comp::phys::Pos>(entity)
|
||||
@ -245,7 +245,8 @@ fn handle_petpig(server: &mut Server, entity: EcsEntity, args: String, action: &
|
||||
.notify(entity, ServerMsg::Chat("You have no position!".to_owned())),
|
||||
}
|
||||
}
|
||||
fn handle_petwolf(server: &mut Server, entity: EcsEntity, args: String, action: &ChatCommand) {
|
||||
|
||||
fn handle_pet_wolf(server: &mut Server, entity: EcsEntity, args: String, action: &ChatCommand) {
|
||||
match server
|
||||
.state
|
||||
.read_component_cloned::<comp::phys::Pos>(entity)
|
||||
@ -272,6 +273,7 @@ fn handle_petwolf(server: &mut Server, entity: EcsEntity, args: String, action:
|
||||
.notify(entity, ServerMsg::Chat("You have no position!".to_owned())),
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_enemy(server: &mut Server, entity: EcsEntity, args: String, action: &ChatCommand) {
|
||||
match server
|
||||
.state
|
||||
@ -296,6 +298,7 @@ fn handle_enemy(server: &mut Server, entity: EcsEntity, args: String, action: &C
|
||||
.notify(entity, ServerMsg::Chat("You have no position!".to_owned())),
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_help(server: &mut Server, entity: EcsEntity, _args: String, _action: &ChatCommand) {
|
||||
for cmd in CHAT_COMMANDS.iter() {
|
||||
server
|
||||
|
@ -145,7 +145,7 @@ impl Server {
|
||||
.create_entity_synced()
|
||||
.with(pos)
|
||||
.with(comp::phys::Vel(Vec3::zero()))
|
||||
.with(comp::phys::Dir(Vec3::unit_y()))
|
||||
.with(comp::phys::Ori(Vec3::unit_y()))
|
||||
.with(comp::Control::default())
|
||||
.with(comp::AnimationInfo::default())
|
||||
.with(comp::Actor::Character { name, body })
|
||||
@ -167,7 +167,7 @@ impl Server {
|
||||
state.write_component(entity, comp::AnimationInfo::default());
|
||||
state.write_component(entity, comp::phys::Pos(spawn_point));
|
||||
state.write_component(entity, comp::phys::Vel(Vec3::zero()));
|
||||
state.write_component(entity, comp::phys::Dir(Vec3::unit_y()));
|
||||
state.write_component(entity, comp::phys::Ori(Vec3::unit_y()));
|
||||
// Make sure physics are accepted.
|
||||
state.write_component(entity, comp::phys::ForceUpdate);
|
||||
|
||||
@ -524,11 +524,11 @@ impl Server {
|
||||
_ => client.error_state(RequestStateError::Impossible),
|
||||
}
|
||||
}
|
||||
ClientMsg::PlayerPhysics { pos, vel, dir } => match client.client_state {
|
||||
ClientMsg::PlayerPhysics { pos, vel, ori } => match client.client_state {
|
||||
ClientState::Character => {
|
||||
state.write_component(entity, pos);
|
||||
state.write_component(entity, vel);
|
||||
state.write_component(entity, dir);
|
||||
state.write_component(entity, ori);
|
||||
}
|
||||
// Only characters can send positions.
|
||||
_ => client.error_state(RequestStateError::Impossible),
|
||||
@ -629,12 +629,12 @@ impl Server {
|
||||
state.write_component(entity, player);
|
||||
|
||||
// Sync physics
|
||||
for (entity, &uid, &pos, &vel, &dir) in (
|
||||
for (entity, &uid, &pos, &vel, &ori) in (
|
||||
&state.ecs().entities(),
|
||||
&state.ecs().read_storage::<Uid>(),
|
||||
&state.ecs().read_storage::<comp::phys::Pos>(),
|
||||
&state.ecs().read_storage::<comp::phys::Vel>(),
|
||||
&state.ecs().read_storage::<comp::phys::Dir>(),
|
||||
&state.ecs().read_storage::<comp::phys::Ori>(),
|
||||
)
|
||||
.join()
|
||||
{
|
||||
@ -642,7 +642,7 @@ impl Server {
|
||||
entity: uid.into(),
|
||||
pos,
|
||||
vel,
|
||||
dir,
|
||||
ori,
|
||||
});
|
||||
}
|
||||
|
||||
@ -671,12 +671,12 @@ impl Server {
|
||||
.notify_registered(ServerMsg::EcsSync(self.state.ecs_mut().next_sync_package()));
|
||||
|
||||
// Sync physics
|
||||
for (entity, &uid, &pos, &vel, &dir, force_update) in (
|
||||
for (entity, &uid, &pos, &vel, &ori, force_update) in (
|
||||
&self.state.ecs().entities(),
|
||||
&self.state.ecs().read_storage::<Uid>(),
|
||||
&self.state.ecs().read_storage::<comp::phys::Pos>(),
|
||||
&self.state.ecs().read_storage::<comp::phys::Vel>(),
|
||||
&self.state.ecs().read_storage::<comp::phys::Dir>(),
|
||||
&self.state.ecs().read_storage::<comp::phys::Ori>(),
|
||||
self.state
|
||||
.ecs()
|
||||
.read_storage::<comp::phys::ForceUpdate>()
|
||||
@ -688,7 +688,7 @@ impl Server {
|
||||
entity: uid.into(),
|
||||
pos,
|
||||
vel,
|
||||
dir,
|
||||
ori,
|
||||
};
|
||||
|
||||
let state = &self.state;
|
||||
|
@ -36,7 +36,7 @@ impl Animation for AttackAnimation {
|
||||
let wave_stop = (anim_time as f32 * 6.0).min(PI / 2.0).sin();
|
||||
let wave_stop_alt = (anim_time as f32 * 28.0).min(PI / 2.0).sin();
|
||||
let wave_stop_quick = (anim_time as f32 * 16.0).min(PI / 2.0).sin();
|
||||
let peakwave = 1.0 - (anim_time as f32 * 1.0).cos();
|
||||
let peak_wave = 1.0 - (anim_time as f32 * 1.0).cos();
|
||||
|
||||
let head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 8.0)
|
||||
|
@ -53,52 +53,52 @@ impl Animation for IdleAnimation {
|
||||
* 0.125,
|
||||
);
|
||||
|
||||
next.wolf_upperhead.offset = Vec3::new(0.0, 7.5, 15.0 + wave_ultra_slow * 0.4) / 11.0;
|
||||
next.wolf_upperhead.ori =
|
||||
next.wolf_head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_ultra_slow * 0.4) / 11.0;
|
||||
next.wolf_head_upper.ori =
|
||||
Quaternion::rotation_z(wolf_look.x) * Quaternion::rotation_x(wolf_look.y);
|
||||
next.wolf_upperhead.scale = Vec3::one() / 10.88;
|
||||
next.wolf_head_upper.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.wolf_jaw.offset =
|
||||
Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0 + wave_slow * 0.2);
|
||||
next.wolf_jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
|
||||
next.wolf_jaw.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wolf_lowerhead.offset = Vec3::new(0.0, 3.1, -4.5 + wave_ultra_slow * 0.20);
|
||||
next.wolf_lowerhead.ori = Quaternion::rotation_z(0.0);
|
||||
next.wolf_lowerhead.scale = Vec3::one() * 0.98;
|
||||
next.wolf_head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_ultra_slow * 0.20);
|
||||
next.wolf_head_lower.ori = Quaternion::rotation_z(0.0);
|
||||
next.wolf_head_lower.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.wolf_tail.offset = Vec3::new(0.0, -13.0, 8.0 + wave_ultra_slow * 1.2) / 11.0;
|
||||
next.wolf_tail.ori = Quaternion::rotation_z(0.0 + wave_slow * 0.2 + wolf_tail.x)
|
||||
* Quaternion::rotation_x(wolf_tail.y);
|
||||
next.wolf_tail.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_torsoback.offset = Vec3::new(0.0, -11.7, 11.0 + wave_ultra_slow * 1.2) / 11.0;
|
||||
next.wolf_torsoback.ori = Quaternion::rotation_y(wave_slow_cos * 0.015);
|
||||
next.wolf_torsoback.scale = Vec3::one() / 11.0;
|
||||
next.wolf_torso_back.offset = Vec3::new(0.0, -11.7, 11.0 + wave_ultra_slow * 1.2) / 11.0;
|
||||
next.wolf_torso_back.ori = Quaternion::rotation_y(wave_slow_cos * 0.015);
|
||||
next.wolf_torso_back.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_torsomid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_ultra_slow * 0.7) / 11.0;
|
||||
next.wolf_torsomid.ori = Quaternion::rotation_y(wave_slow * 0.015);
|
||||
next.wolf_torsomid.scale = Vec3::one() / 10.5;
|
||||
next.wolf_torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_ultra_slow * 0.7) / 11.0;
|
||||
next.wolf_torso_mid.ori = Quaternion::rotation_y(wave_slow * 0.015);
|
||||
next.wolf_torso_mid.scale = Vec3::one() / 10.5;
|
||||
|
||||
next.wolf_ears.offset = Vec3::new(0.0, 0.75, 5.25);
|
||||
next.wolf_ears.ori = Quaternion::rotation_x(0.0 + wave_slow * 0.1);
|
||||
next.wolf_ears.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.wolf_LFFoot.offset = Vec3::new(-5.0, 5.0, 2.5) / 11.0;
|
||||
next.wolf_LFFoot.ori = Quaternion::rotation_x(0.0);
|
||||
next.wolf_LFFoot.scale = Vec3::one() / 11.0;
|
||||
next.wolf_foot_lf.offset = Vec3::new(-5.0, 5.0, 2.5) / 11.0;
|
||||
next.wolf_foot_lf.ori = Quaternion::rotation_x(0.0);
|
||||
next.wolf_foot_lf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_RFFoot.offset = Vec3::new(5.0, 5.0, 2.5) / 11.0;
|
||||
next.wolf_RFFoot.ori = Quaternion::rotation_x(0.0);
|
||||
next.wolf_RFFoot.scale = Vec3::one() / 11.0;
|
||||
next.wolf_foot_rf.offset = Vec3::new(5.0, 5.0, 2.5) / 11.0;
|
||||
next.wolf_foot_rf.ori = Quaternion::rotation_x(0.0);
|
||||
next.wolf_foot_rf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_LBFoot.offset = Vec3::new(-5.0, -10.0, 2.5) / 11.0;
|
||||
next.wolf_LBFoot.ori = Quaternion::rotation_x(0.0);
|
||||
next.wolf_LBFoot.scale = Vec3::one() / 11.0;
|
||||
next.wolf_foot_lb.offset = Vec3::new(-5.0, -10.0, 2.5) / 11.0;
|
||||
next.wolf_foot_lb.ori = Quaternion::rotation_x(0.0);
|
||||
next.wolf_foot_lb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_RBFoot.offset = Vec3::new(5.0, -10.0, 2.5) / 11.0;
|
||||
next.wolf_RBFoot.ori = Quaternion::rotation_x(0.0);
|
||||
next.wolf_RBFoot.scale = Vec3::one() / 11.0;
|
||||
next.wolf_foot_rb.offset = Vec3::new(5.0, -10.0, 2.5) / 11.0;
|
||||
next.wolf_foot_rb.ori = Quaternion::rotation_x(0.0);
|
||||
next.wolf_foot_rb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -28,56 +28,56 @@ impl Animation for JumpAnimation {
|
||||
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
|
||||
let wave_stop = (anim_time as f32 * 5.0).min(PI / 2.0).sin();
|
||||
|
||||
next.wolf_upperhead.offset = Vec3::new(0.0, 7.5, 15.0 + wave_stop * 4.8) / 11.0;
|
||||
next.wolf_upperhead.ori =
|
||||
next.wolf_head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_stop * 4.8) / 11.0;
|
||||
next.wolf_head_upper.ori =
|
||||
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.wolf_upperhead.scale = Vec3::one() / 10.88;
|
||||
next.wolf_head_upper.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.wolf_jaw.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.wolf_jaw.ori = Quaternion::rotation_x(0.0);
|
||||
next.wolf_jaw.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wolf_lowerhead.offset = Vec3::new(0.0, 3.1, -4.5);
|
||||
next.wolf_lowerhead.ori = Quaternion::rotation_x(wave_stop * -0.1);
|
||||
next.wolf_lowerhead.scale = Vec3::one() * 0.98;
|
||||
next.wolf_head_lower.offset = Vec3::new(0.0, 3.1, -4.5);
|
||||
next.wolf_head_lower.ori = Quaternion::rotation_x(wave_stop * -0.1);
|
||||
next.wolf_head_lower.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.wolf_tail.offset = Vec3::new(0.0, -12.0, 8.0) / 11.0;
|
||||
next.wolf_tail.ori =
|
||||
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.wolf_tail.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_torsoback.offset =
|
||||
next.wolf_torso_back.offset =
|
||||
Vec3::new(0.0, -9.5 + wave_stop * 1.0, 11.0 + wave_stop * 2.2) / 11.0;
|
||||
next.wolf_torsoback.ori = Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.wolf_torsoback.scale = Vec3::one() / 11.0;
|
||||
next.wolf_torso_back.ori = Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.wolf_torso_back.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_torsomid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_stop * 3.6) / 11.0;
|
||||
next.wolf_torsomid.ori = Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.wolf_torsomid.scale = Vec3::one() / 10.5;
|
||||
next.wolf_torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_stop * 3.6) / 11.0;
|
||||
next.wolf_torso_mid.ori = Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.wolf_torso_mid.scale = Vec3::one() / 10.5;
|
||||
|
||||
next.wolf_ears.offset = Vec3::new(0.0, 0.75, 6.25);
|
||||
next.wolf_ears.ori = Quaternion::rotation_x(0.0);
|
||||
next.wolf_ears.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.wolf_LFFoot.offset =
|
||||
next.wolf_foot_lf.offset =
|
||||
Vec3::new(-5.0, 5.0 + wave_stop * 3.0, 5.0 + wave_stop * 7.0) / 11.0;
|
||||
next.wolf_LFFoot.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15);
|
||||
next.wolf_LFFoot.scale = Vec3::one() / 11.0;
|
||||
next.wolf_foot_lf.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15);
|
||||
next.wolf_foot_lf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_RFFoot.offset =
|
||||
next.wolf_foot_rf.offset =
|
||||
Vec3::new(5.0, 5.0 - wave_stop * 3.0, 5.0 + wave_stop * 5.0) / 11.0;
|
||||
next.wolf_RFFoot.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15);
|
||||
next.wolf_RFFoot.scale = Vec3::one() / 11.0;
|
||||
next.wolf_foot_rf.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15);
|
||||
next.wolf_foot_rf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_LBFoot.offset =
|
||||
next.wolf_foot_lb.offset =
|
||||
Vec3::new(-5.0, -10.0 - wave_stop * 2.0, 5.0 + wave_stop * 0.0) / 11.0;
|
||||
next.wolf_LBFoot.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15);
|
||||
next.wolf_LBFoot.scale = Vec3::one() / 11.0;
|
||||
next.wolf_foot_lb.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15);
|
||||
next.wolf_foot_lb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_RBFoot.offset =
|
||||
next.wolf_foot_rb.offset =
|
||||
Vec3::new(5.0, -10.0 + wave_stop * 2.0, 5.0 + wave_stop * 2.0) / 11.0;
|
||||
next.wolf_RBFoot.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15);
|
||||
next.wolf_RBFoot.scale = Vec3::one() / 11.0;
|
||||
next.wolf_foot_rb.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15);
|
||||
next.wolf_foot_rb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -17,33 +17,33 @@ const SCALE: f32 = 11.0;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct QuadrupedMediumSkeleton {
|
||||
wolf_upperhead: Bone,
|
||||
wolf_head_upper: Bone,
|
||||
wolf_jaw: Bone,
|
||||
wolf_lowerhead: Bone,
|
||||
wolf_head_lower: Bone,
|
||||
wolf_tail: Bone,
|
||||
wolf_torsoback: Bone,
|
||||
wolf_torsomid: Bone,
|
||||
wolf_torso_back: Bone,
|
||||
wolf_torso_mid: Bone,
|
||||
wolf_ears: Bone,
|
||||
wolf_LFFoot: Bone,
|
||||
wolf_RFFoot: Bone,
|
||||
wolf_LBFoot: Bone,
|
||||
wolf_RBFoot: Bone,
|
||||
wolf_foot_lf: Bone,
|
||||
wolf_foot_rf: Bone,
|
||||
wolf_foot_lb: Bone,
|
||||
wolf_foot_rb: Bone,
|
||||
}
|
||||
|
||||
impl QuadrupedMediumSkeleton {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
wolf_upperhead: Bone::default(),
|
||||
wolf_head_upper: Bone::default(),
|
||||
wolf_jaw: Bone::default(),
|
||||
wolf_lowerhead: Bone::default(),
|
||||
wolf_head_lower: Bone::default(),
|
||||
wolf_tail: Bone::default(),
|
||||
wolf_torsoback: Bone::default(),
|
||||
wolf_torsomid: Bone::default(),
|
||||
wolf_torso_back: Bone::default(),
|
||||
wolf_torso_mid: Bone::default(),
|
||||
wolf_ears: Bone::default(),
|
||||
wolf_LFFoot: Bone::default(),
|
||||
wolf_RFFoot: Bone::default(),
|
||||
wolf_LBFoot: Bone::default(),
|
||||
wolf_RBFoot: Bone::default(),
|
||||
wolf_foot_lf: Bone::default(),
|
||||
wolf_foot_rf: Bone::default(),
|
||||
wolf_foot_lb: Bone::default(),
|
||||
wolf_foot_rb: Bone::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -51,23 +51,23 @@ impl QuadrupedMediumSkeleton {
|
||||
impl Skeleton for QuadrupedMediumSkeleton {
|
||||
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
||||
let ears_mat = self.wolf_ears.compute_base_matrix();
|
||||
let upperhead_mat = self.wolf_upperhead.compute_base_matrix();
|
||||
let lowerhead_mat = self.wolf_lowerhead.compute_base_matrix();
|
||||
let head_upper_mat = self.wolf_head_upper.compute_base_matrix();
|
||||
let head_lower_mat = self.wolf_head_lower.compute_base_matrix();
|
||||
|
||||
[
|
||||
FigureBoneData::new(upperhead_mat),
|
||||
FigureBoneData::new(head_upper_mat),
|
||||
FigureBoneData::new(
|
||||
upperhead_mat * lowerhead_mat * self.wolf_jaw.compute_base_matrix(),
|
||||
head_upper_mat * head_lower_mat * self.wolf_jaw.compute_base_matrix(),
|
||||
),
|
||||
FigureBoneData::new(upperhead_mat * lowerhead_mat),
|
||||
FigureBoneData::new(head_upper_mat * head_lower_mat),
|
||||
FigureBoneData::new(self.wolf_tail.compute_base_matrix()),
|
||||
FigureBoneData::new(self.wolf_torsoback.compute_base_matrix()),
|
||||
FigureBoneData::new(self.wolf_torsomid.compute_base_matrix()),
|
||||
FigureBoneData::new(upperhead_mat * ears_mat),
|
||||
FigureBoneData::new(self.wolf_LFFoot.compute_base_matrix()),
|
||||
FigureBoneData::new(self.wolf_RFFoot.compute_base_matrix()),
|
||||
FigureBoneData::new(self.wolf_LBFoot.compute_base_matrix()),
|
||||
FigureBoneData::new(self.wolf_RBFoot.compute_base_matrix()),
|
||||
FigureBoneData::new(self.wolf_torso_back.compute_base_matrix()),
|
||||
FigureBoneData::new(self.wolf_torso_mid.compute_base_matrix()),
|
||||
FigureBoneData::new(head_upper_mat * ears_mat),
|
||||
FigureBoneData::new(self.wolf_foot_lf.compute_base_matrix()),
|
||||
FigureBoneData::new(self.wolf_foot_rf.compute_base_matrix()),
|
||||
FigureBoneData::new(self.wolf_foot_lb.compute_base_matrix()),
|
||||
FigureBoneData::new(self.wolf_foot_rb.compute_base_matrix()),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
@ -77,16 +77,16 @@ impl Skeleton for QuadrupedMediumSkeleton {
|
||||
}
|
||||
|
||||
fn interpolate(&mut self, target: &Self) {
|
||||
self.wolf_upperhead.interpolate(&target.wolf_upperhead);
|
||||
self.wolf_head_upper.interpolate(&target.wolf_head_upper);
|
||||
self.wolf_jaw.interpolate(&target.wolf_jaw);
|
||||
self.wolf_lowerhead.interpolate(&target.wolf_lowerhead);
|
||||
self.wolf_head_lower.interpolate(&target.wolf_head_lower);
|
||||
self.wolf_tail.interpolate(&target.wolf_tail);
|
||||
self.wolf_torsoback.interpolate(&target.wolf_torsoback);
|
||||
self.wolf_torsomid.interpolate(&target.wolf_torsomid);
|
||||
self.wolf_torso_back.interpolate(&target.wolf_torso_back);
|
||||
self.wolf_torso_mid.interpolate(&target.wolf_torso_mid);
|
||||
self.wolf_ears.interpolate(&target.wolf_ears);
|
||||
self.wolf_LFFoot.interpolate(&target.wolf_LFFoot);
|
||||
self.wolf_RFFoot.interpolate(&target.wolf_RFFoot);
|
||||
self.wolf_LBFoot.interpolate(&target.wolf_LBFoot);
|
||||
self.wolf_RBFoot.interpolate(&target.wolf_RBFoot);
|
||||
self.wolf_foot_lf.interpolate(&target.wolf_foot_lf);
|
||||
self.wolf_foot_rf.interpolate(&target.wolf_foot_rf);
|
||||
self.wolf_foot_lb.interpolate(&target.wolf_foot_lb);
|
||||
self.wolf_foot_rb.interpolate(&target.wolf_foot_rb);
|
||||
}
|
||||
}
|
||||
|
@ -58,58 +58,58 @@ impl Animation for RunAnimation {
|
||||
* 0.125,
|
||||
);
|
||||
|
||||
next.wolf_upperhead.offset =
|
||||
next.wolf_head_upper.offset =
|
||||
Vec3::new(0.0, 9.5 + wave_quick_cos * 2.0, 15.0 + wave_med * 3.0) / 11.0;
|
||||
next.wolf_upperhead.ori =
|
||||
next.wolf_head_upper.ori =
|
||||
Quaternion::rotation_x(-0.12 + wave_quick_cos * 0.12 + wolf_look.y)
|
||||
* Quaternion::rotation_z(wolf_look.x);
|
||||
next.wolf_upperhead.scale = Vec3::one() / 10.88;
|
||||
next.wolf_head_upper.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.wolf_jaw.offset = Vec3::new(0.0, 4.5, 2.0 + wave_slow_cos * 1.0);
|
||||
next.wolf_jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
|
||||
next.wolf_jaw.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wolf_lowerhead.offset = Vec3::new(0.0, 3.1, -4.5 + wave_med * 1.0);
|
||||
next.wolf_lowerhead.ori = Quaternion::rotation_z(0.0);
|
||||
next.wolf_lowerhead.scale = Vec3::one() * 0.98;
|
||||
next.wolf_head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_med * 1.0);
|
||||
next.wolf_head_lower.ori = Quaternion::rotation_z(0.0);
|
||||
next.wolf_head_lower.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.wolf_tail.offset = Vec3::new(0.0, -12.0, 10.0) / 11.0;
|
||||
next.wolf_tail.ori = Quaternion::rotation_x(wave_quick * 0.18);
|
||||
next.wolf_tail.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_torsoback.offset =
|
||||
next.wolf_torso_back.offset =
|
||||
Vec3::new(0.0, -9.5 + wave_quick_cos * 2.2, 13.0 + wave_med * 2.8) / 11.0;
|
||||
next.wolf_torsoback.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.14);
|
||||
next.wolf_torsoback.scale = Vec3::one() / 11.0;
|
||||
next.wolf_torso_back.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.14);
|
||||
next.wolf_torso_back.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_torsomid.offset =
|
||||
next.wolf_torso_mid.offset =
|
||||
Vec3::new(0.0, 0.0 + wave_quick_cos * 2.2, 14.0 + wave_med * 3.2) / 11.0;
|
||||
next.wolf_torsomid.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.12);
|
||||
next.wolf_torsomid.scale = Vec3::one() / 10.5;
|
||||
next.wolf_torso_mid.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.12);
|
||||
next.wolf_torso_mid.scale = Vec3::one() / 10.5;
|
||||
|
||||
next.wolf_ears.offset = Vec3::new(0.0, 0.75 + wave * 0.4, 6.25);
|
||||
next.wolf_ears.ori = Quaternion::rotation_x(wave * 0.2);
|
||||
next.wolf_ears.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.wolf_LFFoot.offset =
|
||||
next.wolf_foot_lf.offset =
|
||||
Vec3::new(-5.0, 5.0 + wave_quick * 3.0, 7.0 + wave_quick_cos * 4.0) / 11.0;
|
||||
next.wolf_LFFoot.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8);
|
||||
next.wolf_LFFoot.scale = Vec3::one() / 11.0;
|
||||
next.wolf_foot_lf.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8);
|
||||
next.wolf_foot_lf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_RFFoot.offset =
|
||||
next.wolf_foot_rf.offset =
|
||||
Vec3::new(5.0, 5.0 - wave_quick_cos * 3.0, 7.0 + wave_quick * 4.0) / 11.0;
|
||||
next.wolf_RFFoot.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8);
|
||||
next.wolf_RFFoot.scale = Vec3::one() / 11.0;
|
||||
next.wolf_foot_rf.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8);
|
||||
next.wolf_foot_rf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_LBFoot.offset =
|
||||
next.wolf_foot_lb.offset =
|
||||
Vec3::new(-5.0, -10.0 - wave_quick_cos * 3.0, 7.0 + wave_quick * 4.0) / 11.0;
|
||||
next.wolf_LBFoot.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8);
|
||||
next.wolf_LBFoot.scale = Vec3::one() / 11.0;
|
||||
next.wolf_foot_lb.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8);
|
||||
next.wolf_foot_lb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wolf_RBFoot.offset =
|
||||
next.wolf_foot_rb.offset =
|
||||
Vec3::new(5.0, -10.0 + wave_quick * 3.0, 7.0 + wave_quick_cos * 4.0) / 11.0;
|
||||
next.wolf_RBFoot.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8);
|
||||
next.wolf_RBFoot.scale = Vec3::one() / 11.0;
|
||||
next.wolf_foot_rb.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8);
|
||||
next.wolf_foot_rb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ pub struct AudioFrontend {
|
||||
device: Device,
|
||||
// Performance optimisation, iterating through available audio devices takes time
|
||||
devices: Vec<Device>,
|
||||
// streams: HashMap<String, SpatialSink>, //always use SpatialSink even if no possition is used for now
|
||||
// streams: HashMap<String, SpatialSink>, //always use SpatialSink even if no position is used for now
|
||||
stream: SpatialSink,
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ impl<'a> Widget for SettingsWindow<'a> {
|
||||
|
||||
Text::new("Show Help")
|
||||
.right_from(state.ids.button_help, 10.0)
|
||||
.font_size(12)
|
||||
.font_size(14)
|
||||
.font_id(self.fonts.opensans)
|
||||
.graphics_for(state.ids.button_help)
|
||||
.color(TEXT_COLOR)
|
||||
@ -500,7 +500,7 @@ impl<'a> Widget for SettingsWindow<'a> {
|
||||
}
|
||||
// Contents
|
||||
if let SettingsTab::Video = state.settings_tab {
|
||||
Text::new("Viewdistance")
|
||||
Text::new("View Distance")
|
||||
.top_left_with_margins_on(state.ids.settings_content, 10.0, 10.0)
|
||||
.font_size(14)
|
||||
.font_id(self.fonts.opensans)
|
||||
|
@ -121,7 +121,7 @@ fn main() {
|
||||
}
|
||||
};
|
||||
let msg = format!(
|
||||
"A critical error has occured and Voxygen has been forced to \
|
||||
"A critical error has occurred and Voxygen has been forced to \
|
||||
terminate in an unusual manner. Details about the error can be \
|
||||
found below.\n\
|
||||
\n\
|
||||
|
@ -88,14 +88,14 @@ impl PlayState for CharSelectionState {
|
||||
}
|
||||
}
|
||||
|
||||
// Mantain global state
|
||||
// Maintain global state.
|
||||
global_state.maintain();
|
||||
|
||||
// Maintain the scene.
|
||||
self.scene
|
||||
.maintain(global_state.window.renderer_mut(), &self.client.borrow());
|
||||
|
||||
// Render the scene
|
||||
// Render the scene.
|
||||
self.scene.render(
|
||||
global_state.window.renderer_mut(),
|
||||
&self.client.borrow(),
|
||||
|
@ -308,10 +308,10 @@ impl MainMenuUi {
|
||||
.w_h(400.0, 400.0)
|
||||
.set(self.ids.servers_frame, ui_widgets);
|
||||
|
||||
let netsettings = &global_state.settings.networking;
|
||||
let net_settings = &global_state.settings.networking;
|
||||
|
||||
// TODO: Draw scroll bar or remove it.
|
||||
let (mut items, scrollbar) = List::flow_down(netsettings.servers.len())
|
||||
let (mut items, scrollbar) = List::flow_down(net_settings.servers.len())
|
||||
.top_left_with_margins_on(self.ids.servers_frame, 0.0, 5.0)
|
||||
.w_h(400.0, 300.0)
|
||||
.scrollbar_next_to()
|
||||
@ -321,12 +321,12 @@ impl MainMenuUi {
|
||||
|
||||
while let Some(item) = items.next(ui_widgets) {
|
||||
let mut text = "".to_string();
|
||||
if &netsettings.servers[item.i] == &self.server_address {
|
||||
if &net_settings.servers[item.i] == &self.server_address {
|
||||
text.push_str("* ")
|
||||
} else {
|
||||
text.push_str(" ")
|
||||
}
|
||||
text.push_str(&netsettings.servers[item.i]);
|
||||
text.push_str(&net_settings.servers[item.i]);
|
||||
|
||||
if item
|
||||
.set(
|
||||
@ -344,7 +344,7 @@ impl MainMenuUi {
|
||||
.was_clicked()
|
||||
{
|
||||
// TODO: Set as current server address
|
||||
self.server_address = netsettings.servers[item.i].clone();
|
||||
self.server_address = net_settings.servers[item.i].clone();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,8 @@ use common::{
|
||||
self,
|
||||
actor::{
|
||||
Belt, Chest, Draw, Foot, Hand, Head, Pants, PigChest, PigHead, PigLegL, PigLegR,
|
||||
Shoulder, Weapon, WolfEars, WolfJaw, WolfLBFoot, WolfLFFoot, WolfLowerHead, WolfRBFoot,
|
||||
WolfRFFoot, WolfTail, WolfTorsoBack, WolfTorsoMid, WolfUpperHead,
|
||||
Shoulder, Weapon, WolfEars, WolfFootLB, WolfFootLF, WolfFootRB, WolfFootRF,
|
||||
WolfHeadLower, WolfHeadUpper, WolfJaw, WolfTail, WolfTorsoBack, WolfTorsoMid,
|
||||
},
|
||||
Body, HumanoidBody, QuadrupedBody, QuadrupedMediumBody,
|
||||
},
|
||||
@ -100,17 +100,17 @@ impl FigureModelCache {
|
||||
None,
|
||||
],
|
||||
Body::QuadrupedMedium(body) => [
|
||||
Some(Self::load_wolf_upperhead(body.wolf_upperhead)),
|
||||
Some(Self::load_wolf_head_upper(body.wolf_head_upper)),
|
||||
Some(Self::load_wolf_jaw(body.wolf_jaw)),
|
||||
Some(Self::load_wolf_lowerhead(body.wolf_lowerhead)),
|
||||
Some(Self::load_wolf_head_lower(body.wolf_head_lower)),
|
||||
Some(Self::load_wolf_tail(body.wolf_tail)),
|
||||
Some(Self::load_wolf_torsoback(body.wolf_torsoback)),
|
||||
Some(Self::load_wolf_torsomid(body.wolf_torsomid)),
|
||||
Some(Self::load_wolf_torso_back(body.wolf_torso_back)),
|
||||
Some(Self::load_wolf_torso_mid(body.wolf_torso_mid)),
|
||||
Some(Self::load_wolf_ears(body.wolf_ears)),
|
||||
Some(Self::load_wolf_lffoot(body.wolf_lffoot)),
|
||||
Some(Self::load_wolf_rffoot(body.wolf_rffoot)),
|
||||
Some(Self::load_wolf_lbfoot(body.wolf_lbfoot)),
|
||||
Some(Self::load_wolf_rbfoot(body.wolf_rbfoot)),
|
||||
Some(Self::load_wolf_foot_lf(body.wolf_foot_lf)),
|
||||
Some(Self::load_wolf_foot_rf(body.wolf_foot_rf)),
|
||||
Some(Self::load_wolf_foot_lb(body.wolf_foot_lb)),
|
||||
Some(Self::load_wolf_foot_rb(body.wolf_foot_rb)),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
@ -286,6 +286,7 @@ impl FigureModelCache {
|
||||
Vec3::new(-1.5, -6.5, -4.5),
|
||||
)
|
||||
}
|
||||
|
||||
fn load_right_equip(hand: Hand) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match hand {
|
||||
@ -298,7 +299,7 @@ impl FigureModelCache {
|
||||
fn load_pig_head(pig_head: PigHead) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match pig_head {
|
||||
PigHead::Default => "npc/pig_purple/pighead.vox",
|
||||
PigHead::Default => "npc/pig_purple/pig_head.vox",
|
||||
},
|
||||
Vec3::new(-6.0, 4.5, 3.0),
|
||||
)
|
||||
@ -307,7 +308,7 @@ impl FigureModelCache {
|
||||
fn load_pig_chest(pig_chest: PigChest) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match pig_chest {
|
||||
PigChest::Default => "npc/pig_purple/pigchest.vox",
|
||||
PigChest::Default => "npc/pig_purple/pig_chest.vox",
|
||||
},
|
||||
Vec3::new(-5.0, 4.5, 0.0),
|
||||
)
|
||||
@ -316,7 +317,7 @@ impl FigureModelCache {
|
||||
fn load_pig_leg_lf(pig_leg_l: PigLegL) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match pig_leg_l {
|
||||
PigLegL::Default => "npc/pig_purple/pigleg_l.vox",
|
||||
PigLegL::Default => "npc/pig_purple/pig_leg_l.vox",
|
||||
},
|
||||
Vec3::new(0.0, -1.0, -1.5),
|
||||
)
|
||||
@ -325,16 +326,16 @@ impl FigureModelCache {
|
||||
fn load_pig_leg_rf(pig_leg_r: PigLegR) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match pig_leg_r {
|
||||
PigLegR::Default => "npc/pig_purple/pigleg_r.vox",
|
||||
PigLegR::Default => "npc/pig_purple/pig_leg_r.vox",
|
||||
},
|
||||
Vec3::new(0.0, -1.0, -1.5),
|
||||
)
|
||||
}
|
||||
|
||||
fn load_pig_leg_lb(pigleg_l: PigLegL) -> Mesh<FigurePipeline> {
|
||||
fn load_pig_leg_lb(pig_leg_l: PigLegL) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match pigleg_l {
|
||||
PigLegL::Default => "npc/pig_purple/pigleg_l.vox",
|
||||
match pig_leg_l {
|
||||
PigLegL::Default => "npc/pig_purple/pig_leg_l.vox",
|
||||
},
|
||||
Vec3::new(0.0, -1.0, -1.5),
|
||||
)
|
||||
@ -343,20 +344,21 @@ impl FigureModelCache {
|
||||
fn load_pig_leg_rb(pig_leg_r: PigLegR) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match pig_leg_r {
|
||||
PigLegR::Default => "npc/pig_purple/pigleg_r.vox",
|
||||
PigLegR::Default => "npc/pig_purple/pig_leg_r.vox",
|
||||
},
|
||||
Vec3::new(0.0, -1.0, -1.5),
|
||||
)
|
||||
}
|
||||
//////
|
||||
fn load_wolf_upperhead(wolf_upperhead: WolfUpperHead) -> Mesh<FigurePipeline> {
|
||||
fn load_wolf_head_upper(wolf_upper_head: WolfHeadUpper) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match wolf_upperhead {
|
||||
WolfUpperHead::Default => "npc/wolf/wolf_upper_head.vox",
|
||||
match wolf_upper_head {
|
||||
WolfHeadUpper::Default => "npc/wolf/wolf_head_upper.vox",
|
||||
},
|
||||
Vec3::new(-7.0, -6.0, -5.5),
|
||||
)
|
||||
}
|
||||
|
||||
fn load_wolf_jaw(wolf_jaw: WolfJaw) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match wolf_jaw {
|
||||
@ -365,14 +367,16 @@ impl FigureModelCache {
|
||||
Vec3::new(-3.0, -3.0, -2.5),
|
||||
)
|
||||
}
|
||||
fn load_wolf_lowerhead(wolf_lowerhead: WolfLowerHead) -> Mesh<FigurePipeline> {
|
||||
|
||||
fn load_wolf_head_lower(wolf_head_lower: WolfHeadLower) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match wolf_lowerhead {
|
||||
WolfLowerHead::Default => "npc/wolf/wolf_lower_head.vox",
|
||||
match wolf_head_lower {
|
||||
WolfHeadLower::Default => "npc/wolf/wolf_head_lower.vox",
|
||||
},
|
||||
Vec3::new(-7.0, -6.0, -5.5),
|
||||
)
|
||||
}
|
||||
|
||||
fn load_wolf_tail(wolf_tail: WolfTail) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match wolf_tail {
|
||||
@ -381,22 +385,25 @@ impl FigureModelCache {
|
||||
Vec3::new(-2.0, -12.0, -5.0),
|
||||
)
|
||||
}
|
||||
fn load_wolf_torsoback(wolf_torsoback: WolfTorsoBack) -> Mesh<FigurePipeline> {
|
||||
|
||||
fn load_wolf_torso_back(wolf_torso_back: WolfTorsoBack) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match wolf_torsoback {
|
||||
match wolf_torso_back {
|
||||
WolfTorsoBack::Default => "npc/wolf/wolf_torso_back.vox",
|
||||
},
|
||||
Vec3::new(-7.0, -6.0, -6.0),
|
||||
)
|
||||
}
|
||||
fn load_wolf_torsomid(wolf_torsomid: WolfTorsoMid) -> Mesh<FigurePipeline> {
|
||||
|
||||
fn load_wolf_torso_mid(wolf_torso_mid: WolfTorsoMid) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match wolf_torsomid {
|
||||
match wolf_torso_mid {
|
||||
WolfTorsoMid::Default => "npc/wolf/wolf_torso_mid.vox",
|
||||
},
|
||||
Vec3::new(-8.0, -5.5, -6.0),
|
||||
)
|
||||
}
|
||||
|
||||
fn load_wolf_ears(wolf_ears: WolfEars) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match wolf_ears {
|
||||
@ -405,34 +412,38 @@ impl FigureModelCache {
|
||||
Vec3::new(-4.0, -1.0, -1.0),
|
||||
)
|
||||
}
|
||||
fn load_wolf_lffoot(wolf_lffoot: WolfLFFoot) -> Mesh<FigurePipeline> {
|
||||
|
||||
fn load_wolf_foot_lf(wolf_foot_lf: WolfFootLF) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match wolf_lffoot {
|
||||
WolfLFFoot::Default => "npc/wolf/wolf_lf_foot.vox",
|
||||
match wolf_foot_lf {
|
||||
WolfFootLF::Default => "npc/wolf/wolf_foot_lf.vox",
|
||||
},
|
||||
Vec3::new(-2.5, -4.0, -2.5),
|
||||
)
|
||||
}
|
||||
fn load_wolf_rffoot(wolf_rffoot: WolfRFFoot) -> Mesh<FigurePipeline> {
|
||||
|
||||
fn load_wolf_foot_rf(wolf_foot_rf: WolfFootRF) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match wolf_rffoot {
|
||||
WolfRFFoot::Default => "npc/wolf/wolf_rf_foot.vox",
|
||||
match wolf_foot_rf {
|
||||
WolfFootRF::Default => "npc/wolf/wolf_foot_rf.vox",
|
||||
},
|
||||
Vec3::new(-2.5, -4.0, -2.5),
|
||||
)
|
||||
}
|
||||
fn load_wolf_lbfoot(wolf_lbfoot: WolfLBFoot) -> Mesh<FigurePipeline> {
|
||||
|
||||
fn load_wolf_foot_lb(wolf_foot_lb: WolfFootLB) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match wolf_lbfoot {
|
||||
WolfLBFoot::Default => "npc/wolf/wolf_lb_foot.vox",
|
||||
match wolf_foot_lb {
|
||||
WolfFootLB::Default => "npc/wolf/wolf_foot_lb.vox",
|
||||
},
|
||||
Vec3::new(-2.5, -4.0, -2.5),
|
||||
)
|
||||
}
|
||||
fn load_wolf_rbfoot(wolf_rbfoot: WolfRBFoot) -> Mesh<FigurePipeline> {
|
||||
|
||||
fn load_wolf_foot_rb(wolf_foot_rb: WolfFootRB) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match wolf_rbfoot {
|
||||
WolfRBFoot::Default => "npc/wolf/wolf_rb_foot.vox",
|
||||
match wolf_foot_rb {
|
||||
WolfFootRB::Default => "npc/wolf/wolf_foot_rb.vox",
|
||||
},
|
||||
Vec3::new(-2.5, -4.0, -2.5),
|
||||
)
|
||||
@ -443,7 +454,7 @@ pub struct FigureMgr {
|
||||
model_cache: FigureModelCache,
|
||||
character_states: HashMap<EcsEntity, FigureState<CharacterSkeleton>>,
|
||||
quadruped_states: HashMap<EcsEntity, FigureState<QuadrupedSkeleton>>,
|
||||
QuadrupedMedium_states: HashMap<EcsEntity, FigureState<QuadrupedMediumSkeleton>>,
|
||||
quadruped_medium_states: HashMap<EcsEntity, FigureState<QuadrupedMediumSkeleton>>,
|
||||
}
|
||||
|
||||
impl FigureMgr {
|
||||
@ -452,7 +463,7 @@ impl FigureMgr {
|
||||
model_cache: FigureModelCache::new(),
|
||||
character_states: HashMap::new(),
|
||||
quadruped_states: HashMap::new(),
|
||||
QuadrupedMedium_states: HashMap::new(),
|
||||
quadruped_medium_states: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -472,11 +483,11 @@ impl FigureMgr {
|
||||
.get(client.entity())
|
||||
.map_or(Vec3::zero(), |pos| pos.0);
|
||||
|
||||
for (entity, pos, vel, dir, actor, animation_info, stats) in (
|
||||
for (entity, pos, vel, ori, actor, animation_info, stats) in (
|
||||
&ecs.entities(),
|
||||
&ecs.read_storage::<comp::phys::Pos>(),
|
||||
&ecs.read_storage::<comp::phys::Vel>(),
|
||||
&ecs.read_storage::<comp::phys::Dir>(),
|
||||
&ecs.read_storage::<comp::phys::Ori>(),
|
||||
&ecs.read_storage::<comp::Actor>(),
|
||||
&ecs.read_storage::<comp::AnimationInfo>(),
|
||||
ecs.read_storage::<comp::Stats>().maybe(),
|
||||
@ -500,7 +511,7 @@ impl FigureMgr {
|
||||
self.quadruped_states.remove(&entity);
|
||||
}
|
||||
Body::QuadrupedMedium(_) => {
|
||||
self.QuadrupedMedium_states.remove(&entity);
|
||||
self.quadruped_medium_states.remove(&entity);
|
||||
}
|
||||
},
|
||||
}
|
||||
@ -557,7 +568,7 @@ impl FigureMgr {
|
||||
};
|
||||
|
||||
state.skeleton.interpolate(&target_skeleton);
|
||||
state.update(renderer, pos.0, dir.0, col);
|
||||
state.update(renderer, pos.0, ori.0, col);
|
||||
}
|
||||
Body::Quadruped(body) => {
|
||||
let state = self.quadruped_states.entry(entity).or_insert_with(|| {
|
||||
@ -586,11 +597,11 @@ impl FigureMgr {
|
||||
};
|
||||
|
||||
state.skeleton.interpolate(&target_skeleton);
|
||||
state.update(renderer, pos.0, dir.0, col);
|
||||
state.update(renderer, pos.0, ori.0, col);
|
||||
}
|
||||
Body::QuadrupedMedium(body) => {
|
||||
let state =
|
||||
self.QuadrupedMedium_states
|
||||
self.quadruped_medium_states
|
||||
.entry(entity)
|
||||
.or_insert_with(|| {
|
||||
FigureState::new(renderer, QuadrupedMediumSkeleton::new())
|
||||
@ -622,7 +633,7 @@ impl FigureMgr {
|
||||
};
|
||||
|
||||
state.skeleton.interpolate(&target_skeleton);
|
||||
state.update(renderer, pos.0, dir.0, col);
|
||||
state.update(renderer, pos.0, ori.0, col);
|
||||
}
|
||||
},
|
||||
// TODO: Non-character actors
|
||||
@ -634,7 +645,7 @@ impl FigureMgr {
|
||||
.retain(|entity, _| ecs.entities().is_alive(*entity));
|
||||
self.quadruped_states
|
||||
.retain(|entity, _| ecs.entities().is_alive(*entity));
|
||||
self.QuadrupedMedium_states
|
||||
self.quadruped_medium_states
|
||||
.retain(|entity, _| ecs.entities().is_alive(*entity));
|
||||
}
|
||||
|
||||
@ -660,7 +671,7 @@ impl FigureMgr {
|
||||
&ecs.entities(),
|
||||
&ecs.read_storage::<comp::phys::Pos>(),
|
||||
&ecs.read_storage::<comp::phys::Vel>(),
|
||||
&ecs.read_storage::<comp::phys::Dir>(),
|
||||
&ecs.read_storage::<comp::phys::Ori>(),
|
||||
&ecs.read_storage::<comp::Actor>(),
|
||||
&ecs.read_storage::<comp::AnimationInfo>(),
|
||||
ecs.read_storage::<comp::Stats>().maybe(),
|
||||
@ -689,7 +700,7 @@ impl FigureMgr {
|
||||
.get(&entity)
|
||||
.map(|state| (state.locals(), state.bone_consts())),
|
||||
Body::QuadrupedMedium(_) => self
|
||||
.QuadrupedMedium_states
|
||||
.quadruped_medium_states
|
||||
.get(&entity)
|
||||
.map(|state| (state.locals(), state.bone_consts())),
|
||||
} {
|
||||
@ -726,12 +737,12 @@ impl<S: Skeleton> FigureState<S> {
|
||||
&mut self,
|
||||
renderer: &mut Renderer,
|
||||
pos: Vec3<f32>,
|
||||
dir: Vec3<f32>,
|
||||
ori: Vec3<f32>,
|
||||
col: Rgba<f32>,
|
||||
) {
|
||||
let mat = Mat4::<f32>::identity()
|
||||
* Mat4::translation_3d(pos)
|
||||
* Mat4::rotation_z(-dir.x.atan2(dir.y)); // + f32::consts::PI / 2.0);
|
||||
* Mat4::rotation_z(-ori.x.atan2(ori.y)); // + f32::consts::PI / 2.0);
|
||||
|
||||
let locals = FigureLocals::new(mat, col);
|
||||
renderer.update_consts(&mut self.locals, &[locals]).unwrap();
|
||||
|
@ -238,11 +238,11 @@ impl FigureMgr {
|
||||
pub fn maintain(&mut self, renderer: &mut Renderer, client: &Client) {
|
||||
let time = client.state().get_time();
|
||||
let ecs = client.state().ecs();
|
||||
for (entity, pos, vel, dir, actor, animation_history) in (
|
||||
for (entity, pos, vel, ori, actor, animation_history) in (
|
||||
&ecs.entities(),
|
||||
&ecs.read_storage::<comp::phys::Pos>(),
|
||||
&ecs.read_storage::<comp::phys::Vel>(),
|
||||
&ecs.read_storage::<comp::phys::Dir>(),
|
||||
&ecs.read_storage::<comp::phys::Ori>(),
|
||||
&ecs.read_storage::<comp::Actor>(),
|
||||
&ecs.read_storage::<comp::AnimationHistory>(),
|
||||
)
|
||||
@ -275,7 +275,7 @@ impl FigureMgr {
|
||||
|
||||
state.skeleton.interpolate(&target_skeleton);
|
||||
|
||||
state.update(renderer, pos.0, dir.0);
|
||||
state.update(renderer, pos.0, ori.0);
|
||||
} // TODO: Non-humanoid bodies.
|
||||
},
|
||||
// TODO: Non-character actors.
|
||||
@ -333,10 +333,10 @@ impl<S: Skeleton> FigureState<S> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update(&mut self, renderer: &mut Renderer, pos: Vec3<f32>, dir: Vec3<f32>) {
|
||||
pub fn update(&mut self, renderer: &mut Renderer, pos: Vec3<f32>, ori: Vec3<f32>) {
|
||||
let mat = Mat4::<f32>::identity()
|
||||
* Mat4::translation_3d(pos)
|
||||
* Mat4::rotation_z(-dir.x.atan2(dir.y)); // + f32::consts::PI / 2.0);
|
||||
* Mat4::rotation_z(-ori.x.atan2(ori.y)); // + f32::consts::PI / 2.0);
|
||||
|
||||
let locals = FigureLocals::new(mat);
|
||||
renderer.update_consts(&mut self.locals, &[locals]).unwrap();
|
||||
|
@ -108,7 +108,7 @@ impl FigureModelCache {
|
||||
fn load_head(head: Head) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match head {
|
||||
Head::Default => "pig_purple/pighead.vox",
|
||||
Head::Default => "pig_purple/pig_head.vox",
|
||||
},
|
||||
Vec3::new(0.0, 0.0, 0.0),
|
||||
)
|
||||
@ -117,7 +117,7 @@ impl FigureModelCache {
|
||||
fn load_chest(chest: Chest) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match chest {
|
||||
Chest::Default => "pig_purple/pigchest.vox",
|
||||
Chest::Default => "pig_purple/pig_chest.vox",
|
||||
},
|
||||
Vec3::new(0.0, 0.0, 0.0),
|
||||
)
|
||||
@ -126,7 +126,7 @@ impl FigureModelCache {
|
||||
fn load_leg_lf(leg_l: Leg_l) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match belt {
|
||||
Belt::Default => "pig_purple/pigleg_l.vox",
|
||||
Belt::Default => "pig_purple/pig_leg_l.vox",
|
||||
},
|
||||
Vec3::new(0.0, 0.0, 0.0),
|
||||
)
|
||||
@ -135,7 +135,7 @@ impl FigureModelCache {
|
||||
fn load_leg_rf(leg_r: Leg_r) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match pants {
|
||||
Pants::Default => "pig_purple/pigleg_r.vox",
|
||||
Pants::Default => "pig_purple/pig_leg_r.vox",
|
||||
},
|
||||
Vec3::new(0.0, 0.0, 0.0),
|
||||
)
|
||||
@ -144,7 +144,7 @@ impl FigureModelCache {
|
||||
fn load_leg_lb(leg_l: Leg_l) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match hand {
|
||||
Hand::Default => "pig_purple/pigleg_l.vox",
|
||||
Hand::Default => "pig_purple/pig_leg_l.vox",
|
||||
},
|
||||
Vec3::new(0.0, 0.0, 0.0),
|
||||
)
|
||||
@ -153,7 +153,7 @@ impl FigureModelCache {
|
||||
fn load_leg_rb(leg_r: Leg_r) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match hand {
|
||||
Hand::Default => "pig_purple/pigleg_r.vox",
|
||||
Hand::Default => "pig_purple/pig_leg_r.vox",
|
||||
},
|
||||
Vec3::new(0.0, 0.0, 0.0),
|
||||
)
|
||||
@ -180,11 +180,11 @@ impl FigureMgr {
|
||||
pub fn maintain(&mut self, renderer: &mut Renderer, client: &Client) {
|
||||
let time = client.state().get_time();
|
||||
let ecs = client.state().ecs();
|
||||
for (entity, pos, vel, dir, actor, animation_history) in (
|
||||
for (entity, pos, vel, ori, actor, animation_history) in (
|
||||
&ecs.entities(),
|
||||
&ecs.read_storage::<comp::phys::Pos>(),
|
||||
&ecs.read_storage::<comp::phys::Vel>(),
|
||||
&ecs.read_storage::<comp::phys::Dir>(),
|
||||
&ecs.read_storage::<comp::phys::Ori>(),
|
||||
&ecs.read_storage::<comp::Actor>(),
|
||||
&ecs.read_storage::<comp::AnimationHistory>(),
|
||||
)
|
||||
@ -205,7 +205,7 @@ impl FigureMgr {
|
||||
|
||||
state.skeleton.interpolate(&target_skeleton);
|
||||
|
||||
state.update(renderer, pos.0, dir.0);
|
||||
state.update(renderer, pos.0, ori.0);
|
||||
} // TODO: Non-humanoid bodies
|
||||
},
|
||||
// TODO: Non-character actors
|
||||
@ -263,10 +263,10 @@ impl<S: Skeleton> FigureState<S> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update(&mut self, renderer: &mut Renderer, pos: Vec3<f32>, dir: Vec3<f32>) {
|
||||
pub fn update(&mut self, renderer: &mut Renderer, pos: Vec3<f32>, ori: Vec3<f32>) {
|
||||
let mat = Mat4::<f32>::identity()
|
||||
* Mat4::translation_3d(pos)
|
||||
* Mat4::rotation_z(-dir.x.atan2(dir.y)); // + f32::consts::PI / 2.0);
|
||||
* Mat4::rotation_z(-ori.x.atan2(ori.y)); // + f32::consts::PI / 2.0);
|
||||
|
||||
let locals = FigureLocals::new(mat);
|
||||
renderer.update_consts(&mut self.locals, &[locals]).unwrap();
|
||||
|
@ -24,7 +24,7 @@ pub struct Singleplayer {
|
||||
|
||||
impl Singleplayer {
|
||||
pub fn new() -> (Self, SocketAddr) {
|
||||
let (sender, reciever) = channel();
|
||||
let (sender, receiver) = channel();
|
||||
|
||||
let sock = SocketAddr::from((
|
||||
[127, 0, 0, 1],
|
||||
@ -35,7 +35,7 @@ impl Singleplayer {
|
||||
let server = Server::bind(sock.clone()).expect("Failed to create server instance!");
|
||||
|
||||
let thread = thread::spawn(move || {
|
||||
run_server(server, reciever);
|
||||
run_server(server, receiver);
|
||||
});
|
||||
|
||||
(
|
||||
|
@ -315,7 +315,7 @@ impl Ui {
|
||||
}
|
||||
// Primitives still left to draw ingame
|
||||
Placement::InWorld(num_prims, res) => match kind {
|
||||
// Other types don't aren't drawn & shoudn't decrement the number of primitives left to draw ingame
|
||||
// Other types aren't drawn & shouldn't decrement the number of primitives left to draw ingame
|
||||
PrimitiveKind::Other(_) => {}
|
||||
// Decrement the number of primitives left
|
||||
_ => placement = Placement::InWorld(num_prims - 1, res),
|
||||
|
@ -60,7 +60,7 @@ pub struct IngameParameters {
|
||||
pub pos: Vec3<f32>,
|
||||
// Number of pixels per 1 unit in world coordinates (ie a voxel)
|
||||
// Used for widgets that are rasterized before being sent to the gpu (text & images)
|
||||
// Potentially make this autmatic based on distance to camera?
|
||||
// Potentially make this automatic based on distance to camera?
|
||||
pub res: f32,
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ impl Window {
|
||||
let mut path = PathBuf::from("./screenshots");
|
||||
if !path.exists() {
|
||||
if let Err(err) = std::fs::create_dir(&path) {
|
||||
log::error!("Coudn't create folder for screenshot: {:?}", err);
|
||||
log::error!("Couldn't create folder for screenshot: {:?}", err);
|
||||
}
|
||||
}
|
||||
path.push(format!(
|
||||
@ -322,11 +322,14 @@ impl Window {
|
||||
.unwrap_or(0)
|
||||
));
|
||||
if let Err(err) = img.save(&path) {
|
||||
log::error!("Coudn't save screenshot: {:?}", err);
|
||||
log::error!("Couldn't save screenshot: {:?}", err);
|
||||
}
|
||||
});
|
||||
}
|
||||
Err(err) => log::error!("Coudn't create screenshot due to renderer error: {:?}", err),
|
||||
Err(err) => log::error!(
|
||||
"Couldn't create screenshot due to renderer error: {:?}",
|
||||
err
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user