Converted some content to the new event hooks and listeners systems in order to clean up code a bit

Added interfaces for standardizing the saving/loading process for data, and allowing it to be declared independently of an entry in PlayerSaver/PlayerSaveParser
This commit is contained in:
Ceikry
2022-04-04 07:12:54 +00:00
committed by Ryan
parent abfddaca43
commit 24b28d84fd
78 changed files with 771 additions and 753 deletions
@@ -0,0 +1,19 @@
package api
import core.game.node.entity.player.Player
import org.json.simple.JSONObject
interface PersistPlayer {
/**
* NOTE: This should NOT reference nonstatic class-local variables.
* You need to fetch a player's specific instance of the data and save from that.
* For reference, see [rs09.game.node.entity.skill.slayer.SlayerManager]
*/
fun savePlayer(player: Player, save: JSONObject)
/**
* NOTE: This should NOT reference nonstatic class-local variables.
* You need to fetch a player's specific instance of the data and parse to that.
* For reference, see [rs09.game.node.entity.skill.slayer.SlayerManager]
*/
fun parsePlayer(player: Player, data: JSONObject)
}
@@ -0,0 +1,6 @@
package api
interface PersistWorld {
fun saveWorld()
fun parseWorld()
}
+2 -1
View File
@@ -12,4 +12,5 @@ data class LitFireEvent(val logId: Int) : Event
data class InteractionEvent(val target: Node, val option: String) : Event
data class ButtonClickedEvent(val iface: Int, val buttonId: Int) : Event
data class UsedWithEvent(val used: Int, val with: Int) : Event
data class SelfDeath(val killer: Entity) : Event
data class SelfDeath(val killer: Entity) : Event
data class TickEvent(val source: Entity) : Event