RanvierMUD / ranviermud

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

Items are searched by get command in confusing order. #247

Closed seanohue closed 7 years ago

seanohue commented 7 years ago

Description

When looting corpses, for example, one might expect the one that was felled most recently to be the first one searched (since it is least likely to be empty). Since room items are Sets, and Sets are iterated over in insertion order, it may be useful to have a method for iterating in reverse order. (easiest way is just to convert the Set to an Array then reverse the Array, inside of the get command script).

Expected outcome

If I kill a mob, loot its corpse, then kill a second in the same room and loot its corpse, the loot or get all command will search the most recently created corpse container. (gruesome, I know)

Actual outcome

The get all command searches the first-inserted corpse container, which is the empty one, so I have to do get all 2.corpse.

Steps to reproduce

Log onto the default server, move to a room with multiple training dummies, and kill one of them. Loot it, kill another, and attempt to loot the second without using dot notation.

Version of Ranvier

v1.1.1

seanohue commented 7 years ago

Updated this since the solution of abstracting a RoomEntitiesList seems silly to fix just a single edge case.