Task.work() should take effort as a float, not ticks as an int #110
Labels
No labels
assets
bug
duplicate
enhancement
help wanted
invalid
question
testing
ui
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
liamjd/UntitledColonyBuilder#110
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of milestone #5. Should land before #75, which will otherwise be built on the current signature.
Task.work(ctx: TaskContext, ticks: int)cannot express a pawn contributing anything other than exactly one unit of effort per tick.Task.work_remainingis already afloat, andPawnalready stubsPawnLevel {NEWBIE, SKILLED, EXPERT, LEADER}. A SKILLED builder pushing 1.5 units per tick has nowhere to go through anintparameter, so the float on one side and the int on the other will start disagreeing the moment specialisation is real (#69, #74).Two ways to fix it:
work(ctx, effort: float)— the caller (the #75 work loop) computes1.0 * pawn.level_multiplierand hands over the result. The task stays ignorant of how pawn skill works.ticks: intand have the task look the pawn up throughctx— requires addingpawnstoTaskContext, and puts skill rules inside every task type that ever counts effort.Prefer (1): it matches why
work_remainingis a float, keepsTaskContextsmall, and keeps the skill rules in one place rather than one per task subclass.Note the unit does not change — effort is still denominated in pawn-ticks, per #88. What changes is that a tick of a pawn's time is no longer required to be worth exactly one of them.
AC:
Task.work()and every override takeeffort: floatrather thanticks: intConstructionTask.work()subtracts the effort given, still clamped at zeroStubTaskand the existing task tests updated