Skip to content

Commit

Permalink
docs: add comments about deprecated first affordability preview system
Browse files Browse the repository at this point in the history
  • Loading branch information
LordMidas committed Jul 16, 2024
1 parent f91cf22 commit 41d577a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
8 changes: 7 additions & 1 deletion msu/hooks/skills/skill.nut
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions msu/hooks/skills/skill_container.nut
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
]);
}

// Deprecated - part of the first Affordability Preview system
q.onAffordablePreview <- function( _skill, _movementTile )
{
this.m.PreviewProperty.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions msu/utils/skills.nut
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -48,6 +48,7 @@
});
}

// Deprecated - part of the first Affordability Preview system
function addPreviewApplicableFunction( _name )
{
::MSU.requireString(_name);
Expand All @@ -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] <- [];
Expand Down

0 comments on commit 41d577a

Please sign in to comment.