Compare commits

..

No commits in common. "016135116ce3d94595899cae65e7edaea8d7c6b9" and "57fdb64a08a16348826d2a68ffd885de3014a8e1" have entirely different histories.

3 changed files with 8 additions and 7 deletions

View File

@ -1,8 +1,6 @@
-- Copyright 2020- Teverse
-- 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 = {
[tonumber(enums.keys.KEY_W)] = vector3(0, 0, 1),
[tonumber(enums.keys.KEY_S)] = vector3(0, 0, -1),
@ -21,14 +19,14 @@ local db = false
teverse.input:on("keyDown", function(key)
local mapped = keyMap[tonumber(key)]
if mapped then
while sleep() and teverse.input:isKeyDown(key) and not globals.ignoreCameraInput do
while sleep() and teverse.input:isKeyDown(key) do
cam.position = cam.position + (cam.rotation * mapped * moveStep)
end
end
end)
teverse.input:on("mouseMoved", function( movement )
if teverse.input:isMouseButtonDown(3) and not globals.ignoreCameraInput then
if teverse.input:isMouseButtonDown(3) then
local pitch = quaternion.euler(movement.y * rotateStep, 0, 0)
local yaw = quaternion.euler(0, movement.x * rotateStep, 0)

View File

@ -5,7 +5,6 @@ return {
dev = nil, -- Holds workshop 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
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)
defaultColours = { -- Default colors used for theming UI components (~\library\ui\components)
primary = colour.rgb(52, 58, 64),

View File

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