Page 1 of 1

[bug?] water_reflection doesn't show on resources

Posted: Tue Nov 23, 2021 1:07 pm
by snouz
In the base game, no resource uses water_reflection, but modded ones could (specifically, offshore oil in Cargo Ships)

I can confirm the property is filled, but doesn't apply to the surface.

Image
Image

my code just in case:

Code: Select all

local deep_oil = table.deepcopy(data.raw["resource"]["crude-oil"])
deep_oil.name = "deep_oil"
deep_oil.infinite_depletion_amount = 40
deep_oil.autoplace = nil
deep_oil.collision_mask = {'object-layer'}
deep_oil.stages = {
  sheet = {
    filename = "__cargo-ships__/graphics/entity/crude-oil/water-crude-oil.png",
    priority = "extra-high",
    width = 74,
    height = 60,
    frame_count = 4,
    variation_count = 1,
    shift = util.by_pixel(0, -2),
    hr_version =
    {
      filename = "__cargo-ships__/graphics/entity/crude-oil/hr-water-crude-oil.png",
      priority = "extra-high",
      width = 148,
      height = 120,
      frame_count = 4,
      variation_count = 1,
      shift = util.by_pixel(0, -2),
      scale = 0.5
    }
  }
}
deep_oil.water_reflection = {
  pictures = {
    sheet = {
      filename = "__cargo-ships__/graphics/entity/crude-oil/hr-water-crude-oil-water-reflection.png",
      width = 22,
      height = 24,
      --shift = util.by_pixel(0, 5),
      variation_count = 1,
      repeat_count = 4,
      scale = 5,

    }
  },
  rotate = false,
  orientation_to_variation = false
}

data:extend({deep_oil})
I tried changing the collision_mask to {'object-layer'}, tried having variation count = 4, repeat count = 4, searching for all of them on the map...

Resource has the property listed in the wiki
https://wiki.factorio.com/Prototype/ResourceEntity

Re: [bug?] water_reflection doesn't show on resources

Posted: Tue Nov 23, 2021 1:18 pm
by posila
water_reflection currently renders only for entities with health (because those have bitmask with some unsed bits which I used to cache a flag marking if reflection is defined or not, as I believe it would add too much performance penalty to query a prototype for this information ... but I am probably wrong, because there are not that many entities without reflection on the screen anymore)

Re: [bug?] water_reflection doesn't show on resources

Posted: Tue Nov 23, 2021 2:30 pm
by snouz
posila wrote: Tue Nov 23, 2021 1:18 pm water_reflection currently renders only for entities with health (because those have bitmask with some unsed bits which I used to cache a flag marking if reflection is defined or not, as I believe it would add too much performance penalty to query a prototype for this information ... but I am probably wrong, because there are not that many entities without reflection on the screen anymore)
Thanks for the response !

I was suspecting something like economy of resources (no pun intended). If this is permanent, I would suggest moving the property to entityWithHealth, but in the meantime, I added a line about it on it on the wiki. https://wiki.factorio.com/Types/WaterRe ... Definition