Code Visualizer

Airborne Vehicle Behavior Visualization

This document presents a comprehensive visualization of an airborne vehicle's behavior using DOT notation, detailing its events, actions, interactions, and sound handling in a simulated environment.


Empty image or helper icon

Prompt

{"airborne"
    {on spawn
        {link_sound	"fall"				"vehicle/airborne/fw_deep"			}

        {add_view	"exhaust_dark_big"	"engine_exhaust"		"FXsmoke1"	}
        {add_view	"exhaust_dark_big"	"engine_exhaust"		"FXsmoke2"	}
        {add_view	"exhaust_dark_big"	"engine_exhaust"		"FXsmoke3"	}
        {add_view	"exhaust_dark_big"	"engine_exhaust"		"FXsmoke4"	}
        {add_view	"exhaust_dark_big"	"engine_exhaust"		"FXsmoke5"	}
        {add_view	"exhaust_dark_big"	"engine_exhaust"		"FXsmoke6"	}
        {add_view	"exhaust_dark_big"	"engine_exhaust"		"FXsmoke7"	}
        {add_view	"exhaust_dark_big"	"engine_exhaust"		"FXsmoke8"	}
        {call "init_gun"}

        {ani_play "wings"}
    }
    {on "add_movement_sound"
        {link_sound "fly"				"vehicle/airborne/fw_move"			}
        {link_sound "engine_start"		"vehicle/airborne/fw_start"			}
        {link_sound "engine_work"		"vehicle/airborne/fw_work"			}
        {link_sound "engine_stop"		"vehicle/airborne/fw_stop"			}
    }
    {on "takeoff"
        {if not dead
            {ani_play "wheels" 0.2}
            {play_sound "fly" 1}
        }
    }
    {on "takeoff_load"
        {ani_wind "wheels" end}
    }
    {on "landing"
        {ani_play "wheels" -0.2}
        {stop_sound "fly"}
    }
    {on engine on overload
        {call "engine_on"}
    }
    {on animation_end "engine_start"
        {ani_play "engine_work" loop}
        {play_sound "engine_work" 1}
    }
    {on engine off overload
        {call "engine_stop"}
        {play_sound "engine_stop"}
    }
    {on "engine_on"
        (mod "mp"
            {if not "engine_started"
                {set "engine_started" 1}
            }
        )
        {if not "engine_started"
            {set "engine_started" 1}
            {play_sound "engine_start"}
            {ani_play "engine_start" callback}
            {view start "engine_exhaust"}
            {delay 1
                {view pause "engine_exhaust"}
            }
        else
            {ani_play "engine_work" loop}
            {play_sound "engine_work" 1}
        }
    }
    {on "update_moveable" overload
        {if chassis "airborne"
            {call "check_work_mover"}
        else chassis "helicopter"
            {call "check_work_mover"}
        }
        {inherited}
    }
    {on "engine_stop"
        {kill_delay "engine_stopped"}
        {if "engine_started"
            {set "engine_started" 0}
            {ani_stop "engine_start"}
            {ani_stop "engine_work"}
            {ani_play "engine_stop"}
            {stop_sound "engine_start"}
            {stop_sound "engine_work"}
            {stop_sound "fly"}
        }
    }
    {on "break_glass"
        {volume disable bullet contact}
        {spawn "glass_hit2" volume x}
        {delay_ex 0.1 uniq
            {bone cut}
        }
    }
    {on break			
        {## if chassis "airborne"	;falling sound
            {if component "body"
                {call "fall"}
            else component "engine"
                {call "fall"}
            else component "engine1"
                {call "fall"}
            else component "engine2"
                {call "fall"}
            }
        }
        {if component "glass"
            {call "break_glass"}
        }
    }
    {on pierce sync
        {vehicle_health_damage_pierce}
    }
    {on "check_work_mover" overload
        {if broken "rotor"
            {movement_limit slow}
        else broken "body"
            {movement_limit slow}
        else broken "engine"
            {movement_limit slow}
        else
            {movement_limit fast}
        }
    }
    {on "fall"
        {if not "fall"
            {set "fall" 1}
            {impulse up 0.1 com}
            {explosive 1}
            {play_sound "fall"}
            {call "fall_fx"}
        }
    }
    {on "fall_fx"
        {delay 2
            {add_view "smoke_aero_dead_big" "fire" "body"}
            {view start "fire"}
            {delay 10
                {view stop "fire"}
            }
            {burn volume "body" fx "smoke_aero_big" time 10 fake}
            {burn volume "engine" fx "smoke_aero_big" time 10 fake}
            {burn volume "engine1" fx "smoke_aero_big" time 10 fake}
            {burn volume "engine2" fx "smoke_aero_big" time 10 fake}
            {delay 10.1
                {burn volume "body" fx "smoke_black" time 40 10 fake}
            }
            ;{burn volume "wingr1" fx "smoke_aero_big" time 5 fake}
            ;{burn volume "wingl1" fx "smoke_aero_big" time 5 fake}
        }
    }
    {on ground_hit sync
        {call "collide"}
        {delay 2.5 1
            {call "explosion"}
        }
    }
    {on contact overload sync
        {if not impregnable
            {if effector "vehicle"
                {if not effector "car"
                    {call "collide"}
                }
            else effector "construction"
                {call "collide"}
            else effector "tree"
                {call "collide"}
            else effector "fence"
                {if volume "part"
                    {call "tear_part"}
                }
            }
        }
    }
    {on "collide"
        {if volume "body"
            {call "explosion"}
        else volume "part"
            {call "tear_part"}
        }
    }
    {on "tear_part"
        {spawn "spheredust_big_short"}
        {component destroy}
        {components "engine" destroy}
        {components "engine1" destroy}
        {components "engine2" destroy}
        {volume disable contact contact_ground}
        {chassis_work 0}
        {tear "piece_big_airborne_wing" bone from_volume
            {impulse up 2 1 dir 2 1}
        }
        {impulse up 0.1 com}
    }

    (define "burn_part"
        {on "burn_%0_start"
            {add_view "smoke_aero_big"		"fire%0" "fx_fire%0_1"}
            {add_view "smoke_aero_big"		"fire%0" "fx_fire%0_2"}
            {add_view "smoke_aero_big"		"fire%0" "fx_fire%0_3"}
            {add_view "smoke_aero_small"	"fire%0" "fx_smoke%0_1"}
            {add_view "smoke_aero_small"	"fire%0" "fx_smoke%0_2"}
            {add_view "smoke_aero_small"	"fire%0" "fx_smoke%0_3"}
            {view start "fire%0"}
        }
        {on "burn_%0_stop"
            {view stop "fire%0"}
        }
    )
    ("burn_part" args 1)
    ("burn_part" args 2)
    ("burn_part" args 3)
    ("burn_part" args 4)

    {on "die"
        {chassis_work 0}
        {drop_orders}
        {components destroy}
        {call "engine_stop"}
        {stop_sound "fall"}
        {stop_sound "engine_stop"}
        {explosive 0}
        {burn stop}
        {bone hide "engine_work"}
    }
    {on "_explosion" overload
        {kill_crew}
        {able select 0}
        {clear_inventory}
        {call "die"}
        {add_view "aero_die" "fire" "body"}
        {add_view "aero_die_fire" "fire" "body"}
        {view start "fire"}
        {spawn "aero_die_particle"}
        {start_sound "crush/big/airborne"}
        {tags add "destroyed"}
        {tags remove "air"}

        {impulse up 0.1 com}
        {delay 0.1
            (define "cut_part"
                {if rand %1
                    {tear "piece_big_airborne_wing" bone %0
                        {impulse up 2 1 dir 2 1}
                    }
                }
            )
            ("cut_part" args "wingr1"		0.5)
            ("cut_part" args "wingl1"		0.5)
            ("cut_part" args "wingr2"		0.5)
            ("cut_part" args "wingl2"		0.5)
            ("cut_part" args "body_back"	0.5)
        }
        {blastwave c4 7 r0 5 r1 8}
    }
    {on "spawn_bomb"
        {spawn "air_bomb_small"}
    }
    {on "kick"
        {impulse up 0.1 com}
    }
    {on "area_disable"
        {area disable}
    }
    {on "area_enable"
        {area enable}
    }
    {on "air_attack"
        {start_sound "vehicle/airborne/air_attack" ambient}
    }

    {on "init_gun"
        {add_view "flash_zenit"	"flashbarrel00"	"barrel00"}
        {add_view "flash_zenit"	"flashbarrel01"	"barrel01"}
        {add_view "flash_zenit"	"flashbarrel02"	"barrel02"}
        {add_view "flash_zenit"	"flashbarrel03"	"barrel03"}
        {add_view "flash_zenit"	"flashbarrel04"	"barrel04"}
    }
    {on fire "zenite"
        (define "fire_barrel"
            name "%0"
                {view start "flashbarrel%0"}
                {delay 0.42
                    {view pause "flashbarrel%0"}
                }
        )

        {	if		("fire_barrel" args 00)
            else	("fire_barrel" args 01)
            else	("fire_barrel" args 02)
            else	("fire_barrel" args 03)
            else	("fire_barrel" args 04)
        }
    }
}

{"airborne no_explosion"
    {on contact
        ;{components "wingleft" destroy}
        ;{components "wingright" destroy}
    }
    {on ground_hit sync
        {call "die"}
        {impulse up 0.1 com}
    }
    {on "_explosion" overload
        {call "die"}
        {impulse up 0.1 com}
        ("cut_part" args "wingr2" 0.5)
        ("cut_part" args "wingl2" 0.5)
    }
    {on "fall_fx" overload
    }
}

Answer

Code Visualization Using DOT Notation

This document provides a visual representation of the specified code snippet using DOT notation. The code represents an airborne vehicle's behavior in a simulated environment, detailing various events, actions, and sounds associated with it.

DOT Notation Structure

Nodes and Relationships

  • airborne
    • on spawn
      • link_sound
      • add_view
      • call "init_gun"
      • ani_play
    • on "add_movement_sound"
      • link_sound
    • on "takeoff"
      • if not dead
        • ani_play
        • play_sound
    • on "takeoff_load"
      • ani_wind
    • on "landing"
      • ani_play
      • stop_sound
    • on engine on overload
      • call "engine_on"
    • on animation_end "engine_start"
      • ani_play
      • play_sound
    • on engine off overload
      • call "engine_stop"
      • play_sound
    • on "engine_on"
      • mod "mp"
        • if not "engine_started"
          • set "engine_started"
        • play_sound
        • ani_play
        • view start
        • delay
      • else
        • ani_play
        • play_sound
    • on "update_moveable" overload
      • if chassis "airborne"
        • call "check_work_mover"
      • else
        • call "check_work_mover"
      • inherited
    • on "engine_stop"
      • kill_delay
      • if "engine_started"
        • set
        • ani_stop
        • play_sound
    • on "break_glass"
      • volume disable bullet contact
      • spawn
      • delay_ex
    • on break
      • if chassis "airborne"
        • if component
          • call "fall"
      • if component "glass"
        • call "break_glass"
    • on pierce sync
      • vehicle_health_damage_pierce
    • on "check_work_mover" overload
      • if broken "rotor"
        • movement_limit slow
      • else
        • movement_limit fast
    • on "fall"
      • if not "fall"
        • set "fall"
        • impulse
        • explosive
        • play_sound
        • call "fall_fx"
    • on "fall_fx"
      • delay
      • add_view
      • view start
      • burn volume
      • delay
    • on ground_hit sync
      • call "collide"
      • delay
    • on contact overload sync
      • if not impregnable
        • if effector
          • call "collide"
    • on "collide"
      • if volume
        • call "explosion"
    • on "tear_part"
      • spawn
      • component destroy
      • volume disable contact contact_ground

Functions Defined

  • (define "burn_part"
    • on "burn_%0_start"
    • on "burn_%0_stop" ) ("burn_part" args 1-4)

Subgroup: airborne no_explosion

  • airborne no_explosion
    • on contact
    • on ground_hit sync
      • call "die"
    • on "_explosion" overload
      • call "die"
    • on "fall_fx" overload

Visual Representation in DOT Notation

digraph G {
    node [shape=box];

    airborne -> "on spawn" -> { link_sound add_view call "init_gun" ani_play };
    airborne -> "on add_movement_sound" -> { link_sound };
    airborne -> "on takeoff" -> { if_not dead -> { ani_play play_sound } };
    airborne -> "on takeoff_load" -> { ani_wind };
    airborne -> "on landing" -> { ani_play stop_sound };
    airborne -> "on engine on overload" -> { call "engine_on" };
    airborne -> "on animation_end 'engine_start'" -> { ani_play play_sound };
    airborne -> "on engine off overload" -> { call "engine_stop" play_sound };
    airborne -> "on engine_on" -> { mod "mp" -> { if_not "engine_started" -> { set "engine_started" } } };
    airborne -> "on update_moveable overload" -> { if_chassis "airborne" -> { call "check_work_mover" } inherited };
    airborne -> "on engine_stop" -> { kill_delay; if "engine_started" -> { set ani_stop play_sound } };
    airborne -> "on break_glass" -> { volume_disable bullet contact spawn delay_ex };
    airborne -> "on break" -> { if_chassis "airborne" -> { if_component -> call "fall" } };
    airborne -> "on pierce sync" -> { vehicle_health_damage_pierce };
    airborne -> "on check_work_mover overload" -> { if_broken "rotor" -> { movement_limit slow } else -> { movement_limit fast } };
    airborne -> "on fall" -> { if_not "fall" -> { set "fall"; impulse explosive play_sound call "fall_fx" } };
    airborne -> "on fall_fx" -> { delay add_view view "fire" burn delay };

    "on ground_hit sync" -> { call "collide" delay };
    "on contact overload sync" -> { if_not impregnable -> { ... } };
    "on collide" -> { if_volume -> { call "explosion" } };
    "on tear_part" -> { spawn component_destroy volume_disable contact_contact_ground };
    
    "burn_part" -> { on "burn_%0_start" on "burn_%0_stop" };
    "airborne no_explosion" -> { on contact on ground_hit sync call "die" };
}

Conclusion

The provided DOT representation encapsulates the critical event-handling functions of an airborne vehicle, facilitating better understanding of its structure and interactions within the code environment. For further learning on code visualization practices, consider the courses available on the Enterprise DNA Platform.

Create your Thread using our flexible tools, share it with friends and colleagues.

Your current query will become the main foundation for the thread, which you can expand with other tools presented on our platform. We will help you choose tools so that your thread is structured and logically built.

Description

This document presents a comprehensive visualization of an airborne vehicle's behavior using DOT notation, detailing its events, actions, interactions, and sound handling in a simulated environment.