Skip to content

Commit a309d67

Browse files
committed
refactor: deprecate the onAffordablePreview system
1 parent a680fdf commit a309d67

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

msu/hooks/skills/skill.nut

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
q.m.IsBaseValuesSaved <- false;
6161
q.m.ScheduledChanges <- []; // Deprecated
6262

63-
q.m.IsApplyingPreview <- false;
64-
q.m.PreviewField <- {};
63+
q.m.IsApplyingPreview <- false; // Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
64+
q.m.PreviewField <- {}; // Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
6565

6666
q.isType = @() function( _t, _any = true, _only = false )
6767
{
@@ -345,15 +345,18 @@
345345
this.onAfterUpdate(_properties);
346346
}
347347

348+
// Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
348349
q.onAffordablePreview <- function( _skill, _movementTile )
349350
{
350351
}
351352

353+
// Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
352354
q.modifyPreviewField <- function( _skill, _field, _newChange, _multiplicative )
353355
{
354356
::MSU.Skills.modifyPreview(this, _skill, _field, _newChange, _multiplicative);
355357
}
356358

359+
// Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
357360
q.modifyPreviewProperty <- function( _skill, _field, _newChange, _multiplicative )
358361
{
359362
::MSU.Skills.modifyPreview(this, null, _field, _newChange, _multiplicative);
@@ -496,6 +499,7 @@
496499

497500
::MSU.QueueBucket.VeryLate.push(function() {
498501
::MSU.MH.hook("scripts/skills/skill", function(q) {
502+
// Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
499503
foreach (func in ::MSU.Skills.PreviewApplicableFunctions)
500504
{
501505
q[func] = @(__original) function()
@@ -557,6 +561,7 @@
557561
}
558562
}
559563

564+
// Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
560565
q.isAffordablePreview = @(__original) function()
561566
{
562567
if (!this.getContainer().m.IsPreviewing) return __original();

msu/hooks/skills/skill_container.nut

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
::MSU.MH.hook("scripts/skills/skill_container", function(q) {
22
q.m.ScheduledChangesSkills <- []; // Deprecated
33
q.m.IsPreviewing <- false;
4-
q.m.PreviewProperty <- {};
4+
q.m.PreviewProperty <- {}; // Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
55

66
q.update = @(__original) function()
77
{
@@ -221,6 +221,7 @@
221221
]);
222222
}
223223

224+
// Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
224225
q.onAffordablePreview <- function( _skill, _movementTile )
225226
{
226227
this.m.PreviewProperty.clear();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
activeEntity.getSkills().m.IsPreviewing = true;
5353
this.m.MSU_PreviewSkill = skill;
5454
this.m.MSU_PreviewMovement = movement;
55-
activeEntity.getSkills().onAffordablePreview(skill, movement == null ? null : movement.End);
55+
activeEntity.getSkills().onAffordablePreview(skill, movement == null ? null : movement.End); // Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
5656
activeEntity.getSkills().updatePreview(skill, movement);
5757
}
5858
}
@@ -71,7 +71,7 @@
7171
local activeEntity = this.getActiveEntity();
7272
if (activeEntity != null)
7373
{
74-
activeEntity.getSkills().m.IsPreviewing = false;
74+
activeEntity.getSkills().m.IsPreviewing = false; // Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
7575
this.m.MSU_PreviewSkill = null;
7676
this.m.MSU_PreviewMovement = null;
7777
}

msu/utils/skills.nut

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
::MSU.Skills <- {
2-
PreviewApplicableFunctions = [
2+
PreviewApplicableFunctions = [ // Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
33
"getActionPointCost",
44
"getFatigueCost"
55
],
6-
QueuedPreviewChanges = {},
6+
QueuedPreviewChanges = {}, // Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
77
SoftResetFields = [
88
"ActionPointCost",
99
"FatigueCost",
@@ -48,6 +48,7 @@
4848
});
4949
}
5050

51+
// Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
5152
function addPreviewApplicableFunction( _name )
5253
{
5354
::MSU.requireString(_name);
@@ -65,6 +66,7 @@
6566
if (idx != null) this.SoftResetFields.remove(idx);
6667
}
6768

69+
// Deprecated - Only needed for the legacy onAffordablePreview system -- use the new onUpdatePreview and onAfterUpdatePreview system
6870
// Private
6971
function modifyPreview( _caller, _targetSkill, _field, _newChange, _multiplicative )
7072
{

0 commit comments

Comments
 (0)