I'm working on something like the LogisticTrainNetwork mod. Like it I have train stops made up of multiple entities: train-stop, small-lamp, constant-combinator, arithmetic-combinator. The end result looks like this:
At the left the place compount entity is seen and at the right the cursor for placing a new one. As you can see the cursor only shows the master entity and the other elements are only added after placement.
I wonder if it wouldn't be better to include all the elements in main entities graphics and set the others to invisible. Doing that would involve a lot of work to re-create the graphics for the train stop. It's made out of multiple parts with blinking lights and such that require a lot of definitions for the prototype that would all have to be redone instead of depp-copying the train-stop.
Should graphics for a multi-part entity contain all parts?
Re: Should graphics for a multi-part entity contain all parts?
You really have 2 questions:
1. Should the cursor preview contain all parts graphics?
Answer: Yes!
2. Should a single built entity contain all parts graphics?
Answer: Probably not. Most entities have hardcoded graphics logic to make them look better, you will lose this by squeezing everything into a single entity.
Which leads to the third question...
3. How can I make the cursor preview look different from the final entity?
Answer: Make an entity whose only job is to look good in the cursor. Swap it out in on_built.
The data.lua looks like this:
1. Should the cursor preview contain all parts graphics?
Answer: Yes!
2. Should a single built entity contain all parts graphics?
Answer: Probably not. Most entities have hardcoded graphics logic to make them look better, you will lose this by squeezing everything into a single entity.
Which leads to the third question...
3. How can I make the cursor preview look different from the final entity?
Answer: Make an entity whose only job is to look good in the cursor. Swap it out in on_built.
The data.lua looks like this:
Code: Select all
cursor_entity.sprite.priority = "very-low" -- Don't waste VRAM on this
item.place_result = cursor_entity.name
real_entity.placeable_by = item.name
real_entity.minable.result = item.name
Re: Should graphics for a multi-part entity contain all parts?
I have to look at this again but it makes sense so far. The item graphics would have all entities simplified and merged while the item.place_result would retain the individual entities with all their special quirks. E.g. the item has no blinking lights.DaveMcW wrote: ↑Sat Sep 14, 2019 10:52 pmYou really have 2 questions:
1. Should the cursor preview contain all parts graphics?
Answer: Yes!
2. Should a single built entity contain all parts graphics?
Answer: Probably not. Most entities have hardcoded graphics logic to make them look better, you will lose this by squeezing everything into a single entity.
Which leads to the third question...
3. How can I make the cursor preview look different from the final entity?
Answer: Make an entity whose only job is to look good in the cursor. Swap it out in on_built.
The data.lua looks like this:Code: Select all
cursor_entity.sprite.priority = "very-low" -- Don't waste VRAM on this item.place_result = cursor_entity.name real_entity.placeable_by = item.name real_entity.minable.result = item.name
"Swap it out in on_built" is something else though and it is imho the worst. You loose wire connections that way, undo breaks, blueprinting has to edit the blueprint, blueprints can't be placed over existing entities, wires's can't be pasted in via blueprints.
Re: Should graphics for a multi-part entity contain all parts?
Thanks, I will test and forward that to the railloader mod. It has some ugly LUA code to work around these problems that would be far better ti avoid outright.
Re: Should graphics for a multi-part entity contain all parts?
Still not getting any of that to work. Lets start with blueprinting over placed entities to add wires:
I checked with detailed infos on and the placed entity is a railloader-chest and the ghost from the blueprint is a railloader-placement-proxy. But holding the blueprint over the entity just shows red and doesn't add wires when shift+clicking.
Code: Select all
{
type = "item",
name = "railloader",
place_result = "railloader-placement-proxy",
},
{
type = "pump",
name = "railloader-placement-proxy",
minable = { mining_time = 0.1, result = "railloader" },
flags = {"player-creation", "placeable-neutral"},
fast_replaceable_group = "railloader",
circuit_wire_connection_points = circuitconnectors["railloader-placement-proxy"].points,
circuit_connector_sprites = circuitconnectors["railloader-placement-proxy"].sprites,
circuit_wire_max_distance = default_circuit_wire_max_distance + 1.5,
},
{
type = "container",
name = "railloader-chest",
flags = {"player-creation"},
minable = {mining_time = 4, result = "railloader"},
placeable_by = {item = "railloader", count = 1},
fast_replaceable_group = "railloader",
circuit_wire_max_distance = default_circuit_wire_max_distance
},
Re: Should graphics for a multi-part entity contain all parts?
Your placeholder entity must be the same type as the wires you want to connect.