Skip to content

Miscellaneous fixes for HEMTT warnings and related#144

Open
Tuupertunut wants to merge 30 commits into
rekterakathom:masterfrom
Tuupertunut:fix/variables
Open

Miscellaneous fixes for HEMTT warnings and related#144
Tuupertunut wants to merge 30 commits into
rekterakathom:masterfrom
Tuupertunut:fix/variables

Conversation

@Tuupertunut

@Tuupertunut Tuupertunut commented Jul 7, 2026

Copy link
Copy Markdown

As promised in #133, while refactoring I (and HEMTT) found many old bugs in the code. This PR fixes them and any related bugs that I found while investigating those. Many of these bugs were found by running hemtt check --pedantic and seeing it complaining about an "undefined variable" or "invalid parameter type", and when looking at the code I realized there was a bug. All relevant HEMTT warnings have now been fixed. The remaining ones seemed to me like intentional design choices or HEMTT was wrong about them.

Notable fixed bugs:

  • "Show known enemy groups on map" mission parameter did nothing.
  • Stamina became infinite after a few respawns.
  • Not all units were editable as Zeus.
  • Player general/rank icons were missing in resistance dialog.
  • NATO did not care about placing explosives, only arming them.
  • Notification "You have been seen placing an explosive" did not appear.
  • NATO behavior bugs (I did not confirm them all but that's how the code looked like):
    • NATO resources would always reset to 2000.
    • Abandoning towers and sending aircraft did not spend NATO resources.
    • Air patrols and FOB raids never happened.
    • Cleared NATO FOBs would always respawn.
    • Controlled population did not affect NATO objective defence or town counter-attack cost.
    • NATO could not send drones to FOBs.
    • In some cases NATO couldn't counter-attack objectives.
    • NATO deploying FOBs did not affect their spending calculations.
    • NATO could still take a turn after countering by abandoning towers or sending aircraft.
  • Failed gang missions did not decrease reputation with the gang.
  • Town name was missing in notification "NATO Informant in %1 has been taken care of".
  • Port "Export all" did not remove items in backpacks but still paid for them.
  • Business employee count did not drop when an employee died.
  • It was possible to press "Hire" employee button with no business selected.
  • Another "Place" or "Build" action could be started when a previous "Place" action was still in progress.
  • If a player was within spawn distance, a gang could not spawn its first members.
  • If a player was within spawn distance when a gang was formed, the gang leader would never despawn.
  • After doing a NATO search the searcher group started acting like a gendarme patrol.
  • Zeus "Set stability" and "Set money" dialogs did not have default values.
  • Zeus "Set stability" and "Change support" modules were deleting units if placed on top of them.
  • Zeus "Set stability" module worked only when Zeus was the server host.

Other changes:

  • Town change messages are now visible again. A text showing town info should appear within 3 seconds of arriving in a new town.
  • "Reset UI" actions were removed. They did nothing anyway but caused bugs.

More info in commit messages.

I will continue fixing more bugs that I can find. I suggest merging this when you can but if this is still unmerged when I'm complete with the next batch of bugfixes, I will add them here.

It has been broken since it was added because its name was missing the letter s.
Nothing was actually broken because the player command happens to return the same object that is in the _player variable, but it was clearly intended to use the _player variable here.
It was disabled for unknown reasons in commits 934c288 and bf88edf labeled as "fixes" but it seems to work just fine. I think it creates atmosphere for the mission.
They did basically nothing useful but were stacking new event loops on top of the existing ones so that the player could have multiple wanted loops, HUD update loops, notification loops etc.
The perk system loop that adjusts stamina based on player fitness was being created again every time the player respawned but never deleted. After a few respawns you could effectively have infinite stamina. There is no reason to bind perk and notification loops to a unit (who might die) as they are player features and not unit features, so they are separated from the player unit setup code. One loop per system is now created when the player joins the server and it keeps running over respawns.
- In some instances the command `addCuratorEditableObjects` was being called with the required parameter `addCrew` missing.
- In some instances a vehicle was added for zeus before creating its crew, causing the crew to not be added.
- In some instances only the crew of a vehicle was added for zeus but not the vehicle.
- In some instances spawned units were only added for zeus after a delay.
- In some instances spawned units were not added for zeus at all.

All temporary units for NATO, gangs, resistance and civilians are now added to zeus, including their vehicles. Player controlled characters, job characters such as faction traitors and special permanent characters such as shop employees and mayors were left out of zeus view. They can be added later if needed.
There was a semicolon missing. This bug has existed since the player list was first created.
`+` has higher precedence than `call`, so this was trying to add an array to a number. This code isn't actually used anywhere so this bug is not visible in the game.
In warehouse code it was added. In arsenal code it did nothing so it was removed.
That variable is never used for drugs so this bug was not visible in the game.
- The correct ace event handler to use is ace_explosives_setup. ace_explosives_place is only called when the explosive is armed.
- Units were not revealed to NATO/CRIM the same way as with other crimes.
- The notification was sent to _x which does not exist here.

The locality of the setCaptive and reveal commands is probably wrong like with many other crimes. This needs to be fixed separately.
Only refactoring, no functional changes.
This one was not in use. There is another in functions/player/fn_doConversation.sqf.
These pieces of code are not used so the errors are not visible in the game. Fixed just to silence HEMTT.
In commit b7f7ee9 fn_factionNATO was split into smaller functions, leaving behind a lot of NATO bugs related to undefined or read-only variables.

- NATO resources would always reset to 2000.
- Abandoning towers and sending aircraft did not spend NATO resources.
- Air patrols and FOB raids never happened.
- Cleared NATO FOBs would always respawn.
- Controlled population did not affect NATO objective defence or town counter-attack cost.
- NATO could not send drones to FOBs.
- In some cases NATO couldn't counter-attack objectives.
- NATO deploying FOBs did not affect their spending calculations.
- Nato could still take a turn after countering by abandoning towers or sending aircraft.
Only refactoring, no functional changes.
This code is not currently used so this change is not visible in game.
This was first incorrectly implemented in 7fdada6 (if statement left out of the loop) and later incorrectly fixed which made it worse in b665804 (the variable _done was also moved out of the loop).

I'm pretty sure the intention has always been to have them inside the loop. Translated to English the loop basically means "Update class loadouts with values loaded from the save, or if the class doesn't have a loadout yet, create a new one".

As far as I know, this change should not break anyone's save.
These changes should not affect gameplay.
While placing an object, it was possible to go to the menu and start placing another at the same time. This caused floating zero cost objects. The same could happen when already placing and starting building at the same time.
These minefields are modules and can't be created with BIS_fnc_objectMapper like the rest of the checkpoint. The module could be created with createUnit, but that still doesn't spawn a minefield. I tried manually placing minefields to the sides of a checkpoint but the checkpoint guards will just walk into their own mines all the time and die, so I just turned them off for now. If minefields are really wanted on checkpoints, they could be implemented in the future.
- If a player was within spawn distance, a gang could not spawn its first members (besides the leader) because the group was missing. It's a bad idea to create an empty group beforehand and flag it as "deleteWhenEmpty" and then wait for a long time before the first member is created. Of course the group has been garbage collected by then. Now it's created only when trying to spawn the first member.
- If a player was within spawn distance when a gang was formed, the gang leader would never despawn, because the gang leader group was not added to the spawner system.
Town, objective and business positions are already there.  This currently only has an effect on the buggy behavior of checkpoint guards after a search, where they start following gendarme behavior.
Previously all waypoints were removed and the searcher group started acting like a gendarme patrol, no matter which role they were in. Now the previous parameters and waypoints are restored after the search is over.
- Set stability module was throwing script errors for wrong parameter type.
- Set stability and set money dialogs did not have default values.
- Set stability and change support modules were deleting units if placed on top of them.
- Set stability module only set the stability variable locally, so the module worked only when the server was zeus.
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