Skip to content

Commit bd640c2

Browse files
committed
move battling from pcb to si
1 parent 68b3299 commit bd640c2

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

pets-lib/src/battle/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ impl BattleEngine {
340340

341341
"Run" => {
342342
// TODO: implement running mechanic described earlier
343-
pcb().bind_mut().battling.clear();
343+
si().bind_mut().battling.clear();
344344

345345
// TODO: don't change scenes, just remove the battle
346346
// stuff since it's all overlayed on top of the world

pets-lib/src/stats/autoload.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ use crate::common::*;
1414
#[class(base=Object)]
1515
pub struct StatsInterface {
1616
base: Base<Object>,
17-
1817
pub save: SaveFile,
18+
19+
/// The enemies that are currently in battle with you
20+
pub battling: Vec<EnemyData>,
1921
}
2022

2123
#[godot_api]
@@ -65,6 +67,10 @@ impl IObject for StatsInterface {
6567
// randomize seed for godot
6668
randomize();
6769

68-
Self { base, save }
70+
Self {
71+
base,
72+
save,
73+
battling: vec![],
74+
}
6975
}
7076
}

pets-lib/src/world/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,7 @@ impl World {
134134
let enemy_data = EnemyData::from_registry(eid.clone());
135135

136136
// TODO: THIS BELONGS IN STATSINTERFACE!!!!!!!! WTF
137-
pcb()
138-
.bind_mut()
139-
.battling
140-
.push(Rc::new(RefCell::new(enemy_data.clone())));
137+
si().bind_mut().battling.push(enemy_data.clone());
141138
let world = World::singleton();
142139

143140
let mat = PartyCB::fx_material();

pets-lib/src/world/partycb.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ pub struct PartyCB {
7979
#[init(val = LimiQ::new(2000))]
8080
past_rotations: LimiQ<Vector2>,
8181

82-
/// The enemies that are currently in battle with you
83-
pub battling: Vec<Rc<RefCell<EnemyData>>>,
84-
8582
pub tpbeacon_debounce: bool,
8683
pub in_water: bool,
8784

@@ -148,7 +145,7 @@ impl PartyCB {
148145
}
149146

150147
pub fn is_in_battle(&self) -> bool {
151-
!self.battling.is_empty()
148+
!si().bind().battling.is_empty()
152149
}
153150

154151
/// Set character positions based on past pos/rot

0 commit comments

Comments
 (0)