示例#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())
	}
}
示例#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
}