On my mod (RSeding91's old forcefield mod) I get the issue of not been able to create entities when can_place_entity says it could
Code of the issue:
Code: Select all
surface.can_place_entity({name = emitterTable["type"], position = pos, direction = direction}) then
local newField = surface.create_entity({name = emitterTable["type"], position = pos, force = force, direction = direction})
-- This new entity will have 0 health on creation + one load of recharge this tick
newField.health = Settings.forcefieldTypes[emitterTable["type"]]["chargeRate"]
-- more code
When the gate is there, the can_pace_entity will say false, and ignore that tile to build a wall.
Then I manualy shoot the wall (or the biters will kill it) it shows up as a ghost for bots to replace it...
On the next iteration to check the wall, the can_place_entity will say true on the ghost..
--> I would say this is correct as you can place items over a ghost entity...
Then the next step is to create the entity. As stated it should be able to place it since its only a ghost...
But it won't place it on that entity and throw an error on the next line as i try to index a nil value as it didn't place the entity...
--> I think this methode should remove the ghost and place the entity, or if this isn't wanted the can_place_entity should at least give false?
I've added a safe file to test this out.
The only mod used is this pre-released update of the forcefield mod (also included)
To do: add the mod, open the world, shoot one of the gates near the player
(south east on the marked spot if you would spawn at spawn point)
It will replace the gate with a ghost (withing 10 seconds) and when it wants to build the entity it will give the error.
PS: shoot the gate on the red wall, that one will respawn the quickest
greetings
lovely_santa