Page 1 of 1

Allowing only biters to walk on water

Posted: Mon Sep 26, 2022 9:01 pm
by hyspeed
Hi,

I want to update my mod (https://mods.factorio.com/mod/CitiesOfEarth3) to allow biters & spitters to walk on water (not deep water).
I've reviewed a couple of mods that do similar (https://mods.factorio.com/mod/walkable-water) & (https://mods.factorio.com/mod/Noxys_Swimming).

I extracted this code from them and it works. But I don't want to give the player the ability, just the enemy (biter) forces.
data-updates.lua

Code: Select all

require("collision_mask")

if settings.global.coe_biters_walk_on_water.value then
  local waters = {"water", "water-green"}
  for _,water in pairs(waters) do
    -- Collision mask
    local mask = data.raw.tile[water].collision_mask
    for i=#mask,1,-1 do
      if mask[i] == "player-layer" then
        table.remove(mask, i)
      end
    end
  end
end
Is there something simple I can do here that would apply only to biters?

thanks