Page 1 of 1

ghost entitites on descrution

Posted: Sat May 12, 2018 5:03 pm
by Iccor56
has anyone else noticed destroyed items no longer make ghost entities? i tried validating game files with steam and i also removed all the mods (change the folder name). i even change the config file name so it was rebuilt.

i tried a brand new game and i still could not make ghost entity when i destroyed something.

Re: ghost entitites on descrution

Posted: Sat May 12, 2018 5:20 pm
by Nexela
Pretty sure ghosts don't show up until construction robots tech is researched.

Re: ghost entitites on descrution

Posted: Sat May 12, 2018 6:19 pm
by kovarex
Nexela wrote:Pretty sure ghosts don't show up until construction robots tech is researched.
That is correct.
Iccor56 wrote:i tried a brand new game and i still could not make ghost entity when i destroyed something.
Are you sure that you had the robot research activated?

There is something called ghost time to live, which is 0 unless the tech is activated, so the ghosts don't appear, this is mainly to not confuse new players before it is relevant.

Re: ghost entitites on descrution

Posted: Sun May 13, 2018 9:58 pm
by Iccor56
it was not researched :(


is there a way or setting or mod based setting that can increase that before research is done?

Re: ghost entitites on descrution

Posted: Mon May 14, 2018 9:55 am
by kovarex
Iccor56 wrote:it was not researched :(


is there a way or setting or mod based setting that can increase that before research is done?
Making mod that enables it from the start would be trivial.

Re: ghost entitites on descrution

Posted: Mon May 14, 2018 11:12 am
by Klonan
Iccor56 wrote:it was not researched :(


is there a way or setting or mod based setting that can increase that before research is done?
Just change this:

http://lua-api.factorio.com/latest/LuaF ... me_to_live

like:

Code: Select all

/c game.player.force.ghost_time_to_live = 60 * 60 * 60

Re: ghost entitites on descrution

Posted: Tue May 15, 2018 12:12 am
by Iccor56
i'm trying that via onload and it does not seem to work. i seem to be having great difficulty understanding the lua modding environment. any suggestions?

Code: Select all

local OnLoad=function() --define handler
game.player.force.ghost_time_to_live=60*60*60
end

script.on_load(OnLoad)--this will execute when the savegame is loaded and the mod was present during the save process

Re: ghost entitites on descrution

Posted: Tue May 15, 2018 1:29 am
by Nexela
You want to use on_init and you ALSO should check and make sure it is at 0/nil before you change it in case it is set to something else.
Also game.player is only available when using the console, you will want to iterate all the forces directly

Code: Select all

script.on_init(function() 
  for _, force in pairs(game.forces) do
    if not (force.name == "enemy" or force.name == "neutral") then -- Don't bother changing enemy/neutral forces
      if force.ghost_time_live == 0 then -- this will work if default is 0 (but it might be nil I dunno)
        force.ghost_time_to_live = 60*60*60
      end
    end
  end
end)