0.16.51 creating a ghost with mod causes an appcrash

This subforum contains all the issues which we already resolved.
Post Reply
TheThunderBirds
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sun Oct 15, 2017 6:15 pm
Contact:

0.16.51 creating a ghost with mod causes an appcrash

Post by TheThunderBirds » Tue Jul 17, 2018 2:21 pm

Shift clicking (creating a ghost) with this piece of code causes an appcrash. It has probably something to do with creating a ghost where there is already one or trying to destroy a ghost because the normal click works without any problems.

This piece of code causes the crash:

script.on_event(defines.events.on_built_entity, function(event)
local ghost = {
name = "entity-ghost",
inner_name = event.created_entity .name,
position = event.created_entity .position,
force = event.created_entity .force
}

event.created_entity.destroy()
game.surfaces['nauvis'].create_entity(ghost)
end)
Attachments
factorio-dump-previous.dmp
dump file
(633.26 KiB) Downloaded 14 times
factorio-current.log
log
(3.71 KiB) Downloaded 24 times

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 2604
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: 0.16.51 creating a ghost with mod causes an appcrash

Post by eradicator » Tue Jul 17, 2018 2:39 pm

TheThunderBirds wrote:Shift clicking (creating a ghost) with this piece of code causes an appcrash.
Why are you trying to create a ghost inside a ghost? Ghostception?
Author of: Hand Crank Generator, Screenshot Hotkey 2.0
Mod support languages: 日本語, Deutsch, English

TheThunderBirds
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sun Oct 15, 2017 6:15 pm
Contact:

Re: 0.16.51 creating a ghost with mod causes an appcrash

Post by TheThunderBirds » Tue Jul 17, 2018 2:43 pm

I tried to make the normal building work like shift clicking but then found out the shift clicking now crashed the game xD. If there is a cleaner way to do this please tell me!

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 2604
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: 0.16.51 creating a ghost with mod causes an appcrash

Post by eradicator » Tue Jul 17, 2018 4:40 pm

Simply skip processing things that are already ghosts:

Code: Select all

if event.created_entity.type == 'entity-ghost' then return end
Author of: Hand Crank Generator, Screenshot Hotkey 2.0
Mod support languages: 日本語, Deutsch, English

Rseding91
Factorio Staff
Factorio Staff
Posts: 8846
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: 0.16.51 creating a ghost with mod causes an appcrash

Post by Rseding91 » Tue Jul 31, 2018 3:49 am

Thanks for the report. It's now fixed for 0.17.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Resolved Problems and Bugs”

Who is online

Users browsing this forum: No registered users and 7 guests