added comment about object rotation, changed lantern spawning command, changed /tell output when you /tell yourself

This commit is contained in:
Monty Marz 2019-07-28 09:21:17 +00:00 committed by Marcel
parent bacee7750f
commit 33565b9480
28 changed files with 178 additions and 74 deletions

BIN
assets/voxygen/voxel/object/bed_blue.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/voxel/object/bed_human_blue.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/object/bedroll.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/object/campfire.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/voxel/object/carpet_human_round.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/object/carpet_human_square.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/object/carpet_human_square_2.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/object/carpet_human_squircle.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/object/chair.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/voxel/object/chair_2.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/object/chair_3.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/object/drawer.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/voxel/object/table.vox (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/voxel/object/table_2.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/object/table_3.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -13,7 +13,7 @@ pub enum Body {
ChestLight,
ChestOpen,
ChestSkull,
Pumpkin1,
Pumpkin,
Pumpkin2,
Pumpkin3,
Pumpkin4,
@ -31,14 +31,23 @@ pub enum Body {
WindowSpooky,
DoorSpooky,
Anvil,
Gravestone1,
Gravestone,
Gravestone2,
Bench,
Chair,
Chair2,
Chair3,
Table,
Table2,
Table3,
Drawer,
BedBlue,
Carpet1,
Carpet,
Bedroll,
CarpetHumanRound,
CarpetHumanSquare,
CarpetHumanSquare2,
CarpetHumanSquircle,
}
impl Body {
@ -48,7 +57,7 @@ impl Body {
}
}
const ALL_OBJECTS: [Body; 37] = [
const ALL_OBJECTS: [Body; 46] = [
Body::Bomb,
Body::Scarecrow,
Body::Cauldron,
@ -60,7 +69,7 @@ const ALL_OBJECTS: [Body; 37] = [
Body::ChestLight,
Body::ChestOpen,
Body::ChestSkull,
Body::Pumpkin1,
Body::Pumpkin,
Body::Pumpkin2,
Body::Pumpkin3,
Body::Pumpkin4,
@ -78,12 +87,21 @@ const ALL_OBJECTS: [Body; 37] = [
Body::WindowSpooky,
Body::DoorSpooky,
Body::Anvil,
Body::Gravestone1,
Body::Gravestone,
Body::Gravestone2,
Body::Bench,
Body::Chair,
Body::Chair2,
Body::Chair3,
Body::Table,
Body::Table2,
Body::Table3,
Body::Drawer,
Body::BedBlue,
Body::Carpet1,
Body::Carpet,
Body::Bedroll,
Body::CarpetHumanRound,
Body::CarpetHumanSquare,
Body::CarpetHumanSquare2,
Body::CarpetHumanSquircle,
];

View File

@ -484,57 +484,91 @@ fn handle_killnpcs(server: &mut Server, entity: EcsEntity, _args: String, _actio
fn handle_object(server: &mut Server, entity: EcsEntity, args: String, _action: &ChatCommand) {
let obj_type = scan_fmt!(&args, _action.arg_fmt, String);
let pos = server
.state
.ecs()
.read_storage::<comp::Pos>()
.get(entity)
.copied();
if let Some(pos) = pos {
let ori = server
.state
.ecs()
.read_storage::<comp::Ori>()
.get(entity)
.copied();
/*let builder = server
.create_object(pos, ori, obj_type)
.with(ori);*/
if let (Some(pos), Some(ori)) = (pos, ori) {
let obj_type = match obj_type.as_ref().map(String::as_str) {
Some("Scarecrow") => comp::object::Body::Scarecrow,
Some("Cauldron") => comp::object::Body::Cauldron,
Some("Chest_Vines") => comp::object::Body::ChestVines,
Some("Chest") => comp::object::Body::Chest,
Some("Chest_Dark") => comp::object::Body::ChestDark,
Some("Chest_Demon") => comp::object::Body::ChestDemon,
Some("Chest_Gold") => comp::object::Body::ChestGold,
Some("Chest_Light") => comp::object::Body::ChestLight,
Some("Chest_Open") => comp::object::Body::ChestOpen,
Some("Chest_Skull") => comp::object::Body::ChestSkull,
Some("Pumpkin_1") => comp::object::Body::Pumpkin1,
Some("Pumpkin_2") => comp::object::Body::Pumpkin2,
Some("Pumpkin_3") => comp::object::Body::Pumpkin3,
Some("Pumpkin_4") => comp::object::Body::Pumpkin4,
Some("Pumpkin_5") => comp::object::Body::Pumpkin5,
Some("Campfire") => comp::object::Body::Campfire,
Some("Lantern_Ground") => comp::object::Body::LanternGround,
Some("Lantern_Ground_Open") => comp::object::Body::LanternGroundOpen,
Some("Lantern_Standing_2") => comp::object::Body::LanternStanding2,
Some("Lantern_Standing") => comp::object::Body::LanternStanding,
Some("Potion_Blue") => comp::object::Body::PotionBlue,
Some("Potion_Green") => comp::object::Body::PotionGreen,
Some("Potion_Red") => comp::object::Body::PotionRed,
Some("Crate") => comp::object::Body::Crate,
Some("Tent") => comp::object::Body::Tent,
Some("Bomb") => comp::object::Body::Bomb,
Some("Window_Spooky") => comp::object::Body::WindowSpooky,
Some("Carpet_1") => comp::object::Body::Carpet1,
Some("Table") => comp::object::Body::Table,
Some("Drawer") => comp::object::Body::Drawer,
Some("Bed_Blue") => comp::object::Body::BedBlue,
Some("Anvil") => comp::object::Body::Anvil,
Some("Gravestone_1") => comp::object::Body::Gravestone1,
Some("Gravestone_2") => comp::object::Body::Gravestone2,
Some("Chair") => comp::object::Body::Chair,
Some("Bench") => comp::object::Body::Bench,
Some("scarecrow") => comp::object::Body::Scarecrow,
Some("cauldron") => comp::object::Body::Cauldron,
Some("chest_vines") => comp::object::Body::ChestVines,
Some("chest") => comp::object::Body::Chest,
Some("chest_dark") => comp::object::Body::ChestDark,
Some("chest_demon") => comp::object::Body::ChestDemon,
Some("chest_gold") => comp::object::Body::ChestGold,
Some("chest_light") => comp::object::Body::ChestLight,
Some("chest_open") => comp::object::Body::ChestOpen,
Some("chest_skull") => comp::object::Body::ChestSkull,
Some("pumpkin") => comp::object::Body::Pumpkin,
Some("pumpkin_2") => comp::object::Body::Pumpkin2,
Some("pumpkin_3") => comp::object::Body::Pumpkin3,
Some("pumpkin_4") => comp::object::Body::Pumpkin4,
Some("pumpkin_5") => comp::object::Body::Pumpkin5,
Some("campfire") => comp::object::Body::Campfire,
Some("lantern_ground") => comp::object::Body::LanternGround,
Some("lantern_ground_open") => comp::object::Body::LanternGroundOpen,
Some("lantern_2") => comp::object::Body::LanternStanding2,
Some("lantern") => comp::object::Body::LanternStanding,
Some("potion_blue") => comp::object::Body::PotionBlue,
Some("potion_green") => comp::object::Body::PotionGreen,
Some("potion_red") => comp::object::Body::PotionRed,
Some("crate") => comp::object::Body::Crate,
Some("tent") => comp::object::Body::Tent,
Some("bomb") => comp::object::Body::Bomb,
Some("window_spooky") => comp::object::Body::WindowSpooky,
Some("door_spooky") => comp::object::Body::DoorSpooky,
Some("carpet") => comp::object::Body::Carpet,
Some("table_human") => comp::object::Body::Table,
Some("table_human_2") => comp::object::Body::Table2,
Some("table_human_3") => comp::object::Body::Table3,
Some("drawer") => comp::object::Body::Drawer,
Some("bed_human_blue") => comp::object::Body::BedBlue,
Some("anvil") => comp::object::Body::Anvil,
Some("gravestone") => comp::object::Body::Gravestone,
Some("gravestone_2") => comp::object::Body::Gravestone2,
Some("chair") => comp::object::Body::Chair,
Some("chair_2") => comp::object::Body::Chair2,
Some("chair_3") => comp::object::Body::Chair3,
Some("bench_human") => comp::object::Body::Bench,
Some("bedroll") => comp::object::Body::Bedroll,
Some("carpet_human_round") => comp::object::Body::CarpetHumanRound,
Some("carpet_human_square") => comp::object::Body::CarpetHumanSquare,
Some("carpet_human_square_2") => comp::object::Body::CarpetHumanSquare2,
Some("carpet_human_squircle") => comp::object::Body::CarpetHumanSquircle,
_ => {
return server
.clients
.notify(entity, ServerMsg::chat(String::from("Object not found!")));
}
};
server.create_object(pos, obj_type).build();
server
.create_object(pos, ori, obj_type)
.with(comp::Ori(
// converts player orientation into a 90° rotation for the object by using the axis with the highest value
ori.0
.map(|e| {
if e.abs() == ori.0.map(|e| e.abs()).reduce_partial_max() {
e
} else {
0.0
}
})
.normalized(),
))
.build();
server
.clients
.notify(entity, ServerMsg::chat(format!("Spawned object.")));
@ -668,9 +702,10 @@ fn handle_tell(server: &mut Server, entity: EcsEntity, args: String, action: &Ch
);
}
} else {
server
.clients
.notify(entity, ServerMsg::private(format!("Don't be crazy!")));
server.clients.notify(
entity,
ServerMsg::private(format!("You can't /tell yourself.")),
);
}
}
None => {

View File

@ -163,12 +163,14 @@ impl Server {
pub fn create_object(
&mut self,
pos: comp::Pos,
ori: comp::Ori,
object: comp::object::Body,
) -> EcsEntityBuilder {
self.state
.ecs_mut()
.create_entity_synced()
.with(pos)
.with(ori)
.with(comp::Vel(Vec3::zero()))
.with(comp::Ori(Vec3::unit_y()))
.with(comp::Body::Object(object))
@ -176,6 +178,7 @@ impl Server {
offset: Vec3::unit_z(),
..comp::LightEmitter::default()
})
//.with(comp::LightEmitter::default())
.with(comp::ActionState::default())
.with(comp::ForceUpdate)
}

View File

@ -19,10 +19,10 @@ impl Default for ServerSettings {
Self {
address: SocketAddr::from(([0; 4], 14004)),
world_seed: 1337,
server_name: "Server name".to_owned(),
server_name: "Veloren Alpha".to_owned(),
server_description: "This is the best Veloren server.".to_owned(),
max_players: 16,
start_time: 0.0,
max_players: 100,
start_time: 12.0 * 3600.0,
}
}
}

View File

@ -526,11 +526,11 @@ impl FigureModelCache {
object::Body::ChestLight => ("object/chest_light.vox", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestOpen => ("object/chest_open.vox", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::ChestSkull => ("object/chest_skull.vox", Vec3::new(-7.5, -6.0, 0.0)),
object::Body::Pumpkin1 => ("object/pumpkin1.vox", Vec3::new(-5.5, -4.0, 0.0)),
object::Body::Pumpkin2 => ("object/pumpkin2.vox", Vec3::new(-5.0, -4.0, 0.0)),
object::Body::Pumpkin3 => ("object/pumpkin3.vox", Vec3::new(-5.0, -4.0, 0.0)),
object::Body::Pumpkin4 => ("object/pumpkin4.vox", Vec3::new(-5.0, -4.0, 0.0)),
object::Body::Pumpkin5 => ("object/pumpkin5.vox", Vec3::new(-4.0, -5.0, 0.0)),
object::Body::Pumpkin => ("object/pumpkin.vox", Vec3::new(-5.5, -4.0, 0.0)),
object::Body::Pumpkin2 => ("object/pumpkin_2.vox", Vec3::new(-5.0, -4.0, 0.0)),
object::Body::Pumpkin3 => ("object/pumpkin_3.vox", Vec3::new(-5.0, -4.0, 0.0)),
object::Body::Pumpkin4 => ("object/pumpkin_4.vox", Vec3::new(-5.0, -4.0, 0.0)),
object::Body::Pumpkin5 => ("object/pumpkin_5.vox", Vec3::new(-4.0, -5.0, 0.0)),
object::Body::Campfire => ("object/campfire.vox", Vec3::new(-9.0, -10.0, 0.0)),
object::Body::LanternGround => {
("object/lantern_ground.vox", Vec3::new(-3.5, -3.5, 0.0))
@ -553,15 +553,36 @@ impl FigureModelCache {
("object/window_spooky.vox", Vec3::new(-15.0, -1.5, -1.0))
}
object::Body::DoorSpooky => ("object/door_spooky.vox", Vec3::new(-15.0, -4.5, 0.0)),
object::Body::Table => ("object/table.vox", Vec3::new(-12.0, -6.0, 0.0)),
object::Body::Drawer => ("object/drawer.vox", Vec3::new(-6.5, -6.5, 0.0)),
object::Body::BedBlue => ("object/bed_blue.vox", Vec3::new(-8.5, -5.0, 0.0)),
object::Body::Table => ("object/table.vox", Vec3::new(-12.0, -8.0, 0.0)),
object::Body::Table2 => ("object/table_2.vox", Vec3::new(-8.0, -8.0, 0.0)),
object::Body::Table3 => ("object/table_3.vox", Vec3::new(-10.0, -10.0, 0.0)),
object::Body::Drawer => ("object/drawer.vox", Vec3::new(-11.0, -7.5, 0.0)),
object::Body::BedBlue => ("object/bed_human_blue.vox", Vec3::new(-11.0, -15.0, 0.0)),
object::Body::Anvil => ("object/anvil.vox", Vec3::new(-3.0, -7.0, 0.0)),
object::Body::Gravestone1 => ("object/gravestone1.vox", Vec3::new(-5.0, -2.0, 0.0)),
object::Body::Gravestone2 => ("object/gravestone2.vox", Vec3::new(-8.5, -3.0, 0.0)),
object::Body::Chair => ("object/chair.vox", Vec3::new(-3.5, -4.0, 0.0)),
object::Body::Gravestone => ("object/gravestone.vox", Vec3::new(-5.0, -2.0, 0.0)),
object::Body::Gravestone2 => ("object/gravestone_2.vox", Vec3::new(-8.5, -3.0, 0.0)),
object::Body::Chair => ("object/chair.vox", Vec3::new(-5.0, -4.5, 0.0)),
object::Body::Chair2 => ("object/chair_2.vox", Vec3::new(-5.0, -4.5, 0.0)),
object::Body::Chair3 => ("object/chair_3.vox", Vec3::new(-5.0, -4.5, 0.0)),
object::Body::Bench => ("object/bench.vox", Vec3::new(-8.8, -5.0, 0.0)),
object::Body::Carpet1 => ("object/carpet1.vox", Vec3::new(-14.0, -14.0, -0.5)),
object::Body::Carpet => ("object/carpet.vox", Vec3::new(-14.0, -14.0, -0.5)),
object::Body::Bedroll => ("object/bedroll.vox", Vec3::new(-11.0, -19.5, -0.5)),
object::Body::CarpetHumanRound => (
"object/carpet_human_round.vox",
Vec3::new(-14.0, -14.0, -0.5),
),
object::Body::CarpetHumanSquare => (
"object/carpet_human_square.vox",
Vec3::new(-13.5, -14.0, -0.5),
),
object::Body::CarpetHumanSquare2 => (
"object/carpet_human_square_2.vox",
Vec3::new(-13.5, -14.0, -0.5),
),
object::Body::CarpetHumanSquircle => (
"object/carpet_human_squircle.vox",
Vec3::new(-21.0, -21.0, -0.5),
),
};
Self::load_mesh(name, offset)
}