Skip to content

Commit c84b413

Browse files
committed
refactor: add skill and movement directly to ActiveEntityCostsPreview
1 parent 7fd3dcf commit c84b413

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

msu/hooks/skills/skill.nut

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@
579579
local preview = ::Tactical.TurnSequenceBar.m.ActiveEntityCostsPreview;
580580
if (preview != null && preview.id == this.getContainer().getActor().getID())
581581
{
582-
this.getContainer().updatePreview(::Tactical.TurnSequenceBar.m.MSU_PreviewSkill, ::Tactical.TurnSequenceBar.m.MSU_PreviewMovement);
582+
this.getContainer().updatePreview(preview.MSU_PreviewSkill, preview.MSU_PreviewMovement);
583583
this.m.IsApplyingPreview = true;
584584
local ret = __original();
585585
this.m.IsApplyingPreview = false;

msu/hooks/ui/screens/tactical/modules/turn_sequence_bar/turn_sequence_bar.nut

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
::MSU.MH.hook("scripts/ui/screens/tactical/modules/turn_sequence_bar/turn_sequence_bar", function(q) {
2-
q.m.MSU_PreviewSkill <- null;
3-
q.m.MSU_PreviewMovement <- null;
4-
52
q.create = @(__original) function()
63
{
74
__original();
@@ -51,8 +48,6 @@
5148
skill = activeEntity.getSkills().getSkillByID(skillID);
5249

5350
activeEntity.getSkills().m.IsPreviewing = true;
54-
this.m.MSU_PreviewSkill = skill;
55-
this.m.MSU_PreviewMovement = movement;
5651
activeEntity.getSkills().onAffordablePreview(skill, movement == null ? null : movement.End); // Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
5752
activeEntity.getSkills().updatePreview(skill, movement);
5853

@@ -62,19 +57,17 @@
6257
this.m.JSHandle = this.m.MSU_JSHandle.__JSHandle;
6358
this.m.JSHandle.asyncCall("updateCostsPreview", this.m.ActiveEntityCostsPreview);
6459

60+
this.m.ActiveEntityCostsPreview.MSU_PreviewSkill <- skill;
61+
this.m.ActiveEntityCostsPreview.MSU_PreviewMovement <- movement;
62+
6563
activeEntity.getSkills().update();
6664
return ret;
6765
}
6866

6967
q.resetActiveEntityCostsPreview = @(__original) function()
7068
{
7169
local activeEntity = this.getActiveEntity();
72-
if (activeEntity != null)
73-
{
74-
activeEntity.getSkills().m.IsPreviewing = false;
75-
this.m.MSU_PreviewSkill = null;
76-
this.m.MSU_PreviewMovement = null;
77-
}
70+
if (activeEntity != null) activeEntity.getSkills().m.IsPreviewing = false;
7871
__original();
7972
}
8073
});

0 commit comments

Comments
 (0)