earwax.story.edit_level module

Provides the EditLevel class.

class earwax.story.edit_level.EditLevel(game: Game, world_context: StoryContext, cursor_sound: Optional[earwax.sound.Sound] = None, inventory: List[earwax.story.world.RoomObject] = NOTHING, reverb: Optional[GlobalFdnReverb] = None, object_ambiances: Dict[str, List[earwax.ambiance.Ambiance]] = NOTHING, object_tracks: Dict[str, List[earwax.track.Track]] = NOTHING, filename: Optional[pathlib.Path] = None, builder_menu_actions: List[earwax.action.Action] = NOTHING)

Bases: earwax.story.play_level.PlayLevel

A level for editing stories.

add_action(obj: Union[earwax.story.world.RoomObject, earwax.story.world.RoomExit, earwax.story.world.StoryWorld], name: str) → Callable[[], None]

Add a new action to the given object.

Parameters:
  • obj – The object to assign the new action to.
  • name – The attribute name to use.
add_ambiance(ambiances: List[earwax.story.world.WorldAmbiance]) → Callable[[], Generator[None, None, None]]

Add a new ambiance to the given list.

ambiance_menu(ambiances: List[earwax.story.world.WorldAmbiance], ambiance: earwax.story.world.WorldAmbiance) → Callable[[], Generator[None, None, None]]

Push the edit ambiance menu.

ambiances_menu() → Generator[None, None, None]

Push a menu that can edit ambiances.

builder_menu() → Generator[None, None, None]

Push the builder menu.

configure_reverb() → None

Configure the reverb for the current room.

create_exit() → Generator[None, None, None]

Link this room to another.

create_menu() → Generator[None, None, None]

Show the creation menu.

create_object() → None

Create a new object in the current room.

create_room() → None

Create a new room.

delete() → None

Delete the currently focused object.

delete_ambiance(ambiances: List[earwax.story.world.WorldAmbiance], ambiance: earwax.story.world.WorldAmbiance) → Callable[[], None]

Delete the ambiance.

describe_room() → Generator[None, None, None]

Set the description for the current room.

edit_action(obj: Union[earwax.story.world.RoomObject, earwax.story.world.RoomExit, earwax.story.world.StoryWorld], action: earwax.story.world.WorldAction) → Callable[[], None]

Push a menu that allows editing of the action.

Parameters:
  • obj – The object the action is attached to.
  • action – The action to edit (or delete).
edit_ambiance(ambiance: earwax.story.world.WorldAmbiance) → Callable[[], Generator[None, None, None]]

Edit the ambiance.

edit_object_class(class_: earwax.story.world.RoomObjectClass) → Callable[[], None]

Push a menu for editing object classes.

Parameters:class – The object class to edit.
edit_object_class_names() → None

Push a menu that can edit object class names.

edit_object_classes() → None

Push a menu for editing object classes.

edit_volume_multiplier(ambiance: earwax.story.world.WorldAmbiance) → Callable[[], Generator[None, None, None]]

Return a callable that can be used to set an ambiance volume multiplier.

Parameters:ambiance – The ambiance whose volume multiplier will be changed.
get_rooms(include_current: bool = True) → List[earwax.story.world.WorldRoom]

Return a list of rooms from this world.

Parameters:include_current – If this value is True, the current room will be included.
goto_room() → Generator[None, None, None]

Let the player choose a room to go to.

object_actions() → Generator[None, None, None]

Push a menu that lets you configure object actions.

remessage() → Optional[Generator[None, None, None]]

Set a message on the currently-focused object.

rename() → Generator[None, None, None]

Rename the currently focused object.

reposition_object() → None

Reposition the currently selected object.

room

Return the current room.

save_world() → None

Save the world.

set_action_sound(action: earwax.story.world.WorldAction) → Generator[None, None, None]

Set the sound on the given action.

Parameters:action – The action whose sound will be changed.
set_message(action: earwax.story.world.WorldAction) → Generator[None, None, None]

Push an editor to set the message on the provided action.

Parameters:action – The action whose message attribute will be modified.
set_name(obj: Union[earwax.story.world.WorldAction, earwax.story.world.RoomObject, earwax.story.world.WorldRoom]) → Generator[None, None, None]

Push an editor that can be used to change the name of obj.

Parameters:obj – The object to rename.
set_object_type() → None

Change the type of an object.

set_world_messages() → Generator[None, None, None]

Push a menu that allows the editing of world messages.

set_world_sound(name: str) → Callable[[], Generator[None, None, None]]

Set the given sound.

Parameters:name – The name of the sound to edit.
shadow_description() → None

Set the description of this room from another room.

shadow_name() → None

Sow a menu to select another room whose name will be shadowed.

sounds_menu() → Optional[Generator[None, None, None]]

Add or remove ambiances for the currently focused object.

world_sounds() → Generator[None, None, None]

Push a menu that can be used to configure world sounds.

class earwax.story.edit_level.ObjectPositionLevel(game: Game, object: Union[earwax.story.world.RoomObject, earwax.story.world.RoomExit], level: EditLevel, initial_position: Optional[earwax.story.world.DumpablePoint] = NOTHING)

Bases: earwax.level.Level

A level for editing the position of an object.

Variables:
  • object – The object or exit whose position will be edited.
  • level – The edit level which pushed this level.
backward() → None

Move the sound backwards.

cancel() → None

Undo the move, and return everything to how it was.

clear() → None

Clear the object position.

done() → None

Finish editing.

down() → None

Move the sound down.

forward() → None

Move the sound forwards.

get_initial_position() → Optional[earwax.story.world.DumpablePoint]

Get the object position.

left() → None

Move the sound left.

move(x: int = 0, y: int = 0, z: int = 0) → None

Change the position of this object.

reset() → None

Reset the current room.

right() → None

Move the sound right.

up() → None

Move the sound up.

earwax.story.edit_level.push_actions_menu(game: earwax.game.Game, actions: List[earwax.story.world.WorldAction], activate: Callable[[earwax.story.world.WorldAction], Optional[Generator[None, None, None]]]) → Generator[None, None, None]

Push a menu that lets the player select an action.

Parameters:
  • game – The game to use when constructing the menu.
  • actions – A list of actions to show.
  • activate – A function to call with the chosen action.
earwax.story.edit_level.push_rooms_menu(game: earwax.game.Game, rooms: List[earwax.story.world.WorldRoom], activate: Callable[[earwax.story.world.WorldRoom], Optional[Generator[None, None, None]]]) → Generator[None, None, None]

Push a menu with all the provided rooms.

Parameters:
  • game – The game to pop this level from when a room is selected.
  • rooms – The rooms which should show up in the menu.
  • activate – The function to call with the selected room.