lua: add lua type defs for FreeFlyCamera and change name of field

This commit is contained in:
SeanOMik 2024-10-08 20:49:57 -04:00
parent b90e19161d
commit 6f65e2ce35
Signed by: SeanOMik
GPG Key ID: FEC9E2FC15235964
3 changed files with 29 additions and 5 deletions

View File

@ -16,7 +16,7 @@ pub const ACTLBL_LOOK_ROLL: &str = "LookRoll";
#[derive(Clone, Component, Reflect)] #[derive(Clone, Component, Reflect)]
pub struct FreeFlyCamera { pub struct FreeFlyCamera {
pub speed: f32, pub speed: f32,
pub slow_speed_factor: f32, pub modifier_speed_factor: f32,
pub look_speed: f32, pub look_speed: f32,
pub mouse_sensitivity: f32, pub mouse_sensitivity: f32,
pub look_with_keys: bool, pub look_with_keys: bool,
@ -26,7 +26,7 @@ impl Default for FreeFlyCamera {
fn default() -> Self { fn default() -> Self {
Self { Self {
speed: 4.0, speed: 4.0,
slow_speed_factor: 0.25, modifier_speed_factor: 0.25,
look_speed: 0.5, look_speed: 0.5,
mouse_sensitivity: 0.9, mouse_sensitivity: 0.9,
look_with_keys: false, look_with_keys: false,
@ -36,10 +36,10 @@ impl Default for FreeFlyCamera {
impl FreeFlyCamera { impl FreeFlyCamera {
#[allow(dead_code)] #[allow(dead_code)]
pub fn new(speed: f32, slow_speed_factor: f32, look_speed: f32, mouse_sensitivity: f32, look_with_keys: bool) -> Self { pub fn new(speed: f32, modifier_speed_factor: f32, look_speed: f32, mouse_sensitivity: f32, look_with_keys: bool) -> Self {
Self { Self {
speed, speed,
slow_speed_factor, modifier_speed_factor,
look_speed, look_speed,
mouse_sensitivity, mouse_sensitivity,
look_with_keys, look_with_keys,

View File

@ -0,0 +1,24 @@
---@meta
---@class FreeFlyCamera: userdata
FreeFlyCamera = {
---Movement speed of the camera.
---@type number
speed = nil,
---The modifier speed factor.
---
---This isn't currently used, but it would be a factor applied to `speed`
---when the modifer key is pressed. For example: a slow or sprint mode.
---
---@type number
modifier_speed_factor = nil,
---The speed that the camera rotates, i.e., looks.
---@type number
look_speed = nil,
---The sensitivity of the mouse when looking.
---@type number
mouse_sensitivity = nil,
---Enable looking with arrow keys
---@type boolean
look_with_keys = nil,
}

View File

@ -9,7 +9,7 @@ to_lua_convert!(
reflect=component, reflect=component,
fields={ fields={
speed: f32, speed: f32,
slow_speed_factor: f32, modifier_speed_factor: f32,
look_speed: f32, look_speed: f32,
mouse_sensitivity: f32, mouse_sensitivity: f32,
look_with_keys: bool, look_with_keys: bool,