Add support for bouncer component

This commit is contained in:
lcdr
2021-02-22 16:29:08 +01:00
parent 85e55e499b
commit e2f90c80d5
6 changed files with 45 additions and 3 deletions
+5 -1
View File
@@ -20,7 +20,7 @@ use self::zip_context::ZipContext;
static mut PRINT_PACKETS: bool = false;
const COMP_ORDER : [u32; 17] = [1, 3, 40, 98, 7, 110, 109, 106, 4, 17, 5, 9, 60, 48, 2, 44, 107];
const COMP_ORDER : [u32; 18] = [1, 3, 40, 98, 7, 110, 109, 106, 4, 17, 5, 9, 60, 48, 6, 2, 44, 107];
pub struct Cdclient {
conn: Connection,
@@ -153,6 +153,10 @@ fn parse(path: &Path, cdclient: &mut Cdclient) -> Res<usize> {
&& !file.name().contains("[1648]"))
|| (file.name().contains("[24]")
&& !file.name().contains("(5958)")
&& !file.name().contains("(6267)")
&& !file.name().contains("(6010)")
&& !file.name().contains("(6289)")
&& !file.name().contains("(6319)")
&& !file.name().contains("(8304)"))
|| file.name().contains("[27]")
{
+9 -2
View File
@@ -7,6 +7,7 @@ use lu_packets::{
ComponentConstruction, ComponentSerialization, ReplicaContext,
base_combat_ai::{BaseCombatAiConstruction, BaseCombatAiSerialization},
bbb::{BbbConstruction, BbbSerialization},
bouncer::{BouncerConstruction, BouncerSerialization},
buff::BuffConstruction,
character::{CharacterConstruction, CharacterSerialization},
controllable_physics::{ControllablePhysicsConstruction, ControllablePhysicsSerialization},
@@ -63,6 +64,9 @@ impl ReplicaContext for ZipContext<'_> {
5 => {
constrs.push(|x| Ok(Box::new(ScriptConstruction::deserialize(x)?)));
}
6 => {
constrs.push(|x| Ok(Box::new(BouncerConstruction::deserialize(x)?)));
}
7 => {
constrs.push(|x| Ok(Box::new(DestroyableConstruction::deserialize(x)?)));
}
@@ -99,7 +103,7 @@ impl ReplicaContext for ZipContext<'_> {
110 => {
constrs.push(|x| Ok(Box::new(PossessionControlConstruction::deserialize(x)?)));
}
2 | 31 | 55 | 56 | 68 => {},
2 | 31 | 35 | 55 | 56 | 64 | 68 | 73 => {},
x => panic!("{}", x),
}
}
@@ -124,6 +128,9 @@ impl ReplicaContext for ZipContext<'_> {
4 => {
sers.push(|x| Ok(Box::new(CharacterSerialization::deserialize(x)?)));
}
6 => {
sers.push(|x| Ok(Box::new(BouncerSerialization::deserialize(x)?)));
}
7 => {
sers.push(|x| Ok(Box::new(DestroyableSerialization::deserialize(x)?)));
}
@@ -151,7 +158,7 @@ impl ReplicaContext for ZipContext<'_> {
110 => {
sers.push(|x| Ok(Box::new(PossessionControlSerialization::deserialize(x)?)));
}
2 | 5 | 9 | 31 | 44 | 55 | 56 | 68 | 98 => {},
2 | 5 | 9 | 31 | 35 | 44 | 55 | 56 | 64 | 68 | 73 | 98 => {},
x => panic!("{}", x),
}
}
+26
View File
@@ -0,0 +1,26 @@
use std::io::Result as Res;
use endio::Serialize;
use endio_bit::BEBitWriter;
use lu_packets_derive::{BitVariantTests, ReplicaSerde};
use super::{ComponentConstruction, ComponentSerialization};
#[derive(BitVariantTests, Debug, PartialEq, ReplicaSerde)]
pub struct BouncerConstruction {
pub bounce_on_collision: Option<bool>,
}
impl ComponentConstruction for BouncerConstruction {
fn ser(&self, writer: &mut BEBitWriter<Vec<u8>>) -> Res<()> {
self.serialize(writer)
}
}
pub type BouncerSerialization = BouncerConstruction;
impl ComponentSerialization for BouncerSerialization {
fn ser(&self, writer: &mut BEBitWriter<Vec<u8>>) -> Res<()> {
self.serialize(writer)
}
}
+1
View File
@@ -1,5 +1,6 @@
pub mod base_combat_ai;
pub mod bbb;
pub mod bouncer;
pub mod buff;
pub mod character;
pub mod controllable_physics;
@@ -0,0 +1 @@
@@ -0,0 +1,3 @@
BouncerConstruction {
bounce_on_collision: Some(true),
}