Implemented timer subsystem to eventually replace pulses

Authentic subsystem supports saving/loading arbitrary data and resuming timer countdowns
Lots of documented CAPI functions for working with these new timers
Converted poison to new timers
Converted disease to new timers
Converted farming to new timers (CropGrowth and Compost)
Farming now syncs with 5 minute intervals on realtime clocks (authentic)
Converted seedling growth to new timers
Converted shooting star mining bonus to new timers
Converted entity freezing to new timers
Converted incubation to new timers
Incubation now supports using both incubators (so 2 eggs at once)
Converted miasmic states to the new timers
Converted god spell charged state to new timers
Converted teleblock to new timers
Converted skulled state to new timers
Converted Enhanced Excalibur special attack effect to new timers
Converted passive stat restoration to timers
Converted multicannon firing and decay to a timer
This commit is contained in:
Ceikry
2023-07-29 04:51:06 +00:00
committed by Ryan
parent bda000f220
commit 661390e66f
114 changed files with 1718 additions and 2112 deletions
@@ -13,6 +13,7 @@ import core.game.world.map.zone.ZoneBuilder
import io.github.classgraph.ClassGraph
import io.github.classgraph.ClassInfo
import io.github.classgraph.ScanResult
import core.game.system.timer.*
import core.game.bots.PlayerScripts
import core.game.interaction.InteractionListener
import core.game.interaction.InterfaceListener
@@ -73,6 +74,18 @@ object ClassScanner {
}
}
fun loadTimers () {
scanResults.getSubclasses ("core.game.system.timer.RSTimer").filter { !it.isAbstract }.forEach {
try {
val clazz = it.loadClass().newInstance() as RSTimer
TimerRegistry.registerTimer (clazz)
} catch (e: Exception) {
log(this::class.java, Log.ERR, "Error registering timer instance: ${it.simpleName}")
e.printStackTrace()
}
}
}
private fun loadContentInterfacesFrom(scanResults: ScanResult) {
scanResults.getClassesImplementing("core.api.ContentInterface").filter { !it.isAbstract }.forEach {
try {