Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Roads

Now, that we know what Cell is. We need a way to connect them with each other, unless we want them floating around doing nothing. And to do we use a Road that creates bridges across them.

A Road is essentially a path that connects a GateExit to a GateEntrance in a one-way direction. With it we can connect two Cells along their gates.

Conditions

However a Road is not a free pass through, each Road can have multiple conditions bound to it. And these conditions can be coded by inserting a Callback (a callback is a function that is passed as a value). Here’s an example of an array of conditions:

local conditions = {
	---@param animbus DS_AnimBus
	function(animbus)
        ---In here is a code that picks the first actor, and checks if they are a female, and doesn't have a penis.
		local main_actor = animbus.actors[1]
		return not main_actor.is_female and not main_actor.has_penis
	end,

    ---@param animbus DS_AnimBus
    function(animbus)
        ---A Code that checks if the bus is at 50% of its speed.
        return animbus.current_speed > 0.5
    end
}

Every condition will need to be true for the road to be passable, and if not, the road will remain blocked. You also might see that we are using an AnimBus here; we will soon explain what this is, but for now keep in mind that they guide our animations by storing our Actors.

If a Road has no conditions applied to it. It will remain free for everyone to pass through. Though it is recommended to always create conditions to avoid complications.

Transitions

Each Road can have a transition animation imbued into them. These animations will play once, when the road gets used up. These transitions can too have its own animation events, mainly used to emit sounds of characters or trigger custom logic.

Actor Reorder

In some VERY specific circumstances, you might encounter situations where you want to connect two Stages together with a Road. However, both Stages don’t match its actors’ ordering. With Stage A having a player actor at index 1, and zombie at index 2. While Stage B is in reverse order, zombie at 1, and player at 2.

In these situations we can imbue an actor reorder, which can switch actors positions with each other. In here we can have this simple reordering table.

local reordering_A = {2, 1}
-- In here reordering_A will make actor_1 go at the second position, 
-- and actor_1 at the first position

local reordering_B = {3, 1, 2}
-- Now in here, this reordering will pick actor_1, and put at second, 
-- actor_2 at last, and actor_3 on first.

Keep in mind that these reordering tables should be used during the creation of an Animation Kit. Which we still need to explain, but we are getting in there.