Skip to content

Adding new trash receptacles

Mahtra edited this page Feb 22, 2023 · 9 revisions

Do I need to add a trash receptacle?

Yes if
   >;eq DRCI.dispose_trash("rock")
   You drop a rock.
No if
  >;eq DRCI.dispose_trash("rock")
  You drop a rock in a tangle of thick roots forming a dark gap.

How to determine the noun of the receptacle as determined by lich:

In our example room we have two objects:

  >;eq echo DRRoom.room_objs
  [exec1: ["sprig of four-leafed clover", "tangle of thick roots forming a dark gap"]]

We use DRC.get_noun to get the noun of the receptacle (in this case, it’s the "tangle of thick roots forming a dark gap")

  >;eq echo DRRoom.room_objs.reject { |obj| obj =~ /azure \w+ tree/ }.map { |long_name| DRC.get_noun(long_name) }
  [exec1: ["sprig", "tangle"]]

The noun according to lich is "tangle" which is what we append to @@trash_storage in common-items.lic

In this case, we don’t actually use "tangle" in game, the in-game noun is "gap", hence we need to create a special case to map the "tangle" to "gap".

Note I opted to make it a "dark gap" which works in game, and is more specific than plain "gap". Try to always use adjective+noun when possible.

>put my rock in tangle
What were you referring to?
>put my rock in dark gap
You drop a rock in a tangle of thick roots forming a dark gap.

In the DRCI.dispose_trash method, we need to add an elsif for this

      elsif trashcan == 'tangle'
        trashcan = 'dark gap' if DRRoom.room_objs.include?('tangle of thick roots forming a dark gap')

If by contrast, "put my rock in tangle" worked, we wouldn’t need this special case, and just appending "tangle" to @@trash_storage would have sufficed.

Some example PRs for adding receptacles.

PR#5919 Which has the example used above.

PR#5891 Which has a simple example where the nouns match.

PR#6409 Which has a gelapod at the pond, which wasn’t even seen as a room object.

Clone this wiki locally