Page 1 of 1

[0.14]David WM's Timelapse crudely updated by script kiddie

Posted: Mon May 22, 2017 12:03 am
by featherwinglove
I decided to post this crude hack of the Timelapse mod here because it was a pain to get working in 0.14 (so if you're really desperate to get it working and are even less adept at getting broken 0.12 mod code working in newer versions than I am ...which is probably unlikely if you're here to read this :lol: go ahead and grab it.) The code hack is really pretty dumb and crufty, which is why I'm not posting a pull request or attempting to upload it to the portal.

Changes:
1. The "seed" and "ticks" parts of the screenshot filename have been replaced with "MuddyAt" because the line accessing was causing a crash and was commented out, and because the modpack is called "Muddy Mountains". This will have the side effect of causing screenshots to get overwritten if you play an older game with screenshots enabled and then play a newer game with screenshots enabled in the same Factorio installation (I had this problem in the Badlands back in 0.12 because I tended to play with the same seed anyway.)

2. The mod does not print a console message for each screenshot. I have no idea why, but game.player.print(string) causes 0.14 to crash (player is nil) when it is happening within script.on_event(defines.on_tick). All of the other console print commands (which are responses to timelapse console commands such as /c remote.call("timelapse", "active")) work fine.

Re: [0.14]David WM's Timelapse crudely updated by script kiddie

Posted: Mon May 22, 2017 7:24 pm
by Jeroen D Stout
I believe you need to use

Code: Select all

game.players[1].print(string)
Nice to see this, all the same :)

Re: [0.14]David WM's Timelapse crudely updated by script kiddie

Posted: Mon May 22, 2017 8:26 pm
by Choumiko
game.player is only available inside a command run from the consol. In events you can use game.print() to print to all players. I think there's also a print for LuaSurface, LuaForce

Re: [0.14]David WM's Timelapse crudely updated by script kiddie

Posted: Thu May 25, 2017 3:06 am
by featherwinglove
That explains why Pollution Damage has no problems. When going from 0.12 to 0.14, I switched from looping players array in ipairs to the connected players array in ipairs. I did this after realizing it has no need to bother logged out players (although logging into a game equipped with Pollution Damage could plausibly become impossible. I don't know if spawn can be moved, but if not, care would need to be taken to keep the origin clean. It isn't too hard to wind up with chunks that can kill an unarmored player in one second with Pollution Damage, since armor does a lot to reduce the damage if you don't mind the console spam, and once an area is automated and sorted out, it isn't hard to avoid ever visiting it again.) I don't loop just for printing, as the mod needs to figure out how much damage each player is taking.

The message problem isn't the only problem that needs to be fixed. For the map seed file name, the best thing to do is probably put it into a global that gets filled with the activate command and reused for each screenshot. Any thoughts?

Re: [0.14]David WM's Timelapse crudely updated by script kiddie

Posted: Wed Jun 21, 2017 5:00 am
by featherwinglove