Sid Meier's Civilization VI

Sid Meier's Civilization VI

Harvest All Resources
Venatorae  [developer] Jun 3 @ 7:59pm
Unitpanel.lua
elseif (actionHash == UnitOperationTypes.HARVEST_RESOURCE) then
local bCanStart:boolean, tResults:table = UnitManager.CanStartOperation(pUnit, actionHash, nil, false, OperationResultsTypes.NO_TARGETS);
if (bCanStart) then
-- Check again if the operation can occur, this time for real.
-- bCanStart, tResults = UnitManager.CanStartOperation(pUnit, actionHash, nil, false, OperationResultsTypes.NO_TARGETS); -- Hint that we don't require possibly expensive target results.
local bDisabled:boolean = not bCanStart;
local toolTipString:string = GetUnitOperationTooltip(operationRow);

if (tResults ~= nil) then
if (tResults[UnitOperationResults.ACTION_NAME] ~= nil and tResults[UnitOperationResults.ACTION_NAME] ~= "") then
toolTipString = Locale.Lookup(tResults[UnitOperationResults.ACTION_NAME]);
end

if (tResults[UnitOperationResults.FEATURE_TYPE] ~= nil) then
local featureName = GameInfo.Features[tResults[UnitOperationResults.FEATURE_TYPE]].Name;
toolTipString = toolTipString .. ": " .. Locale.Lookup(featureName);
end

if (tResults[UnitOperationResults.ADDITIONAL_DESCRIPTION] ~= nil) then
for i,v in ipairs(tResults[UnitOperationResults.ADDITIONAL_DESCRIPTION]) do
toolTipString = toolTipString .. "[NEWLINE]" .. Locale.Lookup(v);
end
end
end
isDisabled = bDisabled or isDisabled;

if(not IsActionLimited(operationRow.PrimaryKey, pUnit))then
local overrideIcon:string = nil;

isDisabled, toolTipString, overrideIcon = LateCheckOperationBeforeAdd( tResults, actionsTable, actionHash, isDisabled, toolTipString, overrideIcon );
AddActionToTable( actionsTable, operationRow, isDisabled, toolTipString, actionHash, OnUnitActionClicked, UnitOperationTypes.TYPE, actionHash, overrideIcon );
end
end