OBT/1.2.0(Spring Update)

Sync with Upstream
This commit is contained in:
NotAlwaysTrue
2026-04-25 13:25:41 +08:00
committed by GitHub
parent 5207b381b7
commit 59bc21973a
421 changed files with 24090 additions and 11391 deletions
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Configuration>
<Settings>
<Setting Name="HideUserNamesInLogs" Type="bool" Value="true"/>
<Setting Name="CsRunPolicy" Type="listString" Value="Prompt" AllowChangesWhileExecuting="false">
<Values>
<Value Value="Disabled"/>
<Value Value="Prompt"/>
<Value Value="Enabled"/>
</Values>
</Setting>
<Setting Name="UseCaching" Type="bool" Value="true" AllowChangesWhileExecuting="false"/>
<Setting Name="IsCsEnabledForSession" Type="bool" AllowChangesWhileExecuting="false" ShowInMenus="false" Value="false"/>
</Settings>
</Configuration>
@@ -0,0 +1,81 @@
-- Contains things to be removed later, they exist only for compatibility reasons.
local compatibilityLib = {}
-- local networking = LuaUserData.RegisterType("Barotrauma.LuaCsNetworking")
-- LuaUserData.AddMethod(networking, "RequestGetHTTP", Networking.HttpGet)
-- LuaUserData.AddMethod(networking, "RequestPostHTTP", Networking.HttpPost)
compatibilityLib.CreateVector2 = Vector2.__new
compatibilityLib.CreateVector3 = Vector3.__new
compatibilityLib.CreateVector4 = Vector4.__new
local luaRandom = {}
luaRandom.Range = function (min, max)
return math.random(min, max - 1)
end
luaRandom.RangeFloat = function (min, max)
return math.random() + math.random(min, max)
end
compatibilityLib["Random"] = luaRandom
local luaPlayer = {}
luaPlayer.GetAllCharacters = function ()
return Character.CharacterList
end
luaPlayer.GetAllClients = function ()
return Client.ClientList
end
luaPlayer.SetClientCharacter = function (client, character)
client.SetClientCharacter(character)
end
luaPlayer.SetCharacterTeam = function (character, team)
character.TeamID = team
end
luaPlayer.SetClientTeam = function (client, team)
client.TeamID = team
end
luaPlayer.Kick = function (client, reason)
client.Kick(reason)
end
luaPlayer.Ban = function (client, reason, range, seconds)
client.Ban(reason, range, seconds)
end
luaPlayer.UnbanPlayer = function (player, endpoint)
Client.Unban(player, endpoint)
end
luaPlayer.SetSpectatorPos = function ()
end
luaPlayer.SetRadioRange = function (character, range)
if (character.Inventory == nil) then return end
for item in character.Inventory.AllItems do
if item ~= nil and item.Prefab.Identifier == "headset" then
item.GetComponentString("WifiComponent").Range = range;
end
end
end
luaPlayer.CheckPermission = function (client, permissions)
return client.CheckPermission(permissions)
end
compatibilityLib["Player"] = luaPlayer
return compatibilityLib
@@ -0,0 +1,68 @@
Hook.Patch("Barotrauma.Item", "TryInteract",
{
"Barotrauma.Character",
"System.Boolean",
"System.Boolean",
"System.Boolean"
},
function(instance, p)
if Hook.Call("item.interact", instance, p["user"], p["ignoreRequiredItems"], p["forceSelectKey"], p["forceUseKey"]) == true then
p.PreventExecution = true
return false
end
end, Hook.HookMethodType.Before)
Hook.Patch("Barotrauma.Item", "ApplyTreatment",
{
"Barotrauma.Character",
"Barotrauma.Character",
"Barotrauma.Limb"
},
function(instance, p)
if Hook.Call("item.applyTreatment", instance, p["user"], p["character"], p["targetLimb"]) then
p.PreventExecution = true
return false
end
end, Hook.HookMethodType.Before)
Hook.Patch("Barotrauma.Item", "Combine",
{
"Barotrauma.Item",
"Barotrauma.Character"
},
function(instance, p)
if Hook.Call("item.combine", instance, p["item"], p["user"]) == true then
p.PreventExecution = true
return false
end
end, Hook.HookMethodType.Before)
Hook.Patch("Barotrauma.Item", "Drop",
function(instance, p)
if Hook.Call("item.drop", instance, p["dropper"]) == true then
p.PreventExecution = true
return false
end
end, Hook.HookMethodType.Before)
Hook.Patch("Barotrauma.Item", "Equip",
{
"Barotrauma.Character"
},
function(instance, p)
if Hook.Call("item.equip", instance, p["character"]) == true then
p.PreventExecution = true
return false
end
end, Hook.HookMethodType.Before)
Hook.Patch("Barotrauma.Item", "Unequip",
{
"Barotrauma.Character"
},
function(instance, p)
if Hook.Call("item.unequip", instance, p["character"]) == true then
p.PreventExecution = true
return false
end
end, Hook.HookMethodType.Before)
@@ -0,0 +1,90 @@
local defaultLib = {}
local CreateStatic = LuaUserData.CreateStatic
local CreateEnum = LuaUserData.CreateEnumTable
local AddCallMetaTable = LuaUserData.AddCallMetaTable
local localizedStrings = {
"LocalizedString", "LimitLString", "WrappedLString", "AddedPunctuationLString", "CapitalizeLString", "ConcatLString", "FallbackLString", "FormattedLString", "InputTypeLString", "JoinLString", "LowerLString", "RawLString", "ReplaceLString", "ServerMsgLString", "SplitLString", "TagLString", "TrimLString", "UpperLString", "StripRichTagsLString",
}
for key, value in pairs(localizedStrings) do
defaultLib[value] = CreateStatic("Barotrauma." .. value, true)
end
local sounds = {}
sounds.LowpassFilter = CreateStatic("Barotrauma.Sounds.LowpassFilter")
sounds.HighpassFilter = CreateStatic("Barotrauma.Sounds.HighpassFilter")
sounds.BandpassFilter = CreateStatic("Barotrauma.Sounds.BandpassFilter")
sounds.NotchFilter = CreateStatic("Barotrauma.Sounds.NotchFilter")
sounds.LowShelfFilter = CreateStatic("Barotrauma.Sounds.LowShelfFilter")
sounds.HighShelfFilter = CreateStatic("Barotrauma.Sounds.HighShelfFilter")
sounds.PeakFilter = CreateStatic("Barotrauma.Sounds.PeakFilter")
defaultLib["Sounds"] = sounds
defaultLib["SpriteEffects"] = CreateStatic("Microsoft.Xna.Framework.Graphics.SpriteEffects")
defaultLib["SoundPlayer"] = CreateStatic("Barotrauma.SoundPlayer")
defaultLib["SoundPrefab"] = CreateStatic("Barotrauma.SoundPrefab", true)
defaultLib["BackgroundMusic"] = CreateStatic("Barotrauma.BackgroundMusic", true)
defaultLib["GUISound"] = CreateStatic("Barotrauma.GUISound", true)
defaultLib["DamageSound"] = CreateStatic("Barotrauma.DamageSound", true)
defaultLib["WaterRenderer"] = CreateStatic("Barotrauma.WaterRenderer", true)
defaultLib["TextureLoader"] = CreateStatic("Barotrauma.TextureLoader")
defaultLib["Sprite"] = CreateStatic("Barotrauma.Sprite", true)
defaultLib["PlayerInput"] = CreateStatic("Barotrauma.PlayerInput", true)
defaultLib["Keys"] = CreateStatic("Microsoft.Xna.Framework.Input.Keys", true)
defaultLib["GUI"] = {
GUI = CreateStatic("Barotrauma.GUI", true),
Style = CreateStatic("Barotrauma.GUIStyle", true),
Component = CreateStatic("Barotrauma.GUIComponent"),
RectTransform = CreateStatic("Barotrauma.RectTransform", true),
LayoutGroup = CreateStatic("Barotrauma.GUILayoutGroup", true),
Button = CreateStatic("Barotrauma.GUIButton", true),
TextBox = CreateStatic("Barotrauma.GUITextBox", true),
Canvas = CreateStatic("Barotrauma.GUICanvas", true),
Frame = CreateStatic("Barotrauma.GUIFrame", true),
TextBlock = CreateStatic("Barotrauma.GUITextBlock", true),
TickBox = CreateStatic("Barotrauma.GUITickBox", true),
Image = CreateStatic("Barotrauma.GUIImage", true),
ListBox = CreateStatic("Barotrauma.GUIListBox", true),
ScrollBar = CreateStatic("Barotrauma.GUIScrollBar", true),
DropDown = CreateStatic("Barotrauma.GUIDropDown", true),
NumberInput = CreateStatic("Barotrauma.GUINumberInput", true),
MessageBox = CreateStatic("Barotrauma.GUIMessageBox", true),
ColorPicker = CreateStatic("Barotrauma.GUIColorPicker", true),
ProgressBar = CreateStatic("Barotrauma.GUIProgressBar", true),
CustomComponent = CreateStatic("Barotrauma.GUICustomComponent", true),
ScissorComponent = CreateStatic("Barotrauma.GUIScissorComponent", true),
VideoPlayer = CreateStatic("Barotrauma.VideoPlayer", true),
Graph = CreateStatic("Barotrauma.Graph", true),
SerializableEntityEditor = CreateStatic("Barotrauma.SerializableEntityEditor", true),
SlideshowPlayer = CreateStatic("Barotrauma.SlideshowPlayer", true),
CreditsPlayer = CreateStatic("Barotrauma.CreditsPlayer", true),
DragHandle = CreateStatic("Barotrauma.GUIDragHandle", true),
ContextMenu = CreateStatic("Barotrauma.GUIContextMenu", true),
ContextMenuOption = CreateStatic("Barotrauma.ContextMenuOption", true),
Screen = CreateStatic("Barotrauma.Screen"),
Anchor = CreateStatic("Barotrauma.Anchor"),
Alignment = CreateStatic("Barotrauma.Alignment"),
Pivot = CreateStatic("Barotrauma.Pivot"),
SoundType = CreateEnum("Barotrauma.GUISoundType"),
CursorState = CreateEnum("Barotrauma.CursorState"),
GUIStyle = CreateStatic("Barotrauma.GUIStyle", true),
}
local guiFallback = defaultLib["GUI"].GUI
setmetatable(defaultLib["GUI"], {
__index = function(_, key)
return guiFallback[key]
end
})
return defaultLib
@@ -0,0 +1,14 @@
local defaultLib = {}
local CreateStatic = LuaUserData.CreateStatic
local CreateEnum = LuaUserData.CreateEnumTable
local localizedStrings = {
"LocalizedString", "AddedPunctuationLString", "CapitalizeLString", "ConcatLString", "FallbackLString", "FormattedLString", "InputTypeLString", "JoinLString", "LowerLString", "RawLString", "ReplaceLString", "ServerMsgLString", "SplitLString", "TagLString", "TrimLString", "UpperLString", "StripRichTagsLString",
}
for key, value in pairs(localizedStrings) do
defaultLib[value] = CreateStatic("Barotrauma." .. value, true)
end
return defaultLib
@@ -0,0 +1,195 @@
local defaultLib = {}
local AddCallMetaTable = LuaUserData.AddCallMetaTable
local CreateStatic = LuaUserData.CreateStatic
local CreateEnum = LuaUserData.CreateEnumTable
defaultLib["SByte"] = CreateStatic("Barotrauma.LuaSByte", true)
defaultLib["Byte"] = CreateStatic("Barotrauma.LuaByte", true)
defaultLib["Int16"] = CreateStatic("Barotrauma.LuaInt16", true)
defaultLib["UInt16"] = CreateStatic("Barotrauma.LuaUInt16", true)
defaultLib["Int32"] = CreateStatic("Barotrauma.LuaInt32", true)
defaultLib["UInt32"] = CreateStatic("Barotrauma.LuaUInt32", true)
defaultLib["Int64"] = CreateStatic("Barotrauma.LuaInt64", true)
defaultLib["UInt64"] = CreateStatic("Barotrauma.LuaUInt64", true)
defaultLib["Single"] = CreateStatic("Barotrauma.LuaSingle", true)
defaultLib["Double"] = CreateStatic("Barotrauma.LuaDouble", true)
-- Backward compatibility
defaultLib["Float"] = CreateStatic("Barotrauma.LuaSingle", true)
defaultLib["Short"] = CreateStatic("Barotrauma.LuaInt16", true)
defaultLib["UShort"] = CreateStatic("Barotrauma.LuaUInt16", true)
defaultLib["SpawnType"] = CreateEnum("Barotrauma.SpawnType")
defaultLib["ChatMessageType"] = CreateEnum("Barotrauma.Networking.ChatMessageType")
defaultLib["ServerLog_MessageType"] = CreateEnum("Barotrauma.Networking.ServerLog+MessageType")
defaultLib["ServerLogMessageType"] = CreateEnum("Barotrauma.Networking.ServerLog+MessageType")
defaultLib["PositionType"] = CreateEnum("Barotrauma.Level+PositionType")
defaultLib["InvSlotType"] = CreateEnum("Barotrauma.InvSlotType")
defaultLib["LimbType"] = CreateEnum("Barotrauma.LimbType")
defaultLib["ActionType"] = CreateEnum("Barotrauma.ActionType")
defaultLib["AbilityEffectType"] = CreateEnum("Barotrauma.AbilityEffectType")
defaultLib["StatTypes"] = CreateEnum("Barotrauma.StatTypes")
defaultLib["AbilityFlags"] = CreateEnum("Barotrauma.AbilityFlags")
defaultLib["DeliveryMethod"] = CreateEnum("Barotrauma.Networking.DeliveryMethod")
defaultLib["ClientPacketHeader"] = CreateEnum("Barotrauma.Networking.ClientPacketHeader")
defaultLib["ServerPacketHeader"] = CreateEnum("Barotrauma.Networking.ServerPacketHeader")
defaultLib["RandSync"] = CreateEnum("Barotrauma.Rand+RandSync")
defaultLib["DisconnectReason"] = CreateEnum("Barotrauma.Networking.DisconnectReason")
defaultLib["CombatMode"] = CreateEnum("Barotrauma.AIObjectiveCombat+CombatMode")
defaultLib["CauseOfDeathType"] = CreateEnum("Barotrauma.CauseOfDeathType")
defaultLib["CharacterTeamType"] = CreateEnum("Barotrauma.CharacterTeamType")
defaultLib["ClientPermissions"] = CreateEnum("Barotrauma.Networking.ClientPermissions")
defaultLib["OrderCategory"] = CreateEnum("Barotrauma.OrderCategory")
defaultLib["WearableType"] = CreateEnum("Barotrauma.WearableType")
defaultLib["NumberType"] = CreateEnum("Barotrauma.NumberType")
defaultLib["ChatMode"] = CreateEnum("Barotrauma.ChatMode")
defaultLib["CharacterType"] = CreateEnum("Barotrauma.CharacterType")
defaultLib["VoteType"] = CreateEnum("Barotrauma.Networking.VoteType")
defaultLib["CanEnterSubmarine"] = CreateEnum("Barotrauma.CanEnterSubmarine")
defaultLib["InputType"] = CreateStatic("Barotrauma.InputType")
defaultLib["EventPrefab"] = CreateStatic("Barotrauma.EventPrefab", true)
defaultLib["TraitorEventPrefab"] = CreateStatic("Barotrauma.TraitorEventPrefab", true)
defaultLib["TraitorEvent"] = CreateStatic("Barotrauma.TraitorEvent", true)
defaultLib["EventSet"] = CreateStatic("Barotrauma.EventSet", true)
defaultLib["EventManagerSettings"] = CreateStatic("Barotrauma.EventManagerSettings", true)
defaultLib["NetConfig"] = CreateStatic("Barotrauma.Networking.NetConfig")
defaultLib["NetworkConnection"] = CreateStatic("Barotrauma.Networking.NetworkConnection")
defaultLib["Inventory"] = CreateStatic("Barotrauma.Inventory", true)
defaultLib["CharacterInventory"] = CreateStatic("Barotrauma.CharacterInventory", true)
defaultLib["ItemInventory"] = CreateStatic("Barotrauma.ItemInventory", true)
defaultLib["ContentPackageManager"] = CreateStatic("Barotrauma.ContentPackageManager")
defaultLib["GameSettings"] = CreateStatic("Barotrauma.GameSettings")
defaultLib["RichString"] = CreateStatic("Barotrauma.RichString", true)
defaultLib["Identifier"] = CreateStatic("Barotrauma.Identifier", true)
defaultLib["LanguageIdentifier"] = CreateStatic("Barotrauma.LanguageIdentifier", true)
defaultLib["ContentPackage"] = CreateStatic("Barotrauma.ContentPackage", true)
defaultLib["WayPoint"] = CreateStatic("Barotrauma.WayPoint", true)
defaultLib["Submarine"] = CreateStatic("Barotrauma.Submarine", true)
defaultLib["Client"] = CreateStatic("Barotrauma.Networking.Client", true)
defaultLib["Character"] = CreateStatic("Barotrauma.Character")
defaultLib["CharacterHealth"] = CreateStatic("Barotrauma.CharacterHealth", true)
defaultLib["CharacterPrefab"] = CreateStatic("Barotrauma.CharacterPrefab", true)
defaultLib["CharacterInfo"] = CreateStatic("Barotrauma.CharacterInfo", true)
AddCallMetaTable(defaultLib["CharacterInfo"].HeadPreset)
AddCallMetaTable(defaultLib["CharacterInfo"].HeadInfo)
defaultLib["CharacterInfoPrefab"] = CreateStatic("Barotrauma.CharacterInfoPrefab")
defaultLib["Item"] = CreateStatic("Barotrauma.Item", true)
AddCallMetaTable(defaultLib["Item"].ChangePropertyEventData)
defaultLib["MapEntityPrefab"] = CreateStatic("Barotrauma.MapEntityPrefab")
defaultLib["ItemPrefab"] = CreateStatic("Barotrauma.ItemPrefab", true)
defaultLib["TalentTree"] = CreateStatic("Barotrauma.TalentTree", true)
defaultLib["TalentPrefab"] = CreateStatic("Barotrauma.TalentPrefab", true)
defaultLib["FactionPrefab"] = CreateStatic("Barotrauma.FactionPrefab", true)
defaultLib["MissionPrefab"] = CreateStatic("Barotrauma.MissionPrefab", true)
defaultLib["Mission"] = CreateStatic("Barotrauma.Mission", true)
defaultLib["Level"] = CreateStatic("Barotrauma.Level")
defaultLib["LevelGenerationParams"] = CreateStatic("Barotrauma.LevelGenerationParams", true)
defaultLib["OutpostGenerationParams"] = CreateStatic("Barotrauma.OutpostGenerationParams", true)
defaultLib["RuinGenerationParams"] = CreateStatic("Barotrauma.RuinGeneration.RuinGenerationParams", true)
defaultLib["Job"] = CreateStatic("Barotrauma.Job", true)
defaultLib["JobPrefab"] = CreateStatic("Barotrauma.JobPrefab", true)
defaultLib["JobVariant"] = CreateStatic("Barotrauma.JobVariant", true)
defaultLib["AfflictionPrefab"] = CreateStatic("Barotrauma.AfflictionPrefab", true)
defaultLib["SkillSettings"] = CreateStatic("Barotrauma.SkillSettings", true)
defaultLib["ChatMessage"] = CreateStatic("Barotrauma.Networking.ChatMessage")
defaultLib["Structure"] = CreateStatic("Barotrauma.Structure", true)
defaultLib["Hull"] = CreateStatic("Barotrauma.Hull", true)
defaultLib["Gap"] = CreateStatic("Barotrauma.Gap", true)
defaultLib["Signal"] = CreateStatic("Barotrauma.Items.Components.Signal", true)
defaultLib["SubmarineInfo"] = CreateStatic("Barotrauma.SubmarineInfo", true)
defaultLib["Entity"] = CreateStatic("Barotrauma.Entity", true)
defaultLib["MapEntity"] = CreateStatic("Barotrauma.MapEntity", true)
defaultLib["Physics"] = CreateStatic("Barotrauma.Physics")
defaultLib["FireSource"] = CreateStatic("Barotrauma.FireSource", true)
defaultLib["TextManager"] = CreateStatic("Barotrauma.TextManager")
defaultLib["NetEntityEvent"] = CreateStatic("Barotrauma.Networking.NetEntityEvent")
defaultLib["Screen"] = CreateStatic("Barotrauma.Screen")
defaultLib["AttackResult"] = CreateStatic("Barotrauma.AttackResult", true)
defaultLib["TempClient"] = CreateStatic("Barotrauma.Networking.TempClient", true)
defaultLib["DecalManager"] = CreateStatic("Barotrauma.DecalManager", true)
defaultLib["AutoItemPlacer"] = CreateStatic("Barotrauma.AutoItemPlacer")
defaultLib["PropertyConditional"] = CreateStatic("Barotrauma.PropertyConditional", true)
defaultLib["StatusEffect"] = CreateStatic("Barotrauma.StatusEffect", true)
defaultLib["OutpostGenerator"] = CreateStatic("Barotrauma.OutpostGenerator")
defaultLib["DamageModifier"] = CreateStatic("Barotrauma.DamageModifier", true)
defaultLib["TraitorManager"] = CreateStatic("Barotrauma.TraitorManager", true)
AddCallMetaTable(defaultLib["TraitorManager"].TraitorResults)
defaultLib["Md5Hash"] = CreateStatic("Barotrauma.Md5Hash", true)
defaultLib["ContentXElement"] = CreateStatic("Barotrauma.ContentXElement", true)
defaultLib["ContentPath"] = CreateStatic("Barotrauma.ContentPath", true)
defaultLib["XElement"] = CreateStatic("System.Xml.Linq.XElement", true)
defaultLib["XName"] = CreateStatic("System.Xml.Linq.XName", true)
defaultLib["XAttribute"] = CreateStatic("System.Xml.Linq.XAttribute", true)
defaultLib["XContainer"] = CreateStatic("System.Xml.Linq.XContainer", true)
defaultLib["XDocument"] = CreateStatic("System.Xml.Linq.XDocument", true)
defaultLib["XNode"] = CreateStatic("System.Xml.Linq.XNode", true)
defaultLib["SoundsFile"] = CreateStatic("Barotrauma.SoundsFile", true)
defaultLib["Voting"] = CreateStatic("Barotrauma.Voting")
defaultLib["TimeSpan"] = CreateStatic("System.TimeSpan")
defaultLib["IPAddress"] = CreateStatic("System.Net.IPAddress")
defaultLib["ContentPackageId"] = CreateStatic("Barotrauma.ContentPackageId")
defaultLib["Address"] = CreateStatic("Barotrauma.Networking.Address")
defaultLib["AccountId"] = CreateStatic("Barotrauma.Networking.AccountId")
defaultLib["Endpoint"] = CreateStatic("Barotrauma.Networking.Endpoint")
defaultLib["Explosion"] = CreateStatic("Barotrauma.Explosion", true)
defaultLib["ConvertUnits"] = CreateStatic("FarseerPhysics.ConvertUnits")
defaultLib["ToolBox"] = CreateStatic("Barotrauma.ToolBox")
defaultLib["AIObjective"] = CreateStatic("Barotrauma.AIObjective", true)
defaultLib["AIObjectiveChargeBatteries"] = CreateStatic("Barotrauma.AIObjectiveChargeBatteries", true)
defaultLib["AIObjectiveCleanupItem"] = CreateStatic("Barotrauma.AIObjectiveCleanupItem", true)
defaultLib["AIObjectiveCleanupItems"] = CreateStatic("Barotrauma.AIObjectiveCleanupItems", true)
defaultLib["AIObjectiveCombat"] = CreateStatic("Barotrauma.AIObjectiveCombat", true)
defaultLib["AIObjectiveContainItem"] = CreateStatic("Barotrauma.AIObjectiveContainItem", true)
defaultLib["AIObjectiveDeconstructItem"] = CreateStatic("Barotrauma.AIObjectiveDeconstructItem", true)
defaultLib["AIObjectiveDeconstructItems"] = CreateStatic("Barotrauma.AIObjectiveDeconstructItems", true)
defaultLib["AIObjectiveEscapeHandcuffs"] = CreateStatic("Barotrauma.AIObjectiveEscapeHandcuffs", true)
defaultLib["AIObjectiveExtinguishFire"] = CreateStatic("Barotrauma.AIObjectiveExtinguishFire", true)
defaultLib["AIObjectiveExtinguishFires"] = CreateStatic("Barotrauma.AIObjectiveExtinguishFires", true)
defaultLib["AIObjectiveFightIntruders"] = CreateStatic("Barotrauma.AIObjectiveFightIntruders", true)
defaultLib["AIObjectiveFindDivingGear"] = CreateStatic("Barotrauma.AIObjectiveFindDivingGear", true)
defaultLib["AIObjectiveFindSafety"] = CreateStatic("Barotrauma.AIObjectiveFindSafety", true)
defaultLib["AIObjectiveFixLeak"] = CreateStatic("Barotrauma.AIObjectiveFixLeak", true)
defaultLib["AIObjectiveFixLeaks"] = CreateStatic("Barotrauma.AIObjectiveFixLeaks", true)
defaultLib["AIObjectiveGetItem"] = CreateStatic("Barotrauma.AIObjectiveGetItem", true)
defaultLib["AIObjectiveGoTo"] = CreateStatic("Barotrauma.AIObjectiveGoTo", true)
defaultLib["AIObjectiveIdle"] = CreateStatic("Barotrauma.AIObjectiveIdle", true)
defaultLib["AIObjectiveOperateItem"] = CreateStatic("Barotrauma.AIObjectiveOperateItem", true)
defaultLib["AIObjectiveOperateItem"] = CreateStatic("Barotrauma.AIObjectiveOperateItem", true)
defaultLib["AIObjectivePumpWater"] = CreateStatic("Barotrauma.AIObjectivePumpWater", true)
defaultLib["AIObjectiveRepairItem"] = CreateStatic("Barotrauma.AIObjectiveRepairItem", true)
defaultLib["AIObjectiveRepairItems"] = CreateStatic("Barotrauma.AIObjectiveRepairItems", true)
defaultLib["AIObjectiveRescue"] = CreateStatic("Barotrauma.AIObjectiveRescue", true)
defaultLib["AIObjectiveRescueAll"] = CreateStatic("Barotrauma.AIObjectiveRescueAll", true)
defaultLib["AIObjectiveReturn"] = CreateStatic("Barotrauma.AIObjectiveReturn", true)
defaultLib["AITarget"] = CreateStatic("Barotrauma.AITarget", true)
defaultLib["Order"] = CreateStatic("Barotrauma.Order", true)
defaultLib["OrderPrefab"] = CreateStatic("Barotrauma.OrderPrefab", true)
defaultLib["OrderTarget"] = CreateStatic("Barotrauma.OrderTarget", true)
local componentsToReference = { "DockingPort", "Door", "GeneticMaterial", "Growable", "Holdable", "LevelResource", "ItemComponent", "ItemLabel", "LightComponent", "Controller", "Deconstructor", "Engine", "Fabricator", "OutpostTerminal", "Pump", "Reactor", "Steering", "PowerContainer", "Projectile", "Repairable", "Rope", "Scanner", "ButtonTerminal", "ConnectionPanel", "CustomInterface", "MemoryComponent", "Terminal", "WifiComponent", "Wire", "TriggerComponent", "ElectricalDischarger", "EntitySpawnerComponent", "ProducedItem", "VineTile", "GrowthSideExtension", "IdCard", "MeleeWeapon", "Pickable", "Propulsion", "RangedWeapon", "RepairTool", "Sprayer", "Throwable", "ItemContainer", "Ladder", "LimbPos", "MiniMap", "OxygenGenerator", "Sonar", "SonarTransducer", "Vent", "NameTag", "Planter", "Powered", "PowerTransfer", "Quality", "RemoteController", "AdderComponent", "AndComponent", "ArithmeticComponent", "ColorComponent", "ConcatComponent", "Connection", "DelayComponent", "DivideComponent", "EqualsComponent", "ExponentiationComponent", "FunctionComponent", "GreaterComponent", "ModuloComponent", "MotionSensor", "MultiplyComponent", "NotComponent", "OrComponent", "OscillatorComponent", "OxygenDetector", "RegExFindComponent", "RelayComponent", "SignalCheckComponent", "SmokeDetector", "StringComponent", "SubtractComponent", "TrigonometricFunctionComponent", "WaterDetector", "XorComponent", "StatusHUD", "Turret", "Wearable", "CustomInterface"
}
defaultLib["Components"] = {}
for key, value in pairs(componentsToReference) do
defaultLib["Components"][value] = CreateStatic("Barotrauma.Items.Components." .. value, true)
end
defaultLib["Vector2"] = CreateStatic("Microsoft.Xna.Framework.Vector2", true)
defaultLib["Vector3"] = CreateStatic("Microsoft.Xna.Framework.Vector3", true)
defaultLib["Vector4"] = CreateStatic("Microsoft.Xna.Framework.Vector4", true)
defaultLib["Color"] = CreateStatic("Microsoft.Xna.Framework.Color", true)
defaultLib["Point"] = CreateStatic("Microsoft.Xna.Framework.Point", true)
defaultLib["Rectangle"] = CreateStatic("Microsoft.Xna.Framework.Rectangle", true)
defaultLib["Matrix"] = CreateStatic("Microsoft.Xna.Framework.Matrix", true)
return defaultLib
@@ -0,0 +1,40 @@
math.lerp = function (a, b, t)
if type(a) ~= "number" then error(string.format("bad argument #1 to 'lerp' (number expected, got %s)", type(a)), 2) end
if type(b) ~= "number" then error(string.format("bad argument #2 to 'lerp' (number expected, got %s)", type(b)), 2) end
if type(t) ~= "number" then error(string.format("bad argument #3 to 'lerp' (number expected, got %s)", type(t)), 2) end
return a * (1 - t) + b * t
end
math.clamp = function (value, min, max)
if type(value) ~= "number" then error(string.format("bad argument #1 to 'clamp' (number expected, got %s)", type(value)), 2) end
if type(min) ~= "number" then error(string.format("bad argument #2 to 'clamp' (number expected, got %s)", type(min)), 2) end
if type(max) ~= "number" then error(string.format("bad argument #3 to 'clamp' (number expected, got %s)", type(max)), 2) end
return math.max(min, math.min(max, value))
end
math.round = function (value, decimals)
if type(value) ~= "number" then error(string.format("bad argument #1 to 'round' (number expected, got %s)", type(value)), 2) end
if type(decimals) ~= "number" then error(string.format("bad argument #2 to 'round' (number expected, got %s)", type(decimals)), 2) end
decimals = decimals or 0
local mult = 10 ^ decimals
return math.floor(value * mult + 0.5) / mult
end
math.sign = function (value)
if type(value) ~= "number" then error(string.format("bad argument #1 to 'sign' (number expected, got %s)", type(value)), 2) end
return value >= 0 and 1 or -1
end
math.remap = function (value, inMin, inMax, outMin, outMax)
if type(value) ~= "number" then error(string.format("bad argument #1 to 'remap' (number expected, got %s)", type(value)), 2) end
if type(inMin) ~= "number" then error(string.format("bad argument #2 to 'remap' (number expected, got %s)", type(inMin)), 2) end
if type(inMax) ~= "number" then error(string.format("bad argument #3 to 'remap' (number expected, got %s)", type(inMax)), 2) end
if type(outMin) ~= "number" then error(string.format("bad argument #4 to 'remap' (number expected, got %s)", type(outMin)), 2) end
if type(outMax) ~= "number" then error(string.format("bad argument #5 to 'remap' (number expected, got %s)", type(outMax)), 2) end
return outMin + (outMax - outMin) * ((value - inMin) / (inMax - inMin))
end
@@ -0,0 +1,28 @@
if true then return end
local descriptor = LuaUserData.RegisterType("Barotrauma.LuaCsSteam")
LuaUserData.AddMethod(descriptor, "GetWorkshopCollection", function (id, callback)
id = tostring(id)
Networking.RequestPostHTTP("https://api.steampowered.com/ISteamRemoteStorage/GetCollectionDetails/v1/", function (result)
local data = json.parse(result)
if data.response.collectiondetails[1].children == nil then
callback()
return
end
local workshopItems = {}
for key, value in pairs(data.response.collectiondetails[1].children) do
table.insert(workshopItems, value.publishedfileid)
end
if callback then
callback(workshopItems)
end
end,
"collectioncount=1&publishedfileids[0]=" .. id,
"application/x-www-form-urlencoded")
end)
@@ -0,0 +1,13 @@
string.startsWith = function(str, start)
if type(str) ~= "string" then error(string.format("bad argument #1 to 'startsWith' (string expected, got %s)", type(str)), 2) end
if type(start) ~= "string" then error(string.format("bad argument #2 to 'startsWith' (string expected, got %s)", type(start)), 2) end
return string.sub(str, 1, string.len(start)) == start
end
string.endsWith = function(str, ending)
if type(str) ~= "string" then error(string.format("bad argument #1 to 'endsWith' (string expected, got %s)", type(str)), 2) end
if type(ending) ~= "string" then error(string.format("bad argument #2 to 'endsWith' (string expected, got %s)", type(ending)), 2) end
return ending == "" or string.sub(str, -string.len(ending)) == ending
end
@@ -0,0 +1,86 @@
Util = {}
local itemDictionary = {}
local itemGroups = {}
local function AddItem(item)
for _, itemGroup in pairs(itemGroups) do
if itemGroup.func(item) then
table.insert(itemGroup.items, item)
end
end
local id = item.Prefab.Identifier.Value
if itemDictionary[id] == nil then
itemDictionary[id] = {}
end
table.insert(itemDictionary[id], item)
end
Hook.Add("item.created", "luaSetup.util.itemDictionary", function (item)
AddItem(item)
end)
Hook.Add("roundEnd", "luaSetup.util.itemDictionary", function (item)
itemDictionary = {}
for _, itemGroup in pairs(itemGroups) do
itemGroup.items = {}
end
end)
for _, item in pairs(Item.ItemList) do
AddItem(item)
end
Util.RegisterItemGroup = function(groupName, func)
if type(groupName) ~= "string" then
error(string.format("bad argument #1 to 'RegisterItemGroup' (string expected, got %s)", type(groupName)), 2)
end
if type(func) ~= "function" then
error(string.format("bad argument #2 to 'RegisterItemGroup' (function expected, got %s)", type(func)), 2)
end
local items = {}
for _, item in pairs(Item.ItemList) do
if func(item) then
table.insert(items, item)
end
end
itemGroups[groupName] = {
func = func,
items = items
}
end
Util.GetItemGroup = function(groupName)
if type(groupName) ~= "string" then
error(string.format("bad argument #1 to 'GetItemGroup' (string expected, got %s)", type(groupName)), 2)
end
if not itemGroups[groupName] then
error("bad argument #1 to 'GetItemGroup' couldn't find the specified groupName", 2)
end
return itemGroups[groupName].items or {}
end
Util.GetItemsById = function(id)
if id == nil then
error(string.format("bad argument #1 to 'GetItemsById' (string expected, got %s)", type(id)), 2)
end
return itemDictionary[id]
end
Util.FindClientCharacter = function(character)
if CLIENT and Game.IsSingleplayer then return nil end
for _, client in pairs(Client.ClientList) do
if client.Character == character then
return client
end
end
end
@@ -0,0 +1,38 @@
LuaSetup = {}
local path = ...
local function AddTableToGlobal(tbl)
for k, v in pairs(tbl) do
_G[k] = v
end
end
if SERVER then
AddTableToGlobal(dofile(path .. "/Lua/DefaultLib/LibServer.lua"))
else
AddTableToGlobal(dofile(path .. "/Lua/DefaultLib/LibClient.lua"))
end
AddTableToGlobal(dofile(path .. "/Lua/DefaultLib/LibShared.lua"))
AddTableToGlobal(dofile(path .. "/Lua/CompatibilityLib.lua"))
dofile(path .. "/Lua/DefaultHook.lua")
Descriptors = LuaUserData
dofile(path .. "/Lua/DefaultLib/Utils/Math.lua")
dofile(path .. "/Lua/DefaultLib/Utils/String.lua")
dofile(path .. "/Lua/DefaultLib/Utils/Util.lua")
dofile(path .. "/Lua/DefaultLib/Utils/SteamApi.lua")
if not CSActive then
for k, v in pairs(debug) do
if k ~= "getmetatable" and k ~= "setmetatable" and k ~= "traceback" then
debug[k] = nil
end
end
end
LuaSetup = nil
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<ModConfig>
<Lua File="%ModDir%/Lua/LuaSetup.lua" IsAutorun="true" />
<Config File="%ModDir%/Config/SettingsShared.xml"/>
<Assembly File="%ModDir%/Publicized/BarotraumaCore.dll" IsReferenceModeOnly="true"/>
<Assembly File="%ModDir%/Publicized/Barotrauma.dll" Target="Client" IsReferenceModeOnly="true" IsFileRequired="false"/>
<Assembly File="%ModDir%/Publicized/DedicatedServer.dll" Target="Server" IsReferenceModeOnly="true"/>
</ModConfig>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<style>
<SettingsMenuTab.LuaCsSettings color="169,212,187,255" hovercolor="220,220,220,255" selectedcolor="255,255,255,255" pressedcolor="100,100,100,255" disabledcolor="125,125,125,125">
<Sprite name="LuaCsSettings" texture="%ModDir%/LuaCsSettingsIcon.png" sourcerect="0,0,64,64" tile="false" maintainaspectratio="true" origin="0.5,0.5"/>
</SettingsMenuTab.LuaCsSettings>
</style>
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<infotexts language="English" nowhitespace="false" translatedname="English">
<LuaCsForBarotrauma.SettingsMenu.ModControlsButton>Mod Controls Settings</LuaCsForBarotrauma.SettingsMenu.ModControlsButton>
<LuaCsForBarotrauma.SettingsMenu.ModGameplayButton>Mod Gameplay Settings</LuaCsForBarotrauma.SettingsMenu.ModGameplayButton>
<LuaCsForBarotrauma.SettingsMenu.ResetVisibleSettings>Reset Displayed Settings</LuaCsForBarotrauma.SettingsMenu.ResetVisibleSettings>
<LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Title>Reset Visible Settings</LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Title>
<LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Message>Are you sure you want to reset the values for currently displayed settings?</LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Message>
<LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Yes>Yes</LuaCsForBarotrauma.SettingsMenu.ResetPrompt.Yes>
<LuaCsForBarotrauma.SettingsMenu.ResetPrompt.No>No</LuaCsForBarotrauma.SettingsMenu.ResetPrompt.No>
<!-- Settings -->
<!-- Is Cs Enabled-->
<LuaCsForBarotrauma.CsRunPolicy.DisplayName>Are C# Mods Allowed</LuaCsForBarotrauma.CsRunPolicy.DisplayName>
<LuaCsForBarotrauma.CsRunPolicy.Tooltip>Should unsandboxed scripts and dlls be allowed to run.</LuaCsForBarotrauma.CsRunPolicy.Tooltip>
<LuaCsForBarotrauma.CsRunPolicy.DisplayCategory>General</LuaCsForBarotrauma.CsRunPolicy.DisplayCategory>
<!-- Use Caching -->
<LuaCsForBarotrauma.UseCaching.DisplayName>Use Pre-Caching</LuaCsForBarotrauma.UseCaching.DisplayName>
<LuaCsForBarotrauma.UseCaching.Tooltip>Should mod files be preloaded to speed up loading. Should only be turned off if you have mods that have issues with this.</LuaCsForBarotrauma.UseCaching.Tooltip>
<LuaCsForBarotrauma.UseCaching.DisplayCategory>General</LuaCsForBarotrauma.UseCaching.DisplayCategory>
<!-- Hide Usernames In Logs-->
<LuaCsForBarotrauma.HideUserNamesInLogs.DisplayName>Hide Local OS Account Name In Logs</LuaCsForBarotrauma.HideUserNamesInLogs.DisplayName>
<LuaCsForBarotrauma.HideUserNamesInLogs.Tooltip>If true, will replace your OS account name with 'USERNAME' in log files' paths.</LuaCsForBarotrauma.HideUserNamesInLogs.Tooltip>
<LuaCsForBarotrauma.HideUserNamesInLogs.DisplayCategory>General</LuaCsForBarotrauma.HideUserNamesInLogs.DisplayCategory>
</infotexts>
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<infotexts language="Portuguese" nowhitespace="false" translatedname="Portuguese">
</infotexts>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<contentpackage name="LuaCsForBarotrauma">
<Text file="%ModDir%/Texts/English.xml"/>
<UIStyle file="%ModDir%/Style.xml" />
<!--<Text file="%ModDir%/Texts/Portuguese.xml"/>-->
</contentpackage>
@@ -45,6 +45,11 @@
<Inventory slots="Any, Any, Any, Any" accessiblewhenalive="False" commonness="50">
<Item identifier="alienblood" />
</Inventory>
<StatusEffect type="OnDeconstructed" target="Character">
<SpawnItem identifiers="alienblood" spawnposition="ThisInventory" count="3" />
</StatusEffect>
<ai CombatStrength="100" Sight="1" Hearing="1" AggressionHurt="200" AggressionGreed="10" FleeHealthThreshold="10" AttackWhenProvoked="False" AvoidGunfire="True" DamageThreshold="0" AvoidTime="3" MinFleeTime="20" AggressiveBoarding="True" EnforceAggressiveBehaviorForMissions="True" TargetOuterWalls="True" RandomAttack="False" CanOpenDoors="False" KeepDoorsClosed="False" AvoidAbyss="True" StayInAbyss="False" PatrolFlooded="False" PatrolDry="False" StartAggression="0" MaxAggression="100" AggressionCumulation="0" WallTargetingMethod="Target">
<target Tag="decoy" State="Attack" Priority="500" ReactDistance="0" AttackDistance="0" Timer="0" IgnoreContained="False" IgnoreInside="False" IgnoreOutside="False" IgnoreIfNotInSameSub="True" IgnoreIncapacitated="False" Threshold="0" ThresholdMin="-1" ThresholdMax="-1" Offset="0,0" AttackPattern="Straight" PrioritizeSubCenter="False" SweepDistance="0" SweepStrength="10" SweepSpeed="1" CircleStartDistance="5000" CircleRotationSpeed="1" CircleStrikeDistanceMultiplier="5" CircleMaxRandomOffset="0" />
<target Tag="stronger" State="Avoid" Priority="200" ReactDistance="2000" AttackDistance="0" Timer="0" IgnoreContained="False" IgnoreInside="False" IgnoreOutside="False" IgnoreIfNotInSameSub="False" IgnoreIncapacitated="False" Threshold="0" ThresholdMin="-1" ThresholdMax="-1" Offset="0,0" AttackPattern="Straight" PrioritizeSubCenter="False" SweepDistance="0" SweepStrength="10" SweepSpeed="1" CircleStartDistance="5000" CircleRotationSpeed="1" CircleStrikeDistanceMultiplier="5" CircleMaxRandomOffset="0" />
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<contentpackage name="Lighting stress (10000 lights)" modversion="1.0.0" corepackage="False" gameversion="1.11.5.0">
<Submarine file="%ModDir%/Lighting stress (10000 lights).sub" />
</contentpackage>
Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

@@ -0,0 +1,23 @@
<Items>
<Item
name="Oxygen Dispenser Test"
identifier="oxygendispensertest"
tags="oxygengenerator,refuelableitem,donttakeitemstorefill"
category="Machine"
scale="0.5"
isshootable="true" GrabWhenSelected="true">
<Sprite texture="%ModDir%/EthanolPowerGenerator.png" depth="0.55" sourcerect="0,336,112,128"/>
<Body width="112" height="128" density="25" />
<Holdable selectkey="Select" pickkey="Use" slots="RightHand+LeftHand" msg="ItemMsgDetach" MsgWhenDropped="ItemMsgPickupSelect" PickingTime="5.0" holdpos="0,-80" handle1="-30,14" handle2="30,14" attachable="true" aimable="true" AttachesToFloor="true"
AttachedByDefault="true" DisallowAttachingOverTags="container,planter,refuelableitem" DisallowAttachingOverSize="115,130">
</Holdable>
<ItemContainer hideitems="false" drawinventory="true" ItemsUseInventoryPlacement="true" capacity="1" maxstacksize="1" canbeselected="true" itempos="32,-83" iteminterval="0,0" itemrotation="0" msg="ItemMsgOxygenRefill" containedspritedepth="0.1">
<GuiFrame relativesize="0.2,0.25" anchor="Center" minsize="140,170" maxsize="280,280" style="ItemUI" />
<SlotIcon slotindex="0" texture="Content/UI/StatusMonitorUI.png" sourcerect="64,448,64,64" origin="0.5,0.5" />
<Containable items="oxygensource" />
</ItemContainer>
</Item>
</Items>
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Items>
<Item name="fliptestholdable" identifier="fliptestholdable" Category="Misc" Tags="smallitem" health="35" maxstacksize="1" scale="0.5" isshootable="true" requireaimtouse="true">
<sprite texture="Content/Map/Outposts/Art/FactionItems.png" sourcerect="263,193,38,39" depth="0.2" origin="0.5,0.5" />
<Body radius="28" density="15" />
<LightComponent LightColor="220,150,30,150" range="15" IsOn="true" castshadows="false" lightoffset="40,20" vulnerabletoemp="false" >
<IsActiveConditional HasStatusTag="smoking" />
<StatusEffect OffsetCopiesEntityTransform="true" offset="40,20" type="OnUse" target="This" statuseffecttags="smoking" duration="0.1" stackable="false">
<ParticleEmitter particle="blooddrop" particlespersecond="10" scalemin="3" scalemax="3" velocitymin="0" velocitymax="0" colormultiplier="255,255,255,180" lifetimemultiplier="2"/>
<ParticleEmitter particle="smoke" particlespersecond="3" scalemin="0.35" scalemax="0.5" velocitymin="0" velocitymax="10" colormultiplier="255,255,255,200" />
</StatusEffect>
</LightComponent>
<Holdable slots="Any,RightHand,LeftHand" aimable="false" aimpos="32,21" handle1="0,-22" holdangle="0" aimangle="-25" swingamount="0,0" swingspeed="0.5" swingwhenusing="true" msg="ItemMsgPickUpSelect">
<StatusEffect type="OnUse" target="This" Condition="-4.0" />
<StatusEffect type="OnUse" target="This">
<Conditional InWater="false" />
<Sound file="Content/Items/Medical/ITEM_cigarette.ogg" range="250" loop="true" selectionmode="Random" />
</StatusEffect>
<StatusEffect type="OnBroken" target="This">
<SpawnItem identifier="bananapeel" spawnposition="SameInventory"/>
<Remove />
</StatusEffect>
</Holdable>
</Item>
<Item name="fliptestlight" identifier="fliptestlighttower" width="176" height="352" texturescale="1.0,1.0" scale="0.5" category="Decorative" subcategory="mining" noninteractable="true">
<sprite texture="Content/Map/Outposts/Art/TunnelWalls.png" sourcerect="849,1697,176,352" depth="0.97" premultiplyalpha="false" origin="0.5,0.5" />
<LightComponent range="160.0" lightcolor="255,234,181,200" IsOn="true" castshadows="false" LightOffset="200,147" allowingameediting="false">
<sprite texture="Content/Map/Outposts/Art/TunnelWalls.png" sourcerect="671,1697,176,62" depth="0.1" origin="0.5,0.5" alpha="1.0" />
<StatusEffect OffsetCopiesEntityTransform="true" offset="200,147" type="OnActive" target="This" duration="0.1" stackable="false">
<ParticleEmitter particle="blooddrop" particlespersecond="10" scalemin="3" scalemax="3" velocitymin="0" velocitymax="0" colormultiplier="255,255,255,180" lifetimemultiplier="2"/>
<ParticleEmitter particle="smoke" particlespersecond="3" scalemin="0.35" scalemax="0.5" velocitymin="0" velocitymax="10" colormultiplier="255,255,255,200" />
</StatusEffect>
</LightComponent>
</Item>
</Items>
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<contentpackage name="[DebugOnlyTest]RotationAndFlippingTests" modversion="1.0.2" corepackage="False" gameversion="1.7.6.0">
<contentpackage name="[DebugOnlyTest]RotationAndFlippingTests" modversion="1.0.3" corepackage="False" gameversion="1.11.5.0">
<Item file="%ModDir%/OxygenDispenserTest.xml" />
<Item file="%ModDir%/StatusEffectAndLightTest.xml" />
<Submarine file="%ModDir%/RotationAndFlippingTests.sub" />
</contentpackage>
@@ -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)
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Items>
</Items>
@@ -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>
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<RandomEvents>
<EventPrefabs>
<ScriptedEvent identifier="testpathfinding1" tags="testpathfinding_colony">
<SpawnAction NPCSetIdentifier="customnpcs1" NPCIdentifier="artiedolittle" TargetTag="npc1" SpawnPointTag="spawnpoint1" />
<SpawnAction NPCSetIdentifier="customnpcs1" NPCIdentifier="clownmessenger" TargetTag="npc2" SpawnPointTag="spawnpoint2" />
<SpawnAction NPCSetIdentifier="customnpcs1" NPCIdentifier="jacovsubra" TargetTag="npc3" SpawnPointTag="spawnpoint3" />
<SpawnAction NPCSetIdentifier="customnpcs1" NPCIdentifier="coalitionspy" TargetTag="npc4" SpawnPointTag="spawnpoint4" />
<SpawnAction NPCSetIdentifier="customnpcs1" NPCIdentifier="raptorowner" TargetTag="npc5" SpawnPointTag="spawnpoint5" />
<SpawnAction NPCSetIdentifier="customnpcs1" NPCIdentifier="hognose" TargetTag="npc6" SpawnPointTag="spawnpoint6" />
<SpawnAction NPCSetIdentifier="customnpcs1" NPCIdentifier="drugdealer" TargetTag="npc7" SpawnPointTag="spawnpoint7" />
<TagAction criteria="hullname:goalroom" tag="goal" />
<NPCFollowAction NPCTag="npc1" TargetTag="goal" />
<NPCFollowAction NPCTag="npc2" TargetTag="goal" />
<NPCFollowAction NPCTag="npc3" TargetTag="goal" />
<NPCFollowAction NPCTag="npc4" TargetTag="goal" />
<NPCFollowAction NPCTag="npc5" TargetTag="goal" forcewalk="true" />
<NPCFollowAction NPCTag="npc6" TargetTag="goal" forcewalk="true" />
<NPCFollowAction NPCTag="npc7" TargetTag="goal" forcewalk="true" />
<ConversationAction Text="Spawned 7 test NPCs. They should now navigate to the furthest module at the right side of the outpost. You may fast-forward by 60 seconds to skip to the end of the test." />
<WaitAction time="60" />
<CheckVisibilityAction EntityTag="npc1" TargetTag="goal" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 1 (Artie Dolittle) did not make it to the target module in time." />
</Failure>
<Success>
<CheckVisibilityAction EntityTag="npc2" TargetTag="goal" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 2 (Clown Messenger) did not make it to the target module in time." />
</Failure>
<Success>
<CheckVisibilityAction EntityTag="npc3" TargetTag="goal" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 3 (Jacov Subra) did not make it to the target module in time." />
</Failure>
<Success>
<CheckVisibilityAction EntityTag="npc4" TargetTag="goal" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 4 (Coalition Operative) did not make it to the target module in time." />
</Failure>
<Success>
<CheckVisibilityAction EntityTag="npc5" TargetTag="goal" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 5 (Severo Ruiz) did not make it to the target module in time." />
</Failure>
<Success>
<CheckVisibilityAction EntityTag="npc6" TargetTag="goal" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 6 (Captain Hognose) did not make it to the target module in time." />
</Failure>
<Success>
<CheckVisibilityAction EntityTag="npc7" TargetTag="goal" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 7 (Drug Dealer) did not make it to the target module in time." />
</Failure>
<Success>
<!-- ALL SUCCEEDED ******************************* -->
<ConversationAction Text="NPC test successful! All NPCs made it to the target module in time." />
</Success>
</CheckVisibilityAction>
</Success>
</CheckVisibilityAction>
</Success>
</CheckVisibilityAction>
</Success>
</CheckVisibilityAction>
</Success>
</CheckVisibilityAction>
</Success>
</CheckVisibilityAction>
</Success>
</CheckVisibilityAction>
<ConversationAction Text="Starting second test: making the NPCs navigate back to the left side of the outpost." />
<TagAction criteria="hullname:goalroom2" tag="goal2" />
<NPCFollowAction NPCTag="npc1" TargetTag="goal2" forcewalk="true" />
<WaitAction time="2" />
<NPCFollowAction NPCTag="npc2" TargetTag="goal2" forcewalk="true" />
<WaitAction time="2" />
<!-- follow another NPC instead of going directly for the goal! -->
<NPCFollowAction NPCTag="npc3" TargetTag="npc2" forcewalk="true" />
<WaitAction time="2" />
<NPCFollowAction NPCTag="npc4" TargetTag="goal2" />
<WaitAction time="2" />
<NPCFollowAction NPCTag="npc5" TargetTag="goal2" />
<WaitAction time="2" />
<NPCFollowAction NPCTag="npc6" TargetTag="goal2" />
<WaitAction time="2" />
<!-- follow another NPC instead of going directly for the goal! -->
<NPCFollowAction NPCTag="npc7" TargetTag="npc4" />
<WaitAction time="100" />
<CheckVisibilityAction EntityTag="npc1" TargetTag="goal2" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 1 (Artie Dolittle) did not make it to the target module in time." />
</Failure>
<Success>
<CheckVisibilityAction EntityTag="npc2" TargetTag="goal2" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 2 (Clown Messenger) did not make it to the target module in time." />
</Failure>
<Success>
<CheckVisibilityAction EntityTag="npc3" TargetTag="goal2" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 3 (Jacov Subra) did not make it to the target module in time." />
</Failure>
<Success>
<CheckVisibilityAction EntityTag="npc4" TargetTag="goal2" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 4 (Coalition Operative) did not make it to the target module in time." />
</Failure>
<Success>
<CheckVisibilityAction EntityTag="npc5" TargetTag="goal2" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 5 (Severo Ruiz) did not make it to the target module in time." />
</Failure>
<Success>
<CheckVisibilityAction EntityTag="npc6" TargetTag="goal2" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 6 (Captain Hognose) did not make it to the target module in time." />
</Failure>
<Success>
<CheckVisibilityAction EntityTag="npc7" TargetTag="goal2" MaxDistance="500">
<Failure>
<ConversationAction Text="Test failed. NPC 7 (Drug Dealer) did not make it to the target module in time." />
</Failure>
<Success>
<!-- ALL SUCCEEDED ******************************* -->
<ConversationAction Text="NPC test successful! All NPCs made it to the target module in time." />
</Success>
</CheckVisibilityAction>
</Success>
</CheckVisibilityAction>
</Success>
</CheckVisibilityAction>
</Success>
</CheckVisibilityAction>
</Success>
</CheckVisibilityAction>
</Success>
</CheckVisibilityAction>
</Success>
</CheckVisibilityAction>
</ScriptedEvent>
</EventPrefabs>
</RandomEvents>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<contentpackage name="[DebugOnlyTest]TestPathFinding" modversion="1.0.0" corepackage="False" gameversion="1.12.4.0">
<Outpost file="%ModDir%/[DebugOnlyTest]TestPathFinding.sub" />
<RandomEvents file="%ModDir%/Events.xml" />
</contentpackage>