Compare commits

...

6 Commits

Author SHA1 Message Date
Sanjay 016135116c
Merge pull request #82 from teverse/rewrite-tevx
Comment Correction
2020-08-15 12:06:14 -04:00
Sanjay Bhadra 4a2bbd66b4 Comment Correction 2020-08-15 12:05:42 -04:00
Sanjay 687898493f
Merge pull request #81 from teverse/rewrite-tevx
Ignore camera inputs when typing in command bar
2020-08-15 12:00:30 -04:00
Sanjay Bhadra d3841a3db7 ignoreCamerInput global var & restrict camera from moving when typing in command bar 2020-08-15 11:57:55 -04:00
Sanjay Bhadra 5218fa7804 Merge branch 'master' into rewrite-tevx 2020-08-15 11:38:06 -04:00
Sanjay bfc2f95a5c
ChatSystem - PlayerScripts (#80)
* Refactor .parent change in teverse.construct

* Redesign to fit dashboard screen

* Fix default side menu registers

* Add Search Bar UI to topbar

* Rename searchBar to commandBar

* Command Bar Trigger Setup

* Commandbar registers

* Command hooks registry

* File cleanup

* Enable 3D viewport & setup env. presets

* Enabled Camera for 3D Environment

* Enabled Callbacks for sidebar options

* Remove testing dump method

* Remove debounce in Camera for more fluid camera movements

* Enabled callbacks for Topbar buttons

* Move legacy playerscripts to archived folder (references)

* Init Client & Server base directories

* Implement PlayerScripts ChatSystem
2020-08-15 10:36:35 +01:00
3 changed files with 7 additions and 8 deletions

View File

@ -1,6 +1,8 @@
-- Copyright 2020- Teverse -- Copyright 2020- Teverse
-- This script is required when workshop is loaded & acts as the 3D Camera for the 3D Environment -- This script is required when workshop is loaded & acts as the 3D Camera for the 3D Environment
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
local keyMap = { local keyMap = {
[tonumber(enums.keys.KEY_W)] = vector3(0, 0, 1), [tonumber(enums.keys.KEY_W)] = vector3(0, 0, 1),
[tonumber(enums.keys.KEY_S)] = vector3(0, 0, -1), [tonumber(enums.keys.KEY_S)] = vector3(0, 0, -1),
@ -19,14 +21,14 @@ local db = false
teverse.input:on("keyDown", function(key) teverse.input:on("keyDown", function(key)
local mapped = keyMap[tonumber(key)] local mapped = keyMap[tonumber(key)]
if mapped then if mapped then
while sleep() and teverse.input:isKeyDown(key) do while sleep() and teverse.input:isKeyDown(key) and not globals.ignoreCameraInput do
cam.position = cam.position + (cam.rotation * mapped * moveStep) cam.position = cam.position + (cam.rotation * mapped * moveStep)
end end
end end
end) end)
teverse.input:on("mouseMoved", function( movement ) teverse.input:on("mouseMoved", function( movement )
if teverse.input:isMouseButtonDown(3) then if teverse.input:isMouseButtonDown(3) and not globals.ignoreCameraInput then
local pitch = quaternion.euler(movement.y * rotateStep, 0, 0) local pitch = quaternion.euler(movement.y * rotateStep, 0, 0)
local yaw = quaternion.euler(0, movement.x * rotateStep, 0) local yaw = quaternion.euler(0, movement.x * rotateStep, 0)

View File

@ -5,6 +5,7 @@ return {
dev = nil, -- Holds workshop instance and is set in main.lua dev = nil, -- Holds workshop instance and is set in main.lua
user = nil, -- Holds user instance and is set in main.lua user = nil, -- Holds user instance and is set in main.lua
developerMode = false, -- Holds the developer_mode boolean and is set in main.lua developerMode = false, -- Holds the developer_mode boolean and is set in main.lua
ignoreCameraInput = false, -- Determines if the camera should be able to move or not (useful when we're trying to type and we don't want the camera to move)
commandGroups = {}, -- Holds the command groups that have been registered (~\library\toolchain\commands.lua) commandGroups = {}, -- Holds the command groups that have been registered (~\library\toolchain\commands.lua)
defaultColours = { -- Default colors used for theming UI components (~\library\ui\components) defaultColours = { -- Default colors used for theming UI components (~\library\ui\components)
primary = colour.rgb(52, 58, 64), primary = colour.rgb(52, 58, 64),

View File

@ -111,7 +111,6 @@ return {
strokeRadius = 3 strokeRadius = 3
}) })
-- Test command Bar
local commandBarIcon = teverse.construct("guiIcon", { local commandBarIcon = teverse.construct("guiIcon", {
parent = container, parent = container,
size = guiCoord(0, 32, 0, 32), size = guiCoord(0, 32, 0, 32),
@ -130,7 +129,6 @@ return {
parent = container, parent = container,
size = guiCoord(0, 200, 0, 32), size = guiCoord(0, 200, 0, 32),
position = guiCoord(0, 191, 0, 4), position = guiCoord(0, 191, 0, 4),
--text = " >",
textAlign = "middleLeft", textAlign = "middleLeft",
textFont = "tevurl:fonts/firaCodeBold.otf", textFont = "tevurl:fonts/firaCodeBold.otf",
textSize = 15, textSize = 15,
@ -158,19 +156,17 @@ return {
end) end)
commandBarField:on("keyDown", function(key) commandBarField:on("keyDown", function(key)
globals.ignoreCameraInput = true -- Restrict the camera from moving if typing in command bar
if key == "KEY_RETURN" then if key == "KEY_RETURN" then
print("Command: "..(commandBarField.text)) print("Command: "..(commandBarField.text))
-- Invoke Command Trigger -- Invoke Command Trigger
commands.parse(commandBarField.text) commands.parse(commandBarField.text)
commandBarField.text = " >" commandBarField.text = " >"
globals.ignoreCameraInput = false -- Re-enable the camera when the commandbar is done being used
end end
end) end)
-- End Test Command Bar
self.registerIcon = function(icon, callback) self.registerIcon = function(icon, callback)
local icon = teverse.construct("guiIcon", { local icon = teverse.construct("guiIcon", {
parent = container, parent = container,