<commit_before>Entity   = require 'models/Entity'
mediator = require 'mediator'

module.exports = class Event extends Entity

  mediator.factory['Event'] = this


  constructor: (x, y, width, height, owningLevel, settings) ->
    # settings.physicsType = 'static'
    # settings.isSensor    = true

    super x, y, width, height, owningLevel, settings

    @triggered = false


  onTouchEnd: (body, point, impulse) =>
    if not @triggered
      @triggered = true
      player = body.GetUserData().ent
      that = @
      dm = mediator.dialogManager

      dm.hideDialog()

      @y.blockInput()
      @y.moveDown 150
      ###
      @y.moveLeft 200
      @y.moveRight 10
      @y.moveLeft 10
      @y.moveRight 10
      @y.moveLeft 10
      @y.moveRight 10
      @y.moveLeft 10
      @y.moveRight 10
      @y.moveLeft 10
      @y.moveRight 10
      @y.moveLeft 10
      ###

      pos =
        x: 324
        y: 188

      @y.moveToPosition(pos, 42)
      @y.addTask ->
        data =
          "text": "Nice skin! Give it to me!"
          "options": [
            "Ok!",
            "NO!"]

        dm.showDialog data, (result) ->
          if result is 1
            player.atlas.src = 'atlases/nick.png'
            data =
              "text": "Very good choice!"
              "options": [
                "F... You"
              ]
            dm.showDialog data, ->
              that.unblockInput()
          else if result is 2
            data =
              "text": "Well, ok, what now?"
              "options": [
                "Follow me and everything will be alright!"
              ]
            dm.showDialog data, ->
              that.unblockInput()
<commit_msg>Yeti follows you when you tell him to<commit_after>Entity   = require 'models/Entity'
mediator = require 'mediator'

module.exports = class Event extends Entity

  mediator.factory['Event'] = this


  constructor: (x, y, width, height, owningLevel, settings) ->
    # settings.physicsType = 'static'
    # settings.isSensor    = true

    super x, y, width, height, owningLevel, settings

    @triggered = false


  onTouchEnd: (body, point, impulse) =>
    if not @triggered
      @triggered = true
      player = body.GetUserData().ent
      that = @
      dm = mediator.dialogManager

      dm.hideDialog()

      @y.blockInput()
      @y.moveDown 150
      ###
      @y.moveLeft 200
      @y.moveRight 10
      @y.moveLeft 10
      @y.moveRight 10
      @y.moveLeft 10
      @y.moveRight 10
      @y.moveLeft 10
      @y.moveRight 10
      @y.moveLeft 10
      @y.moveRight 10
      @y.moveLeft 10
      ###

      pos =
        x: 324
        y: 188

      @y.moveToPosition(pos, 42)
      @y.addTask ->
        data =
          "text": "Nice skin! Give it to me!"
          "options": [
            "Ok!",
            "NO!"]

        dm.showDialog data, (result) ->
          if result is 1
            player.atlas.src = 'atlases/nick.png'
            data =
              "text": "Very good choice!"
              "options": [
                "F... You"
              ]
            dm.showDialog data, ->
              that.unblockInput()
          else if result is 2
            data =
              "text": "Well, ok, what now?"
              "options": [
                "Follow me and everything will be alright!"
              ]
            dm.showDialog data, ->
              that.y.moveToPosition(player.position, 30)
              that.unblockInput()

{'fraction_non_alphanumeric': 0.11281457911483946, 'fraction_numerical': 0.021405843216661846, 'mean_word_length': 1.4612099644128114, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '201552', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1014, 'n_words': 277}