init project ep
This commit is contained in:
75
LocalMods/[DebugOnlyTest]TestLuaMod/Lua/init.lua
Normal file
75
LocalMods/[DebugOnlyTest]TestLuaMod/Lua/init.lua
Normal 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)
|
||||
7
LocalMods/[DebugOnlyTest]TestLuaMod/ModConfig.xml
Normal file
7
LocalMods/[DebugOnlyTest]TestLuaMod/ModConfig.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ModConfig>
|
||||
<Lua File="%ModDir%/Lua/init.lua" IsAutorun="true" />
|
||||
<Config File="%ModDir%/Settings.xml"/>
|
||||
<Config File="%ModDir%/SettingsClient.xml" Target="Client"/>
|
||||
<Config File="%ModDir%/SettingsServer.xml" Target="Server"/>
|
||||
</ModConfig>
|
||||
40
LocalMods/[DebugOnlyTest]TestLuaMod/Settings.xml
Normal file
40
LocalMods/[DebugOnlyTest]TestLuaMod/Settings.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Configuration>
|
||||
<Settings>
|
||||
<Setting Name="TestTickbox" Type="bool" Value="true"/>
|
||||
<Setting Name="TestSynchroClient" Type="int" NetSync="TwoWay" Value="40"/>
|
||||
<Setting Name="TestSynchroServer" Type="int" NetSync="ServerAuthority" Value="25"/>
|
||||
<Setting Name="TestFloat" Type="float" Value="3498"/>
|
||||
<Setting Name="TestHidden" Type="bool" ShowInMenus="false" Value="false"/>
|
||||
<Setting Name="TestRangeFloat" Type="rangeFloat" Min="0" Max="25" Steps="11" Value="4.5"/>
|
||||
<Setting Name="TestRangeInt" Type="rangeInt" Min="0" Max="10" Steps="11" Value="4"/>
|
||||
<Setting Name="TestString" Type="string" Value="ok"/>
|
||||
<Setting Name="TestControl" Type="control" Value="A"/>
|
||||
<Setting Name="TestDropdownList" Type="listString" Value="Hi">
|
||||
<Values>
|
||||
<Value Value="Entry A"/>
|
||||
<Value Value="Entry B"/>
|
||||
<Value Value="Hi"/>
|
||||
<Value Value="YourMom"/>
|
||||
</Values>
|
||||
</Setting>
|
||||
</Settings>
|
||||
<Profiles>
|
||||
<Profile Name="default">
|
||||
<SettingValue Name="TestTickbox" Value="true"/>
|
||||
<SettingValue Name="TestFloat" Value="5"/>
|
||||
<SettingValue Name="TestHidden" Value="true"/>
|
||||
<SettingValue Name="TestRangeFloat" Value="15"/>
|
||||
<SettingValue Name="TestRangeInt" Value="7"/>
|
||||
<SettingValue Name="TestString" Value="Hello!"/>
|
||||
</Profile>
|
||||
<Profile Name="other">
|
||||
<SettingValue Name="TestTickbox" Value="false"/>
|
||||
<SettingValue Name="TestFloat" Value="9"/>
|
||||
<SettingValue Name="TestHidden" Value="false"/>
|
||||
<SettingValue Name="TestRangeFloat" Value="4"/>
|
||||
<SettingValue Name="TestRangeInt" Value="4"/>
|
||||
<SettingValue Name="TestString" Value="Other loaded!"/>
|
||||
</Profile>
|
||||
</Profiles>
|
||||
</Configuration>
|
||||
8
LocalMods/[DebugOnlyTest]TestLuaMod/SettingsClient.xml
Normal file
8
LocalMods/[DebugOnlyTest]TestLuaMod/SettingsClient.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Configuration>
|
||||
<!-- Should match 'SettingsServer'. We define these on the client and server separately to give different values. -->
|
||||
<Settings>
|
||||
<Setting Name="TestSynchroClient" Type="int" NetSync="TwoWay" Value="3545" ShowInMenus="false"/>
|
||||
<Setting Name="TestSynchroServer" Type="int" NetSync="ServerAuthority" Value="577" ShowInMenus="false"/>
|
||||
</Settings>
|
||||
</Configuration>
|
||||
8
LocalMods/[DebugOnlyTest]TestLuaMod/SettingsServer.xml
Normal file
8
LocalMods/[DebugOnlyTest]TestLuaMod/SettingsServer.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Configuration>
|
||||
<!-- Should match 'SettingsClient'. We define these on the client and server separately to give different values. -->
|
||||
<Settings>
|
||||
<Setting Name="TestSynchroClient" Type="int" NetSync="TwoWay" Value="40" ShowInMenus="false"/>
|
||||
<Setting Name="TestSynchroServer" Type="int" NetSync="ServerAuthority" Value="25" ShowInMenus="false"/>
|
||||
</Settings>
|
||||
</Configuration>
|
||||
13
LocalMods/[DebugOnlyTest]TestLuaMod/Texts/English.xml
Normal file
13
LocalMods/[DebugOnlyTest]TestLuaMod/Texts/English.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<infotexts language="English" nowhitespace="false" translatedname="English">
|
||||
<_x005B_DebugOnlyTest_x005D_TestLuaMod.TestTickbox.DisplayName>Test TickBox</_x005B_DebugOnlyTest_x005D_TestLuaMod.TestTickbox.DisplayName>
|
||||
<_x005B_DebugOnlyTest_x005D_TestLuaMod.TestTickbox.DisplayCategory>Tests</_x005B_DebugOnlyTest_x005D_TestLuaMod.TestTickbox.DisplayCategory>
|
||||
<_x005B_DebugOnlyTest_x005D_TestLuaMod.TestFloat.DisplayName>Test Float</_x005B_DebugOnlyTest_x005D_TestLuaMod.TestFloat.DisplayName>
|
||||
<_x005B_DebugOnlyTest_x005D_TestLuaMod.TestFloat.DisplayCategory>Tests</_x005B_DebugOnlyTest_x005D_TestLuaMod.TestFloat.DisplayCategory>
|
||||
<_x005B_DebugOnlyTest_x005D_TestLuaMod.TestRangeFloat.DisplayName>Test Range Float</_x005B_DebugOnlyTest_x005D_TestLuaMod.TestRangeFloat.DisplayName>
|
||||
<_x005B_DebugOnlyTest_x005D_TestLuaMod.TestRangeFloat.DisplayCategory>Tests</_x005B_DebugOnlyTest_x005D_TestLuaMod.TestRangeFloat.DisplayCategory>
|
||||
<_x005B_DebugOnlyTest_x005D_TestLuaMod.TestRangeInt.DisplayName>Test Range Int</_x005B_DebugOnlyTest_x005D_TestLuaMod.TestRangeInt.DisplayName>
|
||||
<_x005B_DebugOnlyTest_x005D_TestLuaMod.TestRangeInt.DisplayCategory>Tests</_x005B_DebugOnlyTest_x005D_TestLuaMod.TestRangeInt.DisplayCategory>
|
||||
<_x005B_DebugOnlyTest_x005D_TestLuaMod.TestString.DisplayName>Test String</_x005B_DebugOnlyTest_x005D_TestLuaMod.TestString.DisplayName>
|
||||
<_x005B_DebugOnlyTest_x005D_TestLuaMod.TestString.DisplayCategory>Tests</_x005B_DebugOnlyTest_x005D_TestLuaMod.TestString.DisplayCategory>
|
||||
</infotexts>
|
||||
4
LocalMods/[DebugOnlyTest]TestLuaMod/dummy.xml
Normal file
4
LocalMods/[DebugOnlyTest]TestLuaMod/dummy.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Items>
|
||||
|
||||
</Items>
|
||||
5
LocalMods/[DebugOnlyTest]TestLuaMod/filelist.xml
Normal file
5
LocalMods/[DebugOnlyTest]TestLuaMod/filelist.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<contentpackage name="[DebugOnlyTest]TestLuaMod" >
|
||||
<Text file="%ModDir%/Texts/English.xml"/>
|
||||
<Item file="%ModDir%/dummy.xml" />
|
||||
</contentpackage>
|
||||
Reference in New Issue
Block a user