init project ep

This commit is contained in:
2026-06-08 16:17:11 +03:00
commit 09c2ae238e
515 changed files with 20648 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
print("Hello!")
Hook.Add("character.created", "test", function(character)
print("character.created: ", character)
end)
Hook.Add("character.death", "test", function(character)
print("character.death: ", character)
end)
Hook.Add("character.giveJobItems", "test", function(character)
print("character.giveJobItems: ", character)
end)
Hook.Add("roundStart", "test", function()
print("roundStart")
end)
Hook.Add("roundEnd", "test", function()
print("roundEnd")
end)
Hook.Add("missionsEnded", "test", function()
print("missionsEnded")
end)
-- cfg tests
local str = "CLIENT: "
if SERVER then
str = "SERVER: "
end
function OnChanged(cfg)
print(str, "cfg value for ", cfg.InternalName, " changed to ", cfg.Value)
end
local failed, package = trygetpackage("[DebugOnlyTest]TestLuaMod")
print("packageFailed=", failed)
print("package", package.Name)
local success, config = ConfigService.TryGetConfig(SettingBase.Int32, package, "TestSynchroServer")
local success2, config2 = ConfigService.TryGetConfig(SettingBase.Int32, package, "TestSynchroClient")
if not success or not success2 then
print("Failed to get configs.")
return
end
config.OnValueChanged.add(OnChanged)
config2.OnValueChanged.add(OnChanged)
print(str, " testsynchroclient=", config2.Value)
print(str, " testsynchroserver=", config.Value)
-- The server should keep updating the value and it should show up on the client.
-- The client should try updating and it should fail.
local lastTime = Timer.Time + 30 -- give time to join
Hook.Add("think", "printconfig", function()
if lastTime > Timer.Time then return end
lastTime = Timer.Time + 10
if SERVER then
local succ = config.TrySetValue(config.Value + 1)
print("Success of setting value on server for '", config.InternalName,"': ", succ)
end
if CLIENT then
local succ = config.TrySetValue(config.Value + 1)
print("Success of setting value on client for '", config.InternalName,"': ", succ, " | This should fail if permissions are not set for client.")
end
end)