Schall Tank Woodcutting (Autodrive fix)

by Pi-C

Harvest wood on the way of vehicles driving over trees, or stone and coal when driving over rocks. Harvested items will be loaded directly into the trunk of Autodrive-controlled vehicles if the items can be used by the vehicle or equipment in its grid..

Utilities
a month ago
1.1
24
Transportation Mining

Changelog

Version: 1.1.2
Date: 2024.09.29

  Uploaded by:
    - Pi-C


  Info:
    - The original mod by Schallfalke would cause problems for Autodrive if it was loaded first (Autodrive loads first according to natural loading order, but dependencies of third mods could change that). As Schallfalke has been away for almost a year now, I've decided to fork his mod to fix that and make some more adjustments for Autodrive. I'll deprecate this fork if Schallfalke returns and incorporates my changes into his mod.


  Changes:
    - Added optional dependency on Autodrive, and a conflict with the original mod.

    - Improvement to handling on_runtime_mod_setting_changed: If several settings have been changed simultaneously, the game will know the new values of *all* changed settings when the first event is raised. We therefore handle all settings at once (which may involve remote calls to Autodrive) and ignore all other events raised on that tick.

    - In on_init and on_configuration_changed, we now compile a look-up list of all simple-entity prototypes that have the count_as_rock_for_filtered_deconstruction property and mineable_properties.products instead of looking for a string in the prototype name.

    - Event on_entity_damaged will now be pre-filtered for impact damage dealt to rocks with mineable products and/or trees.

    - If none of the options for woodcutting and rockcrushing is enabled, we will stop listening to the on_entity_damaged event.

    - Added some remote functions (on both ends) for communicating with Autodrive.

    - If a tree or rock has been damaged by a vehicle that is controlled by Autodrive and has an ammo/fuel/repair sensor, we will insert harvested items that can be used by the vehicle or equipment directly into the trunk, spilling only the remaining items. Autodrive will limit the number of harvested items in the trunk:
      - First-choice items: item stack size * alert threshold
      - Alternative preferred items and non-preferred usable items: item stack size * 2


  Bugfixes:
    - Should fix crash on spilling items. (https://mods.factorio.com/mod/SchallTankWoodcutting/discussion/61a3c71db1f0e8301d188014, https://mods.factorio.com/mod/SchallTankWoodcutting/discussion/633400642118e02c4e8372c0)

    - Some things that depend on map settings were stored in a local table that was rebuilt as needed – which may cause desyncs. Fixed that by moving these data to the global table.

    - The old mod created a LuaRandomGenerator but never used it. We now use the new generator instead of math.random().
Version: 1.1.1
Date: 2021.07.22

  Uploaded by:
    - Schallfalke

  Changes:
    - Now drops randomized amount, if trees/rocks drops are defined as probabilistic in prototypes.  (was using average.)
    - Renamed settings for better mod consistency.
  Bugfixes:
    - Corrected calculation in output amount from probabilistic products.
Version: 1.0.1
Date: 2021.07.22

  Uploaded by:
    - Schallfalke

  Changes:
    - Now drops randomized amount, if trees/rocks drops are defined as probabilistic in prototypes.  (was using average.)
    - Renamed settings for better mod consistency.
  Bugfixes:
    - Corrected calculation in output amount from probabilistic products.
Version: 0.18.4
Date: 2021.07.22

  Uploaded by:
    - Schallfalke

  Changes:
    - Now drops randomized amount, if trees/rocks drops are defined as probabilistic in prototypes.  (was using average.)
    - Renamed settings for better mod consistency.
  Bugfixes:
    - Corrected calculation in output amount from probabilistic products.
Version: 0.17.4
Date: 2021.07.22

  Uploaded by:
    - Schallfalke

  Changes:
    - Now drops randomized amount, if trees/rocks drops are defined as probabilistic in prototypes.  (was using average.)
    - Renamed settings for better mod consistency.
  Bugfixes:
    - Corrected calculation in output amount from probabilistic products.
Version: 1.1.0
Date: 2020.12.07

  Uploaded by:
    - Schallfalke

  Features:
    - Updated to 1.1.
Version: 1.0.0
Date: 2020.11.20

  Uploaded by:
    - Schallfalke

  Features:
    - Updated to 1.0.
Version: 0.18.3
Date: 2020.11.20

  Uploaded by:
    - Schallfalke

  Optimisations:
    - Code refactoring.
Version: 0.17.3
Date: 2020.11.20

  Uploaded by:
    - Schallfalke

  Optimisations:
    - Code refactoring.
Version: 0.18.2
Date: 2020.07.03

  Uploaded by:
    - Schallfalke

  Changes:
    - Options on enable woodcutting.  (Default: On.)
    - Options on enable rockcrushing.  (Default: Off.)
Version: 0.17.2
Date: 2020.07.03

  Uploaded by:
    - Schallfalke

  Changes:
    - Options on enable woodcutting.  (Default: On.)
    - Options on enable rockcrushing.  (Default: Off.)
Version: 0.18.1
Date: 2020.06.06

  Uploaded by:
    - Schallfalke

  Changes:
    - Now drops wood even if trees have multiple products.
  Bugfixes:
    - Fixed crash on attempting to cut trees that give no products.
Version: 0.17.1
Date: 2020.06.06

  Uploaded by:
    - Schallfalke

  Changes:
    - Now drops wood even if trees have multiple products.
  Bugfixes:
    - Fixed crash on attempting to cut trees that give no products.
  Locale:
    - All locale are moved to separate mod "Schall Language Pack".
Version: 0.18.0
Date: 2020.02.04

  Uploaded by:
    - Schallfalke

  Features:
    - Updated to 0.18.
Version: 0.17.0
Date: 2019.03.01

  Uploaded by:
    - Schallfalke

  Features:
    - Updated to 0.17.
    - Added flying text on woodcutting information.
  Locale:
    - Simplified Chinese is available.
Version: 0.16.0
Date: 2018.11.29

  Uploaded by:
    - Schallfalke

  Features:
    - Introduced trees cutting when rolled over by vehicles, harvesting wood.
  Locale:
    - English, German, traditional Chinese are available.
  License:
    - Using Bob's Copyright License.  Document included.