Exemplo n.º 1
0
func (chunk *Chunk) reqRemovePlayerData(entityId EntityId, isDisconnect bool) {
	delete(chunk.playersData, entityId)

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

	chunk.storeDirty = true
}