ghost entitites on descrution

Place to get help with not working mods / modding interface.
Post Reply
Iccor56
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Mon Dec 25, 2017 12:29 am
Contact:

ghost entitites on descrution

Post 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.

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: ghost entitites on descrution

Post by Nexela »

Pretty sure ghosts don't show up until construction robots tech is researched.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: ghost entitites on descrution

Post 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.

Iccor56
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Mon Dec 25, 2017 12:29 am
Contact:

Re: ghost entitites on descrution

Post by Iccor56 »

it was not researched :(


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

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: ghost entitites on descrution

Post 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.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: ghost entitites on descrution

Post 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

Iccor56
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Mon Dec 25, 2017 12:29 am
Contact:

Re: ghost entitites on descrution

Post 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

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: ghost entitites on descrution

Post 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)

Post Reply

Return to “Modding help”