Iñigo Valentin пре 1 недеља
родитељ
комит
1489daec88

+ 13 - 5
data/data/config/config.cfg

@@ -2,12 +2,12 @@ set camera_speed 10.05
 camera_free true
 set_log_level 2
 set console_notification false
-set debug_fps false
-set debug_entity 1
+set debug_fps true
+set debug_entity 2
 set debug_trigger true
 set debug_walkmesh true
 set debug_script 1
-set debug_ui 2
+set debug_ui 0
 resolution 1024 768 0
 
 bind F11 "toggle timer_scale_game 0.0 1.0"
@@ -36,11 +36,19 @@ bind F12 "screenshot"
 
 set_language english
 
-bind_game_event Space "message_ok"
 bind_game_event Up "message_up"
 bind_game_event Down "message_down"
 
-bind_game_event Space "interact"
+bind_game_event Enter "CONFIRM"
+bind_game_event Space "CONFIRM"
+bind_game_event Escape "CANCEL"
+bind_game_event M "MENU"
+bind_game_event BackSpace "EXTRA"
+bind_game_event P "START"
+bind_game_event V "SELECT"
+bind_game_event PGDN "R1"
+bind_game_event PGUP "L1"
+
 bind_game_event LCtrl "run"
 bind_game_event Up "walk_up"
 bind_game_event Right "walk_right"

+ 6 - 6
data/data/scripts/battle/battle_ui.lua

@@ -165,7 +165,7 @@ UiContainer.BattleUi = {
                     cursor:set_default_animation("Position" .. tostring(self.cursor_command))
                     audio_manager:play_sound("Cursor")
                 end
-            elseif button == "Escape" then
+            elseif button == Config.ACTIONS.CANCEL then
                 -- Push the current character to the end of the command queue, and show the first.
                 local new_queue = {}
                 for i = 1, #self.command_queue do
@@ -175,7 +175,7 @@ UiContainer.BattleUi = {
                 self.command_queue = new_queue
                 audio_manager:play_sound("Cursor")
                 self:show_commands(self.command_queue[1])
-            elseif button == "Enter" then
+            elseif button == Config.ACTIONS.CONFIRM then
                 -- Check if a menu must be shown
                 local cmd = Game.Commands[self.party[self.current_character_window].command[self.cursor_command]]
                 if cmd.menu == Battle.Menu.NONE then print("DIRECT COMMAND")
@@ -193,7 +193,7 @@ UiContainer.BattleUi = {
             end
             -- TODO: Rest of cases
             local cursor = ui_manager:get_widget("BattleUi.Container.Bottom.List.Cursor")
-            if button == "LCtrl" then
+            if button == Config.ACTIONS.CANCEL then
                 audio_manager:play_sound("Cursor")
                 self:close_list()
             elseif button == "Down" then
@@ -222,12 +222,12 @@ UiContainer.BattleUi = {
                     self.first_list = self.first_list - 1
                     self:repopulate_list()
                 end
-            elseif button == "Enter" then
+            elseif button == Config.ACTIONS.CONFIRM then
                 audio_manager:play_sound("Cursor")
                 self:select_target()
             end
         elseif self.window_state == "target" then
-            if button == "LCtrl" then
+            if button == Config.ACTIONS.CANCEL then
                 audio_manager:play_sound("Cursor")
                 self:close_target()
             elseif button == "Up" then
@@ -396,7 +396,7 @@ UiContainer.BattleUi = {
                     elseif prev_mode == Battle.TargetType.SINGLE then self.target_type = Battle.TargetType.GROUP
                     end
                 end
-            elseif button == "Enter" then
+            elseif button == Config.ACTIONS.CONFIRM then
                 -- Determine target type and target index
                 if self.target_options.fixed_row == 1 then
                     if self.target_options.default_enemy == 1 then

+ 12 - 8
data/data/scripts/config.lua

@@ -4,14 +4,18 @@ Config = {
         RIGHT = "Right",
         UP = "Up",
         DOWN = "Down",
-        ACTION = "Enter",
-        CANCEL = "Escape",
-        EXTRA = "BackSpace",
-        MENU = "M",
-        PAUSE = "P",
-        SELECT = "V",
-        PGDN = "PGDN",
-        PDUP = "PGUP",
+    },
+    ACTIONS = {
+        CONFIRM = "CONFIRM",
+        CANCEL = "CANCEL",
+        MENU = "MENU",
+        EXTRA = "EXTRA",
+        START = "START",
+        SELECT = "SELECT",
+        R1 = "R1",
+        R2 = "R2",
+        L1 = "L1",
+        L2 = "L2",
     },
     WINDOW = {
         TOP_LEFT = {

+ 2 - 2
data/data/scripts/menu/begin_menu.lua

@@ -23,12 +23,12 @@ if UiContainer == nil then UiContainer = {} end
         --- Handles button events.
         --
         -- Handles directional Up, Down and Enter keys.
-        -- @param button Pressed button string key. Config.CONTROLS.UP, Config.CONTROLS.LEFT, Config.CONTROLS.ACTION and Config.CONTROLS.CANCEL are handled.
+        -- @param button Pressed direction or action name.
         -- @param event Trigger event. Normally, "Press".
         on_button = function(self, button, event)
         if UiContainer.current_menu == "begin" then
             local cursor = ui_manager:get_widget("BeginMenu.Container.Cursor")
-            if button == Config.CONTROLS.ACTION and event == "Press" then
+            if button == Config.ACTIONS.CONFIRM and event == "Press" then
                 if self.position == 1 then -- New game
                     audio_manager:play_sound("Window")
                     generate_control_key()

+ 5 - 5
data/data/scripts/menu/equip_menu.lua

@@ -56,14 +56,14 @@ UiContainer.EquipMenu = {
     --- Handles button events.
     --
     -- For the current submenu, handles directional keys, enter and escape events.
-    -- @param button Pressed button string key. Config.CONTROLS.UP, Config.CONTROLS.LEFT, Config.CONTROLS.ACTION and Config.CONTROLS.CANCEL are handled.
+    -- @param button Pressed direction or action name.
     -- @param event Trigger event. Normally, "Press".
     on_button = function(self, button, event)
         if UiContainer.current_menu == "equip" then
             if UiContainer.current_submenu == "" then
                 -- TODO: Handle L1/R1 (change character)
                 -- TODO: Handle square: Materia menu
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     UiContainer.current_menu = "main"
                     script:request_end_sync(Script.UI, "EquipMenu", "hide", 0)
@@ -83,7 +83,7 @@ UiContainer.EquipMenu = {
                     end
                     ui_manager:get_widget("EquipMenu.Container.Character.Cursor"):set_default_animation("Position" .. self.equip_position)
                     self.populate_details(self, false)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     if self.equip_position == 1 then
                         self.selecting_slot = Inventory.ITEM_TYPE.WEAPON
                     elseif self.equip_position == 2 then
@@ -105,7 +105,7 @@ UiContainer.EquipMenu = {
                 elseif self.selecting_slot == Inventory.ITEM_TYPE.ACCESSORY then
                     list = self.avail_accessories
                 end
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     self.submenu_none(self)
                 elseif button == Config.CONTROLS.DOWN then
@@ -146,7 +146,7 @@ UiContainer.EquipMenu = {
                     end
                     self.populate_details(self, true)
                     self.calculate_stat_diffs(self)
-                elseif button == Config.CONTROLS.ACTION and event == "Press" then
+                elseif button == Config.ACTIONS.CONFIRM and event == "Press" then
                     -- Equip the seleced item
                     local item_id = nil
                     if self.selecting_slot == Inventory.ITEM_TYPE.WEAPON then

+ 14 - 14
data/data/scripts/menu/item_menu.lua

@@ -81,12 +81,12 @@ UiContainer.ItemMenu = {
     --- Handles button events.
     --
     -- For the current submenu, handles directional keys, enter and escape events.
-    -- @param button Pressed button string key. Config.CONTROLS.UP, Config.CONTROLS.LEFT, Config.CONTROLS.ACTION and Config.CONTROLS.CANCEL are handled.
+    -- @param button Pressed direction or action name.
     -- @param event Trigger event. Normally, "Press".
     on_button = function(self, button, event)
         if UiContainer.current_menu == "item" then
             if UiContainer.current_submenu == "bar_selection" then
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     UiContainer.current_menu = "main"
                     script:request_end_sync(Script.UI, "ItemMenu", "hide", 0)
@@ -116,7 +116,7 @@ UiContainer.ItemMenu = {
                     else
                         ui_manager:get_widget("ItemMenu.Container.KeyItems"):set_visible(false)
                     end
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     if self.bar_position == 1 then
                         self.submenu_items(self)
                     elseif self.bar_position == 2 then
@@ -131,7 +131,7 @@ UiContainer.ItemMenu = {
                     return 0
                 end
             elseif UiContainer.current_submenu == "order_selection" then
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     self.submenu_bar(self)
                 elseif button == Config.CONTROLS.DOWN then
@@ -148,7 +148,7 @@ UiContainer.ItemMenu = {
                         self.order_cursor_position = self.order_cursor_position_total
                     end
                     ui_manager:get_widget("ItemMenu.Container.ItemOrder.Cursor"):set_default_animation("Position" .. self.order_cursor_position)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     audio_manager:play_sound("Cursor")
                     if self.order_cursor_position == 1 then
                         Inventory.sort(Inventory.ORDER.CUSTOM)
@@ -219,7 +219,7 @@ UiContainer.ItemMenu = {
                     else
                         desc_label:set_text("")
                     end
-                elseif button == Config.CONTROLS.PGDN then -- TODO: Also, the bind to R1
+                elseif button == Config.ACTIONS.R1 then
                     if self.first_item_in_window + self.item_cursor_position_total < self.inventory_size - self.item_cursor_position_total then
                         audio_manager:play_sound("Cursor")
                         self.item_cursor_item_selected = self.item_cursor_item_selected + self.item_cursor_position_total
@@ -233,7 +233,7 @@ UiContainer.ItemMenu = {
                     else
                         audio_manager:play_sound("Error")
                     end
-                elseif button == Config.CONTROLS.PGUP then -- TODO: Also, the bind to L1
+                elseif button == Config.ACTIONS.L1 then
                     if self.first_item_in_window - self.item_cursor_position_total > 1 then
                         audio_manager:play_sound("Cursor")
                         self.item_cursor_item_selected = self.item_cursor_item_selected - self.item_cursor_position_total
@@ -247,12 +247,12 @@ UiContainer.ItemMenu = {
                     else
                         audio_manager:play_sound("Error")
                     end
-                elseif button == Config.CONTROLS.CANCEL and event == "Press" then
+                elseif button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     self.submenu_bar(self)
                     UiContainer.current_submenu = "bar_selection"
                     ui_manager:get_widget("ItemMenu.Container.ItemList.Cursor"):set_visible(false)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     if Game.Items[Inventory[self.item_cursor_item_selected].item].menu == 1 then
                         audio_manager:play_sound("Cursor")
                         self.item_in_use = Inventory[self.item_cursor_item_selected].item
@@ -290,10 +290,10 @@ UiContainer.ItemMenu = {
                         end
                         ui_manager:get_widget("ItemMenu.Container.ItemMenuCharacters.Cursor"):set_default_animation("Position" .. self.char_position)
                     end
-                elseif button == Config.CONTROLS.CANCEL then
+                elseif button == Config.ACTIONS.CANCEL then
                     audio_manager:play_sound("Back")
                     self.submenu_items(self)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     local use_result = false
                     if self.item_in_use_party == true then
                         use_result = self.use_item(self, self.item_in_use, nil)
@@ -415,7 +415,7 @@ UiContainer.ItemMenu = {
                     else
                         ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text("")
                     end
-                elseif button == Config.CONTROLS.PGDN then -- TODO: Also, the bind to R1
+                elseif button == Config.ACTIONS.R1 then
                     if self.first_key_item_row_in_window + self.key_items_cursor_y_position_total < self.key_items_total_rows - self.key_items_cursor_y_position_total then
                         audio_manager:play_sound("Cursor")
                         self.first_key_item_row_in_window = self.first_key_item_row_in_window + self.key_items_cursor_y_position_total
@@ -430,7 +430,7 @@ UiContainer.ItemMenu = {
                     else
                         audio_manager:play_sound("Error")
                     end
-                elseif button == Config.CONTROLS.PGUP then -- TODO: Also, the bind to L1
+                elseif button == Config.ACTIONS.L1 then
                     if self.first_key_item_row_in_window + self.key_items_cursor_y_position_total > 1 then
                         audio_manager:play_sound("Cursor")
                         self.first_key_item_row_in_window = self.first_key_item_row_in_window - self.key_items_cursor_y_position_total
@@ -445,7 +445,7 @@ UiContainer.ItemMenu = {
                     else
                         audio_manager:play_sound("Cursor")
                     end
-                elseif button == Config.CONTROLS.CANCEL then
+                elseif button == Config.ACTIONS.CANCEL then
                     audio_manager:play_sound("Back")
                     self.submenu_bar(self)
                 end

+ 6 - 6
data/data/scripts/menu/main_menu.lua

@@ -30,7 +30,7 @@ UiContainer.MainMenu = {
     --- Handles button events.
     --
     -- For the current submenu, handles directional keys, enter and escape events.
-    -- @param button Pressed button string key. Config.CONTROLS.UP, Config.CONTROLS.LEFT, Config.CONTROLS.ACTION and Config.CONTROLS.CANCEL are handled.
+    -- @param button Pressed direction or action name.
     -- @param event Trigger event. Normally, "Press".
     on_button = function(self, button, event)
         if UiContainer.current_menu == "main" then
@@ -40,10 +40,10 @@ UiContainer.MainMenu = {
             local timegil = ui_manager:get_widget("MainMenu.Container.TimeGil")
             local location = ui_manager:get_widget("MainMenu.Container.Location")
             if UiContainer.current_submenu == "" then
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     script:request_end_sync(Script.UI, "MainMenu", "hide", 0)
-                elseif button == Config.CONTROLS.ACTION and event == "Press" then
+                elseif button == Config.ACTIONS.CONFIRM and event == "Press" then
                     if self.position == 1 then -- Item menu
                         audio_manager:play_sound("Cursor")
                         script:request_end_sync(Script.UI, "ItemMenu", "show", 0)
@@ -79,7 +79,7 @@ UiContainer.MainMenu = {
                     menu_cursor:set_default_animation("Position" .. self.position)
                 end
             elseif UiContainer.current_submenu == "main_character" then
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     UiContainer.current_submenu = ""
                     ui_manager:get_widget("MainMenu.Container.Characters.Cursor"):set_visible(false)
@@ -99,7 +99,7 @@ UiContainer.MainMenu = {
                         self.character_position = self.character_position_total
                     end
                     ui_manager:get_widget("MainMenu.Container.Characters.Cursor"):set_default_animation("Position" .. self.character_position)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     -- TODO: Check for empty character.
                     audio_manager:play_sound("Cursor")
                     if self.select_character_for_menu == 2 then -- Magic menu
@@ -120,7 +120,7 @@ UiContainer.MainMenu = {
                 end
             end
         elseif ui_manager:get_widget("MainMenu"):is_visible() == false and MenuSettings.available == true then
-            if button == Config.CONTROLS.CANCEL and event == "Press" then
+            if button == Config.ACTIONS.MENU and event == "Press" then
                 audio_manager:play_sound("Back")
                 script:request_end_sync(Script.UI, "MainMenu", "show", 0)
             end

+ 7 - 7
data/data/scripts/menu/materia_menu.lua

@@ -40,14 +40,14 @@ UiContainer.MateriaMenu = {
     --- Handles button events.
     --
     -- For the current submenu, handles directional keys, enter and escape events.
-    -- @param button Pressed button string key. Config.CONTROLS.UP, Config.CONTROLS.LEFT, Config.CONTROLS.ACTION and Config.CONTROLS.CANCEL are handled.
+    -- @param button Pressed direction or action name.
     -- @param event Trigger event. Normally, "Press".
     on_button = function(self, button, event)
         if UiContainer.current_menu == "materia" then
             if UiContainer.current_submenu == "" then
                 -- TODO: Handle L1/R1 (change character)
                 -- TODO: Handle square: Materia menu
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     UiContainer.current_menu = "main"
                     script:request_end_sync(Script.UI, "MateriaMenu", "hide", 0)
@@ -83,7 +83,7 @@ UiContainer.MateriaMenu = {
                     end
                     ui_manager:get_widget("MateriaMenu.Container.Character.Cursor"):set_default_animation("Position" .. self.header_position_row .. "-" .. self.header_position)
                     self.populate_details(self, false)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     if self.header_position_row == 1 and self.header_position == 1 then
                         -- TODO: Command menu
                     elseif self.header_position_row == 2 and self.header_position == 1 then
@@ -141,7 +141,7 @@ UiContainer.MateriaMenu = {
                     ui_manager:get_widget("MateriaMenu.Container.List.Cursor"):set_default_animation("Position" .. self.list_position)
                     -- Show details
                     self.populate_details(self, true)
-                elseif button == Config.CONTROLS.PGDN then -- TODO: Also, the bind to R1
+                elseif button == Config.ACTIONS.R1 then
                     if self.list_first_visible + self.list_position_total < self.list_size - self.list_position_total then
                         audio_manager:play_sound("Cursor")
                         self.list_first_visible = self.list_first_visible + self.list_position_total
@@ -150,7 +150,7 @@ UiContainer.MateriaMenu = {
                     else
                         audio_manager:play_sound("Error")
                     end
-                elseif button == Config.CONTROLS.PGUP then -- TODO: Also, the bind to L1
+                elseif button == Config.ACTIONS.L1 then
                     if self.list_first_visible - self.list_position_total > 1 then
                         audio_manager:play_sound("Cursor")
                         self.list_first_visible = self.list_first_visible - self.list_position_total
@@ -159,10 +159,10 @@ UiContainer.MateriaMenu = {
                     else
                         audio_manager:play_sound("Error")
                     end
-                elseif button == Config.CONTROLS.CANCEL and event == "Press" then
+                elseif button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     self.submenu_none(self)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     -- TODO: Replace for "Equip materia" sound.
                     audio_manager:play_sound("Cursor")
                     self.equip_materia(self)

+ 6 - 3
data/data/scripts/menu/name_menu.lua

@@ -48,8 +48,11 @@ UiContainer.NameMenu = {
     -- For the current submenu, handles directional keys, enter and escape events.
     -- @param button Pressed button string key. "Up", "Left", "Enter" and "Escape" are handled.
     -- @param event Trigger event. Normally, "Press".
-    on_button = function(self, button, event)
+    on_button = function(self, button, event, source_key)
         if UiContainer.current_menu == "name" then
+            if button == Config.ACTIONS.CONFIRM and source_key == "Space" and UiContainer.current_submenu == "" then
+                return 0
+            end
             if UiContainer.current_submenu == "confirm" then
                 if button == "Right" then
                     audio_manager:play_sound("Cursor")
@@ -65,7 +68,7 @@ UiContainer.NameMenu = {
                         self.confirm_position = self.confirm_position_total
                     end
                     ui_manager:get_widget("NameMenu.Container.Confirm.Cursor"):set_default_animation("Position" .. self.confirm_position)
-                elseif button == "Enter" then
+                elseif button == Config.ACTIONS.CONFIRM then
                     audio_manager:play_sound("Cursor")
                     if self.confirm_position == 2 then -- Back
                         UiContainer.current_submenu = ""
@@ -115,7 +118,7 @@ UiContainer.NameMenu = {
                     else
                         audio_manager:play_sound("Error")
                     end
-                elseif button == "Enter" then
+                elseif button == Config.ACTIONS.CONFIRM then
                     if self.options_position == 1 then -- Clear name.
                         audio_manager:play_sound("Cursor")
                         self.name = ""

+ 3 - 3
data/data/scripts/menu/pause_menu.lua

@@ -21,9 +21,9 @@ UiContainer.PauseMenu = {
     on_button = function( self, button, event )
         if System:is_paused() == true then
             local menu_cursor = ui_manager:get_widget( "PauseMenu.Menu.Cursor" )
-            if button == Config.CONTROLS.PAUSE and event == "Press" then
+            if button == Config.ACTIONS.START and event == "Press" then
                 System:unpause()
-            elseif button == "Enter" and event == "Press" then
+            elseif button == Config.ACTIONS.CONFIRM and event == "Press" then
                 audio_manager:play_sound("Cursor")
                 script:request_end_sync( Script.UI, "PauseMenu", "hide", 0 )
                 if self.position == 2 then
@@ -49,7 +49,7 @@ UiContainer.PauseMenu = {
                 menu_cursor:set_default_animation( "Position" .. self.position )
             end
         elseif System:is_paused() == false then
-            if button == Config.CONTROLS.PAUSE and event == "Press" then
+            if button == Config.ACTIONS.START and event == "Press" then
                 System:pause()
             end
         end

+ 3 - 3
data/data/scripts/menu/save_menu.lua

@@ -28,15 +28,15 @@ UiContainer.SaveMenu = {
     --- Handles button events.
     --
     -- For the current submenu, handles directional keys, enter and escape events.
-    -- @param button Pressed button string key. Config.CONTROLS.UP, Config.CONTROLS.LEFT, Config.CONTROLS.ACTION and Config.CONTROLS.CANCEL are handled.
+    -- @param button Pressed direction or action name.
     -- @param event Trigger event. Normally, "Press".
     on_button = function(self, button, event)
         if UiContainer.current_menu == "save" then
             if UiContainer.current_submenu == "" then
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     script:request_end_sync(Script.UI, "SaveMenu", "hide", 0)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     self.action(self, self.first_visible - 1 + self.position)
                 elseif button == Config.CONTROLS.DOWN then
                     if self.position < self.position_total and self.first_visible + self.position < self.max_slots then

+ 2 - 2
src/core/DialogsManager.cpp

@@ -88,8 +88,8 @@ void DialogsManager::Initialise(){
 }
 
 void DialogsManager::Input(const VGears::Event& input){
-    if (input.type == VGears::ET_KEY_PRESS && input.event == "message_ok") next_pressed_ = true;
-    else if (input.type == VGears::ET_KEY_REPEAT && input.event == "message_ok")
+    if (input.type == VGears::ET_KEY_PRESS && input.event == "CONFIRM") next_pressed_ = true;
+    else if (input.type == VGears::ET_KEY_REPEAT && input.event == "CONFIRM")
         next_repeated_ = true;
     else if (input.type == VGears::ET_KEY_PRESS && input.event == "message_up") up_pressed_ = true;
     else if (input.type == VGears::ET_KEY_PRESS && input.event == "message_down")

+ 1 - 1
src/core/EntityManager.cpp

@@ -145,7 +145,7 @@ void EntityManager::Input(const VGears::Event& event){
         else if (event.type == VGears::ET_KEY_REPEAT && event.event == "walk_up")
             player_move_.y = 1;
         if (event.type == VGears::ET_KEY_REPEAT && event.event == "run") player_run_ = true;
-        if (event.type == VGears::ET_KEY_PRESS && event.event == "interact"){
+        if (event.type == VGears::ET_KEY_PRESS && event.event == "CONFIRM"){
             CheckEntityInteract();
             for (unsigned int i = 0; i < entity_triggers_.size(); ++ i){
                 if (

+ 1 - 0
src/core/InputManager.cpp

@@ -219,6 +219,7 @@ void InputManager::AddGameEvents(const int button, const VGears::EventType type)
     for (unsigned int i = 0; i < binds_to_activate.size(); ++ i){
         VGears::Event event;
         event.type = type;
+        event.param1 = button;
         event.event = bind_game_events_[binds_to_activate[i]].event;
         event_queue_.push_back(event);
     }

+ 28 - 5
src/core/ScriptManager.cpp

@@ -66,6 +66,24 @@ ScriptManager::ScriptManager():
 ScriptManager::~ScriptManager(){lua_close(lua_state_);}
 
 void ScriptManager::Input(const VGears::Event& event){
+    if (
+      event.event != ""
+      && (event.type == VGears::ET_KEY_PRESS || event.type == VGears::ET_KEY_REPEAT_WAIT)
+    ){
+        Ogre::String argument2 = "";
+        if (event.type == VGears::ET_KEY_PRESS) argument2 = "Press";
+        else if (event.type == VGears::ET_KEY_REPEAT_WAIT) argument2 = "Repeat";
+        const Ogre::String source_key = KeyToString(
+          static_cast<OIS::KeyCode>(event.param1)
+        );
+        for (unsigned int i = 0; i < script_entity_.size(); ++ i){
+            ScriptRequest(
+              &script_entity_[i], "on_button", 100,
+              event.event, argument2, false, false, source_key, true
+            );
+        }
+        return;
+    }
     if (
       (event.type == VGears::ET_KEY_PRESS || event.type == VGears::ET_KEY_REPEAT_WAIT)
       && (
@@ -206,7 +224,8 @@ void ScriptManager::Update(const ScriptManager::Type type){
                             sol::coroutine coroutine(thread, sol::function(function));
                             auto result = coroutine(
                               table, script_entity_[i].queue[0].argument1,
-                              script_entity_[i].queue[0].argument2
+                              script_entity_[i].queue[0].argument2,
+                              script_entity_[i].queue[0].argument3
                             );
                             if (result.valid()){
                                 // The coroutine yields with the bound function
@@ -628,7 +647,8 @@ int ScriptManager::ScriptRequestEndSync(
 
 bool ScriptManager::ScriptRequest(
   ScriptEntity* script_entity, const Ogre::String& function, const int priority,
-  const Ogre::String& argument1, const Ogre::String& argument2, bool start_sync, bool end_sync
+  const Ogre::String& argument1, const Ogre::String& argument2, bool start_sync,
+  bool end_sync, const Ogre::String& argument3, bool allow_duplicate
 ){
     if (script_entity == nullptr) return false;
 
@@ -642,6 +662,7 @@ bool ScriptManager::ScriptRequest(
         script.function = function;
         script.argument1 = argument1;
         script.argument2 = argument2;
+        script.argument3 = argument3;
         script.priority = priority;
         script.state = lua_newthread(lua_state_);
         // The thread must not be garbage collected,
@@ -655,10 +676,12 @@ bool ScriptManager::ScriptRequest(
         if (end_sync == true) script.paused_script_end = GetCurrentScriptId();
 
         // If the script is already running, don't queue it.
-        for (int i = 0; i < script_entity->queue.size(); i ++){
+        if (allow_duplicate == false){
+          for (int i = 0; i < script_entity->queue.size(); i ++){
              if (script_entity->queue[i].function == function){
-                 script_entity->resort = true;
-                 return true;
+               script_entity->resort = true;
+               return true;
+            }
             }
         }
 

+ 10 - 1
src/core/ScriptManager.h

@@ -61,6 +61,7 @@ struct QueueScript{
       function(""),
       argument1(""),
       argument2(""),
+      argument3(""),
       priority(0),
       state(NULL),
       seconds_to_wait(0),
@@ -83,6 +84,11 @@ struct QueueScript{
      */
     Ogre::String argument2;
 
+    /**
+     * Third function argument.
+     */
+    Ogre::String argument3;
+
     /**
      * Function priority.
      */
@@ -400,12 +406,15 @@ class ScriptManager : public Manager, public Ogre::Singleton<ScriptManager>{
          * @param[in] argument2 Second argument for the script.
          * @param[in] start_sync If true, the script will be started synchronously.
          * @param[in] end_sync @todo Understand and document.
+         * @param[in] argument3 Third argument for the script.
+         * @param[in] allow_duplicate If true, queue this call even if the same function is queued.
          * @return True on success, false on error (i.e. if the entity or the script don't exist)
          */
         bool ScriptRequest(
           ScriptEntity* script_entity, const Ogre::String& function,
           const int priority, const Ogre::String& argument1,
-          const Ogre::String& argument2, bool start_sync, bool end_sync
+          const Ogre::String& argument2, bool start_sync, bool end_sync,
+          const Ogre::String& argument3 = "", bool allow_duplicate = false
         );
 
         /**