An underwater thing

This commit is contained in:
Joshua Barretto 2023-05-23 22:15:06 +01:00
parent 465a62a072
commit 04687aa0b2
9 changed files with 60 additions and 3 deletions

View File

@ -143,6 +143,42 @@
central: ("empty"),
),
custom_indices: {
1: Air(ChairSingle, 4),
2: Air(Helm, 0),
3: Air(Door, 4),
4: Air(Door, 0),
9: Air(CraftingBench, 0),
10: Air(Window1, 0),
11: Air(RepairBench, 0),
12: Air(DismantlingBench, 4),
13: Air(Window1, 2),
14: Air(Crate, 0),
15: Air(Cauldron, 2),
16: Air(Tent, 0),
17: Air(CookingPot, 0),
18: Air(WallLampSmall, 4),
19: Air(Lantern, 4),
},
),
Submarine: (
bone0: (
offset: (-5.5, -18.0, -4.5),
central: ("submarine.structure"),
),
bone1: (
offset: (-3.5, -1.0, -3.5),
central: ("submarine.prop"),
),
bone2: (
offset: (0.0, 0.0, 0.0),
central: ("empty"),
),
bone3: (
offset: (-3.5, -3.0, -3.5),
central: ("submarine.rudder"),
),
custom_indices: {
1: Air(ChairSingle, 4),
2: Air(Helm, 0),

BIN
assets/common/voxel/submarine/prop.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/common/voxel/submarine/rudder.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/common/voxel/submarine/structure.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1098,6 +1098,7 @@ impl Body {
ship::Body::SailBoat => [-2.0, -5.0, 4.0],
ship::Body::Galleon => [-2.0, -5.0, 4.0],
ship::Body::Skiff => [1.0, -2.0, 2.0],
ship::Body::Submarine => [1.0, -2.0, 2.0],
ship::Body::Volume => [0.0, 0.0, 0.0],
},
_ => [0.0, 0.0, 0.0],

View File

@ -9,16 +9,17 @@ use serde::{Deserialize, Serialize};
use std::sync::Arc;
use vek::*;
pub const ALL_BODIES: [Body; 5] = [
pub const ALL_BODIES: [Body; 6] = [
Body::DefaultAirship,
Body::AirBalloon,
Body::SailBoat,
Body::Galleon,
Body::Skiff,
Body::Submarine,
];
pub const ALL_AIRSHIPS: [Body; 2] = [Body::DefaultAirship, Body::AirBalloon];
pub const ALL_SHIPS: [Body; 3] = [Body::SailBoat, Body::Galleon, Body::Skiff];
pub const ALL_SHIPS: [Body; 4] = [Body::SailBoat, Body::Galleon, Body::Skiff, Body::Submarine];
make_case_elim!(
body,
@ -31,6 +32,7 @@ make_case_elim!(
Galleon = 3,
Volume = 4,
Skiff = 5,
Submarine = 6,
}
);
@ -61,6 +63,7 @@ impl Body {
Body::SailBoat => Some("sail_boat.structure"),
Body::Galleon => Some("galleon.structure"),
Body::Skiff => Some("skiff.structure"),
Body::Submarine => Some("submarine.structure"),
Body::Volume => None,
}
}
@ -72,6 +75,7 @@ impl Body {
Body::SailBoat => Vec3::new(12.0, 32.0, 6.0),
Body::Galleon => Vec3::new(14.0, 48.0, 10.0),
Body::Skiff => Vec3::new(7.0, 15.0, 10.0),
Body::Submarine => Vec3::new(2.0, 15.0, 2.0),
}
}
@ -104,6 +108,7 @@ impl Body {
pub fn density(&self) -> Density {
match self {
Body::DefaultAirship | Body::AirBalloon | Body::Volume => Density(AIR_DENSITY),
Body::Submarine => Density(WATER_DENSITY), // Neutrally buoyant
_ => Density(AIR_DENSITY * 0.95 + WATER_DENSITY * 0.05), /* Most boats should be very
* buoyant */
}

View File

@ -12,7 +12,7 @@ use crate::{
tool::{self, AbilityContext},
Hands, ItemKind, ToolKind,
},
quadruped_low, quadruped_medium, quadruped_small,
quadruped_low, quadruped_medium, quadruped_small, ship,
skills::{Skill, SwimSkill, SKILL_MODIFIERS},
theropod, Body, CharacterAbility, CharacterState, Density, InputAttr, InputKind,
InventoryAction, Melee, StateUpdate,
@ -236,6 +236,7 @@ impl Body {
match self {
Body::Object(_) => return None,
Body::ItemDrop(_) => return None,
Body::Ship(ship::Body::Submarine) => 2000.0 * self.mass().0,
Body::Ship(ship) if ship.has_water_thrust() => 500.0 * self.mass().0,
Body::Ship(_) => return None,
Body::BipedLarge(_) => 120.0 * self.mass().0,

View File

@ -314,6 +314,7 @@ impl Vehicle {
comp::ship::Body::SailBoat => 5.0,
comp::ship::Body::Galleon => 6.0,
comp::ship::Body::Skiff => 6.0,
comp::ship::Body::Submarine => 4.0,
_ => 10.0,
}
}

View File

@ -96,6 +96,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
SailBoat => (0.0, 0.0, 0.0),
Galleon => (0.0, 0.0, 0.0),
Skiff => (0.0, 0.0, 0.0),
Submarine => (0.0, 0.0, 0.0),
Volume => (0.0, 0.0, 0.0),
},
bone1: match body {
@ -104,6 +105,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
SailBoat => (0.0, 0.0, 0.0),
Galleon => (0.0, 0.0, 0.0),
Skiff => (0.0, 0.0, 0.0),
Submarine => (0.0, -15.0, 0.0),
Volume => (0.0, 0.0, 0.0),
},
bone2: match body {
@ -112,6 +114,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
SailBoat => (0.0, 0.0, 0.0),
Galleon => (0.0, 0.0, 0.0),
Skiff => (0.0, 0.0, 0.0),
Submarine => (0.0, 0.0, 0.0),
Volume => (0.0, 0.0, 0.0),
},
bone3: match body {
@ -120,6 +123,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
SailBoat => (0.0, 0.0, 0.0),
Galleon => (0.0, 0.0, 0.0),
Skiff => (0.0, 0.0, 0.0),
Submarine => (0.0, -18.0, 0.0),
Volume => (0.0, 0.0, 0.0),
},
}