Class GameTime

java.lang.Object
zombie.GameTime

public final class GameTime extends Object
Tracks both in-game time and real world time. This class is very old and so has a lot of random/deprecated functionality.
  • Field Details

    • MinutesPerHour

      public static final float MinutesPerHour
      See Also:
    • SecondsPerHour

      public static final float SecondsPerHour
      See Also:
    • SecondsPerMinute

      public static final float SecondsPerMinute
      See Also:
    • MULTIPLIER

      public static final float MULTIPLIER
      See Also:
    • instance

      public static GameTime instance
      Because of how Kahlua exposes static fields, when accessed from Lua, this will return a stale GameTime object that does not hold the correct game state. Lua mods should always use getGameTime() or GameTime.getInstance() instead of this field.
    • TimeOfDay

      public float TimeOfDay
    • NightsSurvived

      public int NightsSurvived
    • Calender

      public PZCalendar Calender
    • FPSMultiplier

      public float FPSMultiplier
    • Moon

      public float Moon
    • ServerTimeOfDay

      public float ServerTimeOfDay
    • ServerLastTimeOfDay

      public float ServerLastTimeOfDay
    • ServerNewDays

      public int ServerNewDays
    • lightSourceUpdate

      public float lightSourceUpdate
    • multiplierBias

      public float multiplierBias
    • LastLastTimeOfDay

      public float LastLastTimeOfDay
    • PerObjectMultiplier

      public float PerObjectMultiplier
  • Constructor Details

    • GameTime

      public GameTime()
  • Method Details

    • getInstance

      public static GameTime getInstance()
    • setInstance

      public static void setInstance(GameTime aInstance)
    • syncServerTime

      public static void syncServerTime(long timeClientSend, long timeServer, long timeClientReceive)
    • getServerTime

      public static long getServerTime()
    • getServerTimeMills

      public static long getServerTimeMills()
    • getServerTimeShiftIsSet

      public static boolean getServerTimeShiftIsSet()
    • setServerTimeShift

      public static void setServerTimeShift(long tshift)
    • isGamePaused

      public static boolean isGamePaused()
    • getRealworldSecondsSinceLastUpdate

      public float getRealworldSecondsSinceLastUpdate()
      Number of real seconds since the last tick.
    • getMultipliedSecondsSinceLastUpdate

      public float getMultipliedSecondsSinceLastUpdate()
      Number of real world seconds since the last tick, multiplied by game speed.
    • getGameWorldSecondsSinceLastUpdate

      public float getGameWorldSecondsSinceLastUpdate()
      Number of in-game seconds passed since the last tick.
    • daysInMonth

      public int daysInMonth(int year, int month)
    • getDeathString

      public String getDeathString(IsoPlayer playerObj)
    • getDaysSurvived

      public int getDaysSurvived()
    • getTimeSurvived

      public String getTimeSurvived(IsoPlayer playerObj)
    • getZombieKilledText

      public String getZombieKilledText(IsoPlayer playerObj)
    • getGameModeText

      public String getGameModeText()
    • init

      public void init()
    • Lerp

      public float Lerp(float start, float __end__, float delta)
    • RemoveZombiesIndiscriminate

      public void RemoveZombiesIndiscriminate(int i)
    • TimeLerp

      public float TimeLerp(float startVal, float endVal, float startTime, float endTime)
    • getDeltaMinutesPerDay

      public float getDeltaMinutesPerDay()
      Delta between the default and current day length (as configured in the sandbox options). When using a time delta, multiply by this as well to make the value increase at a fixed game-time rate rather than real time.
      Returns:
      The default day length is considered by this method to be 30 minutes, so a 0.33 delta is expected on default settings, not 1.
    • getNightMin

      public float getNightMin()
      Deprecated.
    • setNightMin

      public void setNightMin(float min)
      Deprecated.
    • getNightMax

      public float getNightMax()
      Deprecated.
    • setNightMax

      public void setNightMax(float max)
      Deprecated.
    • getMinutes

      public int getMinutes()
    • setMoon

      public void setMoon(float moon)
      Deprecated.
    • update

      public void update(boolean bSleeping)
    • getMinutesStamp

      public long getMinutesStamp()
    • getThunderStorm

      public boolean getThunderStorm()
    • getAmbient

      @Deprecated public float getAmbient()
      Deprecated.
      Returns:
      the Ambient
    • getSkyLightLevel

      public int getSkyLightLevel()
    • setAmbient

      public void setAmbient(float _Ambient)
      Deprecated.
      Parameters:
      _Ambient - the Ambient to set
    • getAmbientMax

      public float getAmbientMax()
      Deprecated.
      Returns:
      the AmbientMax
    • setAmbientMax

      public void setAmbientMax(float _AmbientMax)
      Deprecated.
      Parameters:
      _AmbientMax - the AmbientMax to set
    • getAmbientMin

      public float getAmbientMin()
      Deprecated.
      Returns:
      the AmbientMin
    • setAmbientMin

      public void setAmbientMin(float _AmbientMin)
      Deprecated.
      Parameters:
      _AmbientMin - the AmbientMin to set
    • getDay

      public int getDay()
      Returns:
      the Day
    • setDay

      public void setDay(int _Day)
      Parameters:
      _Day - the Day to set
    • getDayPlusOne

      public int getDayPlusOne()
    • getStartDay

      public int getStartDay()
      Returns:
      the StartDay
    • setStartDay

      public void setStartDay(int _StartDay)
      Parameters:
      _StartDay - the StartDay to set
    • getMaxZombieCountStart

      public float getMaxZombieCountStart()
      Deprecated.
      Returns:
      the MaxZombieCountStart
    • setMaxZombieCountStart

      public void setMaxZombieCountStart(float _MaxZombieCountStart)
      Deprecated.
      Parameters:
      _MaxZombieCountStart - the MaxZombieCountStart to set
    • getMinZombieCountStart

      public float getMinZombieCountStart()
      Deprecated.
      Returns:
      the MinZombieCountStart
    • setMinZombieCountStart

      public void setMinZombieCountStart(float _MinZombieCountStart)
      Deprecated.
      Parameters:
      _MinZombieCountStart - the MinZombieCountStart to set
    • getMaxZombieCount

      public float getMaxZombieCount()
      Deprecated.
      Returns:
      the MaxZombieCount
    • setMaxZombieCount

      public void setMaxZombieCount(float _MaxZombieCount)
      Deprecated.
      Parameters:
      _MaxZombieCount - the MaxZombieCount to set
    • getMinZombieCount

      public float getMinZombieCount()
      Deprecated.
      Returns:
      the MinZombieCount
    • setMinZombieCount

      public void setMinZombieCount(float _MinZombieCount)
      Deprecated.
      Parameters:
      _MinZombieCount - the MinZombieCount to set
    • getMonth

      public int getMonth()
      Returns:
      the Month
    • setMonth

      public void setMonth(int _Month)
      Parameters:
      _Month - the Month to set
    • getStartMonth

      public int getStartMonth()
      Returns:
      the StartMonth
    • setStartMonth

      public void setStartMonth(int _StartMonth)
      Parameters:
      _StartMonth - the StartMonth to set
    • getNightTint

      public float getNightTint()
      Deprecated.
      Returns:
      the NightTint
    • getNight

      public float getNight()
      Returns:
      the NightTint
    • getTimeOfDay

      public float getTimeOfDay()
      Returns:
      the TimeOfDay
    • setTimeOfDay

      public void setTimeOfDay(float _TimeOfDay)
      Parameters:
      _TimeOfDay - the TimeOfDay to set
    • getStartTimeOfDay

      public float getStartTimeOfDay()
      Returns:
      the StartTimeOfDay
    • setStartTimeOfDay

      public void setStartTimeOfDay(float _StartTimeOfDay)
      Parameters:
      _StartTimeOfDay - the StartTimeOfDay to set
    • getViewDist

      public float getViewDist()
      Returns:
      the ViewDist
    • getViewDistMax

      public float getViewDistMax()
      Returns:
      the ViewDistMax
    • setViewDistMax

      public void setViewDistMax(float _ViewDistMax)
      Parameters:
      _ViewDistMax - the ViewDistMax to set
    • getViewDistMin

      public float getViewDistMin()
      Deprecated.
      Returns:
      the ViewDistMin
    • setViewDistMin

      public void setViewDistMin(float _ViewDistMin)
      Deprecated.
      Parameters:
      _ViewDistMin - the ViewDistMin to set
    • getYear

      public int getYear()
      Returns:
      the Year
    • setYear

      public void setYear(int _Year)
      Parameters:
      _Year - the Year to set
    • getStartYear

      public int getStartYear()
      Returns:
      the StartYear
    • setStartYear

      public void setStartYear(int _StartYear)
      Parameters:
      _StartYear - the StartYear to set
    • getNightsSurvived

      public int getNightsSurvived()
      Gets the number of nights that have passed since the save was created. 7am is considered the end of a night.
      Returns:
      Number of nights since game start.
    • setNightsSurvived

      public void setNightsSurvived(int _NightsSurvived)
      Parameters:
      _NightsSurvived - the NightsSurvived to set
    • getWorldAgeDaysSinceBegin

      public double getWorldAgeDaysSinceBegin()
    • getWorldAgeHours

      public double getWorldAgeHours()
      Gets the age of the world from the start of the game in hours. The value can be slightly off from the true value depending on game settings, as it considers every 7am passing to be a 24 hour period, however the game does not by default start at 7am. The true number of hours can be calculated by subtracting (getStartTimeOfDay() - 7). However, the uncorrected value is still suitable as a timestamp, as the offset is consistent.
      Returns:
      Age of the world in hours.
    • getHoursSurvived

      public double getHoursSurvived()
      Deprecated.
      Returns:
      the HoursSurvived
    • setHoursSurvived

      public void setHoursSurvived(double _HoursSurvived)
      Deprecated.
      Parameters:
      _HoursSurvived - the HoursSurvived to set
    • getHour

      public int getHour()
    • getCalender

      public PZCalendar getCalender()
      Returns:
      the Calender
    • setCalender

      public void setCalender(PZCalendar _Calender)
      Parameters:
      _Calender - the Calender to set
    • updateCalendar

      public void updateCalendar(int year, int month, int dayOfMonth, int hourOfDay, int minute)
    • getMinutesPerDay

      public float getMinutesPerDay()
      Returns:
      the MinutesPerDay
    • setMinutesPerDay

      public void setMinutesPerDay(float _MinutesPerDay)
      Parameters:
      _MinutesPerDay - the MinutesPerDay to set
    • getLastTimeOfDay

      public float getLastTimeOfDay()
      Returns:
      the LastTimeOfDay
    • setLastTimeOfDay

      public void setLastTimeOfDay(float _LastTimeOfDay)
      Parameters:
      _LastTimeOfDay - the LastTimeOfDay to set
    • setTargetZombies

      public void setTargetZombies(int _TargetZombies)
      Deprecated.
      Parameters:
      _TargetZombies - the TargetZombies to set
    • isRainingToday

      public boolean isRainingToday()
      Deprecated.
      Returns:
      the RainingToday
    • getMultiplier

      public float getMultiplier()
      Number of real world seconds since the last tick, multiplied by game speed. Also multiplied by 48 for some reason.
      Returns:
      the Multiplier
    • setMultiplier

      public void setMultiplier(float _Multiplier)
      Parameters:
      _Multiplier - the Multiplier to set
    • getTimeDelta

      public float getTimeDelta()
      Number of real world seconds since the last tick, multiplied by game speed.
    • getTimeDeltaFromMultiplier

      public float getTimeDeltaFromMultiplier(float float0)
    • getMultiplierFromTimeDelta

      public float getMultiplierFromTimeDelta(float float0)
    • getServerMultiplier

      public float getServerMultiplier()
      Delta based on the target framerate rather than the actual framerate. Unclear purpose. Probably shouldn't be used.
    • getUnmoddedMultiplier

      public float getUnmoddedMultiplier()
      Number of real world seconds since the last tick, multiplied by game speed.
    • getInvMultiplier

      public float getInvMultiplier()
      Return the inverse of getMultiplier() (1 / getMultiplier()). Per-tick RNG functions can multiply by this value to keep chances relatively stable across different framerates.
    • getTrueMultiplier

      public float getTrueMultiplier()
      Returns the current game speed multiplier (from the singleplayer speed up UI or while all players are sleeping).
    • getThirtyFPSMultiplier

      public float getThirtyFPSMultiplier()
    • saveToBufferMap

      public void saveToBufferMap(SaveBufferMap saveBufferMap)
    • save

      public void save()
    • save

      public void save(DataOutputStream output) throws IOException
      Throws:
      IOException
    • save

      public void save(ByteBuffer output) throws IOException
      Throws:
      IOException
    • load

      public void load(DataInputStream input) throws IOException
      Throws:
      IOException
    • load

      public void load(ByteBuffer input) throws IOException
      Throws:
      IOException
    • load

      public void load()
    • getDawn

      public int getDawn()
    • setDawn

      public void setDawn(int _dawn)
    • getDusk

      public int getDusk()
    • setDusk

      public void setDusk(int _dusk)
    • getModData

      public KahluaTable getModData()
      This was used to store non-object-specific mod data in the save file before global mod data was added. It is generally better to use the global mod data API provided by ModData.
    • isThunderDay

      public boolean isThunderDay()
      Deprecated.
    • setThunderDay

      public void setThunderDay(boolean _thunderDay)
      Deprecated.
    • saveToPacket

      public void saveToPacket(ByteBuffer bb) throws IOException
      Throws:
      IOException
    • getHelicopterDay1

      public int getHelicopterDay1()
    • getHelicopterDay

      public int getHelicopterDay()
    • setHelicopterDay

      public void setHelicopterDay(int day)
    • getHelicopterStartHour

      public int getHelicopterStartHour()
    • setHelicopterStartHour

      public void setHelicopterStartHour(int hour)
    • getHelicopterEndHour

      public int getHelicopterEndHour()
    • setHelicopterEndHour

      public void setHelicopterEndHour(int hour)
    • isEndlessDay

      public boolean isEndlessDay()
    • isEndlessNight

      public boolean isEndlessNight()
    • isDay

      public boolean isDay()
    • isNight

      public boolean isNight()
    • isZombieActivityPhase

      public boolean isZombieActivityPhase()
    • isZombieInactivityPhase

      public boolean isZombieInactivityPhase()