<commit_before>angular.module 'IdleLands'
.controller 'PlayerMap', [
  '$scope', '$timeout', 'CurrentPlayer', 'CurrentMap', 'BaseURL'
  ($scope, $timeout, Player, CurrentMap, BaseURL) ->

    $scope.currentMap = {}

    # map variables
    sprite = null
    game = null
    mapName = null
    newMapName = null
    text = null
    objectGroup = null
    itemText = ''

    handleObjects = ->
      _.each objectGroup.children, (child) ->

        child.inputEnabled = yes

        child.events.onInputOver.add ->
          itemText = ''
          itemText = "#{child.realtype}: #{child.name}" if child.realtype and child.realtype isnt 'Door'

          itemText += "\n\"#{child.flavorText}\"" if child.flavorText

          requires = no
          requirementText = '\nRequirements\n-------------------'
          if child.requireAchievement then requirementText += "\nAchievement: #{child.requireAchievement}";requires=yes
          if child.requireBoss        then requirementText += "\nBoss Kill: #{child.requireBoss}";requires=yes
          if child.requireClass       then requirementText += "\nClass: #{child.requireClass}";requires=yes
          if child.requireCollectible then requirementText += "\nCollectible: #{child.requireCollectible}";requires=yes
          if child.requireHoliday     then requirementText += "\nHoliday: #{child.requireHoliday}";requires=yes
          if child.requireRegion      then requirementText += "\nRegion Visited: #{child.requireHoliday}";requires=yes
          if child.requireMap         then requirementText += "\Map Visited: #{child.requireHoliday}";requires=yes

          itemText = "#{itemText}\n#{requirementText}" if requires

        child.events.onInputOut.add ->
          itemText = ''

    hoverText = ->
      coordinates = ((game.camera.x+game.input.x)//16) + ', ' + ((game.camera.y+game.input.y)//16)
      "Hovering (#{coordinates})\n#{itemText}"

    textForPlayer = (player) ->
      "#{player.map} (#{player.mapRegion})\n#{player.x}, #{player.y}\n\n#{hoverText()}"

    $scope.drawMap = ->
      return if _.isEmpty $scope.currentMap
      player = $scope.player

      newMapName = player.map if not newMapName

      if text
        text.text = textForPlayer player

      if sprite
        sprite.x = (player.x*16)
        sprite.y = (player.y*16)
        game.camera.x = sprite.x
        game.camera.y = sprite.y

        if player.map isnt mapName
          newMapName = player.map
          mapName = player.map

      phaserOpts =
        preload: ->
          @game.load.image 'tiles', "#{BaseURL}/img/tiles.png", 16, 16
          @game.load.spritesheet 'interactables', "#{BaseURL}/img/tiles.png", 16, 16
          @game.load.tilemap newMapName, null, $scope.currentMap.map, Phaser.Tilemap.TILED_JSON

        create: ->
          map = @game.add.tilemap newMapName
          map.addTilesetImage 'tiles', 'tiles'
          terrain = map.createLayer 'Terrain'
          terrain.resizeWorld()
          map.createLayer 'Blocking'

          objectGroup = @game.add.group()

          for i in [1, 2, 12, 13, 14, 15, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 35]
            map.createFromObjects 'Interactables', i, 'interactables', i-1, yes, no, objectGroup

          handleObjects()

          sprite = @game.add.sprite player.x*16, player.y*16, 'interactables',
            switch player.gender
              when 'male' then 12
              when 'female' then 13<commit_msg>show two new icons on interactable layer where applicable<commit_after>angular.module 'IdleLands'
.controller 'PlayerMap', [
  '$scope', '$timeout', 'CurrentPlayer', 'CurrentMap', 'BaseURL'
  ($scope, $timeout, Player, CurrentMap, BaseURL) ->

    $scope.currentMap = {}

    # map variables
    sprite = null
    game = null
    mapName = null
    newMapName = null
    text = null
    objectGroup = null
    itemText = ''

    handleObjects = ->
      _.each objectGroup.children, (child) ->

        child.inputEnabled = yes

        child.events.onInputOver.add ->
          itemText = ''
          itemText = "#{child.realtype}: #{child.name}" if child.realtype and child.realtype isnt 'Door'

          itemText += "\n\"#{child.flavorText}\"" if child.flavorText

          requires = no
          requirementText = '\nRequirements\n-------------------'
          if child.requireAchievement then requirementText += "\nAchievement: #{child.requireAchievement}";requires=yes
          if child.requireBoss        then requirementText += "\nBoss Kill: #{child.requireBoss}";requires=yes
          if child.requireClass       then requirementText += "\nClass: #{child.requireClass}";requires=yes
          if child.requireCollectible then requirementText += "\nCollectible: #{child.requireCollectible}";requires=yes
          if child.requireHoliday     then requirementText += "\nHoliday: #{child.requireHoliday}";requires=yes
          if child.requireRegion      then requirementText += "\nRegion Visited: #{child.requireHoliday}";requires=yes
          if child.requireMap         then requirementText += "\Map Visited: #{child.requireHoliday}";requires=yes

          itemText = "#{itemText}\n#{requirementText}" if requires

        child.events.onInputOut.add ->
          itemText = ''

    hoverText = ->
      coordinates = ((game.camera.x+game.input.x)//16) + ', ' + ((game.camera.y+game.input.y)//16)
      "Hovering (#{coordinates})\n#{itemText}"

    textForPlayer = (player) ->
      "#{player.map} (#{player.mapRegion})\n#{player.x}, #{player.y}\n\n#{hoverText()}"

    $scope.drawMap = ->
      return if _.isEmpty $scope.currentMap
      player = $scope.player

      newMapName = player.map if not newMapName

      if text
        text.text = textForPlayer player

      if sprite
        sprite.x = (player.x*16)
        sprite.y = (player.y*16)
        game.camera.x = sprite.x
        game.camera.y = sprite.y

        if player.map isnt mapName
          newMapName = player.map
          mapName = player.map

      phaserOpts =
        preload: ->
          @game.load.image 'tiles', "#{BaseURL}/img/tiles.png", 16, 16
          @game.load.spritesheet 'interactables', "#{BaseURL}/img/tiles.png", 16, 16
          @game.load.tilemap newMapName, null, $scope.currentMap.map, Phaser.Tilemap.TILED_JSON

        create: ->
          map = @game.add.tilemap newMapName
          map.addTilesetImage 'tiles', 'tiles'
          terrain = map.createLayer 'Terrain'
          terrain.resizeWorld()
          map.createLayer 'Blocking'

          objectGroup = @game.add.group()

          for i in [1, 2, 12, 13, 14, 15, 16, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 35, 37]
            map.createFromObjects 'Interactables', i, 'interactables', i-1, yes, no, objectGroup

          handleObjects()

          sprite = @game.add.sprite player.x*16, player.y*16, 'interactables',
            switch player.gender
              when 'male' then 12
              when 'female' then 13
{'fraction_non_alphanumeric': 0.13839541547277937, 'fraction_numerical': 0.019197707736389683, 'mean_word_length': 2.3871906841339157, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '821919', 'n_tokens_mistral': 2257, 'n_tokens_neox': 2089, 'n_words': 473}