mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Readability fixes for cargo clippy
This commit is contained in:
@@ -45,7 +45,7 @@ impl CubeLocationsParser {
|
||||
pub fn locations_of_by_distance_to_first(&self, r: &mut dyn std::io::Read, locations_of_id: u32, distance_to_id: u32) -> Vec<CubeLocationInfo> {
|
||||
match super::parser::Cube::parse_list(r) {
|
||||
Ok(cubes) => {
|
||||
if let Some(target) = cubes.iter().filter(|x| x.id == distance_to_id).next() {
|
||||
if let Some(target) = cubes.iter().find(|x| x.id == distance_to_id) {
|
||||
let target_x = target.x as f32;
|
||||
let target_y = target.y as f32;
|
||||
let target_z = target.z as f32;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
pub(self) mod parser;
|
||||
mod parser;
|
||||
|
||||
mod weapon_list;
|
||||
pub use weapon_list::WeaponListParser;
|
||||
|
||||
@@ -31,7 +31,7 @@ impl ChatChannelMember {
|
||||
pub fn as_transmissible(&self) -> Typed {
|
||||
Typed::HashMap(vec![
|
||||
(Typed::Str("name".into()), Typed::Str(self.name.clone().into())),
|
||||
(Typed::Str("useCustomAvatar".into()), Typed::Bool(self.use_custom_avatar.into())),
|
||||
(Typed::Str("useCustomAvatar".into()), Typed::Bool(self.use_custom_avatar)),
|
||||
(Typed::Str("state".into()), Typed::Int(self.state as _)),
|
||||
if self.use_custom_avatar {
|
||||
(Typed::Str("customAvatar".into()), Typed::Bytes(self.custom_avatar.clone().into()))
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use std::i64;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct ShopItemListFilters {
|
||||
pub page: u32,
|
||||
|
||||
@@ -30,13 +30,13 @@ impl <C: Clone> CubeInfo<C> {
|
||||
(Typed::Str("cpuRating".into()), Typed::Int(self.cpu as i32)),
|
||||
(Typed::Str("health".into()), Typed::Int(self.health as i32)),
|
||||
(Typed::Str("healthBoost".into()), Typed::Float(self.health_boost)),
|
||||
(Typed::Str("GreyOutInTutorial".into()), Typed::Bool(self.grey_out_in_tutorial.into())),
|
||||
(Typed::Str("GreyOutInTutorial".into()), Typed::Bool(self.grey_out_in_tutorial)),
|
||||
(Typed::Str("buildVisibility".into()), Typed::Str(self.visibility.as_str().into())),
|
||||
(Typed::Str("isIndestructible".into()), Typed::Bool(self.indestructible.into())),
|
||||
(Typed::Str("isIndestructible".into()), Typed::Bool(self.indestructible)),
|
||||
(Typed::Str("ItemCategory".into()), Typed::Int(self.category as i32)),
|
||||
(Typed::Str("PlacementFaces".into()), Typed::Int(self.placements as i32)),
|
||||
(Typed::Str("protoniumCrystal".into()), Typed::Bool(self.protonium.into())),
|
||||
(Typed::Str("UnlockedByLeague".into()), Typed::Bool(self.unlocked_by_league.into())),
|
||||
(Typed::Str("protoniumCrystal".into()), Typed::Bool(self.protonium)),
|
||||
(Typed::Str("UnlockedByLeague".into()), Typed::Bool(self.unlocked_by_league)),
|
||||
(Typed::Str("LeagueUnlockIndex".into()), Typed::Int(self.league_unlock_index)),
|
||||
(Typed::Str("DisplayStats".into()), {
|
||||
let items: Vec<(Typed<C>, Typed<C>)> = self.stats.iter().map(|(key, val)| (Typed::<C>::Str(key.into()), val.to_owned())).collect();
|
||||
@@ -51,9 +51,9 @@ impl <C: Clone> CubeInfo<C> {
|
||||
(Typed::Str("ItemSize".into()), Typed::Int(self.size as i32)),
|
||||
(Typed::Str("ItemType".into()), Typed::Str(self.type_.as_str().into())),
|
||||
(Typed::Str("robotRanking".into()), Typed::Int(self.ranking)),
|
||||
(Typed::Str("isCosmetic".into()), Typed::Bool(self.cosmetic.into())),
|
||||
(Typed::Str("isCosmetic".into()), Typed::Bool(self.cosmetic)),
|
||||
(Typed::Str("variantOf".into()), Typed::Str(self.variant_of.clone().into())),
|
||||
(Typed::Str("ignoreInWeaponsList".into()), Typed::Bool(self.ignore_in_weapon_list.into())), // optional
|
||||
(Typed::Str("ignoreInWeaponsList".into()), Typed::Bool(self.ignore_in_weapon_list)), // optional
|
||||
].into())
|
||||
}
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ impl GarageSlotInfo {
|
||||
(Typed::Str("name".into()), Typed::Str(self.name.clone().into())),
|
||||
(Typed::Str("numberCubes".into()), Typed::Int(self.cubes as i32)),
|
||||
(Typed::Str("crfId".into()), Typed::Int(self.crf_id as i32)),
|
||||
(Typed::Str("wasRated".into()), Typed::Bool(self.was_rated.into())),
|
||||
(Typed::Str("wasRated".into()), Typed::Bool(self.was_rated)),
|
||||
(Typed::Str("movementCategories".into()), Typed::Arr(Arr {
|
||||
ty: TypePrefix::Int, // int
|
||||
items: self.movement_categories.iter().map(|x| Typed::Int(x.but_bigger() as i32)).collect(),
|
||||
items: self.movement_categories.iter().map(|x| Typed::Int(x.but_bigger())).collect(),
|
||||
})),
|
||||
(Typed::Str("uniqueId1".into()), Typed::Int(self.uuid.0 as i32)),
|
||||
(Typed::Str("uniqueId2".into()), Typed::Int(self.uuid.1 as i32)),
|
||||
@@ -41,7 +41,7 @@ impl GarageSlotInfo {
|
||||
(Typed::Str("totalCosmeticCPU".into()), Typed::Int(self.total_cosmetic_cpu as i32)),
|
||||
(Typed::Str("totalRobotRanking".into()), Typed::Int(self.total_robot_ranking as i32)),
|
||||
(Typed::Str("bayCpu".into()), Typed::Int(self.bay_cpu as i32)),
|
||||
(Typed::Str("tutorialRobot".into()), Typed::Bool(self.tutorial_robot.into())),
|
||||
(Typed::Str("tutorialRobot".into()), Typed::Bool(self.tutorial_robot)),
|
||||
(Typed::Str("starterRobotIndex".into()), Typed::Int(self.starter_robot_index)),
|
||||
(Typed::Str("controlType".into()), Typed::Int(self.control_type as i32)),
|
||||
(Typed::Str("controlOptions".into()), self.control_options.as_transmissible()),
|
||||
@@ -86,9 +86,9 @@ impl ControlOptions {
|
||||
Typed::Arr(Arr {
|
||||
ty: TypePrefix::Bool, // bool
|
||||
items: vec![
|
||||
Typed::Bool(self.vertical_strafing.into()),
|
||||
Typed::Bool(self.sideways_driving.into()),
|
||||
Typed::Bool(self.tracks_turn_on_spot.into()),
|
||||
Typed::Bool(self.vertical_strafing),
|
||||
Typed::Bool(self.sideways_driving),
|
||||
Typed::Bool(self.tracks_turn_on_spot),
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ pub fn encode_7_bit_i32(mut src: i32) -> Vec<u8> {
|
||||
let mut out = Vec::with_capacity(5);
|
||||
while src != 0 {
|
||||
let last_7 = (src & 0x7F) as u8;
|
||||
src = src >> 7;
|
||||
src >>= 7;
|
||||
if src != 0 {
|
||||
out.push(last_7 | 0x80);
|
||||
} else {
|
||||
@@ -65,5 +65,5 @@ pub fn read_str_for_binwriter(reader: &mut dyn std::io::Read) -> std::io::Result
|
||||
}
|
||||
|
||||
pub fn cube_id_to_str(id: u32) -> String {
|
||||
hex::encode(id.to_be_bytes()).into()
|
||||
hex::encode(id.to_be_bytes())
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@ pub struct MovementCategoryData {
|
||||
impl MovementCategoryData {
|
||||
pub fn as_transmissible<C>(&self) -> Typed<C> {
|
||||
let mut out = Vec::new();
|
||||
self.horizontal_top_speed.map(|x| out.push((Typed::Str("horizontalTopSpeed".into()), Typed::Float(x))));
|
||||
self.vertical_top_speed.map(|x| out.push((Typed::Str("verticalTopSpeed".into()), Typed::Float(x))));
|
||||
self.min_required_items.map(|x| out.push((Typed::Str("minRequiredItems".into()), Typed::Int(x))));
|
||||
self.min_item_modifier.map(|x| out.push((Typed::Str("minItemsModifier".into()), Typed::Float(x))));
|
||||
self.max_hover_height.map(|x| out.push((Typed::Str("maxHoverHeight".into()), Typed::Float(x))));
|
||||
self.light_machine_mass.map(|x| out.push((Typed::Str("lightMachineMass".into()), Typed::Float(x))));
|
||||
self.heavy_machine_mass.map(|x| out.push((Typed::Str("heavyMachineMass".into()), Typed::Float(x))));
|
||||
if let Some(x) = self.horizontal_top_speed { out.push((Typed::Str("horizontalTopSpeed".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.vertical_top_speed { out.push((Typed::Str("verticalTopSpeed".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.min_required_items { out.push((Typed::Str("minRequiredItems".into()), Typed::Int(x))) }
|
||||
if let Some(x) = self.min_item_modifier { out.push((Typed::Str("minItemsModifier".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.max_hover_height { out.push((Typed::Str("maxHoverHeight".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.light_machine_mass { out.push((Typed::Str("lightMachineMass".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.heavy_machine_mass { out.push((Typed::Str("heavyMachineMass".into()), Typed::Float(x))) }
|
||||
out.append(&mut self.specifics.as_transmissible());
|
||||
for (tier, mov_data) in self.stats.iter() {
|
||||
out.push((Typed::Str(tier.as_str().into()), mov_data.as_transmissible()));
|
||||
@@ -35,7 +35,7 @@ impl MovementCategoryData {
|
||||
Typed::Dict(Dict {
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
items: out.into(),
|
||||
items: out,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -136,15 +136,15 @@ pub struct MovementData {
|
||||
impl MovementData {
|
||||
pub fn as_transmissible<C>(&self) -> Typed<C> {
|
||||
let mut out = Vec::new();
|
||||
self.speed_boost.map(|x| out.push((Typed::Str("speedBoost".into()), Typed::Float(x))));
|
||||
self.max_carry_mass.map(|x| out.push((Typed::Str("maxCarryMass".into()), Typed::Float(x))));
|
||||
self.horizontal_top_speed.map(|x| out.push((Typed::Str("horizontalTopSpeed".into()), Typed::Float(x))));
|
||||
self.vertical_top_speed.map(|x| out.push((Typed::Str("verticalTopSpeed".into()), Typed::Float(x))));
|
||||
if let Some(x) = self.speed_boost { out.push((Typed::Str("speedBoost".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.max_carry_mass { out.push((Typed::Str("maxCarryMass".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.horizontal_top_speed { out.push((Typed::Str("horizontalTopSpeed".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.vertical_top_speed { out.push((Typed::Str("verticalTopSpeed".into()), Typed::Float(x))) }
|
||||
out.append(&mut self.specifics.as_transmissible());
|
||||
Typed::Dict(Dict {
|
||||
key_ty: TypePrefix::Str, // str
|
||||
val_ty: TypePrefix::Any, // any
|
||||
items: out.into(),
|
||||
items: out,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ impl TechTreeNode {
|
||||
(Typed::Str("mainCubeId".into()), Typed::Str(hex::encode(self.main_cube_id.to_be_bytes()).into())),
|
||||
(Typed::Str("positionX".into()), Typed::Int(self.position_x)),
|
||||
(Typed::Str("positionY".into()), Typed::Int(self.position_y)),
|
||||
(Typed::Str("isUnlocked".into()), Typed::Bool(self.is_unlocked.into())),
|
||||
(Typed::Str("isUnlockable".into()), Typed::Bool(self.is_unlockable.into())),
|
||||
(Typed::Str("isUnlocked".into()), Typed::Bool(self.is_unlocked)),
|
||||
(Typed::Str("isUnlockable".into()), Typed::Bool(self.is_unlockable)),
|
||||
(Typed::Str("tp".into()), Typed::Int(self.tech_points as i32)),
|
||||
(Typed::Str("neighbours".into()), Typed::Arr(Arr {
|
||||
ty: TypePrefix::Str, // str
|
||||
|
||||
@@ -71,47 +71,47 @@ impl WeaponData {
|
||||
pub fn as_transmissible<C>(&self) -> Typed<C> {
|
||||
let mut out = Vec::new();
|
||||
|
||||
self.damage_inflicted.map(|x| out.push((Typed::Str("damageInflicted".into()), Typed::Int(x))));
|
||||
self.protonium_damage_scale.map(|x| out.push((Typed::Str("protoniumDamageScale".into()), Typed::Float(x))));
|
||||
self.projectile_speed.map(|x| out.push((Typed::Str("projectileSpeed".into()), Typed::Float(x))));
|
||||
self.projectile_range.map(|x| out.push((Typed::Str("projectileRange".into()), Typed::Float(x))));
|
||||
self.base_inaccuracy.map(|x| out.push((Typed::Str("baseInaccuracy".into()), Typed::Float(x))));
|
||||
self.base_air_inaccuracy.map(|x| out.push((Typed::Str("baseAirInaccuracy".into()), Typed::Float(x))));
|
||||
self.movement_inaccuracy.map(|x| out.push((Typed::Str("movementInaccuracy".into()), Typed::Float(x))));
|
||||
self.movement_max_speed.map(|x| out.push((Typed::Str("movementMaxThresholdSpeed".into()), Typed::Float(x))));
|
||||
self.movement_min_speed.map(|x| out.push((Typed::Str("movementMinThresholdSpeed".into()), Typed::Float(x))));
|
||||
self.gun_rotation_slow.map(|x| out.push((Typed::Str("gunRotationThresholdSlow".into()), Typed::Float(x))));
|
||||
self.movement_inaccuracy_decay.map(|x| out.push((Typed::Str("movementInaccuracyDecayTime".into()), Typed::Float(x))));
|
||||
self.slow_rotation_decay.map(|x| out.push((Typed::Str("slowRotationInaccuracyDecayTime".into()), Typed::Float(x))));
|
||||
self.quick_rotation_decay.map(|x| out.push((Typed::Str("quickRotationInaccuracyDecayTime".into()), Typed::Float(x))));
|
||||
self.movement_inaccuracy_recovery.map(|x| out.push((Typed::Str("movementInaccuracyRecoveryTime".into()), Typed::Float(x))));
|
||||
self.repeat_fire_inaccuracy_total_degrees.map(|x| out.push((Typed::Str("repeatFireInaccuracyTotalDegrees".into()), Typed::Float(x))));
|
||||
self.repeat_fire_inaccuracy_decay.map(|x| out.push((Typed::Str("repeatFireInaccuracyDecayTime".into()), Typed::Float(x))));
|
||||
self.repeat_fire_innaccuracy_recovery.map(|x| out.push((Typed::Str("repeatFireInaccuracyRecoveryTime".into()), Typed::Float(x))));
|
||||
self.fire_instant_accuracy_decay.map(|x| out.push((Typed::Str("fireInstantAccuracyDecayDegrees".into()), Typed::Float(x)))); // degrees
|
||||
self.accuracy_non_recover_time.map(|x| out.push((Typed::Str("accuracyNonRecoverTime".into()), Typed::Float(x))));
|
||||
self.accuracy_decay.map(|x| out.push((Typed::Str("accuracyDecayTime".into()), Typed::Float(x))));
|
||||
self.damage_radius.map(|x| out.push((Typed::Str("damageRadius".into()), Typed::Float(x))));
|
||||
self.plasma_time_to_full_damage.map(|x| out.push((Typed::Str("plasmaTimeToFullDamage".into()), Typed::Float(x))));
|
||||
self.plasma_starting_radius_scale.map(|x| out.push((Typed::Str("plasmaStartingRadiusScale".into()), Typed::Float(x))));
|
||||
self.nano_dps.map(|x| out.push((Typed::Str("nanoDPS".into()), Typed::Float(x))));
|
||||
self.nano_hps.map(|x| out.push((Typed::Str("nanoHPS".into()), Typed::Float(x))));
|
||||
self.tesla_damage.map(|x| out.push((Typed::Str("teslaDamage".into()), Typed::Float(x))));
|
||||
self.tesla_charges.map(|x| out.push((Typed::Str("teslaCharges".into()), Typed::Float(x))));
|
||||
self.aeroflak_proximity_damage.map(|x| out.push((Typed::Str("aeroflakProximityDamage".into()), Typed::Float(x))));
|
||||
self.aeroflak_damage_radius.map(|x| out.push((Typed::Str("aeroflakDamageRadius".into()), Typed::Float(x))));
|
||||
self.aeroflak_explosion_radius.map(|x| out.push((Typed::Str("aeroflakExplosionRadius".into()), Typed::Float(x))));
|
||||
self.aeroflak_ground_clearance.map(|x| out.push((Typed::Str("aeroflakGroundClearance".into()), Typed::Float(x))));
|
||||
self.aeroflak_max_stacks.map(|x| out.push((Typed::Str("aeroflakBuffMaxStacks".into()), Typed::Int(x))));
|
||||
self.aeroflak_damage_per_stack.map(|x| out.push((Typed::Str("aeroflakBuffDamagePerStack".into()), Typed::Int(x))));
|
||||
self.aeroflak_stack_expire.map(|x| out.push((Typed::Str("aeroflakBuffTimeToExpire".into()), Typed::Float(x))));
|
||||
self.shot_cooldown.map(|x| out.push((Typed::Str("cooldownBetweenShots".into()), Typed::Float(x))));
|
||||
self.smart_rotation_cooldown.map(|x| out.push((Typed::Str("smartRotationCooldown".into()), Typed::Float(x))));
|
||||
self.smart_rotation_cooldown_extra.map(|x| out.push((Typed::Str("smartRotationExtraCooldownTime".into()), Typed::Float(x))));
|
||||
self.smart_rotation_max_stacks.map(|x| out.push((Typed::Str("smartRotationMaxStacks".into()), Typed::Float(x))));
|
||||
self.spin_up_time.map(|x| out.push((Typed::Str("spinUpTime".into()), Typed::Float(x))));
|
||||
self.spin_down_time.map(|x| out.push((Typed::Str("spinDownTime".into()), Typed::Float(x))));
|
||||
self.spin_initial_cooldown.map(|x| out.push((Typed::Str("spinInitialCooldown".into()), Typed::Float(x))));
|
||||
if let Some(x) = self.damage_inflicted { out.push((Typed::Str("damageInflicted".into()), Typed::Int(x))) }
|
||||
if let Some(x) = self.protonium_damage_scale { out.push((Typed::Str("protoniumDamageScale".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.projectile_speed { out.push((Typed::Str("projectileSpeed".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.projectile_range { out.push((Typed::Str("projectileRange".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.base_inaccuracy { out.push((Typed::Str("baseInaccuracy".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.base_air_inaccuracy { out.push((Typed::Str("baseAirInaccuracy".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.movement_inaccuracy { out.push((Typed::Str("movementInaccuracy".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.movement_max_speed { out.push((Typed::Str("movementMaxThresholdSpeed".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.movement_min_speed { out.push((Typed::Str("movementMinThresholdSpeed".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.gun_rotation_slow { out.push((Typed::Str("gunRotationThresholdSlow".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.movement_inaccuracy_decay { out.push((Typed::Str("movementInaccuracyDecayTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.slow_rotation_decay { out.push((Typed::Str("slowRotationInaccuracyDecayTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.quick_rotation_decay { out.push((Typed::Str("quickRotationInaccuracyDecayTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.movement_inaccuracy_recovery { out.push((Typed::Str("movementInaccuracyRecoveryTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.repeat_fire_inaccuracy_total_degrees { out.push((Typed::Str("repeatFireInaccuracyTotalDegrees".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.repeat_fire_inaccuracy_decay { out.push((Typed::Str("repeatFireInaccuracyDecayTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.repeat_fire_innaccuracy_recovery { out.push((Typed::Str("repeatFireInaccuracyRecoveryTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.fire_instant_accuracy_decay { out.push((Typed::Str("fireInstantAccuracyDecayDegrees".into()), Typed::Float(x))) } // degrees
|
||||
if let Some(x) = self.accuracy_non_recover_time { out.push((Typed::Str("accuracyNonRecoverTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.accuracy_decay { out.push((Typed::Str("accuracyDecayTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.damage_radius { out.push((Typed::Str("damageRadius".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.plasma_time_to_full_damage { out.push((Typed::Str("plasmaTimeToFullDamage".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.plasma_starting_radius_scale { out.push((Typed::Str("plasmaStartingRadiusScale".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.nano_dps { out.push((Typed::Str("nanoDPS".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.nano_hps { out.push((Typed::Str("nanoHPS".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.tesla_damage { out.push((Typed::Str("teslaDamage".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.tesla_charges { out.push((Typed::Str("teslaCharges".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.aeroflak_proximity_damage { out.push((Typed::Str("aeroflakProximityDamage".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.aeroflak_damage_radius { out.push((Typed::Str("aeroflakDamageRadius".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.aeroflak_explosion_radius { out.push((Typed::Str("aeroflakExplosionRadius".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.aeroflak_ground_clearance { out.push((Typed::Str("aeroflakGroundClearance".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.aeroflak_max_stacks { out.push((Typed::Str("aeroflakBuffMaxStacks".into()), Typed::Int(x))) }
|
||||
if let Some(x) = self.aeroflak_damage_per_stack { out.push((Typed::Str("aeroflakBuffDamagePerStack".into()), Typed::Int(x))) }
|
||||
if let Some(x) = self.aeroflak_stack_expire { out.push((Typed::Str("aeroflakBuffTimeToExpire".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.shot_cooldown { out.push((Typed::Str("cooldownBetweenShots".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.smart_rotation_cooldown { out.push((Typed::Str("smartRotationCooldown".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.smart_rotation_cooldown_extra { out.push((Typed::Str("smartRotationExtraCooldownTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.smart_rotation_max_stacks { out.push((Typed::Str("smartRotationMaxStacks".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.spin_up_time { out.push((Typed::Str("spinUpTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.spin_down_time { out.push((Typed::Str("spinDownTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.spin_initial_cooldown { out.push((Typed::Str("spinInitialCooldown".into()), Typed::Float(x))) }
|
||||
|
||||
if !self.group_fire_scales.is_empty() {
|
||||
let typed_arr: Vec<Typed<C>> = self.group_fire_scales.iter().map(|x| Typed::Float(*x)).collect();
|
||||
@@ -121,26 +121,26 @@ impl WeaponData {
|
||||
})));
|
||||
}
|
||||
|
||||
self.mana_cost.map(|x| out.push((Typed::Str("manaCost".into()), Typed::Float(x))));
|
||||
self.lock_time.map(|x| out.push((Typed::Str("lockTime".into()), Typed::Float(x))));
|
||||
self.full_lock_release.map(|x| out.push((Typed::Str("fullLockRelease".into()), Typed::Float(x))));
|
||||
self.change_lock_time.map(|x| out.push((Typed::Str("changeLockTime".into()), Typed::Float(x))));
|
||||
self.max_rotation_speed.map(|x| out.push((Typed::Str("maxRotationSpeed".into()), Typed::Float(x))));
|
||||
self.initial_rotation_speed.map(|x| out.push((Typed::Str("initialRotationSpeed".into()), Typed::Float(x))));
|
||||
self.rotation_acceleration.map(|x| out.push((Typed::Str("rotationAcceleration".into()), Typed::Float(x))));
|
||||
self.nano_healing_priority_time.map(|x| out.push((Typed::Str("nanoHealingPriorityTime".into()), Typed::Float(x))));
|
||||
self.module_range.map(|x| out.push((Typed::Str("moduleRange".into()), Typed::Float(x))));
|
||||
self.shield_lifetime.map(|x| out.push((Typed::Str("shieldLifetime".into()), Typed::Float(x))));
|
||||
self.teleport_time.map(|x| out.push((Typed::Str("teleportTime".into()), Typed::Float(x))));
|
||||
self.camera_time.map(|x| out.push((Typed::Str("cameraTime".into()), Typed::Float(x))));
|
||||
self.camera_delay.map(|x| out.push((Typed::Str("cameraDelay".into()), Typed::Float(x))));
|
||||
self.to_invisible_speed.map(|x| out.push((Typed::Str("toInvisibleSpeed".into()), Typed::Float(x))));
|
||||
self.to_invisible_duration.map(|x| out.push((Typed::Str("toInvisibleDuration".into()), Typed::Float(x))));
|
||||
self.to_visible_duration.map(|x| out.push((Typed::Str("toVisibleDuration".into()), Typed::Float(x))));
|
||||
self.countdown_time.map(|x| out.push((Typed::Str("countdownTime".into()), Typed::Float(x))));
|
||||
self.stun_time.map(|x| out.push((Typed::Str("stunTime".into()), Typed::Float(x))));
|
||||
self.stun_radius.map(|x| out.push((Typed::Str("stunRadius".into()), Typed::Float(x))));
|
||||
self.effect_duration.map(|x| out.push((Typed::Str("effectDuration".into()), Typed::Float(x))));
|
||||
if let Some(x) = self.mana_cost { out.push((Typed::Str("manaCost".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.lock_time { out.push((Typed::Str("lockTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.full_lock_release { out.push((Typed::Str("fullLockRelease".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.change_lock_time { out.push((Typed::Str("changeLockTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.max_rotation_speed { out.push((Typed::Str("maxRotationSpeed".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.initial_rotation_speed { out.push((Typed::Str("initialRotationSpeed".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.rotation_acceleration { out.push((Typed::Str("rotationAcceleration".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.nano_healing_priority_time { out.push((Typed::Str("nanoHealingPriorityTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.module_range { out.push((Typed::Str("moduleRange".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.shield_lifetime { out.push((Typed::Str("shieldLifetime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.teleport_time { out.push((Typed::Str("teleportTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.camera_time { out.push((Typed::Str("cameraTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.camera_delay { out.push((Typed::Str("cameraDelay".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.to_invisible_speed { out.push((Typed::Str("toInvisibleSpeed".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.to_invisible_duration { out.push((Typed::Str("toInvisibleDuration".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.to_visible_duration { out.push((Typed::Str("toVisibleDuration".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.countdown_time { out.push((Typed::Str("countdownTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.stun_time { out.push((Typed::Str("stunTime".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.stun_radius { out.push((Typed::Str("stunRadius".into()), Typed::Float(x))) }
|
||||
if let Some(x) = self.effect_duration { out.push((Typed::Str("effectDuration".into()), Typed::Float(x))) }
|
||||
Typed::HashMap(out.into())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,19 +14,19 @@ pub struct GameplaySettings {
|
||||
pub cross_promo_link: String, // url
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::client_config::GameplaySettings> for GameplaySettings {
|
||||
fn into(self) -> crate::data::client_config::GameplaySettings {
|
||||
impl std::convert::From<GameplaySettings> for crate::data::client_config::GameplaySettings {
|
||||
fn from(val: GameplaySettings) -> Self {
|
||||
crate::data::client_config::GameplaySettings {
|
||||
show_tutorial_after_date: self.show_tutorial_after_date,
|
||||
health_threshold: self.health_threshold,
|
||||
microbot_sphere: self.microbot_sphere,
|
||||
misfire_angle: self.misfire_angle,
|
||||
shield_dps: self.shield_dps,
|
||||
shield_hps: self.shield_hps,
|
||||
request_review_level: self.request_review_level,
|
||||
critical_ratio: self.critical_ratio,
|
||||
cross_promo_image: self.cross_promo_image,
|
||||
cross_promo_link: self.cross_promo_link,
|
||||
show_tutorial_after_date: val.show_tutorial_after_date,
|
||||
health_threshold: val.health_threshold,
|
||||
microbot_sphere: val.microbot_sphere,
|
||||
misfire_angle: val.misfire_angle,
|
||||
shield_dps: val.shield_dps,
|
||||
shield_hps: val.shield_hps,
|
||||
request_review_level: val.request_review_level,
|
||||
critical_ratio: val.critical_ratio,
|
||||
cross_promo_image: val.cross_promo_image,
|
||||
cross_promo_link: val.cross_promo_link,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,13 +28,13 @@ pub struct AutoRegenHealth {
|
||||
pub auto_heal: bool,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::auto_regen::AutoRegenHealthConfig> for AutoRegenHealth {
|
||||
fn into(self) -> crate::data::auto_regen::AutoRegenHealthConfig {
|
||||
impl std::convert::From<AutoRegenHealth> for crate::data::auto_regen::AutoRegenHealthConfig {
|
||||
fn from(val: AutoRegenHealth) -> Self {
|
||||
crate::data::auto_regen::AutoRegenHealthConfig {
|
||||
seconds_to_wait_for_heal: self.wait_for_heal_s,
|
||||
seconds_to_full_heal: self.wait_full_heal_s,
|
||||
threshold_to_start_sound: self.sound_start_s,
|
||||
enable_auto_heal: self.auto_heal,
|
||||
seconds_to_wait_for_heal: val.wait_for_heal_s,
|
||||
seconds_to_full_heal: val.wait_full_heal_s,
|
||||
threshold_to_start_sound: val.sound_start_s,
|
||||
enable_auto_heal: val.auto_heal,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,13 +47,13 @@ pub struct VoteThreshold {
|
||||
pub votes_required: i32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::voting::VoteThresholdData> for VoteThreshold {
|
||||
fn into(self) -> crate::data::voting::VoteThresholdData {
|
||||
impl std::convert::From<VoteThreshold> for crate::data::voting::VoteThresholdData {
|
||||
fn from(val: VoteThreshold) -> Self {
|
||||
crate::data::voting::VoteThresholdData {
|
||||
name: self.name,
|
||||
localised_name: self.localised_name,
|
||||
color: self.color,
|
||||
votes_required: self.votes_required,
|
||||
name: val.name,
|
||||
localised_name: val.localised_name,
|
||||
color: val.color,
|
||||
votes_required: val.votes_required,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,11 +64,11 @@ pub enum Vote {
|
||||
BestLooking,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::voting::Vote> for Vote {
|
||||
fn into(self) -> crate::data::voting::Vote {
|
||||
match self {
|
||||
Self::BestPlayed => crate::data::voting::Vote::BestPlayed,
|
||||
Self::BestLooking => crate::data::voting::Vote::BestLooking,
|
||||
impl std::convert::From<Vote> for crate::data::voting::Vote {
|
||||
fn from(val: Vote) -> Self {
|
||||
match val {
|
||||
Vote::BestPlayed => crate::data::voting::Vote::BestPlayed,
|
||||
Vote::BestLooking => crate::data::voting::Vote::BestLooking,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,13 +81,13 @@ pub struct GameMode {
|
||||
pub game_time_m: i32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::game_mode::GameModeConfig> for GameMode {
|
||||
fn into(self) -> crate::data::game_mode::GameModeConfig {
|
||||
impl std::convert::From<GameMode> for crate::data::game_mode::GameModeConfig {
|
||||
fn from(val: GameMode) -> Self {
|
||||
crate::data::game_mode::GameModeConfig {
|
||||
respawn_heal_duration: self.respawn_heal_duration,
|
||||
respawn_full_heal_duration: self.respawn_full_heal_duration,
|
||||
kill_limit: self.kill_limit,
|
||||
game_time_minutes: self.game_time_m,
|
||||
respawn_heal_duration: val.respawn_heal_duration,
|
||||
respawn_full_heal_duration: val.respawn_full_heal_duration,
|
||||
kill_limit: val.kill_limit,
|
||||
game_time_minutes: val.game_time_m,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,13 +100,13 @@ pub struct GameModes {
|
||||
pub team_deathmatch: GameMode,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::game_mode::GameModeConfigs> for GameModes {
|
||||
fn into(self) -> crate::data::game_mode::GameModeConfigs {
|
||||
impl std::convert::From<GameModes> for crate::data::game_mode::GameModeConfigs {
|
||||
fn from(val: GameModes) -> Self {
|
||||
crate::data::game_mode::GameModeConfigs {
|
||||
battle_arena: self.battle_arena.into(),
|
||||
elimination: self.elimination.into(),
|
||||
the_pit: self.pit.into(),
|
||||
team_deathmatch: self.team_deathmatch.into(),
|
||||
battle_arena: val.battle_arena.into(),
|
||||
elimination: val.elimination.into(),
|
||||
the_pit: val.pit.into(),
|
||||
team_deathmatch: val.team_deathmatch.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -332,7 +332,7 @@ pub(super) fn default_campaigns() -> super::SingleplayerConfig {
|
||||
],
|
||||
kill_target: 1,
|
||||
time_min: 1,
|
||||
time_max: 1 * 60,
|
||||
time_max: 60,
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
|
||||
}
|
||||
let mut movement_cat_stats = Vec::with_capacity(self.movement.len());
|
||||
for (k, v) in self.movement.iter() {
|
||||
let stats: Vec<_> = if let Some(stats) = movements_stats.get(&k) {
|
||||
let stats: Vec<_> = if let Some(stats) = movements_stats.get(k) {
|
||||
stats.iter().map(|(k, v)| (k.to_owned(), v.to_owned())).collect()
|
||||
} else {
|
||||
Vec::default()
|
||||
@@ -250,7 +250,7 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
|
||||
val_ty: TypePrefix::HashMap,
|
||||
items: vec![
|
||||
(Typed::Str("GameplaySettings".into()), conf_data.as_transmissible()),
|
||||
].into(),
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
|
||||
}
|
||||
|
||||
fn gamemodes(&self) -> crate::data::game_mode::GameModeConfigs {
|
||||
self.battle.games.clone().into()
|
||||
self.battle.games.into()
|
||||
}
|
||||
|
||||
fn singleplayer_details(&self) -> super::SingleplayerConfig {
|
||||
|
||||
@@ -67,21 +67,21 @@ fn default_true() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
impl <C: Clone> std::convert::Into<crate::data::cube_list::CubeInfo<C>> for CubeInfo {
|
||||
fn into(self) -> crate::data::cube_list::CubeInfo<C> {
|
||||
impl <C: Clone> std::convert::From<CubeInfo> for crate::data::cube_list::CubeInfo<C> {
|
||||
fn from(val: CubeInfo) -> Self {
|
||||
crate::data::cube_list::CubeInfo {
|
||||
cpu: self.cpu,
|
||||
health: self.health,
|
||||
health_boost: self.health_boost,
|
||||
grey_out_in_tutorial: self.grey_out_in_tutorial,
|
||||
visibility: self.visibility.into(),
|
||||
indestructible: self.indestructible,
|
||||
category: self.category.into(),
|
||||
placements: self.placements, // default 63
|
||||
protonium: self.protonium,
|
||||
unlocked_by_league: self.unlocked_by_league,
|
||||
league_unlock_index: self.league_unlock_index,
|
||||
stats: self.stats.into_iter().map(|(k, v)| {
|
||||
cpu: val.cpu,
|
||||
health: val.health,
|
||||
health_boost: val.health_boost,
|
||||
grey_out_in_tutorial: val.grey_out_in_tutorial,
|
||||
visibility: val.visibility.into(),
|
||||
indestructible: val.indestructible,
|
||||
category: val.category.into(),
|
||||
placements: val.placements, // default 63
|
||||
protonium: val.protonium,
|
||||
unlocked_by_league: val.unlocked_by_league,
|
||||
league_unlock_index: val.league_unlock_index,
|
||||
stats: val.stats.into_iter().map(|(k, v)| {
|
||||
let new_v = match v {
|
||||
serde_json::Value::Bool(b) => Typed::Bool(b),
|
||||
serde_json::Value::Number(n) => if let Some(n_i64) = n.as_i64() {
|
||||
@@ -96,13 +96,13 @@ impl <C: Clone> std::convert::Into<crate::data::cube_list::CubeInfo<C>> for Cube
|
||||
};
|
||||
(k, new_v)
|
||||
}).collect(),
|
||||
description: self.description,
|
||||
size: self.size.into(),
|
||||
type_: self.type_.into(),
|
||||
ranking: self.ranking,
|
||||
cosmetic: self.cosmetic,
|
||||
variant_of: hex::encode(self.variant_of.to_be_bytes()).into(),
|
||||
ignore_in_weapon_list: self.ignore_in_weapon_list,
|
||||
description: val.description,
|
||||
size: val.size.into(),
|
||||
type_: val.type_.into(),
|
||||
ranking: val.ranking,
|
||||
cosmetic: val.cosmetic,
|
||||
variant_of: hex::encode(val.variant_of.to_be_bytes()),
|
||||
ignore_in_weapon_list: val.ignore_in_weapon_list,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,13 +116,13 @@ pub enum VisibilityMode {
|
||||
None,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::cube_list::VisibilityMode> for VisibilityMode {
|
||||
fn into(self) -> crate::data::cube_list::VisibilityMode {
|
||||
match self {
|
||||
Self::Mothership => crate::data::cube_list::VisibilityMode::Mothership,
|
||||
Self::All => crate::data::cube_list::VisibilityMode::All,
|
||||
Self::Tutorial => crate::data::cube_list::VisibilityMode::Tutorial,
|
||||
Self::None => crate::data::cube_list::VisibilityMode::None,
|
||||
impl std::convert::From<VisibilityMode> for crate::data::cube_list::VisibilityMode {
|
||||
fn from(val: VisibilityMode) -> Self {
|
||||
match val {
|
||||
VisibilityMode::Mothership => crate::data::cube_list::VisibilityMode::Mothership,
|
||||
VisibilityMode::All => crate::data::cube_list::VisibilityMode::All,
|
||||
VisibilityMode::Tutorial => crate::data::cube_list::VisibilityMode::Tutorial,
|
||||
VisibilityMode::None => crate::data::cube_list::VisibilityMode::None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,16 +139,16 @@ pub enum ItemTier {
|
||||
T5 = 600,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::cube_list::ItemTier> for ItemTier {
|
||||
fn into(self) -> crate::data::cube_list::ItemTier {
|
||||
match self {
|
||||
Self::NoTier => crate::data::cube_list::ItemTier::NoTier,
|
||||
Self::T0 => crate::data::cube_list::ItemTier::T0,
|
||||
Self::T1 => crate::data::cube_list::ItemTier::T1,
|
||||
Self::T2 => crate::data::cube_list::ItemTier::T2,
|
||||
Self::T3 => crate::data::cube_list::ItemTier::T3,
|
||||
Self::T4 => crate::data::cube_list::ItemTier::T4,
|
||||
Self::T5 => crate::data::cube_list::ItemTier::T5,
|
||||
impl std::convert::From<ItemTier> for crate::data::cube_list::ItemTier {
|
||||
fn from(val: ItemTier) -> Self {
|
||||
match val {
|
||||
ItemTier::NoTier => crate::data::cube_list::ItemTier::NoTier,
|
||||
ItemTier::T0 => crate::data::cube_list::ItemTier::T0,
|
||||
ItemTier::T1 => crate::data::cube_list::ItemTier::T1,
|
||||
ItemTier::T2 => crate::data::cube_list::ItemTier::T2,
|
||||
ItemTier::T3 => crate::data::cube_list::ItemTier::T3,
|
||||
ItemTier::T4 => crate::data::cube_list::ItemTier::T4,
|
||||
ItemTier::T5 => crate::data::cube_list::ItemTier::T5,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,14 +163,14 @@ pub enum ItemType {
|
||||
Cosmetic,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::cube_list::ItemType> for ItemType {
|
||||
fn into(self) -> crate::data::cube_list::ItemType {
|
||||
match self {
|
||||
Self::NotAFunctionalItem => crate::data::cube_list::ItemType::NoFunction,
|
||||
Self::Weapon => crate::data::cube_list::ItemType::Weapon,
|
||||
Self::Module => crate::data::cube_list::ItemType::Module,
|
||||
Self::Movement => crate::data::cube_list::ItemType::Movement,
|
||||
Self::Cosmetic => crate::data::cube_list::ItemType::Cosmetic,
|
||||
impl std::convert::From<ItemType> for crate::data::cube_list::ItemType {
|
||||
fn from(val: ItemType) -> Self {
|
||||
match val {
|
||||
ItemType::NotAFunctionalItem => crate::data::cube_list::ItemType::NoFunction,
|
||||
ItemType::Weapon => crate::data::cube_list::ItemType::Weapon,
|
||||
ItemType::Module => crate::data::cube_list::ItemType::Module,
|
||||
ItemType::Movement => crate::data::cube_list::ItemType::Movement,
|
||||
ItemType::Cosmetic => crate::data::cube_list::ItemType::Cosmetic,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,38 +209,38 @@ pub enum ItemCategory {
|
||||
EnergyModule = 900,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::weapon_list::ItemCategory> for ItemCategory {
|
||||
fn into(self) -> crate::data::weapon_list::ItemCategory {
|
||||
match self {
|
||||
Self::NotAFunctionalItem => crate::data::weapon_list::ItemCategory::NoFunction,
|
||||
Self::Wheel => crate::data::weapon_list::ItemCategory::Wheel,
|
||||
Self::Hover => crate::data::weapon_list::ItemCategory::Hover,
|
||||
Self::Wing => crate::data::weapon_list::ItemCategory::Wing,
|
||||
Self::Rudder => crate::data::weapon_list::ItemCategory::Rudder,
|
||||
Self::Thruster => crate::data::weapon_list::ItemCategory::Thruster,
|
||||
Self::InsectLeg => crate::data::weapon_list::ItemCategory::InsectLeg,
|
||||
Self::MechLeg => crate::data::weapon_list::ItemCategory::MechLeg,
|
||||
Self::Ski => crate::data::weapon_list::ItemCategory::Ski,
|
||||
Self::TankTrack => crate::data::weapon_list::ItemCategory::TankTrack,
|
||||
Self::Rotor => crate::data::weapon_list::ItemCategory::Rotor,
|
||||
Self::SprinterLeg => crate::data::weapon_list::ItemCategory::SprinterLeg,
|
||||
Self::Propeller => crate::data::weapon_list::ItemCategory::Propeller,
|
||||
Self::Laser => crate::data::weapon_list::ItemCategory::Laser,
|
||||
Self::Plasma => crate::data::weapon_list::ItemCategory::Plasma,
|
||||
Self::Mortar => crate::data::weapon_list::ItemCategory::Mortar,
|
||||
Self::Rail => crate::data::weapon_list::ItemCategory::Rail,
|
||||
Self::Nano => crate::data::weapon_list::ItemCategory::Nano,
|
||||
Self::Tesla => crate::data::weapon_list::ItemCategory::Tesla,
|
||||
Self::Aeroflak => crate::data::weapon_list::ItemCategory::Aeroflak,
|
||||
Self::Ion => crate::data::weapon_list::ItemCategory::Ion,
|
||||
Self::Seeker => crate::data::weapon_list::ItemCategory::Seeker,
|
||||
Self::Chaingun => crate::data::weapon_list::ItemCategory::Chaingun,
|
||||
Self::ShieldModule => crate::data::weapon_list::ItemCategory::ShieldModule,
|
||||
Self::GhostModule => crate::data::weapon_list::ItemCategory::GhostModule,
|
||||
Self::BlinkModule => crate::data::weapon_list::ItemCategory::BlinkModule,
|
||||
Self::EmpModule => crate::data::weapon_list::ItemCategory::EmpModule,
|
||||
Self::WindowmakerModule => crate::data::weapon_list::ItemCategory::WindowmakerModule,
|
||||
Self::EnergyModule => crate::data::weapon_list::ItemCategory::EnergyModule,
|
||||
impl std::convert::From<ItemCategory> for crate::data::weapon_list::ItemCategory {
|
||||
fn from(val: ItemCategory) -> Self {
|
||||
match val {
|
||||
ItemCategory::NotAFunctionalItem => crate::data::weapon_list::ItemCategory::NoFunction,
|
||||
ItemCategory::Wheel => crate::data::weapon_list::ItemCategory::Wheel,
|
||||
ItemCategory::Hover => crate::data::weapon_list::ItemCategory::Hover,
|
||||
ItemCategory::Wing => crate::data::weapon_list::ItemCategory::Wing,
|
||||
ItemCategory::Rudder => crate::data::weapon_list::ItemCategory::Rudder,
|
||||
ItemCategory::Thruster => crate::data::weapon_list::ItemCategory::Thruster,
|
||||
ItemCategory::InsectLeg => crate::data::weapon_list::ItemCategory::InsectLeg,
|
||||
ItemCategory::MechLeg => crate::data::weapon_list::ItemCategory::MechLeg,
|
||||
ItemCategory::Ski => crate::data::weapon_list::ItemCategory::Ski,
|
||||
ItemCategory::TankTrack => crate::data::weapon_list::ItemCategory::TankTrack,
|
||||
ItemCategory::Rotor => crate::data::weapon_list::ItemCategory::Rotor,
|
||||
ItemCategory::SprinterLeg => crate::data::weapon_list::ItemCategory::SprinterLeg,
|
||||
ItemCategory::Propeller => crate::data::weapon_list::ItemCategory::Propeller,
|
||||
ItemCategory::Laser => crate::data::weapon_list::ItemCategory::Laser,
|
||||
ItemCategory::Plasma => crate::data::weapon_list::ItemCategory::Plasma,
|
||||
ItemCategory::Mortar => crate::data::weapon_list::ItemCategory::Mortar,
|
||||
ItemCategory::Rail => crate::data::weapon_list::ItemCategory::Rail,
|
||||
ItemCategory::Nano => crate::data::weapon_list::ItemCategory::Nano,
|
||||
ItemCategory::Tesla => crate::data::weapon_list::ItemCategory::Tesla,
|
||||
ItemCategory::Aeroflak => crate::data::weapon_list::ItemCategory::Aeroflak,
|
||||
ItemCategory::Ion => crate::data::weapon_list::ItemCategory::Ion,
|
||||
ItemCategory::Seeker => crate::data::weapon_list::ItemCategory::Seeker,
|
||||
ItemCategory::Chaingun => crate::data::weapon_list::ItemCategory::Chaingun,
|
||||
ItemCategory::ShieldModule => crate::data::weapon_list::ItemCategory::ShieldModule,
|
||||
ItemCategory::GhostModule => crate::data::weapon_list::ItemCategory::GhostModule,
|
||||
ItemCategory::BlinkModule => crate::data::weapon_list::ItemCategory::BlinkModule,
|
||||
ItemCategory::EmpModule => crate::data::weapon_list::ItemCategory::EmpModule,
|
||||
ItemCategory::WindowmakerModule => crate::data::weapon_list::ItemCategory::WindowmakerModule,
|
||||
ItemCategory::EnergyModule => crate::data::weapon_list::ItemCategory::EnergyModule,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,27 +74,27 @@ impl GarageSlot {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::garage_bay::GarageSlotInfo> for GarageSlot {
|
||||
fn into(self) -> crate::data::garage_bay::GarageSlotInfo {
|
||||
impl std::convert::From<GarageSlot> for crate::data::garage_bay::GarageSlotInfo {
|
||||
fn from(val: GarageSlot) -> Self {
|
||||
crate::data::garage_bay::GarageSlotInfo {
|
||||
name: self.name,
|
||||
cubes: self.cubes,
|
||||
crf_id: self.crf_id as u32,
|
||||
was_rated: self.was_rated,
|
||||
movement_categories: self.movement_categories.into_iter().map(|x| x.into()).collect(),
|
||||
uuid: self.uuid,
|
||||
thumbnail_version: self.thumbnail_version as u32,
|
||||
total_robot_cpu: self.total_robot_cpu as u32,
|
||||
total_cosmetic_cpu: self.total_cosmetic_cpu as u32,
|
||||
total_robot_ranking: self.total_robot_ranking as u32,
|
||||
bay_cpu: self.bay_cpu as u32,
|
||||
tutorial_robot: self.tutorial_robot,
|
||||
starter_robot_index: self.starter_robot_index,
|
||||
control_type: self.control_type.into(),
|
||||
control_options: self.control_options.into(),
|
||||
mastery_level: self.mastery_level,
|
||||
bay_skin_id: self.bay_skin_id,
|
||||
weapon_order: self.weapon_order,
|
||||
name: val.name,
|
||||
cubes: val.cubes,
|
||||
crf_id: val.crf_id as u32,
|
||||
was_rated: val.was_rated,
|
||||
movement_categories: val.movement_categories.into_iter().map(|x| x.into()).collect(),
|
||||
uuid: val.uuid,
|
||||
thumbnail_version: val.thumbnail_version as u32,
|
||||
total_robot_cpu: val.total_robot_cpu as u32,
|
||||
total_cosmetic_cpu: val.total_cosmetic_cpu as u32,
|
||||
total_robot_ranking: val.total_robot_ranking as u32,
|
||||
bay_cpu: val.bay_cpu as u32,
|
||||
tutorial_robot: val.tutorial_robot,
|
||||
starter_robot_index: val.starter_robot_index,
|
||||
control_type: val.control_type.into(),
|
||||
control_options: val.control_options.into(),
|
||||
mastery_level: val.mastery_level,
|
||||
bay_skin_id: val.bay_skin_id,
|
||||
weapon_order: val.weapon_order,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,14 +114,14 @@ pub fn db_into_data(garage: oj_rc_database::schema::garage::Model) -> crate::dat
|
||||
total_robot_ranking: garage.total_robot_ranking as u32,
|
||||
bay_cpu: garage.bay_cpu as u32,
|
||||
tutorial_robot: garage.tutorial_robot,
|
||||
starter_robot_index: garage.starter_robot_index.map(|x| x as i32).unwrap_or(-1),
|
||||
starter_robot_index: garage.starter_robot_index.unwrap_or(-1),
|
||||
control_type: control_ty_into_data(garage.control_type),
|
||||
control_options: crate::data::garage_bay::ControlOptions {
|
||||
vertical_strafing: garage.vertical_strafing,
|
||||
sideways_driving: garage.sideways_driving,
|
||||
tracks_turn_on_spot: garage.tracks_turn_on_spot,
|
||||
},
|
||||
mastery_level: garage.mastery_level as i32,
|
||||
mastery_level: garage.mastery_level,
|
||||
bay_skin_id: garage.bay_skin_id,
|
||||
weapon_order: oj_rc_database::schema::parse_int_csv(&garage.weapon_order).into_iter().map(|x| x as i32).collect(),
|
||||
}
|
||||
@@ -150,12 +150,12 @@ pub enum ControlType {
|
||||
Count,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::garage_bay::ControlType> for ControlType {
|
||||
fn into(self) -> crate::data::garage_bay::ControlType {
|
||||
match self {
|
||||
Self::Camera => crate::data::garage_bay::ControlType::Camera,
|
||||
Self::Keyboard => crate::data::garage_bay::ControlType::Keyboard,
|
||||
Self::Count => crate::data::garage_bay::ControlType::Count,
|
||||
impl std::convert::From<ControlType> for crate::data::garage_bay::ControlType {
|
||||
fn from(val: ControlType) -> Self {
|
||||
match val {
|
||||
ControlType::Camera => crate::data::garage_bay::ControlType::Camera,
|
||||
ControlType::Keyboard => crate::data::garage_bay::ControlType::Keyboard,
|
||||
ControlType::Count => crate::data::garage_bay::ControlType::Count,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,12 +167,12 @@ pub struct GarageControls {
|
||||
pub tracks_turn_on_spot: bool,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::garage_bay::ControlOptions> for GarageControls {
|
||||
fn into(self) -> crate::data::garage_bay::ControlOptions {
|
||||
impl std::convert::From<GarageControls> for crate::data::garage_bay::ControlOptions {
|
||||
fn from(val: GarageControls) -> Self {
|
||||
crate::data::garage_bay::ControlOptions {
|
||||
vertical_strafing: self.vertical_strafing,
|
||||
sideways_driving: self.sideways_driving,
|
||||
tracks_turn_on_spot: self.tracks_turn_on_spot,
|
||||
vertical_strafing: val.vertical_strafing,
|
||||
sideways_driving: val.sideways_driving,
|
||||
tracks_turn_on_spot: val.tracks_turn_on_spot,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,12 +212,12 @@ pub enum PrefabId {
|
||||
// TODO File
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::persist::config::VehicleDescriptor> for PrefabId {
|
||||
fn into(self) -> crate::persist::config::VehicleDescriptor {
|
||||
match self {
|
||||
Self::Factory { factory } => crate::persist::config::VehicleDescriptor::Factory { factory },
|
||||
Self::Database { garage } => crate::persist::config::VehicleDescriptor::Database { garage },
|
||||
Self::Raw { cube_data, colour_data } => crate::persist::config::VehicleDescriptor::Raw { cube_data , colour_data },
|
||||
impl std::convert::From<PrefabId> for crate::persist::config::VehicleDescriptor {
|
||||
fn from(val: PrefabId) -> Self {
|
||||
match val {
|
||||
PrefabId::Factory { factory } => crate::persist::config::VehicleDescriptor::Factory { factory },
|
||||
PrefabId::Database { garage } => crate::persist::config::VehicleDescriptor::Database { garage },
|
||||
PrefabId::Raw { cube_data, colour_data } => crate::persist::config::VehicleDescriptor::Raw { cube_data , colour_data },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +97,7 @@ const DEFAULT_BASE_RADIUS: f32 = 20.0;
|
||||
const DEFAULT_CAPTURE_PERCENT_PER_SECOND: f32 = DEFAULT_BASE_PERCENT_PER_SECOND * 1.5;
|
||||
const DEFAULT_CAPTURE_RADIUS: f32 = 14.0;
|
||||
|
||||
#[allow(clippy::approx_constant)]
|
||||
pub(super) fn default_map() -> std::collections::HashMap<super::combat::GameMap, MapConfig> {
|
||||
let mut map = std::collections::HashMap::with_capacity(9);
|
||||
//let coords_t0 = corner_to_center((6.60, 4.09, 20.3), 10.0);
|
||||
|
||||
@@ -41,7 +41,7 @@ pub use multiplayer::{MultiplayerConfig, NetworkConf};
|
||||
mod maps;
|
||||
pub use maps::{MapsConfig, MapConfig};
|
||||
|
||||
pub(self) const VALID_ROBOT: &[u8] = &[64,
|
||||
const VALID_ROBOT: &[u8] = &[64,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -558,7 +558,7 @@ pub(self) const VALID_ROBOT: &[u8] = &[64,
|
||||
15,
|
||||
6];
|
||||
|
||||
pub(self) const VALID_COLOUR: &[u8] = &[64,
|
||||
const VALID_COLOUR: &[u8] = &[64,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
||||
@@ -49,21 +49,21 @@ pub enum MovementCategorySpecificData {
|
||||
Ski,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::MovementCategorySpecificData> for MovementCategorySpecificData {
|
||||
fn into(self) -> crate::data::movement_list::MovementCategorySpecificData {
|
||||
match self {
|
||||
Self::Wheel => crate::data::movement_list::MovementCategorySpecificData::Wheel,
|
||||
Self::Hover(x) => crate::data::movement_list::MovementCategorySpecificData::Hover(x.into()),
|
||||
Self::Wing => crate::data::movement_list::MovementCategorySpecificData::Wing,
|
||||
Self::Rudder => crate::data::movement_list::MovementCategorySpecificData::Rudder,
|
||||
Self::Thruster => crate::data::movement_list::MovementCategorySpecificData::Thruster,
|
||||
Self::Propeller => crate::data::movement_list::MovementCategorySpecificData::Propeller,
|
||||
Self::InsectLeg => crate::data::movement_list::MovementCategorySpecificData::InsectLeg,
|
||||
Self::MechLeg(x) => crate::data::movement_list::MovementCategorySpecificData::MechLeg(x.into()),
|
||||
Self::SprinterLeg(x) => crate::data::movement_list::MovementCategorySpecificData::SprinterLeg(x.into()),
|
||||
Self::TankTrack => crate::data::movement_list::MovementCategorySpecificData::TankTrack,
|
||||
Self::Rotor(x) => crate::data::movement_list::MovementCategorySpecificData::Rotor(x.into()),
|
||||
Self::Ski => crate::data::movement_list::MovementCategorySpecificData::Ski,
|
||||
impl std::convert::From<MovementCategorySpecificData> for crate::data::movement_list::MovementCategorySpecificData {
|
||||
fn from(val: MovementCategorySpecificData) -> Self {
|
||||
match val {
|
||||
MovementCategorySpecificData::Wheel => crate::data::movement_list::MovementCategorySpecificData::Wheel,
|
||||
MovementCategorySpecificData::Hover(x) => crate::data::movement_list::MovementCategorySpecificData::Hover(x.into()),
|
||||
MovementCategorySpecificData::Wing => crate::data::movement_list::MovementCategorySpecificData::Wing,
|
||||
MovementCategorySpecificData::Rudder => crate::data::movement_list::MovementCategorySpecificData::Rudder,
|
||||
MovementCategorySpecificData::Thruster => crate::data::movement_list::MovementCategorySpecificData::Thruster,
|
||||
MovementCategorySpecificData::Propeller => crate::data::movement_list::MovementCategorySpecificData::Propeller,
|
||||
MovementCategorySpecificData::InsectLeg => crate::data::movement_list::MovementCategorySpecificData::InsectLeg,
|
||||
MovementCategorySpecificData::MechLeg(x) => crate::data::movement_list::MovementCategorySpecificData::MechLeg(x.into()),
|
||||
MovementCategorySpecificData::SprinterLeg(x) => crate::data::movement_list::MovementCategorySpecificData::SprinterLeg(x.into()),
|
||||
MovementCategorySpecificData::TankTrack => crate::data::movement_list::MovementCategorySpecificData::TankTrack,
|
||||
MovementCategorySpecificData::Rotor(x) => crate::data::movement_list::MovementCategorySpecificData::Rotor(x.into()),
|
||||
MovementCategorySpecificData::Ski => crate::data::movement_list::MovementCategorySpecificData::Ski,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,16 +79,16 @@ pub struct HoverCategoryData {
|
||||
pub deceleration_multiplier: f32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::HoverCategoryData> for HoverCategoryData {
|
||||
fn into(self) -> crate::data::movement_list::HoverCategoryData {
|
||||
impl std::convert::From<HoverCategoryData> for crate::data::movement_list::HoverCategoryData {
|
||||
fn from(val: HoverCategoryData) -> Self {
|
||||
crate::data::movement_list::HoverCategoryData {
|
||||
height_tolerance: self.height_tolerance,
|
||||
force_y_offset: self.force_y_offset,
|
||||
turning_scale: self.turning_scale,
|
||||
small_angle_turning_scale: self.small_angle_turning_scale,
|
||||
hover_damping: self.hover_damping,
|
||||
angular_damping: self.angular_damping,
|
||||
deceleration_multiplier: self.deceleration_multiplier,
|
||||
height_tolerance: val.height_tolerance,
|
||||
force_y_offset: val.force_y_offset,
|
||||
turning_scale: val.turning_scale,
|
||||
small_angle_turning_scale: val.small_angle_turning_scale,
|
||||
hover_damping: val.hover_damping,
|
||||
angular_damping: val.angular_damping,
|
||||
deceleration_multiplier: val.deceleration_multiplier,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,10 +98,10 @@ pub struct MechLegCategoryData {
|
||||
pub deceleration_multiplier: f32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::MechLegCategoryData> for MechLegCategoryData {
|
||||
fn into(self) -> crate::data::movement_list::MechLegCategoryData {
|
||||
impl std::convert::From<MechLegCategoryData> for crate::data::movement_list::MechLegCategoryData {
|
||||
fn from(val: MechLegCategoryData) -> Self {
|
||||
crate::data::movement_list::MechLegCategoryData {
|
||||
deceleration_multiplier: self.deceleration_multiplier,
|
||||
deceleration_multiplier: val.deceleration_multiplier,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,10 +111,10 @@ pub struct RotorCategoryData {
|
||||
pub max_turn_rate: f32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::RotorCategoryData> for RotorCategoryData {
|
||||
fn into(self) -> crate::data::movement_list::RotorCategoryData {
|
||||
impl std::convert::From<RotorCategoryData> for crate::data::movement_list::RotorCategoryData {
|
||||
fn from(val: RotorCategoryData) -> Self {
|
||||
crate::data::movement_list::RotorCategoryData {
|
||||
max_turn_rate: self.max_turn_rate,
|
||||
max_turn_rate: val.max_turn_rate,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,14 +129,14 @@ pub struct MovementData {
|
||||
pub specifics: MovementSpecificData,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::MovementData> for MovementData {
|
||||
fn into(self) -> crate::data::movement_list::MovementData {
|
||||
impl std::convert::From<MovementData> for crate::data::movement_list::MovementData {
|
||||
fn from(val: MovementData) -> Self {
|
||||
crate::data::movement_list::MovementData {
|
||||
speed_boost: self.speed_boost,
|
||||
max_carry_mass: self.max_carry_mass,
|
||||
horizontal_top_speed: self.horizontal_top_speed,
|
||||
vertical_top_speed: self.vertical_top_speed,
|
||||
specifics: self.specifics.into(),
|
||||
speed_boost: val.speed_boost,
|
||||
max_carry_mass: val.max_carry_mass,
|
||||
horizontal_top_speed: val.horizontal_top_speed,
|
||||
vertical_top_speed: val.vertical_top_speed,
|
||||
specifics: val.specifics.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,21 +158,21 @@ pub enum MovementSpecificData {
|
||||
Ski,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::MovementSpecificData> for MovementSpecificData {
|
||||
fn into(self) -> crate::data::movement_list::MovementSpecificData {
|
||||
match self {
|
||||
Self::Wheel(x) => crate::data::movement_list::MovementSpecificData::Wheel(x.into()),
|
||||
Self::Hover(x) => crate::data::movement_list::MovementSpecificData::Hover(x.into()),
|
||||
Self::Wing(x) => crate::data::movement_list::MovementSpecificData::Wing(x.into()),
|
||||
Self::Rudder(x) => crate::data::movement_list::MovementSpecificData::Rudder(x.into()),
|
||||
Self::Thruster(x) => crate::data::movement_list::MovementSpecificData::Thruster(x.into()),
|
||||
Self::Propeller(x) => crate::data::movement_list::MovementSpecificData::Propeller(x.into()),
|
||||
Self::InsectLeg(x) => crate::data::movement_list::MovementSpecificData::InsectLeg(x.into()),
|
||||
Self::MechLeg(x) => crate::data::movement_list::MovementSpecificData::MechLeg(x.into()),
|
||||
Self::SprinterLeg(x) => crate::data::movement_list::MovementSpecificData::SprinterLeg(x.into()),
|
||||
Self::TankTrack(x) => crate::data::movement_list::MovementSpecificData::TankTrack(x.into()),
|
||||
Self::Rotor(x) => crate::data::movement_list::MovementSpecificData::Rotor(x.into()),
|
||||
Self::Ski=> crate::data::movement_list::MovementSpecificData::Ski,
|
||||
impl std::convert::From<MovementSpecificData> for crate::data::movement_list::MovementSpecificData {
|
||||
fn from(val: MovementSpecificData) -> Self {
|
||||
match val {
|
||||
MovementSpecificData::Wheel(x) => crate::data::movement_list::MovementSpecificData::Wheel(x.into()),
|
||||
MovementSpecificData::Hover(x) => crate::data::movement_list::MovementSpecificData::Hover(x.into()),
|
||||
MovementSpecificData::Wing(x) => crate::data::movement_list::MovementSpecificData::Wing(x.into()),
|
||||
MovementSpecificData::Rudder(x) => crate::data::movement_list::MovementSpecificData::Rudder(x.into()),
|
||||
MovementSpecificData::Thruster(x) => crate::data::movement_list::MovementSpecificData::Thruster(x.into()),
|
||||
MovementSpecificData::Propeller(x) => crate::data::movement_list::MovementSpecificData::Propeller(x.into()),
|
||||
MovementSpecificData::InsectLeg(x) => crate::data::movement_list::MovementSpecificData::InsectLeg(x.into()),
|
||||
MovementSpecificData::MechLeg(x) => crate::data::movement_list::MovementSpecificData::MechLeg(x.into()),
|
||||
MovementSpecificData::SprinterLeg(x) => crate::data::movement_list::MovementSpecificData::SprinterLeg(x.into()),
|
||||
MovementSpecificData::TankTrack(x) => crate::data::movement_list::MovementSpecificData::TankTrack(x.into()),
|
||||
MovementSpecificData::Rotor(x) => crate::data::movement_list::MovementSpecificData::Rotor(x.into()),
|
||||
MovementSpecificData::Ski=> crate::data::movement_list::MovementSpecificData::Ski,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -191,19 +191,19 @@ pub struct WheelData {
|
||||
pub brake_force_heavy: f32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::WheelData> for WheelData {
|
||||
fn into(self) -> crate::data::movement_list::WheelData {
|
||||
impl std::convert::From<WheelData> for crate::data::movement_list::WheelData {
|
||||
fn from(val: WheelData) -> Self {
|
||||
crate::data::movement_list::WheelData {
|
||||
steering_speed_light: self.steering_speed_light,
|
||||
steering_speed_heavy: self.steering_speed_heavy,
|
||||
steering_force_multiplier_light: self.steering_force_multiplier_light,
|
||||
steering_force_multiplier_heavy: self.steering_force_multiplier_heavy,
|
||||
lateral_acceleration_light: self.lateral_acceleration_light,
|
||||
lateral_acceleration_heavy: self.lateral_acceleration_heavy,
|
||||
time_to_max_acceleration_light: self.time_to_max_acceleration_light,
|
||||
time_to_max_acceleration_heavy: self.time_to_max_acceleration_heavy,
|
||||
brake_force_light: self.brake_force_light,
|
||||
brake_force_heavy: self.brake_force_heavy,
|
||||
steering_speed_light: val.steering_speed_light,
|
||||
steering_speed_heavy: val.steering_speed_heavy,
|
||||
steering_force_multiplier_light: val.steering_force_multiplier_light,
|
||||
steering_force_multiplier_heavy: val.steering_force_multiplier_heavy,
|
||||
lateral_acceleration_light: val.lateral_acceleration_light,
|
||||
lateral_acceleration_heavy: val.lateral_acceleration_heavy,
|
||||
time_to_max_acceleration_light: val.time_to_max_acceleration_light,
|
||||
time_to_max_acceleration_heavy: val.time_to_max_acceleration_heavy,
|
||||
brake_force_light: val.brake_force_light,
|
||||
brake_force_heavy: val.brake_force_heavy,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,21 +224,21 @@ pub struct HoverData {
|
||||
pub lateral_damping_heavy: f32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::HoverData> for HoverData {
|
||||
fn into(self) -> crate::data::movement_list::HoverData {
|
||||
impl std::convert::From<HoverData> for crate::data::movement_list::HoverData {
|
||||
fn from(val: HoverData) -> Self {
|
||||
crate::data::movement_list::HoverData {
|
||||
max_hover_height_light: self.max_hover_height_light,
|
||||
max_hover_height_heavy: self.max_hover_height_heavy,
|
||||
height_change_speed_light: self.height_change_speed_light,
|
||||
height_change_speed_heavy: self.height_change_speed_heavy,
|
||||
turn_torque_light: self.turn_torque_light,
|
||||
turn_torque_heavy: self.turn_torque_heavy,
|
||||
acceleration_light: self.acceleration_light,
|
||||
acceleration_heavy: self.acceleration_heavy,
|
||||
max_angular_velocity_light: self.max_angular_velocity_light,
|
||||
max_angular_velocity_heavy: self.max_angular_velocity_heavy,
|
||||
lateral_damping_light: self.lateral_damping_light,
|
||||
lateral_damping_heavy: self.lateral_damping_heavy,
|
||||
max_hover_height_light: val.max_hover_height_light,
|
||||
max_hover_height_heavy: val.max_hover_height_heavy,
|
||||
height_change_speed_light: val.height_change_speed_light,
|
||||
height_change_speed_heavy: val.height_change_speed_heavy,
|
||||
turn_torque_light: val.turn_torque_light,
|
||||
turn_torque_heavy: val.turn_torque_heavy,
|
||||
acceleration_light: val.acceleration_light,
|
||||
acceleration_heavy: val.acceleration_heavy,
|
||||
max_angular_velocity_light: val.max_angular_velocity_light,
|
||||
max_angular_velocity_heavy: val.max_angular_velocity_heavy,
|
||||
lateral_damping_light: val.lateral_damping_light,
|
||||
lateral_damping_heavy: val.lateral_damping_heavy,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,21 +259,21 @@ pub struct AerofoilData {
|
||||
pub vtol_velocity_heavy: f32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::AerofoilData> for AerofoilData {
|
||||
fn into(self) -> crate::data::movement_list::AerofoilData {
|
||||
impl std::convert::From<AerofoilData> for crate::data::movement_list::AerofoilData {
|
||||
fn from(val: AerofoilData) -> Self {
|
||||
crate::data::movement_list::AerofoilData {
|
||||
barrel_speed_light: self.barrel_speed_light,
|
||||
barrel_speed_heavy: self.barrel_speed_heavy,
|
||||
bank_speed_light: self.bank_speed_light,
|
||||
bank_speed_heavy: self.bank_speed_heavy,
|
||||
elevation_speed_light: self.elevation_speed_light,
|
||||
elevation_speed_heavy: self.elevation_speed_heavy,
|
||||
rudder_speed_light: self.rudder_speed_light,
|
||||
rudder_speed_heavy: self.rudder_speed_heavy,
|
||||
thrust_light: self.thrust_light,
|
||||
thrust_heavy: self.thrust_heavy,
|
||||
vtol_velocity_light: self.vtol_velocity_light,
|
||||
vtol_velocity_heavy: self.vtol_velocity_heavy,
|
||||
barrel_speed_light: val.barrel_speed_light,
|
||||
barrel_speed_heavy: val.barrel_speed_heavy,
|
||||
bank_speed_light: val.bank_speed_light,
|
||||
bank_speed_heavy: val.bank_speed_heavy,
|
||||
elevation_speed_light: val.elevation_speed_light,
|
||||
elevation_speed_heavy: val.elevation_speed_heavy,
|
||||
rudder_speed_light: val.rudder_speed_light,
|
||||
rudder_speed_heavy: val.rudder_speed_heavy,
|
||||
thrust_light: val.thrust_light,
|
||||
thrust_heavy: val.thrust_heavy,
|
||||
vtol_velocity_light: val.vtol_velocity_light,
|
||||
vtol_velocity_heavy: val.vtol_velocity_heavy,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,11 +284,11 @@ pub struct ThrusterData {
|
||||
pub acceleration_delay_heavy: f32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::ThrusterData> for ThrusterData {
|
||||
fn into(self) -> crate::data::movement_list::ThrusterData {
|
||||
impl std::convert::From<ThrusterData> for crate::data::movement_list::ThrusterData {
|
||||
fn from(val: ThrusterData) -> Self {
|
||||
crate::data::movement_list::ThrusterData {
|
||||
acceleration_delay_light: self.acceleration_delay_light,
|
||||
acceleration_delay_heavy: self.acceleration_delay_heavy,
|
||||
acceleration_delay_light: val.acceleration_delay_light,
|
||||
acceleration_delay_heavy: val.acceleration_delay_heavy,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,35 +323,35 @@ pub struct InsectLegData {
|
||||
pub swagger_force_heavy: f32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::InsectLegData> for InsectLegData {
|
||||
fn into(self) -> crate::data::movement_list::InsectLegData {
|
||||
impl std::convert::From<InsectLegData> for crate::data::movement_list::InsectLegData {
|
||||
fn from(val: InsectLegData) -> Self {
|
||||
crate::data::movement_list::InsectLegData {
|
||||
ideal_height_light: self.ideal_height_light,
|
||||
ideal_height_heavy: self.ideal_height_heavy,
|
||||
ideal_crouching_height_light: self.ideal_crouching_height_light,
|
||||
ideal_crouching_height_heavy: self.ideal_crouching_height_heavy,
|
||||
ideal_height_range_light: self.ideal_height_range_light,
|
||||
ideal_height_range_heavy: self.ideal_height_range_heavy,
|
||||
jump_height_light: self.jump_height_light,
|
||||
jump_height_heavy: self.jump_height_heavy,
|
||||
max_upwards_force_light: self.max_upwards_force_light,
|
||||
max_upwards_force_heavy: self.max_upwards_force_heavy,
|
||||
max_lateral_force_light: self.max_lateral_force_light,
|
||||
max_lateral_force_heavy: self.max_lateral_force_heavy,
|
||||
max_turning_force_light: self.max_turning_force_light,
|
||||
max_turning_force_heavy: self.max_turning_force_heavy,
|
||||
max_damping_force_light: self.max_damping_force_light,
|
||||
max_damping_force_heavy: self.max_damping_force_heavy,
|
||||
max_stopped_force_light: self.max_stopped_force_light,
|
||||
max_stopped_force_heavy: self.max_stopped_force_heavy,
|
||||
max_new_stopped_force_light: self.max_new_stopped_force_light,
|
||||
max_new_stopped_force_heavy: self.max_new_stopped_force_heavy,
|
||||
upwards_damping_force_light: self.upwards_damping_force_light,
|
||||
upwards_damping_force_heavy: self.upwards_damping_force_heavy,
|
||||
lateral_damp_force_light: self.lateral_damp_force_light,
|
||||
lateral_damp_force_heavy: self.lateral_damp_force_heavy,
|
||||
swagger_force_light: self.swagger_force_light,
|
||||
swagger_force_heavy: self.swagger_force_heavy,
|
||||
ideal_height_light: val.ideal_height_light,
|
||||
ideal_height_heavy: val.ideal_height_heavy,
|
||||
ideal_crouching_height_light: val.ideal_crouching_height_light,
|
||||
ideal_crouching_height_heavy: val.ideal_crouching_height_heavy,
|
||||
ideal_height_range_light: val.ideal_height_range_light,
|
||||
ideal_height_range_heavy: val.ideal_height_range_heavy,
|
||||
jump_height_light: val.jump_height_light,
|
||||
jump_height_heavy: val.jump_height_heavy,
|
||||
max_upwards_force_light: val.max_upwards_force_light,
|
||||
max_upwards_force_heavy: val.max_upwards_force_heavy,
|
||||
max_lateral_force_light: val.max_lateral_force_light,
|
||||
max_lateral_force_heavy: val.max_lateral_force_heavy,
|
||||
max_turning_force_light: val.max_turning_force_light,
|
||||
max_turning_force_heavy: val.max_turning_force_heavy,
|
||||
max_damping_force_light: val.max_damping_force_light,
|
||||
max_damping_force_heavy: val.max_damping_force_heavy,
|
||||
max_stopped_force_light: val.max_stopped_force_light,
|
||||
max_stopped_force_heavy: val.max_stopped_force_heavy,
|
||||
max_new_stopped_force_light: val.max_new_stopped_force_light,
|
||||
max_new_stopped_force_heavy: val.max_new_stopped_force_heavy,
|
||||
upwards_damping_force_light: val.upwards_damping_force_light,
|
||||
upwards_damping_force_heavy: val.upwards_damping_force_heavy,
|
||||
lateral_damp_force_light: val.lateral_damp_force_light,
|
||||
lateral_damp_force_heavy: val.lateral_damp_force_heavy,
|
||||
swagger_force_light: val.swagger_force_light,
|
||||
swagger_force_heavy: val.swagger_force_heavy,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -374,23 +374,23 @@ pub struct MechLegData {
|
||||
pub max_damping_force_heavy: f32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::MechLegData> for MechLegData {
|
||||
fn into(self) -> crate::data::movement_list::MechLegData {
|
||||
impl std::convert::From<MechLegData> for crate::data::movement_list::MechLegData {
|
||||
fn from(val: MechLegData) -> Self {
|
||||
crate::data::movement_list::MechLegData {
|
||||
time_grounded_after_jump_light: self.time_grounded_after_jump_light,
|
||||
time_grounded_after_jump_heavy: self.time_grounded_after_jump_heavy,
|
||||
jump_height_light: self.jump_height_light,
|
||||
jump_height_heavy: self.jump_height_heavy,
|
||||
turn_acceleration_light: self.turn_acceleration_light,
|
||||
turn_acceleration_heavy: self.turn_acceleration_heavy,
|
||||
legacy_turn_acceleration_light: self.legacy_turn_acceleration_light,
|
||||
legacy_turn_acceleration_heavy: self.legacy_turn_acceleration_heavy,
|
||||
long_jump_speed_scale_light: self.long_jump_speed_scale_light,
|
||||
long_jump_speed_scale_heavy: self.long_jump_speed_scale_heavy,
|
||||
max_lateral_force_light: self.max_lateral_force_light,
|
||||
max_lateral_force_heavy: self.max_lateral_force_heavy,
|
||||
max_damping_force_light: self.max_damping_force_light,
|
||||
max_damping_force_heavy: self.max_damping_force_heavy,
|
||||
time_grounded_after_jump_light: val.time_grounded_after_jump_light,
|
||||
time_grounded_after_jump_heavy: val.time_grounded_after_jump_heavy,
|
||||
jump_height_light: val.jump_height_light,
|
||||
jump_height_heavy: val.jump_height_heavy,
|
||||
turn_acceleration_light: val.turn_acceleration_light,
|
||||
turn_acceleration_heavy: val.turn_acceleration_heavy,
|
||||
legacy_turn_acceleration_light: val.legacy_turn_acceleration_light,
|
||||
legacy_turn_acceleration_heavy: val.legacy_turn_acceleration_heavy,
|
||||
long_jump_speed_scale_light: val.long_jump_speed_scale_light,
|
||||
long_jump_speed_scale_heavy: val.long_jump_speed_scale_heavy,
|
||||
max_lateral_force_light: val.max_lateral_force_light,
|
||||
max_lateral_force_heavy: val.max_lateral_force_heavy,
|
||||
max_damping_force_light: val.max_damping_force_light,
|
||||
max_damping_force_heavy: val.max_damping_force_heavy,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -407,17 +407,17 @@ pub struct TankTrackData {
|
||||
pub lateral_acceleration_heavy: f32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::TankTrackData> for TankTrackData {
|
||||
fn into(self) -> crate::data::movement_list::TankTrackData {
|
||||
impl std::convert::From<TankTrackData> for crate::data::movement_list::TankTrackData {
|
||||
fn from(val: TankTrackData) -> Self {
|
||||
crate::data::movement_list::TankTrackData {
|
||||
max_turn_rate_moving_light: self.max_turn_rate_moving_light,
|
||||
max_turn_rate_moving_heavy: self.max_turn_rate_moving_heavy,
|
||||
max_turn_rate_stopped_light: self.max_turn_rate_stopped_light,
|
||||
max_turn_rate_stopped_heavy: self.max_turn_rate_stopped_heavy,
|
||||
turn_acceleration_light: self.turn_acceleration_light,
|
||||
turn_acceleration_heavy: self.turn_acceleration_heavy,
|
||||
lateral_acceleration_light: self.lateral_acceleration_light,
|
||||
lateral_acceleration_heavy: self.lateral_acceleration_heavy,
|
||||
max_turn_rate_moving_light: val.max_turn_rate_moving_light,
|
||||
max_turn_rate_moving_heavy: val.max_turn_rate_moving_heavy,
|
||||
max_turn_rate_stopped_light: val.max_turn_rate_stopped_light,
|
||||
max_turn_rate_stopped_heavy: val.max_turn_rate_stopped_heavy,
|
||||
turn_acceleration_light: val.turn_acceleration_light,
|
||||
turn_acceleration_heavy: val.turn_acceleration_heavy,
|
||||
lateral_acceleration_light: val.lateral_acceleration_light,
|
||||
lateral_acceleration_heavy: val.lateral_acceleration_heavy,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -436,19 +436,19 @@ pub struct RotorData {
|
||||
pub level_acceleration_heavy: f32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::movement_list::RotorData> for RotorData {
|
||||
fn into(self) -> crate::data::movement_list::RotorData {
|
||||
impl std::convert::From<RotorData> for crate::data::movement_list::RotorData {
|
||||
fn from(val: RotorData) -> Self {
|
||||
crate::data::movement_list::RotorData {
|
||||
height_acceleration_light: self.height_acceleration_light,
|
||||
height_acceleration_heavy: self.height_acceleration_heavy,
|
||||
strafe_acceleration_light: self.strafe_acceleration_light,
|
||||
strafe_acceleration_heavy: self.strafe_acceleration_heavy,
|
||||
turn_acceleration_light: self.turn_acceleration_light,
|
||||
turn_acceleration_heavy: self.turn_acceleration_heavy,
|
||||
height_max_change_speed_light: self.height_max_change_speed_light,
|
||||
height_max_change_speed_heavy: self.height_max_change_speed_heavy,
|
||||
level_acceleration_light: self.level_acceleration_light,
|
||||
level_acceleration_heavy: self.level_acceleration_heavy,
|
||||
height_acceleration_light: val.height_acceleration_light,
|
||||
height_acceleration_heavy: val.height_acceleration_heavy,
|
||||
strafe_acceleration_light: val.strafe_acceleration_light,
|
||||
strafe_acceleration_heavy: val.strafe_acceleration_heavy,
|
||||
turn_acceleration_light: val.turn_acceleration_light,
|
||||
turn_acceleration_heavy: val.turn_acceleration_heavy,
|
||||
height_max_change_speed_light: val.height_max_change_speed_light,
|
||||
height_max_change_speed_heavy: val.height_max_change_speed_heavy,
|
||||
level_acceleration_light: val.level_acceleration_light,
|
||||
level_acceleration_heavy: val.level_acceleration_heavy,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,17 +86,17 @@ pub struct CampaignDifficulty {
|
||||
pub damage_boost_wave_increase: f32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::campaign::CampaignDifficultyData> for CampaignDifficulty {
|
||||
fn into(self) -> crate::data::campaign::CampaignDifficultyData {
|
||||
impl std::convert::From<CampaignDifficulty> for crate::data::campaign::CampaignDifficultyData {
|
||||
fn from(val: CampaignDifficulty) -> Self {
|
||||
crate::data::campaign::CampaignDifficultyData {
|
||||
level: self.level,
|
||||
lives: self.lives,
|
||||
auto_heal: self.auto_heal,
|
||||
single_wave_bonus: self.single_wave_bonus,
|
||||
initial_health_boost: self.initial_health_boost,
|
||||
health_boost_wave_increase: self.health_boost_wave_increase,
|
||||
initial_damage_boost: self.initial_damage_boost,
|
||||
damage_boost_wave_increase: self.damage_boost_wave_increase,
|
||||
level: val.level,
|
||||
lives: val.lives,
|
||||
auto_heal: val.auto_heal,
|
||||
single_wave_bonus: val.single_wave_bonus,
|
||||
initial_health_boost: val.initial_health_boost,
|
||||
health_boost_wave_increase: val.health_boost_wave_increase,
|
||||
initial_damage_boost: val.initial_damage_boost,
|
||||
damage_boost_wave_increase: val.damage_boost_wave_increase,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,22 +128,22 @@ pub struct Wave {
|
||||
pub time_max: i32,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::campaign::WaveData> for Wave {
|
||||
fn into(self) -> crate::data::campaign::WaveData {
|
||||
impl std::convert::From<Wave> for crate::data::campaign::WaveData {
|
||||
fn from(val: Wave) -> Self {
|
||||
crate::data::campaign::WaveData {
|
||||
robots_in_wave: self.robots_in_wave.into_iter().map(|x| x.into()).collect(),
|
||||
robots_in_wave: val.robots_in_wave.into_iter().map(|x| x.into()).collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::campaign::CompleteWaveData> for Wave {
|
||||
fn into(self) -> crate::data::campaign::CompleteWaveData {
|
||||
impl std::convert::From<Wave> for crate::data::campaign::CompleteWaveData {
|
||||
fn from(val: Wave) -> Self {
|
||||
crate::data::campaign::CompleteWaveData {
|
||||
player_spawn_location: self.player_spawn_location,
|
||||
robots_in_wave: self.robots_in_wave.into_iter().map(|x| x.into()).collect(),
|
||||
kill_target: self.kill_target,
|
||||
time_min: self.time_min,
|
||||
time_max: self.time_max,
|
||||
player_spawn_location: val.player_spawn_location,
|
||||
robots_in_wave: val.robots_in_wave.into_iter().map(|x| x.into()).collect(),
|
||||
kill_target: val.kill_target,
|
||||
time_min: val.time_min,
|
||||
time_max: val.time_max,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,35 +185,35 @@ fn default_1() -> i32 {
|
||||
1
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::campaign::WaveRobotData> for WaveRobot {
|
||||
fn into(self) -> crate::data::campaign::WaveRobotData {
|
||||
impl std::convert::From<WaveRobot> for crate::data::campaign::WaveRobotData {
|
||||
fn from(val: WaveRobot) -> Self {
|
||||
crate::data::campaign::WaveRobotData {
|
||||
name: self.name,
|
||||
weapon: self.weapon,
|
||||
movement: self.movement,
|
||||
rank: self.rank,
|
||||
count: self.count,
|
||||
name: val.name,
|
||||
weapon: val.weapon,
|
||||
movement: val.movement,
|
||||
rank: val.rank,
|
||||
count: val.count,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::campaign::CompleteWaveRobotData> for WaveRobot {
|
||||
fn into(self) -> crate::data::campaign::CompleteWaveRobotData {
|
||||
impl std::convert::From<WaveRobot> for crate::data::campaign::CompleteWaveRobotData {
|
||||
fn from(val: WaveRobot) -> Self {
|
||||
crate::data::campaign::CompleteWaveRobotData {
|
||||
name: self.name,
|
||||
robot_data: self.robot_data,
|
||||
colour_data: self.colour_data,
|
||||
time_to_spawn: self.time_to_spawn,
|
||||
kills_to_spawn: self.kills_to_spawn,
|
||||
time_to_despawn: self.time_to_despawn,
|
||||
kills_to_despawn: self.kills_to_despawn,
|
||||
initial_robot_amount: self.initial_robot_amount,
|
||||
periodic_robot_amount: self.periodic_robot_amount,
|
||||
spawn_interval: self.spawn_interval,
|
||||
min_robot_amount: self.min_robot_amount,
|
||||
max_robot_amount: self.max_robot_amount,
|
||||
is_boss: self.is_boss,
|
||||
is_kill_requirement: self.is_kill_requirement,
|
||||
name: val.name,
|
||||
robot_data: val.robot_data,
|
||||
colour_data: val.colour_data,
|
||||
time_to_spawn: val.time_to_spawn,
|
||||
kills_to_spawn: val.kills_to_spawn,
|
||||
time_to_despawn: val.time_to_despawn,
|
||||
kills_to_despawn: val.kills_to_despawn,
|
||||
initial_robot_amount: val.initial_robot_amount,
|
||||
periodic_robot_amount: val.periodic_robot_amount,
|
||||
spawn_interval: val.spawn_interval,
|
||||
min_robot_amount: val.min_robot_amount,
|
||||
max_robot_amount: val.max_robot_amount,
|
||||
is_boss: val.is_boss,
|
||||
is_kill_requirement: val.is_kill_requirement,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,12 +225,12 @@ pub enum CampaignType {
|
||||
Elimination = 2,
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::campaign::CampaignType> for CampaignType {
|
||||
fn into(self) -> crate::data::campaign::CampaignType {
|
||||
match self {
|
||||
Self::TimedElimination => crate::data::campaign::CampaignType::TimedElimination,
|
||||
Self::Survival => crate::data::campaign::CampaignType::Survival,
|
||||
Self::Elimination => crate::data::campaign::CampaignType::Elimination,
|
||||
impl std::convert::From<CampaignType> for crate::data::campaign::CampaignType {
|
||||
fn from(val: CampaignType) -> Self {
|
||||
match val {
|
||||
CampaignType::TimedElimination => crate::data::campaign::CampaignType::TimedElimination,
|
||||
CampaignType::Survival => crate::data::campaign::CampaignType::Survival,
|
||||
CampaignType::Elimination => crate::data::campaign::CampaignType::Elimination,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ impl UserData {
|
||||
group: None, // no platoon
|
||||
team: 0,
|
||||
has_premium: false, // FIXME
|
||||
robot_uuid: super::i64_as_uuid_str(current_slot.uuid).into(),
|
||||
robot_uuid: super::i64_as_uuid_str(current_slot.uuid),
|
||||
cpu: cpu_count,
|
||||
avatar_id: avatar_id.ok(),
|
||||
weapon_order: weapon_orders,
|
||||
@@ -448,17 +448,17 @@ impl UserData {
|
||||
},
|
||||
Ok(None) => {
|
||||
log::error!("Prefab vehicle {} does not exist in factory", factory_id);
|
||||
return Err(polariton_server::operations::SimpleOpError::with_message(
|
||||
Err(polariton_server::operations::SimpleOpError::with_message(
|
||||
crate::data::error_codes::SingleplayerErrorCode::UnexpectedError as i16,
|
||||
format!("Prefab vehicle {} does not exist in factory", factory_id),
|
||||
));
|
||||
))
|
||||
},
|
||||
Err(e) => {
|
||||
log::error!("Failed to retrieve prefab vehicle {} from factory: {}", factory_id, e);
|
||||
return Err(polariton_server::operations::SimpleOpError::with_message(
|
||||
Err(polariton_server::operations::SimpleOpError::with_message(
|
||||
crate::data::error_codes::SingleplayerErrorCode::DatabaseError as i16,
|
||||
format!("Failed to retrieve prefab vehicle {} from factory: {}", factory_id, e),
|
||||
));
|
||||
))
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -488,17 +488,17 @@ impl UserData {
|
||||
},
|
||||
Ok(None) => {
|
||||
log::error!("Prefab vehicle {} does not exist in main garage database", garage);
|
||||
return Err(polariton_server::operations::SimpleOpError::with_message(
|
||||
Err(polariton_server::operations::SimpleOpError::with_message(
|
||||
crate::data::error_codes::SingleplayerErrorCode::UnexpectedError as i16,
|
||||
format!("Prefab vehicle {} does not exist in main garage database", garage),
|
||||
));
|
||||
))
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("Failed to retrieve prefab vehicle {} from main garage database: {}", garage, e);
|
||||
return Err(polariton_server::operations::SimpleOpError::with_message(
|
||||
Err(polariton_server::operations::SimpleOpError::with_message(
|
||||
crate::data::error_codes::SingleplayerErrorCode::DatabaseError as i16,
|
||||
format!("Failed to retrieve prefab vehicle {} from main garage database: {}", garage, e),
|
||||
));
|
||||
))
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -507,7 +507,7 @@ impl UserData {
|
||||
colour_data,
|
||||
} => {
|
||||
use sha2::Digest;
|
||||
let sha_bytes = sha2::Sha256::digest(&cube_data);
|
||||
let sha_bytes = sha2::Sha256::digest(cube_data);
|
||||
let u32_bytes = [
|
||||
sha_bytes[0],
|
||||
sha_bytes[1],
|
||||
@@ -518,9 +518,9 @@ impl UserData {
|
||||
let uuid_str = crate::persist::user::i64_as_uuid_str(uuid_i64);
|
||||
let weapons_guess = weapon_order.guess_weapons(&mut std::io::Cursor::new(&cube_data));
|
||||
let weapons_guess = vec![
|
||||
weapons_guess.get(0).map(|x| *x).unwrap_or(0),
|
||||
weapons_guess.get(1).map(|x| *x).unwrap_or(0),
|
||||
weapons_guess.get(2).map(|x| *x).unwrap_or(0),
|
||||
weapons_guess.first().copied().unwrap_or(0),
|
||||
weapons_guess.get(1).copied().unwrap_or(0),
|
||||
weapons_guess.get(2).copied().unwrap_or(0),
|
||||
];
|
||||
let weapon_ranks = weapons_guess.iter().map(|&x| (x, if x == 0 { 0 } else { 1 })).collect();
|
||||
let cpu_counts = cpu_counter.calculate_cpu(&mut std::io::Cursor::new(&cube_data));
|
||||
@@ -546,6 +546,7 @@ impl UserData {
|
||||
let mut players = Vec::with_capacity((singleplayer_config.max_enemies + singleplayer_config.max_teammates + 1) as usize);
|
||||
let mut next_id = 0;
|
||||
let mut seen_usernames = std::collections::HashSet::<String>::new();
|
||||
#[allow(clippy::explicit_counter_loop)] // this is really bad to read with this suggested refactor
|
||||
for i in 0..(singleplayer_config.max_enemies + singleplayer_config.max_teammates) {
|
||||
let vehicle = singleplayer_config.vehicles.choose(&mut rand::rng())
|
||||
.ok_or(crate::data::error_codes::SingleplayerErrorCode::UnexpectedError as i16)?;
|
||||
@@ -723,7 +724,7 @@ impl <C: Clone> super::User<C> for UserData {
|
||||
movement_categories: polariton::operation::Typed::IntArr(oj_rc_database::schema::parse_int_csv(&slot.movement_categories).into_iter().map(|x| x as i32).collect::<Vec<_>>().into()),
|
||||
control_type: polariton::operation::Typed::Int(control_ty as _),
|
||||
control_options: control_options.as_transmissible(),
|
||||
mastery_level: polariton::operation::Typed::Int(slot.mastery_level as i32),
|
||||
mastery_level: polariton::operation::Typed::Int(slot.mastery_level),
|
||||
robot_rank: polariton::operation::Typed::Int(slot.total_robot_ranking as _),
|
||||
cpu: polariton::operation::Typed::Int(slot.total_robot_cpu as _),
|
||||
cosmetic_cpu: polariton::operation::Typed::Int(slot.total_cosmetic_cpu as _),
|
||||
@@ -899,7 +900,7 @@ impl <C: Clone> super::User<C> for UserData {
|
||||
log::error!("No selected vehicle slot for user_id {}", self.account.id);
|
||||
DATABASE_ERR
|
||||
})?;
|
||||
let inc_opt = self.garage_upgrades.increments.iter().enumerate().filter(|(_i, inc)| inc.cpu <= selected_slot.bay_cpu as u32).last();
|
||||
let inc_opt = self.garage_upgrades.increments.iter().enumerate().filter(|(_i, inc)| inc.cpu <= selected_slot.bay_cpu as u32).next_back();
|
||||
if let Some((i, _)) = inc_opt {
|
||||
let max_upgrade = self.garage_upgrades.increments.len() - 1;
|
||||
let upgrade_to = i + (increments as usize);
|
||||
|
||||
@@ -52,11 +52,7 @@ fn default_user_data(info: &super::RegistrationInfo) -> oj_rc_database::schema::
|
||||
Ok(password) => password.to_string(),
|
||||
}
|
||||
};
|
||||
let steam_id = if let Some(id) = info.steam_id {
|
||||
Some(id.to_string())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let steam_id = info.steam_id.map(|id| id.to_string());
|
||||
oj_rc_database::schema::user::ActiveModel {
|
||||
id: Default::default(),
|
||||
creation_time: oj_rc_database::sea_orm::ActiveValue::Set(current_unix_time()),
|
||||
|
||||
@@ -88,71 +88,71 @@ fn group_fire_scales_default() -> Vec<f32> {
|
||||
vec![1.0]
|
||||
}
|
||||
|
||||
impl std::convert::Into<crate::data::weapon_list::WeaponData> for WeaponData {
|
||||
fn into(self) -> crate::data::weapon_list::WeaponData {
|
||||
impl std::convert::From<WeaponData> for crate::data::weapon_list::WeaponData {
|
||||
fn from(val: WeaponData) -> Self {
|
||||
crate::data::weapon_list::WeaponData {
|
||||
damage_inflicted: self.damage_inflicted,
|
||||
protonium_damage_scale: self.protonium_damage_scale,
|
||||
projectile_speed: self.projectile_speed,
|
||||
projectile_range: self.projectile_range,
|
||||
base_inaccuracy: self.base_inaccuracy,
|
||||
base_air_inaccuracy: self.base_air_inaccuracy,
|
||||
movement_inaccuracy: self.movement_inaccuracy,
|
||||
movement_max_speed: self.movement_max_speed,
|
||||
movement_min_speed: self.movement_min_speed,
|
||||
gun_rotation_slow: self.gun_rotation_slow,
|
||||
movement_inaccuracy_decay: self.movement_inaccuracy_decay,
|
||||
slow_rotation_decay: self.slow_rotation_decay,
|
||||
quick_rotation_decay: self.quick_rotation_decay,
|
||||
movement_inaccuracy_recovery: self.movement_inaccuracy_recovery,
|
||||
repeat_fire_inaccuracy_total_degrees: self.repeat_fire_inaccuracy_total_degrees,
|
||||
repeat_fire_inaccuracy_decay: self.repeat_fire_inaccuracy_decay,
|
||||
repeat_fire_innaccuracy_recovery: self.repeat_fire_innaccuracy_recovery,
|
||||
fire_instant_accuracy_decay: self.fire_instant_accuracy_decay, // degrees
|
||||
accuracy_non_recover_time: self.accuracy_non_recover_time,
|
||||
accuracy_decay: self.accuracy_decay,
|
||||
damage_radius: self.damage_radius,
|
||||
plasma_time_to_full_damage: self.plasma_time_to_full_damage,
|
||||
plasma_starting_radius_scale: self.plasma_starting_radius_scale,
|
||||
nano_dps: self.nano_dps,
|
||||
nano_hps: self.nano_hps,
|
||||
tesla_damage: self.tesla_damage,
|
||||
tesla_charges: self.tesla_charges,
|
||||
aeroflak_proximity_damage: self.aeroflak_proximity_damage,
|
||||
aeroflak_damage_radius: self.aeroflak_damage_radius,
|
||||
aeroflak_explosion_radius: self.aeroflak_explosion_radius,
|
||||
aeroflak_ground_clearance: self.aeroflak_ground_clearance,
|
||||
aeroflak_max_stacks: self.aeroflak_max_stacks,
|
||||
aeroflak_damage_per_stack: self.aeroflak_damage_per_stack,
|
||||
aeroflak_stack_expire: self.aeroflak_stack_expire,
|
||||
shot_cooldown: self.shot_cooldown,
|
||||
smart_rotation_cooldown: self.smart_rotation_cooldown,
|
||||
smart_rotation_cooldown_extra: self.smart_rotation_cooldown_extra,
|
||||
smart_rotation_max_stacks: self.smart_rotation_max_stacks,
|
||||
spin_up_time: self.spin_up_time,
|
||||
spin_down_time: self.spin_down_time,
|
||||
spin_initial_cooldown: self.spin_initial_cooldown,
|
||||
group_fire_scales: self.group_fire_scales,
|
||||
mana_cost: self.mana_cost,
|
||||
lock_time: self.lock_time,
|
||||
full_lock_release: self.full_lock_release,
|
||||
change_lock_time: self.change_lock_time,
|
||||
max_rotation_speed: self.max_rotation_speed,
|
||||
initial_rotation_speed: self.initial_rotation_speed,
|
||||
rotation_acceleration: self.rotation_acceleration,
|
||||
nano_healing_priority_time: self.nano_healing_priority_time,
|
||||
module_range: self.module_range,
|
||||
shield_lifetime: self.shield_lifetime,
|
||||
teleport_time: self.teleport_time,
|
||||
camera_time: self.camera_time,
|
||||
camera_delay: self.camera_delay,
|
||||
to_invisible_speed: self.to_invisible_speed,
|
||||
to_invisible_duration: self.to_invisible_duration,
|
||||
to_visible_duration: self.to_visible_duration,
|
||||
countdown_time: self.countdown_time,
|
||||
stun_time: self.stun_time,
|
||||
stun_radius: self.stun_radius,
|
||||
effect_duration: self.effect_duration,
|
||||
damage_inflicted: val.damage_inflicted,
|
||||
protonium_damage_scale: val.protonium_damage_scale,
|
||||
projectile_speed: val.projectile_speed,
|
||||
projectile_range: val.projectile_range,
|
||||
base_inaccuracy: val.base_inaccuracy,
|
||||
base_air_inaccuracy: val.base_air_inaccuracy,
|
||||
movement_inaccuracy: val.movement_inaccuracy,
|
||||
movement_max_speed: val.movement_max_speed,
|
||||
movement_min_speed: val.movement_min_speed,
|
||||
gun_rotation_slow: val.gun_rotation_slow,
|
||||
movement_inaccuracy_decay: val.movement_inaccuracy_decay,
|
||||
slow_rotation_decay: val.slow_rotation_decay,
|
||||
quick_rotation_decay: val.quick_rotation_decay,
|
||||
movement_inaccuracy_recovery: val.movement_inaccuracy_recovery,
|
||||
repeat_fire_inaccuracy_total_degrees: val.repeat_fire_inaccuracy_total_degrees,
|
||||
repeat_fire_inaccuracy_decay: val.repeat_fire_inaccuracy_decay,
|
||||
repeat_fire_innaccuracy_recovery: val.repeat_fire_innaccuracy_recovery,
|
||||
fire_instant_accuracy_decay: val.fire_instant_accuracy_decay, // degrees
|
||||
accuracy_non_recover_time: val.accuracy_non_recover_time,
|
||||
accuracy_decay: val.accuracy_decay,
|
||||
damage_radius: val.damage_radius,
|
||||
plasma_time_to_full_damage: val.plasma_time_to_full_damage,
|
||||
plasma_starting_radius_scale: val.plasma_starting_radius_scale,
|
||||
nano_dps: val.nano_dps,
|
||||
nano_hps: val.nano_hps,
|
||||
tesla_damage: val.tesla_damage,
|
||||
tesla_charges: val.tesla_charges,
|
||||
aeroflak_proximity_damage: val.aeroflak_proximity_damage,
|
||||
aeroflak_damage_radius: val.aeroflak_damage_radius,
|
||||
aeroflak_explosion_radius: val.aeroflak_explosion_radius,
|
||||
aeroflak_ground_clearance: val.aeroflak_ground_clearance,
|
||||
aeroflak_max_stacks: val.aeroflak_max_stacks,
|
||||
aeroflak_damage_per_stack: val.aeroflak_damage_per_stack,
|
||||
aeroflak_stack_expire: val.aeroflak_stack_expire,
|
||||
shot_cooldown: val.shot_cooldown,
|
||||
smart_rotation_cooldown: val.smart_rotation_cooldown,
|
||||
smart_rotation_cooldown_extra: val.smart_rotation_cooldown_extra,
|
||||
smart_rotation_max_stacks: val.smart_rotation_max_stacks,
|
||||
spin_up_time: val.spin_up_time,
|
||||
spin_down_time: val.spin_down_time,
|
||||
spin_initial_cooldown: val.spin_initial_cooldown,
|
||||
group_fire_scales: val.group_fire_scales,
|
||||
mana_cost: val.mana_cost,
|
||||
lock_time: val.lock_time,
|
||||
full_lock_release: val.full_lock_release,
|
||||
change_lock_time: val.change_lock_time,
|
||||
max_rotation_speed: val.max_rotation_speed,
|
||||
initial_rotation_speed: val.initial_rotation_speed,
|
||||
rotation_acceleration: val.rotation_acceleration,
|
||||
nano_healing_priority_time: val.nano_healing_priority_time,
|
||||
module_range: val.module_range,
|
||||
shield_lifetime: val.shield_lifetime,
|
||||
teleport_time: val.teleport_time,
|
||||
camera_time: val.camera_time,
|
||||
camera_delay: val.camera_delay,
|
||||
to_invisible_speed: val.to_invisible_speed,
|
||||
to_invisible_duration: val.to_invisible_duration,
|
||||
to_visible_duration: val.to_visible_duration,
|
||||
countdown_time: val.countdown_time,
|
||||
stun_time: val.stun_time,
|
||||
stun_radius: val.stun_radius,
|
||||
effect_duration: val.effect_duration,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user