Prison Architect

Prison Architect

Not enough ratings
TimeWarpFactor Calculator
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
73.923 KB
25 Aug, 2018 @ 6:40am
6 Sep, 2018 @ 4:31am
6 Change Notes ( view )

Subscribe to download
TimeWarpFactor Calculator

In 1 collection by murgh
Murgh Mods
75 items
Description
For modders only:

A basic template for any scripted object which demonstrates how to calculate the TimeWarpFactor. This factor determines how fast the game will run: on a small map time passes more quickly than on a large map.

For instance, normally when you script an object and tell it to update once every 8 ticks, this would mean it updates every 8 game minutes on a small map, but the script would update every 1 minute on a small map if the SlowTime mutator was enabled... or it would update every 4 game minutes on a large map. Of course this will lead to timing errors when you expect something to happen in your script each half an hour or so.

This template will allow you to run scripts with the same update interval on all map sizes with or without the Slow Time mutator enabled. Read the comments in the lua script for more information about why the sprites behave like they do and why the tooltip time might differ from the actual clock.

When placing the object it will take a game minute to do the calculation. During this time it will show a Stopwatch. When calculation is done it will display the results in the Tooltip for a few moments so you can verify if things are correct. It will then start to change it's sprite each game minute. It doesn't matter on which map size you run it, the sprite always changes at the same interval according to the passed game time (the example object updates once in every game minute).

Use this template for any mod which needs strict Update() intervals based on game time. It will make sure things happen at the time you desire, not 'way off' in a manner you didn't expect.

It also includes code to calculate the current day, hour and minute in the game.

CUSTOM REPORTS TAB DEMO
Besides the TimeWarpFactor calculation, it now also includes a basic demo for the new Custom Reports tab for scripted objects. Credits go to Leander for providing this little sample mod. Be sure to enable/disable the timePerUpdate settings mentioned in the script comments.

As you can see, the object doesn't have a default popup menu when using custom reports. This is to prevent clutter. You can use the Dismantle tool from the menu to get rid of the object, or just create a Delete button (and other needed buttons for your mod) somewhere on the reports window.



Please don't forget to press the Like button if you like this mod.
Feel free to check out my workshop with tons of handy mods!

Non-Steam users: follow this guide to download manually.
Popular Discussions View All (1)
0
29 Jan, 2021 @ 2:59am
COMPATIBILITY
murgh
2 Comments
武装窝卫喵 18 Dec, 2019 @ 6:32am 
thank you.

Is there a way to implement a second clock?
murgh  [author] 7 Sep, 2018 @ 11:39am 
I've also added some screenshots of the Limo Garage Installer which is using this reports feature as a walk through. Mod: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1465161615