38 lines
802 B
Rust
38 lines
802 B
Rust
use godot::{
|
|
classes::{CharacterBody3D, IRigidBody3D, RigidBody3D},
|
|
prelude::*,
|
|
};
|
|
|
|
use crate::{
|
|
net::util::NetVector3,
|
|
player::{IPlayer, NetTransform},
|
|
};
|
|
|
|
#[derive(GodotClass)]
|
|
#[class(base=RigidBody3D, init)]
|
|
pub struct Telegrenade {
|
|
pub player: Option<DynGd<CharacterBody3D, dyn IPlayer>>,
|
|
|
|
base: Base<RigidBody3D>,
|
|
}
|
|
|
|
#[godot_api]
|
|
impl IRigidBody3D for Telegrenade {
|
|
fn ready(&mut self) {}
|
|
}
|
|
|
|
impl Telegrenade {
|
|
pub fn teleport(&mut self) {}
|
|
|
|
pub fn get_transform(&self) -> NetTransform {
|
|
NetTransform {
|
|
location: self.base().get_global_position().into(),
|
|
rotation: self.base().get_global_rotation().into(),
|
|
}
|
|
}
|
|
|
|
pub fn get_velocity(&self) -> NetVector3 {
|
|
self.base().get_linear_velocity().into()
|
|
}
|
|
}
|