Package horizons :: Package scenario :: Module actions
[hide private]
[frames] | no frames]

Module actions

source code

Classes [hide private]
  ActionsRegistry
Class that holds all available action functions.
Functions [hide private]
 
show_message(session, type=None, *messages)
Shows a message with custom text in the messagewidget.
source code
 
show_db_message(session, database_message_id)
Shows a message with predefined text in the messagewidget.
source code
 
show_logbook_entry_delayed(session, *parameters)
Shows a logbook entry and opens the logbook after some seconds.
source code
 
do_win(session)
The player wins the current scenario.
source code
 
goal_reached(session, goal_number)
The player reaches a certain goal in the current scenario.
source code
 
do_lose(session)
The player fails the current scenario.
source code
 
set_var(session, variable, value)
Assigns values to scenario variables.
source code
 
wait(session, seconds)
Postpones any other scenario events for a certain amount of seconds.
source code
 
alter_inventory(session, resource, amount)
Alters the inventory of each settlement.
source code
 
highlight_position(session, where, play_sound=False, color=(0,0,0))
Highlights a position on the minimap.
source code
 
change_tier(session, tier)
Changes the tier of the settlements.
source code
 
spawn_ships(session, owner_id, ship_id, number, *position)
Creates a number of ships controlled by a certain player around a position on the map.
source code
Variables [hide private]
  ACTIONS = ActionsRegistry()
  register = ACTIONS.register
Function Details [hide private]

show_message(session, type=None, *messages)

source code 

Shows a message with custom text in the messagewidget. If you pass more than one message, they are shown simultaneously.

Decorators:
  • @register(name= 'message')

show_db_message(session, database_message_id)

source code 

Shows a message with predefined text in the messagewidget.

Decorators:
  • @register(name= 'db_message')

show_logbook_entry_delayed(session, *parameters)

source code 

Shows a logbook entry and opens the logbook after some seconds. Displays a YAML-defined notification message on logbook close.

Parameters:
  • parameters - list of logbook parameters, including their values. See widgets.logbook:add_captainslog_entry for parameter documentation.
Decorators:
  • @register(name= 'logbook')

do_win(session)

source code 

The player wins the current scenario.

Decorators:
  • @register(name= 'win')

goal_reached(session, goal_number)

source code 

The player reaches a certain goal in the current scenario.

Decorators:
  • @register(name= 'goal_reached')

do_lose(session)

source code 

The player fails the current scenario.

Decorators:
  • @register(name= 'lose')

set_var(session, variable, value)

source code 

Assigns values to scenario variables. Overwrites previous assignments to the same variable.

Decorators:
  • @register()

wait(session, seconds)

source code 

Postpones any other scenario events for a certain amount of seconds.

Decorators:
  • @register()

alter_inventory(session, resource, amount)

source code 

Alters the inventory of each settlement.

Decorators:
  • @register()

highlight_position(session, where, play_sound=False, color=(0,0,0))

source code 

Highlights a position on the minimap. where: (x, y) coordinate tuple color is a optional parameter that defines the color of the highlight.

Decorators:
  • @register()

change_tier(session, tier)

source code 

Changes the tier of the settlements.

Decorators:
  • @register(name= 'change_increment')

spawn_ships(session, owner_id, ship_id, number, *position)

source code 

Creates a number of ships controlled by a certain player around a position on the map.

Parameters:
  • owner_id - the owner worldid
  • ship_id - the ship id
  • number - number of ships to be spawned
  • position - position around the ships to be spawned
Decorators:
  • @register()