Entity changes
This commit is contained in:
parent
71cd8bf486
commit
0414f83541
2 changed files with 12 additions and 3 deletions
|
@ -23,10 +23,17 @@ interface Entity {
|
|||
*/
|
||||
val numericID: Int
|
||||
|
||||
/**
|
||||
* If players should be added to [visibleTo] when they join.
|
||||
*
|
||||
* Defaults to true.
|
||||
*/
|
||||
var visibleToNewPlayers: Boolean
|
||||
|
||||
/**
|
||||
* Players that can see this entity if it is in their view distance.
|
||||
*/
|
||||
val viewers: MutableSet<Player>
|
||||
val visibleTo: MutableSet<Player>
|
||||
|
||||
fun belongsToChunk(key: Chunk.Key): Boolean
|
||||
|
||||
|
@ -34,9 +41,9 @@ interface Entity {
|
|||
suspend fun setWorld(world: World?)
|
||||
|
||||
/**
|
||||
* If players should be added to [viewers] when they enter [world].
|
||||
* Players who currently have this entity loaded (= it is in their viewing distance).
|
||||
*/
|
||||
var visibleToNewPlayers: Boolean
|
||||
val viewers: Set<Player>
|
||||
|
||||
var glowing: Boolean // It seems like every entity can glow
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ sealed class UranosEntity(server: UranosServer) : Entity {
|
|||
|
||||
override var visibleToNewPlayers: Boolean = true
|
||||
|
||||
override val visibleTo = mutableSetOf<Player>()
|
||||
|
||||
private val worldMutex = Mutex()
|
||||
final override var world: World? = null; private set
|
||||
|
||||
|
|
Reference in a new issue