RanvierMUD / ranviermud

A node.js based MUD game engine
https://ranviermud.com
MIT License
796 stars 247 forks source link

Cannot flee during battle #304

Closed bostrt closed 6 years ago

bostrt commented 6 years ago

Description

During battle sequence, cannot flee:

Client side:

> flee

Server side:

2017-12-12T15:27:01.137Z - error:  TypeError: Cannot read property 'direction' of undefined
    at Command.func (/home/mud/ranviermud/bundles/ranvier-combat/commands/flee.js:15:57)
    at TelnetStream.player.socket.once.error (/home/mud/ranviermud/bundles/ranvier-input-events/input-events/commands.js:40:30)
    at TelnetStream.g (events.js:292:16)
    at emitOne (events.js:96:13)
    at TelnetStream.emit (events.js:188:7)
    at TelnetSocket.socket.on.message (/home/mud/ranviermud/bundles/ranvier-telnet/lib/TelnetStream.js:16:12)
    at emitOne (events.js:96:13)
    at TelnetSocket.emit (events.js:188:7)
    at TelnetSocket.input (/home/mud/ranviermud/bundles/ranvier-telnet/node_modules/ranvier-telnet/index.js:328:10)
    at Socket.connection.on (/home/mud/ranviermud/bundles/ranvier-telnet/node_modules/ranvier-telnet/index.js:176:16)

Expected outcome

Ability to flee or error message on client side indicating inability

Steps to reproduce

  1. Initiate battle
  2. type flee or flee <direction> command

Version of Ranvier

# ./ranvier --version
2.0.0
shawncplus commented 6 years ago

I can't replicate this, did you try to run this command in a room without exits?

bostrt commented 6 years ago

I thought the room would have inferred exits like in http://ranviermud.com/extending/areas/rooms/#rooms-with-coordinates .

Here is a reproducer rooms.yml:

- id: start
  behaviors: {}
  coordinates:
    - 0
    - 0
    - 0
  description: This is where it begins.
  doors: {}
  items: []
  meta: {}
  npcs:
    - {id: 'test:4'}
  script: null
  title: Starting point
  exits: []
- id: end
  behaviors: {}
  coordinates:
    - 0
    - 1
    - 0
  description: >-
    A large room.
  doors: {}
  items: []
  meta: {}
  npcs:
    - {id: 'test:3'}
  script: null
  title: End room
shawncplus commented 6 years ago

Yep looks like flee wasn't updated to support rooms with coordinates, will fix