Class GameTime
java.lang.Object
zombie.GameTime
Tracks both in-game time and real world time. This class is very old and so has a lot of random/deprecated functionality.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionfloat
static GameTime
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.float
float
static final float
float
static final float
float
int
float
static final float
static final float
float
int
float
float
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
daysInMonth
(int year, int month) float
Deprecated.float
Deprecated.float
Deprecated.int
getDawn()
int
getDay()
int
int
getDeathString
(IsoPlayer playerObj) float
Delta between the default and current day length (as configured in the sandbox options).int
getDusk()
float
Number of in-game seconds passed since the last tick.int
int
int
int
int
getHour()
double
Deprecated.static GameTime
float
Return the inverse of getMultiplier() (1 / getMultiplier()).float
float
Deprecated.float
Deprecated.int
float
long
float
Deprecated.float
Deprecated.This was used to store non-object-specific mod data in the save file before global mod data was added.int
getMonth()
float
Number of real world seconds since the last tick, multiplied by game speed.float
Number of real world seconds since the last tick, multiplied by game speed.float
getMultiplierFromTimeDelta
(float float0) float
getNight()
float
Deprecated.float
Deprecated.int
Gets the number of nights that have passed since the save was created.float
Deprecated.float
Number of real seconds since the last tick.float
Delta based on the target framerate rather than the actual framerate.static long
static long
static boolean
int
int
int
float
int
float
boolean
float
Number of real world seconds since the last tick, multiplied by game speed.float
getTimeDeltaFromMultiplier
(float float0) float
getTimeSurvived
(IsoPlayer playerObj) float
Returns the current game speed multiplier (from the singleplayer speed up UI or while all players are sleeping).float
Number of real world seconds since the last tick, multiplied by game speed.float
float
float
Deprecated.double
double
Gets the age of the world from the start of the game in hours.int
getYear()
getZombieKilledText
(IsoPlayer playerObj) void
init()
boolean
isDay()
boolean
boolean
static boolean
boolean
isNight()
boolean
Deprecated.boolean
Deprecated.boolean
boolean
float
Lerp
(float start, float __end__, float delta) void
load()
void
load
(DataInputStream input) void
load
(ByteBuffer input) void
RemoveZombiesIndiscriminate
(int i) void
save()
void
save
(DataOutputStream output) void
save
(ByteBuffer output) void
saveToBufferMap
(SaveBufferMap saveBufferMap) void
void
setAmbient
(float _Ambient) Deprecated.void
setAmbientMax
(float _AmbientMax) Deprecated.void
setAmbientMin
(float _AmbientMin) Deprecated.void
setCalender
(PZCalendar _Calender) void
setDawn
(int _dawn) void
setDay
(int _Day) void
setDusk
(int _dusk) void
setHelicopterDay
(int day) void
setHelicopterEndHour
(int hour) void
setHelicopterStartHour
(int hour) void
setHoursSurvived
(double _HoursSurvived) Deprecated.static void
setInstance
(GameTime aInstance) void
setLastTimeOfDay
(float _LastTimeOfDay) void
setMaxZombieCount
(float _MaxZombieCount) Deprecated.void
setMaxZombieCountStart
(float _MaxZombieCountStart) Deprecated.void
setMinutesPerDay
(float _MinutesPerDay) void
setMinZombieCount
(float _MinZombieCount) Deprecated.void
setMinZombieCountStart
(float _MinZombieCountStart) Deprecated.void
setMonth
(int _Month) void
setMoon
(float moon) Deprecated.void
setMultiplier
(float _Multiplier) void
setNightMax
(float max) Deprecated.void
setNightMin
(float min) Deprecated.void
setNightsSurvived
(int _NightsSurvived) static void
setServerTimeShift
(long tshift) void
setStartDay
(int _StartDay) void
setStartMonth
(int _StartMonth) void
setStartTimeOfDay
(float _StartTimeOfDay) void
setStartYear
(int _StartYear) void
setTargetZombies
(int _TargetZombies) Deprecated.void
setThunderDay
(boolean _thunderDay) Deprecated.void
setTimeOfDay
(float _TimeOfDay) void
setViewDistMax
(float _ViewDistMax) void
setViewDistMin
(float _ViewDistMin) Deprecated.void
setYear
(int _Year) static void
syncServerTime
(long timeClientSend, long timeServer, long timeClientReceive) float
TimeLerp
(float startVal, float endVal, float startTime, float endTime) void
update
(boolean bSleeping) void
updateCalendar
(int year, int month, int dayOfMonth, int hourOfDay, int minute)
-
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
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
-
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
-
setInstance
-
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
-
getDaysSurvived
public int getDaysSurvived() -
getTimeSurvived
-
getZombieKilledText
-
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
-
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
- Returns:
- the Calender
-
setCalender
- 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
-
save
public void save() -
save
- Throws:
IOException
-
save
- Throws:
IOException
-
load
- Throws:
IOException
-
load
- 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
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
- 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()
-