RCON Companion


Companion Mod for running specific RCON commands without disabling achievements. You probably don't need this mod...

Internal
3 years ago
1.1
114
Owner:
Karoschel
Source:
https://github.com/nicolas-lang/Facto...
Homepage:
https://github.com/nicolas-lang/Facto...
License:
MIT
Created:
3 years ago
Latest Version:
0.0.4 (3 years ago)
Factorio version:
1.1
Downloaded by:
114 users

RCON Companion

Companion mod for some RCON commands to avoid disabling achievements while using RCON

Availiable commands:

  • /rcon print_tick
  • /rcon print_gamespeed
  • /rcon print_tickpaused
  • /rcon get_gamestate
  • /rcon set_clock

Example use case (python)

def getClusterUPS(self,clustername,timeframe = 5):
    try:
        clusterIP = self.getClusterIP(clustername)
        con = rCon(clusterIP,self.clusterCfg.rConPassword)
        paused = bool((con.execute('/rcon print_tickpaused')) == "true")
        if paused:
            print("Server is paused, no UPS stats avaliable")
        else:
            speed = round(float(con.execute('/rcon print_gamespeed')),3)
            tick_1 = int(con.execute('/rcon print_tick'))
            time.sleep(timeframe)
            tick_2 = int(con.execute('/rcon print_tick'))
            server_ups = (tick_2-tick_1)/timeframe
            game_ups = (speed*60)
            perf = int(round(server_ups / game_ups,2)*100)
            print("Server UPS: {0}, Expected Game UPS: {1} (Speed = {2}), Performance = {3}%".format(server_ups, game_ups, speed, perf))
    except:
        print("error, check logs")
        logging.exception('')

Contributing

Acknowledgements