Skip to content

Commit

Permalink
fix health bar desyncing, and boss respawning
Browse files Browse the repository at this point in the history
  • Loading branch information
bgkillas committed Feb 3, 2025
1 parent fc29543 commit 40c2859
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ewext/src/modules/entity_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,14 @@ impl Module for EntitySync {
}

if ctx.sync_rate == 1 || frame_num % ctx.sync_rate == 0 {
let (diff, dead) = self.local_diff_model.make_diff(ctx);
self.local_diff_model
.update_tracked_entities(ctx)
.wrap_err("Failed to update locally tracked entities")?;
if self.interest_tracker.got_any_new_interested() {
//game_print("Got new interested");
self.local_diff_model.reset_diff_encoding();
}
let (diff, dead) = self.local_diff_model.make_diff(ctx);
// FIXME (perf): allow a Destination that can send to several peers at once, to prevent cloning and stuff.
for peer in self.interest_tracker.iter_interested() {
send_remotedes(
Expand Down
17 changes: 17 additions & 0 deletions ewext/src/modules/entity_sync/diff_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,23 @@ impl RemoteDiffModel {
None,
None,
)?;
} else {
if current_hp < 0.0 {
damage.set_hp(f32::MIN_POSITIVE as f64)?;
}
noita_api::raw::entity_inflict_damage(
entity.raw() as i32,
(current_hp - entity_info.hp) as f64,
"DAMAGE_HEALING".into(), //TODO should be enum
"hp sync".into(),
"NONE".into(),
0.0,
0.0,
None,
None,
None,
None,
)?;
}
}

Expand Down

0 comments on commit 40c2859

Please sign in to comment.