MapAreas can now reference their associated zones to dynamically add/remove borders

Random Events can no longer spawn in fishing trawler
Players can no longer have multiple random events spawned in/active at a time
This commit is contained in:
Ceikry
2022-04-18 12:17:18 +00:00
committed by Ryan
parent 202775f150
commit f454712c58
9 changed files with 119 additions and 2 deletions
+14
View File
@@ -2,6 +2,8 @@ package api
import core.game.node.entity.Entity
import core.game.world.map.Location
import core.game.world.map.zone.MapZone
import core.game.world.map.zone.RegionZone
import core.game.world.map.zone.ZoneBorders
import core.game.world.map.zone.ZoneRestriction
@@ -10,9 +12,21 @@ import core.game.world.map.zone.ZoneRestriction
* Optionally-overridable methods include [getRestrictions], [areaEnter], [areaLeave] and [entityStep]
*/
interface MapArea {
var zone: MapZone
get(){
return zoneMaps[this.javaClass.simpleName + "MapArea"]!!
}
set(value) {
zoneMaps[this.javaClass.simpleName + "MapArea"] = value
}
fun defineAreaBorders() : Array<ZoneBorders>
fun getRestrictions() : Array<ZoneRestriction> {return arrayOf()}
fun areaEnter(entity: Entity) {}
fun areaLeave(entity: Entity, logout: Boolean) {}
fun entityStep(entity: Entity, location: Location, lastLocation: Location) {}
companion object {
val zoneMaps = HashMap<String, MapZone>()
}
}