rename RawTime to AbsoluteTime
This commit is contained in:
parent
8ad5d28e51
commit
a967f31004
@ -1,5 +1,5 @@
|
|||||||
use crate::model;
|
use crate::model;
|
||||||
use crate::integer::{RawTime,Planar64,Planar64Vec3};
|
use crate::integer::{AbsoluteTime,Planar64,Planar64Vec3};
|
||||||
|
|
||||||
//you have this effect while in contact
|
//you have this effect while in contact
|
||||||
#[derive(Clone,Hash,Eq,PartialEq)]
|
#[derive(Clone,Hash,Eq,PartialEq)]
|
||||||
@ -31,7 +31,7 @@ pub enum Booster{
|
|||||||
//Affine(crate::integer::Planar64Affine3),//capable of SetVelocity,DotVelocity,normal booster,bouncy part,redirect velocity, and much more
|
//Affine(crate::integer::Planar64Affine3),//capable of SetVelocity,DotVelocity,normal booster,bouncy part,redirect velocity, and much more
|
||||||
Velocity(Planar64Vec3),//straight up boost velocity adds to your current velocity
|
Velocity(Planar64Vec3),//straight up boost velocity adds to your current velocity
|
||||||
Energy{direction:Planar64Vec3,energy:Planar64},//increase energy in direction
|
Energy{direction:Planar64Vec3,energy:Planar64},//increase energy in direction
|
||||||
AirTime(RawTime),//increase airtime, invariant across mass and gravity changes
|
AirTime(AbsoluteTime),//increase airtime, invariant across mass and gravity changes
|
||||||
Height(Planar64),//increase height, invariant across mass and gravity changes
|
Height(Planar64),//increase height, invariant across mass and gravity changes
|
||||||
}
|
}
|
||||||
impl Booster{
|
impl Booster{
|
||||||
@ -57,13 +57,13 @@ pub enum TrajectoryChoice{
|
|||||||
#[derive(Clone,Hash,Eq,PartialEq)]
|
#[derive(Clone,Hash,Eq,PartialEq)]
|
||||||
pub enum SetTrajectory{
|
pub enum SetTrajectory{
|
||||||
//Speed-type SetTrajectory
|
//Speed-type SetTrajectory
|
||||||
AirTime(RawTime),//air time (relative to gravity direction) is invariant across mass and gravity changes
|
AirTime(AbsoluteTime),//air time (relative to gravity direction) is invariant across mass and gravity changes
|
||||||
Height(Planar64),//boost height (relative to gravity direction) is invariant across mass and gravity changes
|
Height(Planar64),//boost height (relative to gravity direction) is invariant across mass and gravity changes
|
||||||
DotVelocity{direction:Planar64Vec3,dot:Planar64},//set your velocity in a specific direction without touching other directions
|
DotVelocity{direction:Planar64Vec3,dot:Planar64},//set your velocity in a specific direction without touching other directions
|
||||||
//Velocity-type SetTrajectory
|
//Velocity-type SetTrajectory
|
||||||
TargetPointTime{//launch on a trajectory that will land at a target point in a set amount of time
|
TargetPointTime{//launch on a trajectory that will land at a target point in a set amount of time
|
||||||
target_point:Planar64Vec3,
|
target_point:Planar64Vec3,
|
||||||
time:RawTime,//short time = fast and direct, long time = launch high in the air, negative time = wrong way
|
time:AbsoluteTime,//short time = fast and direct, long time = launch high in the air, negative time = wrong way
|
||||||
},
|
},
|
||||||
TargetPointSpeed{//launch at a fixed speed and land at a target point
|
TargetPointSpeed{//launch at a fixed speed and land at a target point
|
||||||
target_point:Planar64Vec3,
|
target_point:Planar64Vec3,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const VALVE_SCALE:Planar64=Planar64::raw(1<<28);// 1/16
|
const VALVE_SCALE:Planar64=Planar64::raw(1<<28);// 1/16
|
||||||
|
|
||||||
use crate::integer::{int,vec3::int as int3,RawTime,Ratio64,Planar64,Planar64Vec3};
|
use crate::integer::{int,vec3::int as int3,AbsoluteTime,Ratio64,Planar64,Planar64Vec3};
|
||||||
use crate::controls_bitflag::Controls;
|
use crate::controls_bitflag::Controls;
|
||||||
use crate::physics::Time as PhysicsTime;
|
use crate::physics::Time as PhysicsTime;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ pub enum JumpCalculation{
|
|||||||
|
|
||||||
#[derive(Clone,Debug)]
|
#[derive(Clone,Debug)]
|
||||||
pub enum JumpImpulse{
|
pub enum JumpImpulse{
|
||||||
Time(RawTime),//jump time is invariant across mass and gravity changes
|
Time(AbsoluteTime),//jump time is invariant across mass and gravity changes
|
||||||
Height(Planar64),//jump height is invariant across mass and gravity changes
|
Height(Planar64),//jump height is invariant across mass and gravity changes
|
||||||
Linear(Planar64),//jump velocity is invariant across mass and gravity changes
|
Linear(Planar64),//jump velocity is invariant across mass and gravity changes
|
||||||
Energy(Planar64),// :)
|
Energy(Planar64),// :)
|
||||||
@ -436,7 +436,7 @@ impl StyleModifiers{
|
|||||||
enable:ControlsActivation::full_2d(),
|
enable:ControlsActivation::full_2d(),
|
||||||
air_accel_limit:None,
|
air_accel_limit:None,
|
||||||
mv:int(3),
|
mv:int(3),
|
||||||
tick_rate:Ratio64::new(64,RawTime::ONE_SECOND.get() as u64).unwrap(),
|
tick_rate:Ratio64::new(64,AbsoluteTime::ONE_SECOND.get() as u64).unwrap(),
|
||||||
}),
|
}),
|
||||||
jump:Some(JumpSettings{
|
jump:Some(JumpSettings{
|
||||||
impulse:JumpImpulse::Energy(int(512)),
|
impulse:JumpImpulse::Energy(int(512)),
|
||||||
@ -478,10 +478,10 @@ impl StyleModifiers{
|
|||||||
enable:ControlsActivation::full_2d(),
|
enable:ControlsActivation::full_2d(),
|
||||||
air_accel_limit:None,
|
air_accel_limit:None,
|
||||||
mv:int(27)/10,
|
mv:int(27)/10,
|
||||||
tick_rate:Ratio64::new(100,RawTime::ONE_SECOND.get() as u64).unwrap(),
|
tick_rate:Ratio64::new(100,AbsoluteTime::ONE_SECOND.get() as u64).unwrap(),
|
||||||
}),
|
}),
|
||||||
jump:Some(JumpSettings{
|
jump:Some(JumpSettings{
|
||||||
impulse:JumpImpulse::Time(RawTime::from_micros(715_588)),
|
impulse:JumpImpulse::Time(AbsoluteTime::from_micros(715_588)),
|
||||||
calculation:JumpCalculation::Max,
|
calculation:JumpCalculation::Max,
|
||||||
limit_minimum:true,
|
limit_minimum:true,
|
||||||
}),
|
}),
|
||||||
@ -535,7 +535,7 @@ impl StyleModifiers{
|
|||||||
enable:ControlsActivation::full_2d(),
|
enable:ControlsActivation::full_2d(),
|
||||||
air_accel_limit:Some(Planar64::raw(150<<28)*100),
|
air_accel_limit:Some(Planar64::raw(150<<28)*100),
|
||||||
mv:(Planar64::raw(30)*VALVE_SCALE).fix_1(),
|
mv:(Planar64::raw(30)*VALVE_SCALE).fix_1(),
|
||||||
tick_rate:Ratio64::new(100,RawTime::ONE_SECOND.get() as u64).unwrap(),
|
tick_rate:Ratio64::new(100,AbsoluteTime::ONE_SECOND.get() as u64).unwrap(),
|
||||||
}),
|
}),
|
||||||
jump:Some(JumpSettings{
|
jump:Some(JumpSettings{
|
||||||
impulse:JumpImpulse::Height((int(52)*VALVE_SCALE).fix_1()),
|
impulse:JumpImpulse::Height((int(52)*VALVE_SCALE).fix_1()),
|
||||||
@ -576,7 +576,7 @@ impl StyleModifiers{
|
|||||||
enable:ControlsActivation::full_2d(),
|
enable:ControlsActivation::full_2d(),
|
||||||
air_accel_limit:Some((int(150)*66*VALVE_SCALE).fix_1()),
|
air_accel_limit:Some((int(150)*66*VALVE_SCALE).fix_1()),
|
||||||
mv:(int(30)*VALVE_SCALE).fix_1(),
|
mv:(int(30)*VALVE_SCALE).fix_1(),
|
||||||
tick_rate:Ratio64::new(66,RawTime::ONE_SECOND.get() as u64).unwrap(),
|
tick_rate:Ratio64::new(66,AbsoluteTime::ONE_SECOND.get() as u64).unwrap(),
|
||||||
}),
|
}),
|
||||||
jump:Some(JumpSettings{
|
jump:Some(JumpSettings{
|
||||||
impulse:JumpImpulse::Height((int(52)*VALVE_SCALE).fix_1()),
|
impulse:JumpImpulse::Height((int(52)*VALVE_SCALE).fix_1()),
|
||||||
|
@ -6,7 +6,7 @@ pub use ratio_ops::ratio::{Ratio,Divide};
|
|||||||
/// specific example of a "default" time type
|
/// specific example of a "default" time type
|
||||||
#[derive(Clone,Copy,Hash,Eq,PartialEq,PartialOrd,Debug)]
|
#[derive(Clone,Copy,Hash,Eq,PartialEq,PartialOrd,Debug)]
|
||||||
pub enum TimeInner{}
|
pub enum TimeInner{}
|
||||||
pub type RawTime=Time<TimeInner>;
|
pub type AbsoluteTime=Time<TimeInner>;
|
||||||
|
|
||||||
#[derive(Clone,Copy,Hash,Eq,PartialEq,PartialOrd,Debug)]
|
#[derive(Clone,Copy,Hash,Eq,PartialEq,PartialOrd,Debug)]
|
||||||
pub struct Time<T>(i64,core::marker::PhantomData<T>);
|
pub struct Time<T>(i64,core::marker::PhantomData<T>);
|
||||||
@ -148,9 +148,7 @@ impl<T> core::ops::Mul<Time<T>> for Planar64{
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_time{
|
mod test_time{
|
||||||
use super::*;
|
use super::*;
|
||||||
#[derive(Clone,Copy,Hash,Eq,PartialEq,PartialOrd,Debug)]
|
type Time=super::AbsoluteTime;
|
||||||
struct Test;
|
|
||||||
type Time=super::Time<Test>;
|
|
||||||
#[test]
|
#[test]
|
||||||
fn time_from_planar64(){
|
fn time_from_planar64(){
|
||||||
let a:Time=Planar64::from(1).into();
|
let a:Time=Planar64::from(1).into();
|
||||||
|
Loading…
Reference in New Issue
Block a user