func (self *Region) AddEntity(entity entities.Entity) { // Add the entity to the list of entities. self.entities = append(self.entities, &entity) // Tell everyone else that the entity is here. x, y := entity.BlockingPosition() self.Broadcast( self.GetEvent( events.REGION_ENTRANCE, fmt.Sprintf( "%s\n%f %f", entity.BlockingString(), x, y, ), entity, ), ) // Tell the entity about everyone else. for _, regEnt := range self.entities { if regEnt == &entity { continue } x, y := (*regEnt).BlockingPosition() entity.Receive() <- self.GetEvent( events.REGION_ENTRANCE, fmt.Sprintf( "%s\n%f %f", <-((*regEnt).String()), x, y, ), *regEnt, ) } }