Page 1 of 1

create_entity resource amount appears richer than default

Posted: Fri May 12, 2017 8:25 pm
by sparr
I am cloning entities with the code at the bottom of this post. In-game I see that the "amount" of the cloned resource entities are the same, but the visual representation of the resource on the ground appears richer in the clone. In the screenshot, clone is left, original is right.

https://i.imgur.com/o3aM936.png

Code: Select all

  local master_entities = surface.find_entities({master_pos, {master_pos.x+32, master_pos.y+32}})
  for _, entity in ipairs(master_entities) do
    if entity.type ~= "character" and entity.type ~= "player" then
      local amount = entity.type == "resource" and entity.amount or nil
      surface.create_entity{
        name= entity.name,
        position= {
          x= (entity.position.x - master_pos.x) * slave_dx + slave_pos.x,
          y= (entity.position.y - master_pos.y) * slave_dy + slave_pos.y
        },
        direction= entity.direction,
        force= entity.force,
        -- TODO: more thorough cloning
        -- type-specific parameters
        amount= amount,
      }
    end
  end

Re: create_entity resource amount appears richer than default

Posted: Fri May 12, 2017 8:29 pm
by Rseding91
There are several images for the same richness for each resource so you don't always get the same visuals across all ore patches.

That's by design.

Re: create_entity resource amount appears richer than default

Posted: Fri May 12, 2017 8:33 pm
by sparr
Rseding91 wrote:There are several images for the same richness for each resource so you don't always get the same visuals across all ore patches.

That's by design.
This isn't random. The copies always appear richer.

wider screenshot: https://i.imgur.com/JqikzhD.png

every left side cloned resource patch appears richer than its right side counterpart.

also attaching a save

Re: create_entity resource amount appears richer than default

Posted: Fri May 12, 2017 10:05 pm
by posila
Patches on left have 2 resource entities on top of each other.

Re: create_entity resource amount appears richer than default

Posted: Fri May 12, 2017 10:09 pm
by sparr
Thanks, that would do it!