Skip to content

Commit

Permalink
fix: also add attribute for dronebay usage (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueBrain authored May 5, 2024
1 parent 44cc5e5 commit af58e2f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/calculate/pass_4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub enum AttributeId {
droneBandwidthUsedTotal = -32,
droneDamageAlphaHp = -33,
droneDamageDps = -34,
droneCapacityUsed = -35,

mass = 4,
capacitorNeed = 6,
Expand Down Expand Up @@ -147,6 +148,7 @@ impl Pass for PassFour {
damage::attribute_damage_with_reload(ship);

drone::attribute_drone_active(ship);
drone::attribute_drone_capacity_used(ship);
drone::attribute_drone_bandwidth_used(ship);
drone::attribute_drone_damage(ship);
}
Expand Down
21 changes: 21 additions & 0 deletions src/calculate/pass_4/drone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,27 @@ pub fn attribute_drone_active(ship: &mut Ship) {
.add_attribute(AttributeId::droneActive, 0.0, active as f64);
}

pub fn attribute_drone_capacity_used(ship: &mut Ship) {
/* The capacity of the dronebay used by drones. */

let attr_drone_capacity = AttributeId::volume as i32;

let mut capacity_used = 0.0;
for item in &ship.items {
if item.flag == 87 {
capacity_used += item
.attributes
.get(&attr_drone_capacity)
.unwrap()
.value
.unwrap();
}
}

ship.hull
.add_attribute(AttributeId::droneCapacityUsed, 0.0, capacity_used);
}

pub fn attribute_drone_bandwidth_used(ship: &mut Ship) {
/* The bandwidth used by drones. */

Expand Down

0 comments on commit af58e2f

Please sign in to comment.