Skip to content

Fix issue #3: Worker costs too high (double-charging)#8

Merged
TheCodingDad-TisonK merged 2 commits intomainfrom
development
Feb 27, 2026
Merged

Fix issue #3: Worker costs too high (double-charging)#8
TheCodingDad-TisonK merged 2 commits intomainfrom
development

Conversation

@TheCodingDad-TisonK
Copy link
Owner

Summary

This PR fixes issue #3 where worker costs were much higher than expected due to double-charging.

Root Cause

The mod was charging workers in addition to the game's built-in worker payment system. This caused:

  • A fixed ~25€ fee (the game's default worker cost)
  • PLUS the expected wage from the mod setting

Solution

Hooks into mission:addMoney to intercept and skip the game's built-in worker payments when the mod is enabled. Uses a flag to allow the mod's own payments through while blocking the game's payments.

Changes

  • WorkerSystem.lua: Added installGameHook() function to intercept �ddMoney calls
  • chargeWage(): Added _isProcessingPayment flag to allow mod payments through
  • Version: Bumped to 1.0.0.8 across all files

Testing

Users should see worker costs matching their configured rate (e.g., /h) instead of the previous ~25€ + expected wage.

…uble-charging

Issue #3: Worker costs too high - fixed 25€ fee being charged

The mod was charging workers in addition to the game's built-in worker
payment system, causing a ~25€ fixed fee (the game's default) PLUS
the expected wage from the mod. This fix:

1. Hooks into mission:addMoney to intercept and skip the game's
   built-in worker payments when our mod is enabled
2. Uses a flag (_isProcessingPayment) to allow our mod's payments
   through while blocking the game's payments
3. Only affects negative money amounts (deductions) when mod is enabled

Also updated version to 1.0.0.8 across all files.
…s through

- Changed hook to return nil (no value) when skipping game's built-in payments
- This fixes the bug where money was not being charged at all
- The flag _isProcessingPayment now correctly allows our mod's payments through
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant