Skip to content

World

object World
Example
on_input<DeveloperCommandInput> { player ->
if (name != "census") return@on_input
var online = 0
World.players.forEach { online++ }
val npcs = World.spatial.npcsWithin(player.tile4.tile, radius = 10, shard = player.shardId)
player.message("$online online; ${npcs.size} NPCs within 10 tiles of you.")
}
val players: EntityList<Actor>
val spatial: WorldSpatialIndex
fun collisionView(entity: Entity): CollisionView
fun worldObjectAt(
observer: Entity,
tile: Tile3,
id: Int,
shard: Int = observer.shardId
): WorldObject?
fun createInstance(map: InstanceMap): Int
fun placeProjection(
definition: Int,
shard: Int,
tile: Tile3,
angle: Int = 0
): WorldProjection
fun createParallelWorld(): Int
fun destroyInstance(
shard: Int,
evictTo: Tile3,
evictToShard: Int = WorldSpatialIndex.GLOBAL
)
fun enterInstance(
actor: Actor,
shard: Int,
tile: Tile3
)
fun findPlayer(username: String): Actor?
fun register(actor: Actor): Boolean
fun register(
actor: Actor,
atIndex: Int
): Boolean
fun unregister(p: Actor)
fun forEachNpc(action: (Npc) -> Unit)
fun registerNpc(npc: Npc): Boolean
fun unregisterNpc(npc: Npc)
fun registerWorldItem(item: WorldItem): Boolean
fun registerWorldObject(wo: WorldObject): Boolean
fun setWorldItemQuantity(
item: WorldItem,
newQuantity: Int
)
fun unregisterWorldItem(item: WorldItem)
fun registerProjectile(projectile: Projectile): Boolean
fun registerWorldSound(
sound: WorldSound,
loops: Int = 1
): Boolean
fun registerWorldGraphic(graphic: WorldGraphic): Boolean
fun launchProjectile(
shard: Int,
from: Tile3,
dest: Tile3,
id: Int,
lifespan: Int = 60,
delay: Int = 0,
onHit: ((projectile: Entity, target: Entity, clientSideDelay: Int) -> Unit)? = null
): Projectile?
fun launchProjectile(
shard: Int,
from: Tile3,
target: Entity,
id: Int,
lifespan: Int = 60,
delay: Int = 0,
onHit: ((projectile: Entity, target: Entity, clientSideDelay: Int) -> Unit)? = null
): Projectile?
fun launchProjectile(
shard: Int,
source: Entity,
target: Entity,
id: Int,
lifespan: Int = 60,
delay: Int = 0,
onHit: ((projectile: Entity, target: Entity, clientSideDelay: Int) -> Unit)? = null
): Projectile?
fun projectionsViewing(childShard: Int): List<WorldProjection>
fun rootShardOf(entity: Entity): Int
fun viewportProjectionOf(entity: Entity): WorldProjection?
fun changeActorRoot(
actor: Actor,
shard: Int,
tile: Tile3? = null
)
fun canAllocateProjection(
rootShard: Int,
sizeX: Int,
sizeZ: Int
): Boolean
fun registerWorldProjection(projection: WorldProjection): Boolean
fun registerArea(area: WorldArea): Boolean
fun unregisterArea(area: WorldArea): Unit
var cycle: Int
fun cycle()
fun postLoginIntent(intent: () -> Unit)
fun systemsAt(anchor: Anchor): List<System<*, *>>
fun composeAnchor(
anchor: Anchor,
vararg systems: System<*, *>
): Unit
fun setGameloopMovement (vararg systems: System<*, *>): Unit
var profiler: ((phase: String, nanos: Long) -> Unit)?
var phaseProbe: ((phase: String) -> Unit)?
fun subcycle()