Hi! Just downloaded your mod for checking compatibility with Autodrive. Some things I've noticed:
-
You've used the text "See setting name 8P." for the strings prefixed with "mauler-" in your mod-setting-description section. At first I thought "8P" was some placeholder you've forgotten to remove, then I understood that it is supposed to be a smiley (that would have been more obvious if the smiley was placed after the period). If my assumption is correct, why add a description for these settings at all?
-
Did you really mean to prefix setting names and descriptions with a space? In locale files, everything before '=' is part of the string name, and everything after it is part of the localized text -- this includes white space before/after the '='.
-
In data-final-fixes.lua, you set equipment_categories
to a fixed list if Krastorio2 is active. Please keep in mind that there are other mods that may add equipment categories to grids (e.g., Autodrive will make sure that its equipment can be placed in existing grids). While I could easily work around this by adding an optional dependency on your mod and add my equipment category after your mod is done, it would be better for overall compatibility if you'd just add categories to the existing table instead of overwriting it.
-
In control.lua, you check for whodunit.name == "player"
. This will probably be OK most of the time, but you have no guarantee that there really are players on force "player" (think of multiplayer games with players on competing forces, mods that move each player to a separate force, etc.). Why don't you make this a bit more general and check whether whodunit really is a force with players? Something like this may work:
local whodunit = event.force -- event.force is optional, so it may be nil!
local isplayerforce = whodunit and whodunit.valid and next(whodunit.players) and true
[…]
-- As all inner tests check for damage_type and the force, it's more efficient to move those checks up
if isplayerforce and entity and entity.valid and damage_type.name == "impact" then
if entity.type == "unit-spawner" then
[…]
elseif treeon and entity.type == "tree" then
[…]
end
end
-
You check for just the vanilla units, but mods may add variations of the default biters/spitters. I guess it would be inconvenient to check all unit names for substrings "biter" or "spitter", but there is another way to distinguish between them:
-- Biter:
if biteron and entity.type == "unit" and entity.prototype.attack_parameters.type == "projectile" then
[…]
-- Spitter:
elseif spitteron and entity.type == "unit" and entity.prototype.attack_parameters.type == "stream" then
[…]
end
By the way, my mod acts similar to yours: If a vehicle that's controlled by my mod collides with a tree, it may get healed completely (depends on setting). If it collides with trees, spawners, worms, or units and destroys them, it will accelerate for a short time -- or bounce off if the damaged entity survived. If it collides with an entity of the same force, it will restore full health to the damaged entity. I'll have to check if this will pose problems later (my WIP version is broken because I'm restructuring some tables again).