Detect

Description

The detect() function checks the forward tile infront of Gizmo and returns what it finds. This function consumes energy only if it fails to find a detectable object.

Syntax

detect_info = detect()

Parameters

None.

Return

The function returns an object with the following properties:

  • detected: A boolean indicating if something was detected (True) or not (False).
  • type: A string indicating the object found. If no object is found, returns None.

If a Barrier is detected, the following properties are returned:

  • barrier_is_open: A boolean indicating whether the barrier is currently open (True) or closed (False).
  • barrier_min_closed_time: A float representing the minimum time the barrier stays closed.
  • barrier_max_closed_time: A float representing the maximum time the barrier stays closed.
  • barrier_open_duration: A float representing how long the barrier stays open.

If a Hazard is detected, the following properties are returned:

  • hazard_type: A string describing the type of hazard (Timed or Static).
  • hazard_name: A string representing the name of the hazard ("Pit", "Oil Spill", etc).
  • hazard_active: A boolean indicating whether the hazard is currently active (True) or inactive (False).

If a Station is detected, the following properties are returned:

  • station_name: A string representing the name of the station ("Charge Station", "Repair Station", etc).

If an Interactable is detected, the following properties are returned:

  • interactable_name: A string representing the name of the interactable ("Lever", "Button", etc).
  • interactable_state: A boolean indicating if the interactable is active (True) or inactive (False).

Examples

Here's some examples of how to use the detect() function:

# Check for a barrier in front of Gizmo
detect_info = detect()

if detect_info.detected and detect_info.type == "Barrier":
    print(f"Detected a {detect_info.type}!")
    if detect_info.barrier_is_open:
        print("The barrier is currently open. Move quickly!")
    else:
        print("The barrier is closed. Wait for it to open.")
    print(f"The barrier stays closed for {detect_info.barrier_min_closed_time} to {detect_info.barrier_max_closed_time} seconds.")
    print(f"When open, it stays open for {detect_info.barrier_open_duration} seconds.")
else:
    print("No barrier detected in front of Gizmo.")
# Check for a hazard in front of Gizmo
detect_info = detect()

if detect_info.detected and detect_info.type == "Hazard":
    print(f"Warning! Detected a {detect_info.hazard_name} hazard!")
    print(f"Hazard type: {detect_info.type}")
    if detect_info.hazard_active:
        print("The hazard is currently active. Be careful!")
    else:
        print("The hazard is currently inactive, but stay alert.")
else:
    print("No hazard detected in front of Gizmo. It's safe to proceed.")

Notes

  • The detect() function becomes available at level 5.
  • As you progress through the game, detect() begins to detect additional types of objects.
  • This function consumes energy when it fails to find a detectable object.
  • Use this function to plan your movements around barriers, hazards, etc efficiently.