seeking advice about Collision Masks

Place to get help with not working mods / modding interface.
Post Reply
User avatar
adamwong246
Fast Inserter
Fast Inserter
Posts: 148
Joined: Tue Dec 01, 2020 5:01 am
Contact:

seeking advice about Collision Masks

Post by adamwong246 »

I've got a mod that alters recipes to produce useless byproducts. You can sequester the waste into polluting tiles called "garbagefill" (based on "landfill") and each garbagefill is made of 100 waste products. The whole point is that you must eventually cede real estate to sequester this waste.

I've been playing around with the collision mask and can't quite get the effect I'm looking for.
- The tiles need to be permanent, so you can't sequester your waste and then destroy the garbagefill by landfilling "over" it.
- You need to be able to put concrete over the landfill (to block the polluting effects) but removing the concrete re-exposes the garbagefill beneath.
- Every n ticks, the number of garbagefill on a chunk are used to generate pollution
- The landfill should be VERY flammable.

- I'm not sure what the correct Collision Mask ought to be
- I'm not sure which parts of this can be accomplished via the Collision Mask vs which parts needed to be handled with edge cases
- I'm not sure if it should be capable of garbagefill-ing water?

Thoughts
- I wish pollution_absorption_per_second supported a negative number, so I did not have to implement this myself.

User avatar
adamwong246
Fast Inserter
Fast Inserter
Posts: 148
Joined: Tue Dec 01, 2020 5:01 am
Contact:

Re: seeking advice about Collision Masks

Post by adamwong246 »

Code: Select all

-- I'm not sure what this ought to be
local collisionMask = {
-- "ground-tile",
-- "water-tile",
-- "resource-layer",
-- "doodad-layer",
-- "floor-layer",
-- "item-layer",
-- "object-layer"
}

local garbagefillItem =   {
    type = "item",
    name = "garbagefill",
    icon = "__base__/graphics/icons/landfill.png",
    icon_size = 64, icon_mipmaps = 4,
    subgroup = "terrain",
    order = "c[landfill]-a[dirt]",
    stack_size = 100,
    place_as_tile =
    {
      result = "garbagefill",
      condition_size = 1,
      condition = collisionMask
    },
    tint = {0.1, 0.1, 0.1, 0.1}
  }

local garbagefillRecipe = {
    type = "recipe",
    name = "garbagefill",
    energy_required = 0.5,
    enabled = true,
    category = "crafting",
    ingredients =
    {
      {"scrap", 1}
    },
    result= "garbagefill",
    result_count = 1
}

local garbagefillTile = table.deepcopy(data.raw["tile"]["landfill"])

garbagefillTile.name = "garbagefill"
garbagefillTile.tint = {0.1, 0.1, 0.1, 0.1}
-- garbagefillTile.pollution_absorption_per_second = -100
garbagefillTile.collision_mask = collisionMask
garbagefillTile.layer = 56

data:extend{
    garbagefillItem, garbagefillRecipe, garbagefillTile
}

Post Reply

Return to “Modding help”