intficpy.room module

class intficpy.room.OutdoorRoom(game, name, desc)

Bases: intficpy.room.Room

An OutdoorRoom is a Room with no walls, with ground instead of a floor, and with sky instead of a ceiling.

Parameters
  • game (IFPObject) – the current game

  • name (str) – the title of the room, to print when the player enters or looks around. Spaces are allowed. This name will not become a part of the parser’s vocabulary.

  • desc – the base Room description, to be printed when the player enters this Room, or looks around. The descriptions of any Things the Room contains will be appeneded to this base.

class intficpy.room.Room(game, name, desc)

Bases: intficpy.physical_entity.PhysicalEntity

A Room is a top-level location in the game.

By default, a Room is assumed to be an indoor location with four walls, (north, south, east, and west), a floor, and a ceiling.

Rooms can be connected directly to other Rooms by setting the direction attributes (north, northeast, etc.) of the Room.

If a Room’s dark attribute is set to True, the player will not be able to see while in the Room, unless a LightSource is present.

Parameters
  • game (IFPObject) – the current game

  • name (str) – the title of the room, to print when the player enters or looks around. Spaces are allowed. This name will not become a part of the parser’s vocabulary.

  • desc – the base Room description, to be printed when the player enters this Room, or looks around. The descriptions of any Things the Room contains will be appeneded to this base.

arriveFunc(game)

Override this to trigger custom behaviour when the player enters this room or looks around, before the room description is printed.

This will not trigger unless a LightSource is present if the Room is set to dark=True.

Parameters

game (IFPGame) – the current game

contentsByClass(class_ref)

Get every Thing in the top level contents of this Room (i.e., not inside another Thing) that is an instance of a given Thing subclass. (For instance, get all top level Surfaces.)

Parameters
  • game (IFPGame) – the current game

  • class_ref (type) – the class to filter items on

Return type

list

descFunc(game)

Override this to trigger custom behaviour when the player enters this room or looks around, after the room description is printed.

This will not trigger unless a LightSource is present if the Room is set to dark=True.

Parameters

game (IFPGame) – the current game

describe(game)

Generates and prints the Room description shown when the player enters this Room, or looks around.

If it is too dark to see, only describe the darkness. Otherwise, print the Room description, and the descriptions of the Things that that are currently here.

Returns False if it is too dark to see, and True otherwise.

Parameters

game (IFPGame) – the current game

Return type

bool

describeDark(game)

If this Room is currently dark, describe the darkness. If the Room is lit by a LightSource, describe how the LightSource lights the Room.

Return True if the player will be unable to see anything but darkness, and False otherwise.

Parameters

game (IFPGame) – the current game

Return type

bool

getLocContents(game)

Create a sentence listing the other items in the player’s immediate location, aside from the player.

This is used in describing the Room when the player is inside/on top of/underneath or otherwise nested in a Thing inside this Room.

Parameters

game (IFPGame) – the current game

Return type

str, None

onDiscover(game)

Override this to trigger custom behaviour when the player “discovers” this Room.

Discovery is not triggered until the player receives the description of this Room with full light, i.e. by entering/looking while either this Room’s dark attribute is set to False (default), or a lit LightSource is present.

Parameters

game (IFPGame) – the current game

resolveDarkness(game)

Determine if the player can see, based on this Room’s dark attribute, and whether there is a lit LightSource present

Parameters

game (IFPGame) – the current game

updateDiscovered(game)

Check if the player has discovered this Room before. If not, carry out any behaviour that the creator has specified should occur on this Room’s discovery, and mark this Room as discovered.

Parameters

game (IFPGame) – the current game

class intficpy.room.RoomGroup(game)

Bases: intficpy.ifp_object.IFPObject

RoomGroup provides convenience features for modifying aspects of several Rooms at once. In particular, it allows creators to quickly set & update the ceilings and or floors of all Rooms in the group at once.

This can be useful for making larger scale changes during play. For instance, RoomGroup allows the creator to update the skies of a group of OutdoorRooms all at once, identically, to reflect weather.

Member Rooms can be added individually with addMember, or in a bulk with setMembers. The members can be updated all at once with updateMembers

Parameters

game (IFPObject) – the current game

addMember(member)

Add a single Room to this RoomGroup

Parameters

member (Room) – the Room or OutdoorRoom to add to this RoomGroup

setGroupCeiling(ceiling)

Change the ceiling/sky for all member Rooms to match the ceiling (Thing) provided.

Parameters

ceiling (Thing) – a Thing instance with attributes set to the desired values. The ceilings/skies of all Rooms and OutdoorRooms in this RoomGroup will have their attributes set to match those of the Thing provided.

setGroupFloor(floor)

Change the floor/ground for all member Rooms to match the floor (Thing) provided.

Parameters

floor (Thing) – a Thing instance with attributes set to the desired values. The floors/ground of all Rooms and OutdoorRooms in this RoomGroup will have their attributes set to match those of the Thing provided.

setMembers(members_arr)

Add a list of Rooms to this RoomGroup

Parameters

members_arr (list of Room objects) – the list of Rooms to add to this RoomGroup

updateMembers()

Refresh the member Rooms to match the current ceiling, floor, etc. for this RoomGroup