Vetoing the pipette tool

Place to get help with not working mods / modding interface.
Post Reply
User avatar
hgschmie
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Feb 06, 2024 5:18 am
Contact:

Vetoing the pipette tool

Post by hgschmie »

(long time reader, first time caller)

I am putting together a mod that uses an entity that is composed of a "base" entity and a number of "child" entities that are created and manipulated when the base entity changes. Took a bit but at this point, things work (blueprinting, shift-pasting, copy-paste etc.). Except the pipette. I can hover over one of the secondary entities and press "Q" and the pipette picks those up (and now I hold an item for this entity, something that should not be possible).

Is there a way for me to mark these entities as "can not be picked up by pipette". I still need them to be user selectable (they connect to wires). I was looking int placeable_by to just return the item of my primary entity but now a robot can construct those secondary entities out of the items for the primary which is not what I want.

I looked at some other mods that do similar things (compakt-circuits) and they have the same problem (I can pick up an IO connector with the pipette tool).

Ideally I can either add something to the entity/item that says "don't allow pickup by the pipette tool" or, when I receive the on_player_pipette event, I veto the actual execution of the pipette action.

Or is the answer just "you found a limitation of the engine, just don't do that :-)"

Grateful for any tips/help.

Xorimuth
Filter Inserter
Filter Inserter
Posts: 628
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: Vetoing the pipette tool

Post by Xorimuth »

Why do your secondary entities have associated items at all? Surely you should just be creating the entity and not the item?
My mods
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

robot256
Filter Inserter
Filter Inserter
Posts: 602
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Vetoing the pipette tool

Post by robot256 »

There are a bunch of ways to preempt or diasble pipetting, both via prototype flags and via scripts.

Look at some of my mods for ways to do it! They also handle blueprintable/not blueprintable items.

https://mods.factorio.com/mod/MultipleUnitTrainControl (change MU setting to "Basic", put two locos back to back and then pipette one of them)

https://mods.factorio.com/mod/cargo-ships -- pipette the invisible ship engine or the oil rig power pole.

User avatar
hgschmie
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Feb 06, 2024 5:18 am
Contact:

Re: Vetoing the pipette tool

Post by hgschmie »

@robot256,

Thanks for the quick response. I looked a bit at the source code you pointed out and it seems to me that this is mostly accomplished by not associating an item with an entity. If there is no item, then the pipette has nothing to pick up.

That would work for me, however, I am using entities that are supposed to connect to the network (power or circuit). And without an item, the connections can not be blueprinted (if I remove the related items from my mod, then the blueprints lose all the wire connections because the blue prints seem to store the items with the connection information). Same applies to cut-and-paste. This is not a problem for any entity that is silently recreated by the primary entity placed (I have some of those and they work fine).

I am currently working through the process of publishing the mod, this may be easier to show than to tell.

Again, thanks for the suggestion.

-h

User avatar
hgschmie
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Feb 06, 2024 5:18 am
Contact:

Re: Vetoing the pipette tool

Post by hgschmie »

Xorimuth wrote:
Sun May 05, 2024 12:22 am
Why do your secondary entities have associated items at all? Surely you should just be creating the entity and not the item?
@Xorimuth,

thank you for the reply. I am using entities that connect to the network(s) (both power and circuit) and it seems that blueprinting and cut-and-paste require items to maintain the wire connections.

-h

Gweneph
Inserter
Inserter
Posts: 30
Joined: Thu Nov 14, 2019 11:51 pm
Contact:

Re: Vetoing the pipette tool

Post by Gweneph »

SE seems to do something similar with their spaceship clamps which are a constant combinator and a electric pole.

The electric pole has an placeableby of an se-struct-generic-clamp-east item, but that item has nil for it's place result.
Blueprints handle making the ghosts, and then the mod calls revive on them through the lua in event handlers for:
defines.events.on_entity_cloned
defines.events.on_built_entity
defines.events.on_robot_built_entity
defines.events.script_raised_built
defines.events.script_raised_revive

Post Reply

Return to “Modding help”