Skip to content

Commit 58fefbe

Browse files
authored
Merge pull request #75 from StanleyDudek/boost
Boost blocking
2 parents c231336 + cc1c2ca commit 58fefbe

3 files changed

Lines changed: 79 additions & 2 deletions

File tree

Resources/Client/CEI.zip

338 Bytes
Binary file not shown.

Resources/Client/CEI/lua/ge/extensions/CEI.lua

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
local M = {}
44

5-
local CEI_VERSION = "0.8.6"
5+
local CEI_VERSION = "0.8.7"
66
local logTag = "CEI"
77
local gui_module = require("ge/extensions/editor/api/gui")
88
local gui = {setupEditorGuiTheme = nop}
@@ -23,6 +23,7 @@ local isFrozen = {}
2323
local resetsBlockedInputActions = {}
2424
local allResetsBlockedInputActions = {}
2525
local editorBlocked = {}
26+
local boostBlocked = { "funBoost", "funBoostBackwards", "funFling", "funFlingDownward" }
2627
local descriptions = {}
2728
local environmentValsSet = false
2829
local environmentVals = {}
@@ -65,6 +66,11 @@ local syncRequested = false
6566
local environmentDefaults = {}
6667
local environmentPause = false
6768

69+
local b
70+
local bb
71+
local fu
72+
local fd
73+
6874
local function getObject(className, preferredObjName)
6975
if envObjectIdCache[className] then
7076
return scenetree.findObjectById(envObjectIdCache[className])
@@ -199,6 +205,21 @@ local function rxConfigData(data)
199205
extensions.core_input_actionFilter.setGroup('cei2', editorBlocked)
200206
extensions.core_input_actionFilter.addAction(0, 'cei2', true)
201207

208+
if config.restrictions.boost == true then
209+
core_funstuff.boost = function() end
210+
core_funstuff.boostBackwards = function() end
211+
core_funstuff.flingUpward = function() end
212+
core_funstuff.flingDownward = function() end
213+
else
214+
core_funstuff.boost = b
215+
core_funstuff.boostBackwards = bb
216+
core_funstuff.flingUpward = fu
217+
core_funstuff.flingDownward = fd
218+
end
219+
220+
extensions.core_input_actionFilter.setGroup('boost', boostBlocked)
221+
extensions.core_input_actionFilter.addAction(0, 'boost', config.restrictions.boost)
222+
202223
if configValsSet == false then
203224
configVals.server = {}
204225
configVals.cobalt = {}
@@ -2998,6 +3019,42 @@ local function drawCEI()
29983019
log('W', logTag, "CEISetRestrictions Called: " .. data)
29993020
end
30003021
end
3022+
3023+
if im.TreeNode1("Boost") then
3024+
im.SameLine()
3025+
if im.SmallButton("Reset##boost") then
3026+
local data = jsonEncode( { "boost", "default", "boost" } )
3027+
TriggerServerEvent("CEISetRestrictions", data)
3028+
log('W', logTag, "CEISetRestrictions Called: " .. data)
3029+
end
3030+
im.Indent()
3031+
im.Text("Boost: ")
3032+
if config.restrictions.boost then
3033+
im.SameLine()
3034+
if im.SmallButton("Blocked##boost") then
3035+
local data = jsonEncode( { "boost", false, "boost" } )
3036+
TriggerServerEvent("CEISetRestrictions", data)
3037+
log('W', logTag, "CEISetRestrictions Called: " .. data)
3038+
end
3039+
else
3040+
im.SameLine()
3041+
if im.SmallButton("Allowed##boost") then
3042+
local data = jsonEncode( { "boost", true, "boost" } )
3043+
TriggerServerEvent("CEISetRestrictions", data)
3044+
log('W', logTag, "CEISetRestrictions Called: " .. data)
3045+
end
3046+
end
3047+
im.TreePop()
3048+
im.Unindent()
3049+
else
3050+
im.SameLine()
3051+
if im.SmallButton("Reset##boost") then
3052+
local data = jsonEncode( { "boost", "default", "boost" } )
3053+
TriggerServerEvent("CEISetRestrictions", data)
3054+
log('W', logTag, "CEISetRestrictions Called: " .. data)
3055+
end
3056+
end
3057+
30013058
im.Unindent()
30023059
end
30033060
end
@@ -5795,6 +5852,12 @@ local function onWorldReadyState(state)
57955852
syncRequested = true
57965853
end
57975854
end
5855+
if core_funstuff then
5856+
b = core_funstuff.boost
5857+
bb = core_funstuff.boostBackwards
5858+
fu = core_funstuff.flingUpward
5859+
fd = core_funstuff.flingDownward
5860+
end
57985861
end
57995862
end
58005863

Resources/Server/CobaltEssentials/extensions/CEI.lua

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ local M = {}
44

55
M.COBALT_VERSION = "1.7.6"
66

7-
local CEI_VERSION = "0.8.6"
7+
local CEI_VERSION = "0.8.7"
88

99
utils.setLogType("CEI",93)
1010

@@ -110,6 +110,7 @@ config.restrictions.CEN.editorToggle_default = false
110110
config.restrictions.CEN.editorSafeModeToggle_default = false
111111
config.restrictions.CEN.objectEditorToggle_default = false
112112
config.restrictions.CEN.nodegrabberRender_default = false
113+
config.restrictions.boost_default = false
113114
config.restrictions.voteKick = {}
114115
config.restrictions.voteKick.voteKick_enabled_default = true
115116

@@ -482,6 +483,8 @@ local defaultRestrictions = {
482483
objectEditorToggle = {value = config.restrictions.CEN.objectEditorToggle_default},
483484
nodegrabberRender = {value = config.restrictions.CEN.nodegrabberRender_default},
484485

486+
boost = {value = config.restrictions.boost_default},
487+
485488
voteKick_enabled = {value = config.restrictions.voteKick.voteKick_enabled_default}
486489
}
487490

@@ -899,6 +902,8 @@ local function onInit()
899902
config.restrictions.CEN.objectEditorToggle = CobaltDB.query("restrictions", "objectEditorToggle", "value")
900903
config.restrictions.CEN.nodegrabberRender = CobaltDB.query("restrictions", "nodegrabberRender", "value")
901904

905+
config.restrictions.boost = CobaltDB.query("restrictions", "boost", "value")
906+
902907
config.restrictions.voteKick.voteKick_enabled = CobaltDB.query("restrictions", "voteKick_enabled", "value")
903908

904909
config.nametags.settings.blockingEnabled = CobaltDB.query("nametags", "blockingEnabled", "value")
@@ -1501,6 +1506,15 @@ function CEISetRestrictions(senderID, data)
15011506
CobaltDB.set("restrictions", key, "value", value)
15021507
end
15031508
end
1509+
if tag == "boost" then
1510+
if value == "default" then
1511+
config.restrictions[key] = config.restrictions[key .. "_default"]
1512+
CobaltDB.set("restrictions", key, "value", config.restrictions[key .. "_default"])
1513+
else
1514+
config.restrictions.boost = value
1515+
CobaltDB.set("restrictions", key, "value", value)
1516+
end
1517+
end
15041518
if tag == "voteKick" then
15051519
config.restrictions.voteKick["voteKick_enabled"] = value
15061520
CobaltDB.set("restrictions", key, "value", value)

0 commit comments

Comments
 (0)