From 41d577a0fcafb9bc77216db4ec8181a10d35f891 Mon Sep 17 00:00:00 2001 From: LordMidas <55047920+LordMidas@users.noreply.github.com> Date: Mon, 15 Jul 2024 20:52:38 -0400 Subject: [PATCH] docs: add comments about deprecated first affordability preview system --- msu/hooks/skills/skill.nut | 8 +++++++- msu/hooks/skills/skill_container.nut | 1 + .../modules/turn_sequence_bar/turn_sequence_bar.nut | 2 +- msu/utils/skills.nut | 6 ++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/msu/hooks/skills/skill.nut b/msu/hooks/skills/skill.nut index 1a528d284..ab5cacf23 100644 --- a/msu/hooks/skills/skill.nut +++ b/msu/hooks/skills/skill.nut @@ -62,7 +62,7 @@ q.m.IsBaseValuesSaved <- false; q.m.ScheduledChanges <- []; - q.m.PreviewField <- {}; + q.m.PreviewField <- {}; // Deprecated - part of the first Affordability Preview system q.isType = @() function( _t, _any = true, _only = false ) { @@ -334,15 +334,18 @@ { } + // Deprecated - part of the first Affordability Preview system q.onAffordablePreview <- function( _skill, _movementTile ) { } + // Deprecated - part of the first Affordability Preview system q.modifyPreviewField <- function( _skill, _field, _newChange, _multiplicative ) { ::MSU.Skills.modifyPreview(this, _skill, _field, _newChange, _multiplicative); } + // Deprecated - part of the first Affordability Preview system q.modifyPreviewProperty <- function( _skill, _field, _newChange, _multiplicative ) { ::MSU.Skills.modifyPreview(this, null, _field, _newChange, _multiplicative); @@ -485,6 +488,8 @@ ::MSU.QueueBucket.VeryLate.push(function() { ::MSU.MH.hook("scripts/skills/skill", function(q) { + // Deprecated - part of the first Affordability Preview system + // i.e. the hooks in this foreach loop are for the deprecated feature foreach (func in ::MSU.Skills.PreviewApplicableFunctions) { q[func] = @(__original) function() @@ -587,6 +592,7 @@ }); ::MSU.QueueBucket.VeryLate.push(function() { + // Legacy support for the first Affordablity Preview system which has been deprecated ::MSU.MH.rawHookTree("scripts/skills/skill", function(p) { local obj = p; while (!("onAffordablePreview" in obj)) diff --git a/msu/hooks/skills/skill_container.nut b/msu/hooks/skills/skill_container.nut index 33d15b3d0..6f00fd36d 100644 --- a/msu/hooks/skills/skill_container.nut +++ b/msu/hooks/skills/skill_container.nut @@ -220,6 +220,7 @@ ]); } + // Deprecated - part of the first Affordability Preview system q.onAffordablePreview <- function( _skill, _movementTile ) { this.m.PreviewProperty.clear(); diff --git a/msu/hooks/ui/screens/tactical/modules/turn_sequence_bar/turn_sequence_bar.nut b/msu/hooks/ui/screens/tactical/modules/turn_sequence_bar/turn_sequence_bar.nut index 0227ab8c9..1018e8ea2 100644 --- a/msu/hooks/ui/screens/tactical/modules/turn_sequence_bar/turn_sequence_bar.nut +++ b/msu/hooks/ui/screens/tactical/modules/turn_sequence_bar/turn_sequence_bar.nut @@ -60,7 +60,7 @@ local previewAP = activeEntity.getPreviewActionPoints(); activeEntity.m.MSU_IsPreviewing = true; - activeEntity.getSkills().onAffordablePreview(skill, movement == null ? null : movement.End); + activeEntity.getSkills().onAffordablePreview(skill, movement == null ? null : movement.End); // Deprecated - part of the first Affordability Preview system activeEntity.m.MSU_PreviewSkill = skill; activeEntity.m.MSU_PreviewMovement = movement; activeEntity.getSkills().update(); // During this update actor.isPreviewing() is true diff --git a/msu/utils/skills.nut b/msu/utils/skills.nut index 21ab9422d..e5eabaaf4 100644 --- a/msu/utils/skills.nut +++ b/msu/utils/skills.nut @@ -1,9 +1,9 @@ ::MSU.Skills <- { - PreviewApplicableFunctions = [ + PreviewApplicableFunctions = [ // Deprecated - part of the first Affordability Preview system "getActionPointCost", "getFatigueCost" ], - QueuedPreviewChanges = {}, + QueuedPreviewChanges = {}, // Deprecated - part of the first Affordability Preview system SoftResetFields = [ "ActionPointCost", "FatigueCost", @@ -48,6 +48,7 @@ }); } + // Deprecated - part of the first Affordability Preview system function addPreviewApplicableFunction( _name ) { ::MSU.requireString(_name); @@ -66,6 +67,7 @@ } // Private + // Deprecated - part of the first Affordability Preview system function modifyPreview( _caller, _targetSkill, _field, _newChange, _multiplicative ) { if (!(_caller in this.QueuedPreviewChanges)) this.QueuedPreviewChanges[_caller] <- [];