create_entity resource amount appears richer than default

Bugs that are actually features.
sparr
Smart Inserter
Smart Inserter
Posts: 1521
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

create_entity resource amount appears richer than default

Post 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
Rseding91
Factorio Staff
Factorio Staff
Posts: 15985
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: create_entity resource amount appears richer than default

Post 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.
If you want to get ahold of me I'm almost always on Discord.
sparr
Smart Inserter
Smart Inserter
Posts: 1521
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: create_entity resource amount appears richer than default

Post 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
Attachments
resource_clone_richness_bug.zip
(1.41 MiB) Downloaded 63 times
posila
Former Staff
Former Staff
Posts: 5448
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: create_entity resource amount appears richer than default

Post by posila »

Patches on left have 2 resource entities on top of each other.
sparr
Smart Inserter
Smart Inserter
Posts: 1521
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: create_entity resource amount appears richer than default

Post by sparr »

Thanks, that would do it!
Post Reply

Return to “Not a bug”