Exemple #1
0
func (chunk *Chunk) reqRemovePlayerData(entityId EntityId, isDisconnect bool) {
	chunk.playersData[entityId] = nil, false

	if isDisconnect {
		buf := new(bytes.Buffer)
		proto.WriteEntityDestroy(buf, entityId)
		chunk.reqMulticastPlayers(entityId, buf.Bytes())
	}
}
Exemple #2
0
func (chunk *Chunk) removeEntity(s gamerules.INonPlayerEntity) {
	e := s.GetEntityId()
	chunk.shard.entityMgr.RemoveEntityById(e)
	chunk.entities[e] = nil, false
	// Tell all subscribers that the spawn's entity is destroyed.
	buf := new(bytes.Buffer)
	proto.WriteEntityDestroy(buf, e)
	chunk.reqMulticastPlayers(-1, buf.Bytes())
}