Skip to content

Commit

Permalink
Merge pull request #82 from GTNewHorizons/tps_card
Browse files Browse the repository at this point in the history
added a way to retrieve the whole tick time table in one call
  • Loading branch information
Dream-Master authored Oct 19, 2022
2 parents e4a5321 + 43a2354 commit b5dbab2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/scala/li/cil/oc/server/component/TpsCard.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class TpsCard (val host: EnvironmentHost) extends prefab.ManagedEnvironment with
def getAllDims(context: Context, args: Arguments): Array[AnyRef] =
result(DimensionManager.getWorlds.map( w => (w.provider.dimensionId, w.provider.getDimensionName())).toMap)

@Callback(doc = """function():table -- Returns a table with index corresponding to the dimension id and value at the index being the tick time taken by the dim.""")
def getAllTickTimes(context: Context, args: Arguments): Array[AnyRef] =
result(DimensionManager.getWorlds.map( w => (w.provider.dimensionId, getTickTimeSum(CoFHCore.server.worldTickTimes.get(w.provider.dimensionId)) * 1.0E-6D)).toMap)

@Callback(doc = """function(dimension:number):string -- Returns the name corresponding to the dimension.""")
def getNameForDim(context: Context, args: Arguments): Array[AnyRef] = {
val dim = args.checkInteger(0)
Expand Down

0 comments on commit b5dbab2

Please sign in to comment.