Skip to content

Commit

Permalink
rm PlayerCB::ready
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamby777 committed Aug 19, 2024
1 parent 0cd7422 commit a06753c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
3 changes: 3 additions & 0 deletions pets-gd/quests/intro1.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ func room_id():
return $"../../YSort/Room".room_id

func _ready():
for pchar in ["Ethan", "Siva", "Terra", "Mira"]:
pcb().push_pchar_gd(pchar)

pcb().move_to_relative(0.0, -200.0)
await pcb().motion_done

Expand Down
16 changes: 4 additions & 12 deletions pets-lib/src/world/playercb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ pub struct PlayerCB {
base: Base<CharacterBody2D>,

/// Each party member's scene node
party: Vec<Gd<PCharNode>>,
#[var]
party: Array<Gd<PCharNode>>,

#[init(val = LimiQ::new(2000))]
past_positions: LimiQ<Vector2>,
Expand Down Expand Up @@ -76,7 +77,7 @@ impl PlayerCB {
}

pub fn party_pchars(&self) -> Vec<PChar> {
self.party.iter().map(|v| v.bind().pchar).collect()
self.party.iter_shared().map(|v| v.bind().pchar).collect()
}

pub fn party_chardata(&self) -> Vec<Rc<RefCell<CharData>>> {
Expand Down Expand Up @@ -124,7 +125,7 @@ impl PlayerCB {
return;
}

for (i, ch) in self.party.iter_mut().enumerate() {
for (i, mut ch) in self.party.iter_shared().enumerate() {
// index of past data limqs
let nth = i * PERSONAL_SPACE;
ch.set_global_position(*self.past_positions.get_or_last(nth));
Expand Down Expand Up @@ -241,15 +242,6 @@ impl PlayerCB {

#[godot_api]
impl ICharacterBody2D for PlayerCB {
fn ready(&mut self) {
self.party = vec![
self.push_pchar(PChar::Ethan),
self.push_pchar(PChar::Siva),
self.push_pchar(PChar::Terra),
self.push_pchar(PChar::Mira),
];
}

fn physics_process(&mut self, delta: f64) {
let mut moving = false;

Expand Down

0 comments on commit a06753c

Please sign in to comment.