reload() for dynamicitems

This commit is contained in:
minjaesong
2023-05-22 11:46:06 +09:00
parent f12bf553ff
commit 07b44a92c5
3 changed files with 11 additions and 3 deletions

View File

@@ -74,10 +74,10 @@ abstract class Actor : Comparable<Actor>, Runnable {
fun Int.sign(): Int = if (this > 0) 1 else if (this < 0) -1 else 0
/* called when the actor is loaded from the save; one use of this function is to "re-sync" the
* Transient variables such as `mainUI` of FixtureBase
*/
open fun reload() {
/* called when the actor is loaded from the save; one use of this function is to "re-sync" the
* Transient variables such as `mainUI` of FixtureBase
*/
actorValue.actor = this
if (this is Pocketed)

View File

@@ -192,6 +192,11 @@ abstract class GameItem(val originalID: ItemID) : Comparable<GameItem>, Cloneabl
*/
open val extra = Codex()
/* called when the instance of the dynamic is loaded from the save; one may use this function to "re-sync" some values,
* for the purpose of savegame format update, defence against rogue savegame manipulation, etc.
*/
open fun reload() { }
/**
* Effects applied continuously while in pocket
*/

View File

@@ -73,6 +73,9 @@ class ItemCodex {
}
}
dynamicItemInventory[dynid] = item
// try to call reload() of the dynamic items
item.reload()
}
}