"""
VN Scene Script Ext - vnframe11
Provide functions to call VNFrame acts and anime functions

f_stinit, f_acts, f_actm, f_act, f_anime

1.1 - added f_synch and f_animclipnum
1.1.1 - also added synch as synonym for f_synch

Examples:
(init)
:useext:vnframe10
:a:i:f_stinit
(actual actions)
:a:0:f_acts:main:anim:(0,0,0)
:a:2:f_actm:main::{'anim':(7, 20, 2)}
:a:0:f_act:::{'desk': {'move_to': (1.043, 0.000, -0.810)}}
:a:3:f_act:::{'main': {'anim': (0, 4, 0), 'rotate_to': (0.000, 10.000, 0.000), 'anim_spd': 0.000}}
:a:4:f_act:::{'main': {'anim_spd': 1.000}}
:a:5:f_anime:::(({ 'desk': {'move_to': ((1.043, 0.000, -0.810), (1.043, 0.000, -0.362))},}, 1.00, 'linear'),)
:a:0:f_acts:sys:text:('s', 'Start pos!')
"""

import vnframe

def custom_action(game,act):
    """:type game: vngameengine.VNNeoController"""

    # ------- texts --------
    if act["action"] == "f_synch" or act["action"] == "synch":
        # example of simple action
        fid = act["actionparam"]
        mid = act["actionparam2"]

        factor = game.scenef_get_actor(fid)
        mactor = game.scenef_get_actor(mid)
        anime_option_param = (factor.height, factor.breast)

        #if factor.isHAnime:
        factor.set_anime_option_param(anime_option_param)
        #if mactor.isHAnime:
        mactor.set_anime_option_param(anime_option_param)
        return True

    if act["action"] == "f_animclipnum":
        fid = act["actionparam"]
        factor = game.scenef_get_actor(fid)

        curanim = list(factor.get_animate())
        curanim[2] = int(act["actionparam2"])
        factor.animate(curanim[0], curanim[1], curanim[2])

        return True

    import vnscenescriptext_vnframe10
    return vnscenescriptext_vnframe10.custom_action(game,act)


# -----

def debug_buttons(game,state):
    return [] # if we want no additional buttons

    # return in format of set_buttons_alt
    #return ["Demo btn (keitaro10)", demo1]

def demo1(game):
    """:type game: vngameengine.VNNeoController"""
    game.show_blocking_message_time("Some demo message")