def actions_by_behavior(actions):
    """
    Gather a dictionary grouping the actions by behavior (not SubBehaviors). The actions in each
    list are still sorted by order of their execution in the script.

    @param actions (list) of Action objects

    @return (dict) where the keys are behaviors and the values are lists of actions
    """

    split = {}

    for action in actions:
        for behavior in action.behaviors:

            if behavior.name not in split:
                split[behavior.name] = []

            split[behavior.name].append(action)

    return split