From c729f603b81af17acb431c840e5b374eea511f68 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:27:51 -0600 Subject: [PATCH] Added convenience function to take control of selected entity if it supports it. --- .../game/tools/worldEditor/scripts/menuHandlers.ed.cs | 7 +++++++ .../BaseGame/game/tools/worldEditor/scripts/menus.ed.cs | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs index f476ccaeb..8c558bfef 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs @@ -587,6 +587,13 @@ function makeSelectedAMesh() EditorTree.buildVisibleTree( true ); } +function EditorTakeControlOfEntity() +{ + %object = EWorldEditor.getSelectedObject(0); + switchCamera(localClientConnection, %object); + switchControlObject(localClientConnection, %object); +} + function EditorMount() { echo( "EditorMount" ); diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs index b225d3534..e0d53a76d 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs @@ -379,8 +379,10 @@ function EditorGui::buildMenus(%this) Item[17] = "Make Selection Prefab" TAB "" TAB "EditorMakePrefab();"; Item[18] = "Explode Selected Prefab" TAB "" TAB "EditorExplodePrefab();"; Item[19] = "-"; - Item[20] = "Mount Selection A to B" TAB "" TAB "EditorMount();"; - Item[21] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();"; + Item[20] = "Take control of entity" TAB "" TAB "EditorTakeControlOfEntity();"; + Item[21] = "-"; + Item[22] = "Mount Selection A to B" TAB "" TAB "EditorMount();"; + Item[23] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();"; }; } }