Previously we couldn't tell if a restart was due to game win or fail. Statistics are now saved that include the start and end epoch, the game time in ticks (so we can gauge activity), how many biters, worms and nests were killed, how many enemy_entities remain (so we can tell if the map was cleared) and how many players participated in total.
- Use the player's force rather than the player force for determining whether the recipes are enabled.
- Call draw_loader_frame_for_player when player opens crafting gui instead of on_player_created.
- Check in the button events if the recipe is enabled.
- Draw the frames even if 'loader' recipe is not enabled to allow for the case that only 'fast-loader' or 'express-laoder' is enabled.
The strike count and cost described by the market was correct but the actual number of capsules sent and the number of capsules removed from the chest was wrong. Bug due to starting index, have now updated the maths to be correct.
Tested and the market description, number of shots fired and the number of capsules removed from the chest are now correct.
Rearranged the order of the code so that it's more performant and added comments to further explain the logic and reasons for the complications, ie. the cheesing with artillery.
Previously the airstrike was not reaching the corners of the map. There was a default max_range value of 1000 that limited how far the poison capsules could travel. Have set it to 1400 so that it can reach the corners of the map.
THIS NEEDS PLAY TESTING. Please don't merge until I've confirmed I've play tested it.
- Current behaviour is that when destroyers/defenders are created their target position is set to the entity that killed them.
- If a player picks up the artillery after the capsules spawn then they lose their cause.target and stop, not reaching the cause of the turret death.
- I've changed this behaviour so that if the target.cause is artillery then it spawns a defender/destroyer projectile NOT an entity. The projectile target can therefore be a position not an entity. So the capsules won't stop if the artillery is picked up.
- If the cause is not artillery turret or wagon then a destroyer/defender capsule entity is spawned instead of a projectile because a projectile cannot track the player.
- If the player picks up the artillery turret before the projectile that kills a turret arrives then the event cause.name will be missing and no bots spawn at all. I have changed the behaviour so that "if not cause" then we assume they're doing something fucky. We won't have the entity cause name or position, so let's just spawn double the normal amount of destroyers and just send them at 0, 0 since we know nothing else to do with them.