Page 1 of 1

Entity only placeable by hand ?

Posted: Fri Jul 29, 2016 9:06 am
by binbinhfr
Hi,

is there a way to force an entity to be position on map only by hand/player action, and disable automatic positionnement by construction bots ?

I want to ensure that this entity will only exist once on the map.

I could use on_robot_built_entity and destory any unwanted entity, but I don't know how to put the item them back to where it was taken from...
And I'm afraid about loops : robots will try to position it forever.
(in the case of on_built_entity, it's easier, because you can put it back into player's inventory or quickbar).

Re: Entity only placeable by hand ?

Posted: Fri Jul 29, 2016 9:13 am
by Supercheese
Yes, you can monitor and disallow placement of the ghost entity (inspecting the contents of the ghost), which should stop any bot-placement. I did this once for Logistics Railway: https://github.com/Suprcheese/Logistics ... ol.lua#L35

Re: Entity only placeable by hand ?

Posted: Fri Jul 29, 2016 10:38 am
by Nexela
Something along the lines of this

on_entity_built event -

if entity.name="entity-ghost" and entity.ghost_name="my-entity" then entity.destroy()

will not allow blueprints or shift placing and you don't have to worry about the item since it is just a ghost.

if it is IN a blueprint it will just destroy that ghost when placed

Re: Entity only placeable by hand ?

Posted: Fri Jul 29, 2016 11:14 am
by binbinhfr
thx guys ! I'll try this right now.