Rust update

This commit is contained in:
Flero 2025-07-05 09:25:40 +09:30
parent 6825e8ae64
commit d62ccfaa04
Signed by: flerouwu
SSH key fingerprint: SHA256:FB8cuclKIbQLfo1o/JNTq7r9e3vocaOu/vkEg+gViVU
3832 changed files with 46601 additions and 636999 deletions

View file

@ -1,13 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/.idea.decompiled.iml
/modules.xml
/projectSettingsUpdater.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View file

@ -22,7 +22,7 @@
</ItemGroup>
<ItemGroup>
<Reference Include="System.Core">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/System.Core.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/System.Core.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View file

@ -13,49 +13,49 @@
<ItemGroup />
<ItemGroup>
<Reference Include="Facepunch.UnityEngine">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.UnityEngine.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.UI.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="Rust.UI">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.UI.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.UI.dll</HintPath>
</Reference>
<Reference Include="Unity.TextMeshPro">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Unity.TextMeshPro.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Unity.TextMeshPro.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.CoreModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.InputLegacyModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
<Reference Include="Facepunch.System">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.System.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.System.dll</HintPath>
</Reference>
<Reference Include="System.Xml">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/System.Xml.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/System.Xml.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AudioModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.AudioModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.AudioModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ParticleSystemModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.ParticleSystemModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.ParticleSystemModule.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Network">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Network.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Network.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Unity">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Unity.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Unity.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Input">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Input.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Input.dll</HintPath>
</Reference>
<Reference Include="System.Core">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/System.Core.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/System.Core.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.JSONSerializeModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.JSONSerializeModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.JSONSerializeModule.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View file

@ -16,32 +16,43 @@ public static class KeyCombos
}
string[] array = name.Substring(1, name.Length - 2).ToLowerInvariant().Split('+');
List<KeyCode> list = new List<KeyCode>(array.Length);
List<string> list2 = new List<string>(array.Length);
string[] array2 = array;
foreach (string text in array2)
{
string value = text;
string text2 = text;
if (text.Length == 1 && char.IsDigit(text[0]))
{
value = "alpha" + text;
text2 = "alpha" + text;
}
if (!Enum.TryParse<KeyCode>(value, ignoreCase: true, out var result))
if (text2 == "mousewheelup" || text2 == "mousewheeldown")
{
list2.Add(text2);
continue;
}
if (!Enum.TryParse<KeyCode>(text2, ignoreCase: true, out var result))
{
keys = null;
return false;
}
list.Add(result);
string text3 = result.ToString().ToLowerInvariant();
list2.Add(text3.StartsWith("alpha") ? text3.Replace("alpha", "") : text3);
}
IEnumerable<string> values = from k in list
select k.ToString().ToLowerInvariant() into s
select (!s.StartsWith("alpha")) ? s : s.Replace("alpha", "");
name = "[" + string.Join("+", values) + "]";
name = "[" + string.Join("+", list2) + "]";
keys = list;
return true;
}
public static void RegisterButton(string name, List<KeyCode> keys)
{
if (string.IsNullOrWhiteSpace(name) || keys == null || keys.Count <= 1 || Input.HasButton(name))
if (string.IsNullOrWhiteSpace(name) || keys == null)
{
return;
}
bool usesMouseWheelUp = name.Contains("mousewheelup");
bool usesMouseWheelDown = name.Contains("mousewheeldown");
if ((keys.Count <= 1 && !usesMouseWheelUp && !usesMouseWheelDown) || Input.HasButton(name))
{
return;
}
@ -61,6 +72,14 @@ public static class KeyCombos
{
return false;
}
if (usesMouseWheelUp && UnityEngine.Input.GetAxis("Mouse ScrollWheel") <= 0f)
{
return false;
}
if (usesMouseWheelDown && UnityEngine.Input.GetAxis("Mouse ScrollWheel") >= 0f)
{
return false;
}
}
return true;
});

View file

@ -90,7 +90,7 @@ public static class AntiHack
private const int vehicle_mask = 8192;
private const int grounded_mask = 1503731969;
private const int grounded_mask = 1503764737;
private const int player_mask = 131072;
@ -1324,7 +1324,7 @@ public static class AntiHack
Vector3 vector2 = vector + new Vector3(0f, radius - flyhack_extrusion, 0f);
Vector3 vector3 = vector + new Vector3(0f, height - radius, 0f);
float radius2 = radius - flyhack_margin;
ply.isInAir = !UnityEngine.Physics.CheckCapsule(vector2, vector3, radius2, 1503731969, QueryTriggerInteraction.Ignore);
ply.isInAir = !UnityEngine.Physics.CheckCapsule(vector2, vector3, radius2, 1503764737, QueryTriggerInteraction.Ignore);
if (ply.isInAir)
{
int num = UnityEngine.Physics.OverlapCapsuleNonAlloc(vector2, vector3, radius2, buffer, 131072, QueryTriggerInteraction.Ignore);

View file

@ -13,238 +13,238 @@
<ItemGroup />
<ItemGroup>
<Reference Include="UnityEngine.CoreModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TerrainModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.TerrainModule.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Network">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Network.dll</HintPath>
</Reference>
<Reference Include="Facepunch.UnityEngine">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
<Reference Include="Rust.Localization">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.Localization.dll</HintPath>
</Reference>
<Reference Include="Rust.UI">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.UI.dll</HintPath>
</Reference>
<Reference Include="Rust.Data">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.Data.dll</HintPath>
</Reference>
<Reference Include="System.Core">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/System.Core.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Nexus">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Nexus.dll</HintPath>
</Reference>
<Reference Include="Facepunch.System">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.System.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Unity">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Unity.dll</HintPath>
</Reference>
<Reference Include="Rust.Global">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.Global.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AnimationModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.AnimationModule.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Console">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Console.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ParticleSystemModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.ParticleSystemModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VehiclesModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.VehiclesModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AIModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.AIModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="Rust.World">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.World.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.World.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Network">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Network.dll</HintPath>
</Reference>
<Reference Include="Facepunch.UnityEngine">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
<Reference Include="Rust.Localization">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.Localization.dll</HintPath>
</Reference>
<Reference Include="Rust.UI">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.UI.dll</HintPath>
</Reference>
<Reference Include="Rust.Data">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.Data.dll</HintPath>
</Reference>
<Reference Include="System.Core">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/System.Core.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Nexus">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Nexus.dll</HintPath>
</Reference>
<Reference Include="Facepunch.System">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.System.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Unity">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Unity.dll</HintPath>
</Reference>
<Reference Include="Rust.Global">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.Global.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AnimationModule">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.AnimationModule.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Console">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Console.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ParticleSystemModule">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.ParticleSystemModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VehiclesModule">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.VehiclesModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AIModule">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.AIModule.dll</HintPath>
</Reference>
<Reference Include="Rust.Clans">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.Clans.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.Clans.dll</HintPath>
</Reference>
<Reference Include="Unity.Collections">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Unity.Collections.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Unity.Collections.dll</HintPath>
</Reference>
<Reference Include="Unity.Mathematics">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Unity.Mathematics.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Unity.Mathematics.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AudioModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.AudioModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.AudioModule.dll</HintPath>
</Reference>
<Reference Include="Unity.TextMeshPro">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Unity.TextMeshPro.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Unity.TextMeshPro.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.UIModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.UIModule.dll</HintPath>
</Reference>
<Reference Include="Unity.AI.Navigation">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Unity.AI.Navigation.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Unity.AI.Navigation.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Newtonsoft.Json.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.InputLegacyModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
<Reference Include="Rust.Platform.Common">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.Platform.Common.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.Platform.Common.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Skeleton">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Skeleton.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Skeleton.dll</HintPath>
</Reference>
<Reference Include="Facepunch.BurstCloth">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.BurstCloth.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.BurstCloth.dll</HintPath>
</Reference>
<Reference Include="EZhex1991.EZSoftBone">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/EZhex1991.EZSoftBone.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/EZhex1991.EZSoftBone.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Flexbox">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Flexbox.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Flexbox.dll</HintPath>
</Reference>
<Reference Include="CurvedTextMeshPro">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/CurvedTextMeshPro.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/CurvedTextMeshPro.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VideoModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.VideoModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.VideoModule.dll</HintPath>
</Reference>
<Reference Include="Rust.Workshop">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.Workshop.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.Workshop.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Raknet">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Raknet.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Raknet.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TerrainModule">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.TerrainModule.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Input">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Input.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Input.dll</HintPath>
</Reference>
<Reference Include="Facepunch.UnwrapBaker.Settings">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.UnwrapBaker.Settings.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.UnwrapBaker.Settings.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.IMGUIModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="Rust.FileSystem">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.FileSystem.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.FileSystem.dll</HintPath>
</Reference>
<Reference Include="Ionic.Zip.Reduced">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Ionic.Zip.Reduced.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Ionic.Zip.Reduced.dll</HintPath>
</Reference>
<Reference Include="Cronos">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Cronos.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Cronos.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Unity.Burst.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Unity.Burst.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ClothModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.ClothModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.ClothModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TerrainPhysicsModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.TerrainPhysicsModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.TerrainPhysicsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.UnityWebRequestModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.UnityWebRequestModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.WindModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.WindModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.WindModule.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/System.Net.Http.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Sqlite">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Sqlite.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Sqlite.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.DirectorModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.DirectorModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.DirectorModule.dll</HintPath>
</Reference>
<Reference Include="Unity.Timeline">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Unity.Timeline.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Unity.Timeline.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestWWWModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.UnityWebRequestWWWModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
<Reference Include="RTLTMPro">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/RTLTMPro.dll</HintPath>
</Reference>
<Reference Include="EasyRoads3Dv3">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/EasyRoads3Dv3.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Physics2DModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.Physics2DModule.dll</HintPath>
</Reference>
<Reference Include="Fleck">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Fleck.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Rcon">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Rcon.dll</HintPath>
</Reference>
<Reference Include="ZString">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/ZString.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.UnityWebRequestWWWModule.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Steamworks.Posix">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Steamworks.Posix.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Steamworks.Posix.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
<Reference Include="RTLTMPro">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/RTLTMPro.dll</HintPath>
</Reference>
<Reference Include="EasyRoads3Dv3">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/EasyRoads3Dv3.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Physics2DModule">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.Physics2DModule.dll</HintPath>
</Reference>
<Reference Include="Fleck">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Fleck.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Rcon">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Rcon.dll</HintPath>
</Reference>
<Reference Include="ZString">
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/ZString.dll</HintPath>
</Reference>
<Reference Include="Azure.Identity">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Azure.Identity.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Azure.Identity.dll</HintPath>
</Reference>
<Reference Include="Azure.Storage.Blobs">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Azure.Storage.Blobs.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Azure.Storage.Blobs.dll</HintPath>
</Reference>
<Reference Include="Azure.Core">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Azure.Core.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Azure.Core.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Ping">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.Ping.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.Ping.dll</HintPath>
</Reference>
<Reference Include="Rust.Harmony">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.Harmony.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.Harmony.dll</HintPath>
</Reference>
<Reference Include="LZ4">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/LZ4.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/LZ4.dll</HintPath>
</Reference>
<Reference Include="Rust.Clans.Local">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.Clans.Local.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.Clans.Local.dll</HintPath>
</Reference>
<Reference Include="Rust.Platform">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.Platform.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.Platform.dll</HintPath>
</Reference>
<Reference Include="Rust.Demo">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Rust.Demo.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Rust.Demo.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ImageConversionModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.ImageConversionModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.ImageConversionModule.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="TimeZoneConverter">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/TimeZoneConverter.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/TimeZoneConverter.dll</HintPath>
</Reference>
<Reference Include="Facepunch.SteamNetworking">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/Facepunch.SteamNetworking.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/Facepunch.SteamNetworking.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.JSONSerializeModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.JSONSerializeModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.JSONSerializeModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TilemapModule">
<HintPath>../../../../../work/rust-server/RustDedicated_Data/Managed/UnityEngine.TilemapModule.dll</HintPath>
<HintPath>../../ProtobitRust/.references/RustDedicated_Data/Managed/UnityEngine.TilemapModule.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View file

@ -309,7 +309,7 @@ public class AttackEntity : HeldEntity
Collider col;
if (num8 > ConVar.AntiHack.eye_noclip_cutoff)
{
if (AntiHack.TestNoClipping(player, position2, vector3, BasePlayer.NoClipRadius(ConVar.AntiHack.eye_noclip_margin), ConVar.AntiHack.eye_noclip_backtracking, out col))
if (AntiHack.TestNoClipping(player, position2, vector3, BasePlayer.NoClipRadius(ConVar.AntiHack.eye_noclip_margin), ConVar.AntiHack.eye_noclip_backtracking, out col, vehicleLayer: false, null, forceCast: true))
{
string shortPrefabName5 = base.ShortPrefabName;
string[] obj2 = new string[6] { "NoClip (", shortPrefabName5, " on attack) ", null, null, null };
@ -323,7 +323,7 @@ public class AttackEntity : HeldEntity
flag = false;
}
}
else if (num8 > 0.01f && AntiHack.TestNoClipping(player, position2, vector3, 0.1f, ConVar.AntiHack.eye_noclip_backtracking, out col))
else if (num8 > 0.01f && AntiHack.TestNoClipping(player, position2, vector3, 0.1f, ConVar.AntiHack.eye_noclip_backtracking, out col, vehicleLayer: false, null, forceCast: true))
{
string shortPrefabName6 = base.ShortPrefabName;
string[] obj3 = new string[6] { "NoClip (", shortPrefabName6, " on attack) ", null, null, null };

View file

@ -24,7 +24,7 @@ public class AudioSettings : MonoBehaviour
}
float num = 1f - ((SingletonComponent<MixerSnapshotManager>.Instance == null) ? 0f : SingletonComponent<MixerSnapshotManager>.Instance.deafness);
mixer.SetFloat("WorldVol", LinearToDecibel(Audio.game * num));
mixer.SetFloat("UIVol", LinearToDecibel(Audio.game * num));
mixer.SetFloat("UIVol", LinearToDecibel(Audio.ui * num));
mixer.SetFloat("WorldVolFlashbang", LinearToDecibel(Audio.game));
mixer.SetFloat("VoiceVol", LinearToDecibel(Audio.voices * num));
mixer.SetFloat("InstrumentVol", LinearToDecibel(Audio.instruments * num));

View file

@ -8,16 +8,12 @@ using Facepunch.Rust;
using Network;
using ProtoBuf;
using Rust;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Assertions;
public class AutoTurret : ContainerIOEntity, IRemoteControllable
public class AutoTurret : ContainerIOEntity, IRemoteControllable, IHostileWarningEntity
{
public static class TurretFlags
{
public const Flags Peacekeeper = Flags.Reserved1;
}
public class UpdateAutoTurretScanQueue : PersistentObjectWorkQueue<AutoTurret>
{
protected override void RunJob(AutoTurret entity)
@ -92,6 +88,8 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
public float aimCone;
public const Flags Flag_Peacekeeper = Flags.Reserved1;
public const Flags Flag_Equipped = Flags.Reserved3;
public const Flags Flag_MaxAuths = Flags.Reserved4;
@ -129,22 +127,22 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
private bool authDirty;
private bool hasPotentialUnauthedTarget = true;
private double nextShotTime;
private float nextShotTime;
private double nextVisCheck;
private float lastShotTime;
private double lastTargetSeenTime;
private float nextVisCheck;
private double lastDamageEventTime;
private float lastTargetSeenTime;
private double lastScanTime;
private double nextIdleAimTime;
private bool targetVisible = true;
private bool booting;
private float nextIdleAimTime;
private Vector3 targetAimDir = Vector3.forward;
private const float bulletDamage = 15f;
@ -159,7 +157,17 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
private const float SlowProjectileSpeedThreshold = 100f;
private float nextForcedAimTime;
private Matrix4x4 gunRoot;
private Matrix4x4 gunAimInitialLS;
private Quaternion gunAimInitialRot;
private Quaternion gunAimRotLS;
private Transform cachedTransf;
private double nextForcedAimTime;
private Vector3 lastSentAimDir = Vector3.zero;
@ -173,7 +181,7 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
[NonSerialized]
private int totalAmmo;
private float nextAmmoCheckTime;
private double nextAmmoCheckTime;
private bool totalAmmoDirty = true;
@ -187,6 +195,10 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
public bool CanPing => false;
public bool IsServer => base.isServer;
public bool IsClient => base.isClient;
public virtual bool RequiresMouse => true;
public float MaxRange => 10000f;
@ -575,19 +587,25 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
base.ResetState();
}
public virtual Transform GetCenterMuzzle()
public virtual Matrix4x4 GetCenterMuzzle()
{
return gun_pitch;
if (base.isServer)
{
return cachedTransf.localToWorldMatrix * gunAimInitialLS * Matrix4x4.Rotate(gunAimRotLS);
}
return gun_pitch.localToWorldMatrix;
}
public float AngleToTarget(BaseCombatEntity potentialtarget, bool use2D = false)
{
use2D = true;
Transform centerMuzzle = GetCenterMuzzle();
Vector3 position = centerMuzzle.position;
Matrix4x4 centerMuzzle = GetCenterMuzzle();
Vector3 position = centerMuzzle.GetPosition();
Vector3 vector = AimOffset(potentialtarget);
Vector3 zero = Vector3.zero;
return Vector3.Angle(to: (!use2D) ? (vector - position).normalized : Vector3Ex.Direction2D(vector, position), from: use2D ? centerMuzzle.forward.XZ3D().normalized : centerMuzzle.forward);
zero = ((!use2D) ? (vector - position).normalized : Vector3Ex.Direction2D(vector, position));
Vector3 vector2 = centerMuzzle.MultiplyVector(Vector3.forward);
return Vector3.Angle(use2D ? vector2.XZ3D().normalized : vector2, zero);
}
public virtual bool InFiringArc(BaseCombatEntity potentialtarget)
@ -696,23 +714,22 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
public void UpdateAiming(float dt)
{
if (!(aimDir == Vector3.zero))
if (aimDir == Vector3.zero)
{
float speed = 5f;
if (base.isServer && !IsBeingControlled)
return;
}
float speed = 5f;
if (base.isServer && !IsBeingControlled)
{
speed = ((!HasTarget()) ? 15f : 35f);
}
Quaternion quaternion = Quaternion.LookRotation(aimDir);
if (base.isServer)
{
Quaternion quaternion2 = Quaternion.Inverse(cachedTransf.rotation * gunAimInitialRot) * quaternion;
if (gunAimRotLS != quaternion2)
{
speed = ((!HasTarget()) ? 15f : 35f);
}
Quaternion quaternion = Quaternion.LookRotation(aimDir);
Quaternion quaternion2 = Quaternion.Euler(0f, quaternion.eulerAngles.y, 0f);
Quaternion quaternion3 = Quaternion.Euler(quaternion.eulerAngles.x, 0f, 0f);
if (gun_yaw.transform.rotation != quaternion2)
{
gun_yaw.transform.rotation = Mathx.Lerp(gun_yaw.transform.rotation, quaternion2, speed, dt);
}
if (gun_pitch.transform.localRotation != quaternion3)
{
gun_pitch.transform.localRotation = Mathx.Lerp(gun_pitch.transform.localRotation, quaternion3, speed, dt);
gunAimRotLS = Mathx.Lerp(gunAimRotLS, quaternion2, speed, dt);
}
}
}
@ -748,6 +765,33 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
return false;
}
bool IHostileWarningEntity.WarningEnabled(BaseEntity forEntity)
{
if (!IsPowered())
{
return false;
}
if (!PeacekeeperMode())
{
return false;
}
BasePlayer basePlayer = forEntity as BasePlayer;
if (basePlayer == null)
{
return false;
}
if (IsAuthed(basePlayer))
{
return false;
}
return true;
}
float IHostileWarningEntity.WarningRange()
{
return sightRange * 2f;
}
public bool PeacekeeperMode()
{
return HasFlag(Flags.Reserved1);
@ -811,7 +855,8 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
return;
}
UpdateManualAim(inputState);
if (UnityEngine.Time.time < nextShotTime)
double timeAsDouble = UnityEngine.Time.timeAsDouble;
if (timeAsDouble < nextShotTime)
{
return;
}
@ -841,24 +886,24 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
}
if (attachedWeapon.primaryMagazine.contents > 0)
{
FireAttachedGun(Vector3.zero, aimCone, null, null, damageModifier, speedModifier);
FireAttachedGun(Vector3.zero, aimCone, null, damageModifier, speedModifier);
float delay = (attachedWeapon.isSemiAuto ? (attachedWeapon.repeatDelay * 1.5f) : attachedWeapon.repeatDelay);
delay = attachedWeapon.ScaleRepeatDelay(delay);
nextShotTime = UnityEngine.Time.time + delay;
nextShotTime = timeAsDouble + (double)delay;
}
else
{
nextShotTime = UnityEngine.Time.time + 5f;
nextShotTime = timeAsDouble + 5.0;
}
}
else if (HasGenericFireable())
{
AttachedWeapon.ServerUse();
nextShotTime = UnityEngine.Time.time + 0.115f;
nextShotTime = timeAsDouble + 0.11500000208616257;
}
else
{
nextShotTime = UnityEngine.Time.time + 1f;
nextShotTime = timeAsDouble + 1.0;
}
}
}
@ -1008,13 +1053,12 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
public static void ProcessInterferenceQueue()
{
float realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartup;
float num = 0.0005f;
double realtimeSinceStartupAsDouble = UnityEngine.Time.realtimeSinceStartupAsDouble;
List<AutoTurret> obj = Facepunch.Pool.Get<List<AutoTurret>>();
while (interferenceUpdateList.Count > 0 && UnityEngine.Time.realtimeSinceStartup < realtimeSinceStartup + num)
while (interferenceUpdateList.Count > 0 && UnityEngine.Time.realtimeSinceStartupAsDouble < realtimeSinceStartupAsDouble + 0.0005)
{
obj.Clear();
ulong num2 = 0uL;
ulong num = 0uL;
AutoTurret autoTurret = null;
foreach (AutoTurret interferenceUpdate in interferenceUpdateList)
{
@ -1022,9 +1066,9 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
{
obj.Add(interferenceUpdate);
}
else if (interferenceUpdate.net.ID.Value > num2)
else if (interferenceUpdate.net.ID.Value > num)
{
num2 = interferenceUpdate.net.ID.Value;
num = interferenceUpdate.net.ID.Value;
autoTurret = interferenceUpdate;
}
}
@ -1303,6 +1347,13 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
updateAutoTurretScanQueue.Add(this);
targetTrigger.GetComponent<SphereCollider>().radius = sightRange;
UpdateNearbyTurrets(created: true);
cachedTransf = base.transform;
gunRoot = cachedTransf.localToWorldMatrix;
Matrix4x4 matrix4x = gun_yaw.localToWorldMatrix * gunRoot.inverse;
Matrix4x4 matrix4x2 = Matrix4x4.TRS(gun_pitch.localPosition, gun_pitch.localRotation, gun_pitch.localScale);
gunAimInitialLS = matrix4x2 * matrix4x;
gunAimRotLS = gunAimInitialLS.rotation;
gunAimInitialRot = gunAimRotLS;
}
internal override void DoServerDestroy()
@ -1322,7 +1373,7 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
public void SendAimDir()
{
if (UnityEngine.Time.realtimeSinceStartup > nextForcedAimTime || HasTarget() || Vector3.Angle(lastSentAimDir, aimDir) > 0.03f)
if (UnityEngine.Time.realtimeSinceStartupAsDouble > nextForcedAimTime || HasTarget() || Vector3.Angle(lastSentAimDir, aimDir) > 0.03f)
{
SendAimDirImmediate();
}
@ -1332,7 +1383,7 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
{
lastSentAimDir = aimDir;
ClientRPC(RpcTarget.NetworkGroup("CLIENT_ReceiveAimDir"), aimDir);
nextForcedAimTime = UnityEngine.Time.realtimeSinceStartup + 2f;
nextForcedAimTime = UnityEngine.Time.realtimeSinceStartupAsDouble + 2.0;
}
public void SetTarget(BaseCombatEntity targ)
@ -1344,10 +1395,15 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
{
MarkDirtyForceUpdateOutputs();
}
nextShotTime += 0.1f;
nextShotTime += 0.10000000149011612;
authDirty = true;
}
target = targ;
if (target.IsRealNull())
{
targetVisible = false;
nextVisCheck = 0.0;
}
}
public virtual bool CheckPeekers()
@ -1397,12 +1453,13 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
return false;
}
public virtual void FireAttachedGun(Vector3 targetPos, float aimCone, Transform muzzleToUse = null, BaseCombatEntity target = null, float damageModifier = 1f, float speedModifier = 1f)
public virtual void FireAttachedGun(Vector3 targetPos, float aimCone, BaseCombatEntity target = null, float damageModifier = 1f, float speedModifier = 1f)
{
BaseProjectile attachedWeapon = GetAttachedWeapon();
if (!(attachedWeapon == null) && !IsOffline())
{
attachedWeapon.ServerUse(damageModifier, speedModifier, IsBeingControlled ? RCEyes : gun_pitch, useBulletThickness: false);
Matrix4x4 value = (IsBeingControlled ? RCEyes.localToWorldMatrix : GetCenterMuzzle());
attachedWeapon.ServerUse(damageModifier, speedModifier, value, useBulletThickness: false);
}
}
@ -1416,12 +1473,14 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
{
muzzleToUse = muzzlePos;
}
Vector3 vector = GetCenterMuzzle().transform.position - GetCenterMuzzle().forward * 0.25f;
Vector3 vector2 = GetCenterMuzzle().transform.forward;
Vector3 modifiedAimConeDirection = AimConeUtil.GetModifiedAimConeDirection(aimCone, vector2);
targetPos = vector + modifiedAimConeDirection * 300f;
Matrix4x4 centerMuzzle = GetCenterMuzzle();
Vector3 vector = centerMuzzle.MultiplyVector(Vector3.forward);
Vector3 vector2 = centerMuzzle.GetPosition() - vector * 0.25f;
Vector3 vector3 = vector;
Vector3 modifiedAimConeDirection = AimConeUtil.GetModifiedAimConeDirection(aimCone, vector3);
targetPos = vector2 + modifiedAimConeDirection * 300f;
List<RaycastHit> obj = Facepunch.Pool.Get<List<RaycastHit>>();
GamePhysics.TraceAll(new Ray(vector, modifiedAimConeDirection), 0f, obj, 300f, 1220225809);
GamePhysics.TraceAll(new Ray(vector2, modifiedAimConeDirection), 0f, obj, 300f, 1220225809);
bool flag = false;
for (int i = 0; i < obj.Count; i++)
{
@ -1443,7 +1502,7 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
if (!(entity != null) || entity.ShouldBlockProjectiles())
{
targetPos = hit.point;
vector2 = (targetPos - vector).normalized;
vector3 = (targetPos - vector2).normalized;
break;
}
}
@ -1458,7 +1517,7 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
}
if (target != null && targetVisible && numConsecutiveMisses > num)
{
ApplyDamage(target, target.transform.position - vector2 * 0.25f, vector2);
ApplyDamage(target, target.transform.position - vector3 * 0.25f, vector3);
numConsecutiveMisses = 0;
}
ClientRPC(RpcTarget.NetworkGroup("CLIENT_FireGun"), StringPool.Get(muzzleToUse.gameObject.name), targetPos);
@ -1491,9 +1550,10 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
public void IdleTick(float dt)
{
if (UnityEngine.Time.realtimeSinceStartup > nextIdleAimTime)
double realtimeSinceStartupAsDouble = UnityEngine.Time.realtimeSinceStartupAsDouble;
if (realtimeSinceStartupAsDouble > nextIdleAimTime)
{
nextIdleAimTime = UnityEngine.Time.realtimeSinceStartup + UnityEngine.Random.Range(4f, 5f);
nextIdleAimTime = realtimeSinceStartupAsDouble + (double)UnityEngine.Random.Range(4f, 5f);
Quaternion quaternion = Quaternion.LookRotation(base.transform.forward, Vector3.up);
quaternion *= Quaternion.AngleAxis(UnityEngine.Random.Range(-45f, 45f), Vector3.up);
targetAimDir = quaternion * Vector3.forward;
@ -1570,7 +1630,7 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
}
_ = attachedWeapon.primaryMagazine.ammoType;
float turretReloadDuration = attachedWeapon.GetTurretReloadDuration();
nextShotTime = Mathf.Max(nextShotTime, UnityEngine.Time.time + Mathf.Min(turretReloadDuration, 2f));
nextShotTime = math.max(nextShotTime, UnityEngine.Time.timeAsDouble + (double)Mathf.Min(turretReloadDuration, 2f));
AmmoTypes ammoTypes = attachedWeapon.primaryMagazine.definition.ammoTypes;
if (attachedWeapon.primaryMagazine.contents > 0)
{
@ -1820,34 +1880,30 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
UpdateTotalAmmo();
EnsureReloaded(onlyReloadIfEmpty: false);
UpdateTotalAmmo();
nextShotTime = UnityEngine.Time.time;
nextShotTime = UnityEngine.Time.timeAsDouble;
}
public virtual float GetMaxAngleForEngagement()
{
BaseProjectile attachedWeapon = GetAttachedWeapon();
float result = ((attachedWeapon == null) ? 1f : ((1f - Mathf.InverseLerp(0.2f, 1f, attachedWeapon.repeatDelay)) * 7f));
if (UnityEngine.Time.time - lastShotTime > 1f)
{
result = 1f;
}
return result;
return 1f;
}
public void TargetTick()
{
if (UnityEngine.Time.realtimeSinceStartup >= nextVisCheck)
double timeAsDouble = UnityEngine.Time.timeAsDouble;
double realtimeSinceStartupAsDouble = UnityEngine.Time.realtimeSinceStartupAsDouble;
if (realtimeSinceStartupAsDouble >= nextVisCheck)
{
nextVisCheck = UnityEngine.Time.realtimeSinceStartup + UnityEngine.Random.Range(0.2f, 0.3f);
nextVisCheck = realtimeSinceStartupAsDouble + (double)UnityEngine.Random.Range(0.2f, 0.3f);
targetVisible = ObjectVisible(target);
if (targetVisible)
{
lastTargetSeenTime = UnityEngine.Time.realtimeSinceStartup;
lastTargetSeenTime = realtimeSinceStartupAsDouble;
}
}
EnsureReloaded();
BaseProjectile attachedWeapon = GetAttachedWeapon();
if (!(UnityEngine.Time.time >= nextShotTime) || !targetVisible || !(Mathf.Abs(AngleToTarget(target, currentAmmoGravity != 0f)) < GetMaxAngleForEngagement()))
if (!(timeAsDouble >= nextShotTime) || !targetVisible || !(Mathf.Abs(AngleToTarget(target, currentAmmoGravity != 0f)) < GetMaxAngleForEngagement()))
{
return;
}
@ -1875,15 +1931,15 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
damageModifier = 0f;
}
}
FireAttachedGun(AimOffset(target), aimCone, null, PeacekeeperMode() ? target : null, damageModifier, speedModifier);
FireAttachedGun(AimOffset(target), aimCone, PeacekeeperMode() ? target : null, damageModifier, speedModifier);
float delay = (attachedWeapon.isSemiAuto ? (attachedWeapon.repeatDelay * 1.5f) : attachedWeapon.repeatDelay);
delay = attachedWeapon.ScaleRepeatDelay(delay);
nextShotTime = UnityEngine.Time.time + delay;
nextShotTime = timeAsDouble + (double)delay;
shouldUpdateOnOutOfAmmo = true;
}
else
{
nextShotTime = UnityEngine.Time.time + 5f;
nextShotTime = timeAsDouble + 5.0;
if (shouldUpdateOnOutOfAmmo)
{
shouldUpdateOnOutOfAmmo = false;
@ -1894,16 +1950,16 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
else if (HasFallbackWeapon())
{
FireGun(AimOffset(target), aimCone, null, target);
nextShotTime = UnityEngine.Time.time + 0.115f;
nextShotTime = timeAsDouble + 0.11500000208616257;
}
else if (HasGenericFireable())
{
AttachedWeapon.ServerUse();
nextShotTime = UnityEngine.Time.time + 0.115f;
nextShotTime = timeAsDouble + 0.11500000208616257;
}
else
{
nextShotTime = UnityEngine.Time.time + 1f;
nextShotTime = timeAsDouble + 1.0;
}
}
@ -2029,13 +2085,15 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
public void TargetScan()
{
if (!target.IsRealNull() && (target == null || target.IsDead() || UnityEngine.Time.realtimeSinceStartup - lastTargetSeenTime > 3f || Vector3.Distance(base.transform.position, target.transform.position) > sightRange || (PeacekeeperMode() && !IsEntityHostile(target))))
double realtimeSinceStartupAsDouble = UnityEngine.Time.realtimeSinceStartupAsDouble;
if (!target.IsRealNull())
{
SetTarget(null);
}
if (!authDirty && !hasPotentialUnauthedTarget)
{
return;
double num = realtimeSinceStartupAsDouble - lastTargetSeenTime;
double num2 = realtimeSinceStartupAsDouble - lastDamageEventTime;
if (target == null || target.IsDead() || (num > 3.0 && num2 > 3.0) || Vector3.Distance(base.transform.position, target.transform.position) > sightRange || (PeacekeeperMode() && !IsEntityHostile(target)))
{
SetTarget(null);
}
}
if (HasInterference())
{
@ -2043,45 +2101,48 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
{
SetTarget(null);
}
return;
}
hasPotentialUnauthedTarget = false;
authDirty = false;
if (HasTarget() || IsOffline() || IsBeingControlled)
else
{
return;
}
if (targetTrigger.entityContents != null)
{
foreach (BaseEntity entityContent in targetTrigger.entityContents)
if (HasTarget() || IsOffline() || IsBeingControlled || aimDir == Vector3.up)
{
BaseCombatEntity baseCombatEntity = entityContent as BaseCombatEntity;
if (baseCombatEntity == null)
return;
}
bool flag = targetTrigger.entityContents != null && !targetTrigger.entityContents.IsEmpty() && realtimeSinceStartupAsDouble - lastScanTime >= (double)Sentry.scantimer;
if (!authDirty && !flag)
{
return;
}
authDirty = false;
lastScanTime = realtimeSinceStartupAsDouble;
if (targetTrigger.entityContents != null)
{
foreach (BaseEntity entityContent in targetTrigger.entityContents)
{
continue;
}
if (!Sentry.targetall)
{
BasePlayer basePlayer = baseCombatEntity as BasePlayer;
if (basePlayer != null && (IsAuthed(basePlayer) || Ignore(basePlayer)))
BaseCombatEntity baseCombatEntity = entityContent as BaseCombatEntity;
if (baseCombatEntity == null)
{
continue;
}
}
if (!hasPotentialUnauthedTarget)
{
hasPotentialUnauthedTarget = true;
}
if ((!PeacekeeperMode() || IsEntityHostile(baseCombatEntity)) && baseCombatEntity.IsAlive() && ShouldTarget(baseCombatEntity) && InFiringArc(baseCombatEntity) && ObjectVisible(baseCombatEntity))
{
SetTarget(baseCombatEntity);
break;
if (!Sentry.targetall)
{
BasePlayer basePlayer = baseCombatEntity as BasePlayer;
if (basePlayer != null && (IsAuthed(basePlayer) || Ignore(basePlayer)))
{
continue;
}
}
if ((!PeacekeeperMode() || IsEntityHostile(baseCombatEntity)) && baseCombatEntity.IsAlive() && ShouldTarget(baseCombatEntity) && InFiringArc(baseCombatEntity) && ObjectVisible(baseCombatEntity))
{
SetTarget(baseCombatEntity);
break;
}
}
}
}
if (PeacekeeperMode() && target == null)
{
nextShotTime = UnityEngine.Time.time + 1f;
if (PeacekeeperMode() && target == null)
{
nextShotTime = UnityEngine.Time.timeAsDouble + 1.0;
}
}
}
@ -2114,11 +2175,11 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
}
}
UpdateFacingToTarget(dt);
if (totalAmmoDirty && UnityEngine.Time.time > nextAmmoCheckTime)
if (totalAmmoDirty && UnityEngine.Time.timeAsDouble > nextAmmoCheckTime)
{
UpdateTotalAmmo();
totalAmmoDirty = false;
nextAmmoCheckTime = UnityEngine.Time.time + 0.5f;
nextAmmoCheckTime = UnityEngine.Time.timeAsDouble + 0.5;
}
}
@ -2131,6 +2192,7 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
if (!basePlayer || !IsAuthed(basePlayer))
{
SetTarget(info.Initiator as BaseCombatEntity);
lastDamageEventTime = UnityEngine.Time.realtimeSinceStartupAsDouble;
}
}
}
@ -2140,14 +2202,15 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
if (target != null && targetVisible && !IsBeingControlled)
{
Vector3 vector = AimOffset(target);
Vector3 position = eyePos.position;
if (peekIndex != 0)
{
Vector3 position = eyePos.transform.position;
Vector3.Distance(vector, position);
Vector3 vector2 = Vector3.Cross((vector - position).normalized, Vector3.up);
vector += vector2 * visibilityOffsets[peekIndex];
Vector3 vector2 = position;
Vector3.Distance(vector, vector2);
Vector3 vector3 = Vector3.Cross((vector - vector2).normalized, Vector3.up);
vector += vector3 * visibilityOffsets[peekIndex];
}
Vector3 vector3 = (vector - eyePos.transform.position).normalized;
Vector3 vector4 = (vector - position).normalized;
if (currentAmmoGravity != 0f)
{
float num = 0.2f;
@ -2160,11 +2223,11 @@ public class AutoTurret : ContainerIOEntity, IRemoteControllable
}
}
vector = target.transform.position + Vector3.up * num;
float angle = GetAngle(eyePos.transform.position, vector, currentAmmoVelocity, currentAmmoGravity);
Vector3 normalized = (vector.XZ3D() - eyePos.transform.position.XZ3D()).normalized;
vector3 = Quaternion.LookRotation(normalized) * Quaternion.Euler(angle, 0f, 0f) * Vector3.forward;
float angle = GetAngle(position, vector, currentAmmoVelocity, currentAmmoGravity);
Vector3 normalized = (vector.XZ3D() - position.XZ3D()).normalized;
vector4 = Quaternion.LookRotation(normalized) * Quaternion.Euler(angle, 0f, 0f) * Vector3.forward;
}
aimDir = vector3;
aimDir = vector4;
}
UpdateAiming(dt);
}

View file

@ -342,11 +342,14 @@ public class BaseCorpse : BaseCombatEntity, Hopper.IHopperTarget
{
foreach (ItemAmount containedItem in component.containedItems)
{
Item item = ItemManager.Create(containedItem.itemDef, (int)containedItem.amount, 0uL);
component.OverrideOwnership(item, null);
if (!item.MoveToContainer(itemContainer))
if (containedItem.amount >= 1f)
{
item.Drop(fallbackWorldPos, Vector3.zero, Quaternion.identity);
Item item = ItemManager.Create(containedItem.itemDef, (int)containedItem.amount, 0uL);
component.OverrideOwnership(item, null);
if (!item.MoveToContainer(itemContainer))
{
item.Drop(fallbackWorldPos, Vector3.zero, Quaternion.identity);
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -144,6 +144,8 @@ public class BaseGameMode : BaseEntity
public bool allowPings = true;
public BaseMission[] blockedMissions = new BaseMission[0];
public static BaseGameMode svActiveGameMode = null;
public static List<BaseGameMode> svGameModeManifest = new List<BaseGameMode>();
@ -1285,4 +1287,17 @@ public class BaseGameMode : BaseEntity
{
return true;
}
public bool HasBlockedMission(BaseMission mission)
{
BaseMission[] array = blockedMissions;
for (int i = 0; i < array.Length; i++)
{
if (array[i].id == mission.id)
{
return true;
}
}
return false;
}
}

View file

@ -60,7 +60,7 @@ public class BaseLauncher : BaseProjectile
return true;
}
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Transform originOverride = null, bool useBulletThickness = true)
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Matrix4x4? originOverride = null, bool useBulletThickness = true)
{
ItemModProjectile component = primaryMagazine.ammoType.GetComponent<ItemModProjectile>();
if (!component)

View file

@ -593,7 +593,7 @@ public class BaseMelee : AttackEntity
return strikeFX.resourcePath;
}
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Transform originOverride = null, bool useBulletThickness = true)
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Matrix4x4? originOverride = null, bool useBulletThickness = true)
{
if (base.isClient || HasAttackCooldown())
{

View file

@ -65,7 +65,8 @@ public class BaseMission : BaseScriptableObject
ENTER_TRIGGER,
UPGRADE_BUILDING_GRADE,
RESPAWN,
METAL_DETECTOR_FIND
METAL_DETECTOR_FIND,
LONG_USE_OBJECT
}
[Serializable]
@ -73,6 +74,8 @@ public class BaseMission : BaseScriptableObject
{
public Translate.Phrase description;
public bool startAfterPriorObjectives;
public int[] startAfterCompletedObjectives;
public int[] autoCompleteOtherObjectives;
@ -255,7 +258,10 @@ public class BaseMission : BaseScriptableObject
}
Vector3 position = positionGenerator.GetPosition(this, playerFor, depth);
missionPoints.Add(identifier, position);
AddBlocker(position);
if (positionGenerator.positionsAreExclusive)
{
AddBlocker(position);
}
return position;
}
@ -285,10 +291,19 @@ public class BaseMission : BaseScriptableObject
Vector3 missionPoint = GetMissionPoint(missionEntityEntry.spawnPositionToUse, playerFor);
BaseEntity baseEntity = GameManager.server.CreateEntity(missionEntityEntry.entityRef.resourcePath, missionPoint, Quaternion.identity);
MissionEntity component;
MissionEntity obj = (baseEntity.gameObject.TryGetComponent<MissionEntity>(out component) ? component : baseEntity.gameObject.AddComponent<MissionEntity>());
obj.Setup(playerFor, this, identifier, missionEntityEntry.cleanupOnMissionSuccess, missionEntityEntry.cleanupOnMissionFailed);
MissionEntity missionEntity = (baseEntity.gameObject.TryGetComponent<MissionEntity>(out component) ? component : baseEntity.gameObject.AddComponent<MissionEntity>());
missionEntity.Setup(playerFor, this, identifier, missionEntityEntry.cleanupOnMissionSuccess, missionEntityEntry.cleanupOnMissionFailed);
baseEntity.Spawn();
value = obj;
if (baseEntity is LootContainer lootContainer && missionEntityEntry.overrideLootOnItem != null && missionEntityEntry.overrideLootOnItem.Length != 0)
{
lootContainer.inventory.Clear();
ItemAmount[] overrideLootOnItem = missionEntityEntry.overrideLootOnItem;
foreach (ItemAmount itemAmount in overrideLootOnItem)
{
lootContainer.inventory.AddItem(itemAmount.itemDef, (int)itemAmount.amount, 0uL);
}
}
value = missionEntity;
}
missionEntities.Add(identifier, value);
if (value != null)
@ -366,6 +381,10 @@ public class BaseMission : BaseScriptableObject
Radius
}
public class PositionPointAttribute : PropertyAttribute
{
}
public string identifier;
public float minDistForMovePoint;
@ -374,6 +393,8 @@ public class BaseMission : BaseScriptableObject
public bool allowDoubleDistanceIfNoOptionsAreFound;
public bool positionsAreExclusive = true;
public RelativeType relativeTo;
public PositionType positionType;
@ -408,13 +429,11 @@ public class BaseMission : BaseScriptableObject
Facepunch.Pool.FreeUnmanaged(ref points);
if (!missionPoints)
{
Debug.Log("FAILED TO FIND MISSION POINTS");
return false;
}
}
else if (positionType == PositionType.WorldPositionGenerator && worldPositionGenerator != null && !worldPositionGenerator.TrySample(assignee.transform.position, minDistForMovePoint, maxDistForMovePoint, out position, blockedPoints))
{
Debug.Log("FAILED TO GENERATE WORLD POSITION!!!!!");
return false;
}
return true;
@ -556,6 +575,24 @@ public class BaseMission : BaseScriptableObject
public bool cleanupOnMissionFailed;
public bool cleanupOnMissionSuccess;
public ItemAmount[] overrideLootOnItem;
}
[Serializable]
public struct NonItemReward
{
public Translate.Phrase DisplayPhrase;
public Sprite DisplaySprite;
public NonItemRewardType RewardType;
}
public enum NonItemRewardType
{
None,
SafeZoneRespawnUnlock
}
[Serializable]
@ -592,8 +629,12 @@ public class BaseMission : BaseScriptableObject
public TutorialMissionHelpSet showHelpInfo;
public string[] requiredGameModeTags = new string[0];
public MissionObjectiveEntry[] objectives;
public GameObjectRef genericMissionProvider;
public static List<Vector3> blockedPoints = new List<Vector3>();
public const string MISSION_COMPLETE_STAT = "missions_completed";
@ -630,6 +671,8 @@ public class BaseMission : BaseScriptableObject
public MissionRewards[] alternativeRewards;
public NonItemReward[] nonItemRewards;
public uint id => shortname.ManifestHash();
public bool isRepeatable
@ -707,11 +750,15 @@ public class BaseMission : BaseScriptableObject
}
}
public static void RemoveBlockers(MissionInstance instance)
public void RemoveBlockers(MissionInstance instance)
{
int num = 0;
foreach (KeyValuePair<string, Vector3> missionPoint in instance.missionPoints)
{
blockedPoints.Remove(missionPoint.Value);
if (positionGenerators[num++].positionsAreExclusive)
{
blockedPoints.Remove(missionPoint.Value);
}
}
}
@ -803,6 +850,23 @@ public class BaseMission : BaseScriptableObject
GiveReward(assignee, reward);
}
}
if (mission.nonItemRewards != null)
{
NonItemReward[] array2 = mission.nonItemRewards;
for (int i = 0; i < array2.Length; i++)
{
if (array2[i].RewardType != NonItemRewardType.SafeZoneRespawnUnlock)
{
continue;
}
using HashSet<StaticRespawnArea>.Enumerator enumerator = StaticRespawnArea.staticRespawnAreas.GetEnumerator();
if (enumerator.MoveNext())
{
enumerator.Current.Authorize(assignee.userID);
assignee.SendRespawnOptions();
}
}
}
for (int j = 0; j < mission.objectives.Length; j++)
{
MissionObjectiveEntry missionObjectiveEntry = mission.objectives[j];
@ -837,6 +901,10 @@ public class BaseMission : BaseScriptableObject
currentTutorialIsland.StartEndingCinematic(assignee);
}
}
if (!completeSilently)
{
assignee.ClientRPC(RpcTarget.Player("Client_MissionComplete", assignee), id);
}
static void GiveReward(BasePlayer player, ItemAmount itemAmount)
{
if (itemAmount.itemDef == null || itemAmount.amount == 0f)

View file

@ -115,6 +115,10 @@ public abstract class BaseModifiers<T> : EntityComponent<T> where T : BaseCombat
{
return false;
}
if (modifier.HasNegativeSource() && owner != null && owner is BasePlayer basePlayer && basePlayer.IsGod())
{
return false;
}
return true;
}

View file

@ -326,6 +326,8 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
public Vector3 pos;
public Quaternion rot;
public bool isProcedualSpawn;
}
internal struct DeathBlow
@ -774,10 +776,6 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
private float lastPlayerTick;
private static string DebugStage = "Entry";
private static bool IsUpdateActive = false;
private float sleepStartTime = -1f;
private float fallTickRate = 0.1f;
@ -4664,6 +4662,10 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
}
}
}
else if (HasCompletedMission(missionID))
{
return false;
}
BaseMission.PositionGenerator[] positionGenerators = fromID.positionGenerators;
for (int i = 0; i < positionGenerators.Length; i++)
{
@ -4672,6 +4674,35 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
return false;
}
}
BaseGameMode activeGameMode = BaseGameMode.GetActiveGameMode(base.isServer);
if (activeGameMode != null && activeGameMode.HasBlockedMission(fromID))
{
return false;
}
if (fromID.requiredGameModeTags.Length != 0)
{
if (activeGameMode == null)
{
bool flag3 = false;
string[] requiredGameModeTags = fromID.requiredGameModeTags;
for (int i = 0; i < requiredGameModeTags.Length; i++)
{
if (string.Equals(requiredGameModeTags[i], "vanilla"))
{
flag3 = true;
break;
}
}
if (!flag3)
{
return false;
}
}
else if (!activeGameMode.HasAnyGameModeTag(fromID.requiredGameModeTags))
{
return false;
}
}
return true;
}
@ -4809,7 +4840,7 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
public void ProcessMissionEvent(BaseMission.MissionEventType type, BaseMission.MissionEventPayload payload, float amount)
{
if (!BaseMission.missionsenabled)
if (!BaseMission.missionsenabled || missions == null)
{
return;
}
@ -4844,7 +4875,7 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
Missions missions = Facepunch.Pool.Get<Missions>();
missions.missions = Facepunch.Pool.Get<List<MissionInstance>>();
missions.activeMission = GetActiveMission();
missions.protocol = 268;
missions.protocol = 269;
missions.seed = World.Seed;
missions.saveCreatedTime = Epoch.FromDateTime(SaveRestore.SaveCreatedTime);
foreach (BaseMission.MissionInstance mission in this.missions)
@ -4948,7 +4979,7 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
uint seed = loadedMissions.seed;
int saveCreatedTime = loadedMissions.saveCreatedTime;
int num2 = Epoch.FromDateTime(SaveRestore.SaveCreatedTime);
if (268 != protocol || World.Seed != seed || num2 != saveCreatedTime)
if (269 != protocol || World.Seed != seed || num2 != saveCreatedTime)
{
Debug.Log("Missions were from old protocol or different seed, or not from a loaded save. Clearing");
loadedMissions.activeMission = -1;
@ -4961,7 +4992,8 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
{
foreach (MissionInstance mission2 in loadedMissions.missions)
{
if (MissionManifest.GetFromID(mission2.missionID) == null)
BaseMission fromID = MissionManifest.GetFromID(mission2.missionID);
if (fromID == null)
{
continue;
}
@ -4980,7 +5012,10 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
foreach (ProtoBuf.MissionPoint missionPoint in instanceData.missionPoints)
{
missionInstance.missionPoints.Add(missionPoint.identifier, missionPoint.location);
BaseMission.AddBlocker(missionPoint.location);
if (fromID.positionGenerators[missionInstance.missionPoints.Count - 1].positionsAreExclusive)
{
BaseMission.AddBlocker(missionPoint.location);
}
}
}
missionInstance.objectiveStatuses = new BaseMission.MissionInstance.ObjectiveStatus[instanceData.objectiveStatuses.Count];
@ -7833,10 +7868,6 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
{
Facepunch.Pool.Free(ref cachedPersistantPlayer);
}
if (ConVar.Server.UsePlayerUpdateJobs && IsUpdateActive)
{
Debug.LogError("UsePlayerUpdateJobs: Destroying player mid update, this will mess up transform cache!");
}
}
protected void ServerUpdate(float deltaTime)
@ -7942,16 +7973,7 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
}
using (TimeWarning.New("FinalizeTick"))
{
try
{
DebugStage = "Entry";
FinalizeTickParallel(deltaTime, playerCache);
}
catch (Exception arg)
{
Debug.LogError($"UsePlayerUpdateJobs: Stage {DebugStage}, exception - {arg}!");
return false;
}
FinalizeTickParallel(deltaTime, playerCache);
}
foreach (BasePlayer validPlayer2 in playerCache.ValidPlayers)
{
@ -8061,7 +8083,7 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
{
modifiers.ServerUpdate(this);
}
if (InSafeZone())
if (InSafeZone() || InHostileWarningZone())
{
float num = 0f;
HeldEntity heldEntity = GetHeldEntity();
@ -8114,6 +8136,10 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
Debug.LogWarning("Force removing loading flag for player (sanity check failed)", this);
SetPlayerFlag(PlayerFlags.LoadingAfterTransfer, b: false);
}
if (State != null)
{
SetPlayerFlag(PlayerFlags.ChatMute, State.chatMuted);
}
RefreshColliderSize(forced: false);
SendModelState();
}
@ -8200,6 +8226,7 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
using (TimeWarning.New("PlayerInit", 10))
{
CancelInvoke(base.KillMessage);
CancelInvoke(OfflineMetabolism);
SetPlayerFlag(PlayerFlags.Connected, b: true);
activePlayerList.Add(this);
if (ConVar.Server.UsePlayerUpdateJobs)
@ -8284,6 +8311,10 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
{
SendCargoPatrolPath();
}
if (currentTeam == 0L && RelationshipManager.ServerInstance.HasPendingInvite(userID, out var foundTeamID) && RelationshipManager.ServerInstance.GetTeamLeaderInfo(foundTeamID, out var leaderDisplayName, out var leaderID))
{
ClientRPC(RpcTarget.Player("CLIENT_PendingInvite", this), leaderDisplayName, leaderID, foundTeamID);
}
}
}
@ -8384,7 +8415,7 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
SleepingBag[] array = SleepingBag.FindForPlayer(userID, ignoreTimers: true);
foreach (SleepingBag sleepingBag in array)
{
if (!(basePlayer != null) || basePlayer.IsInTutorial == sleepingBag.IsTutorialBag)
if ((!(sleepingBag is StaticRespawnArea staticRespawnArea) || staticRespawnArea.IsAuthed(userID)) && (!(basePlayer != null) || basePlayer.IsInTutorial == sleepingBag.IsTutorialBag))
{
RespawnInformation.SpawnOptions spawnOptions2 = Facepunch.Pool.Get<RespawnInformation.SpawnOptions>();
spawnOptions2.id = sleepingBag.net.ID;
@ -8453,6 +8484,7 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
TurnOffAllLights();
}
SetServerFall(wantsOn: true);
RunOfflineMetabolism(state: true);
}
}
@ -8554,6 +8586,27 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
MovePosition(position2);
}
public void RunOfflineMetabolism(bool state)
{
if (state)
{
InvokeRandomized(OfflineMetabolism, ConVar.Server.metabolismtick, ConVar.Server.metabolismtick, ConVar.Server.metabolismtick / 10f);
}
else
{
CancelInvoke(OfflineMetabolism);
}
}
private void OfflineMetabolism()
{
if (!base.IsDestroyed)
{
inventory.containerWear.OnCycle(ConVar.Server.metabolismtick);
metabolism.ServerUpdate(this, ConVar.Server.metabolismtick);
}
}
public void DelayedRigidbodyDisable()
{
RemovePlayerRigidbody();
@ -8584,6 +8637,7 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
EnablePlayerCollider();
AddPlayerRigidbody();
SetServerFall(wantsOn: false);
RunOfflineMetabolism(state: false);
if (HasParent())
{
SetParent(null, worldPositionStays: true);
@ -8636,10 +8690,6 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
if (ConVar.Server.UsePlayerUpdateJobs && StableIndex != -1)
{
playerCache.Remove(this);
if (IsUpdateActive)
{
Debug.LogError("UsePlayerUpdateJobs: Removing player mid update, this will mess up transform cache!");
}
}
SetPlayerFlag(PlayerFlags.Connected, b: false);
StopDemoRecording();
@ -9162,7 +9212,7 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
public void Respawn()
{
SpawnPoint spawnPoint = ServerMgr.FindSpawnPoint(this);
SpawnPoint spawnPoint = ServerMgr.FindSpawnPoint(this, 0uL);
if (ConVar.Server.respawnAtDeathPosition && ServerCurrentDeathNote != null)
{
spawnPoint.pos = ServerCurrentDeathNote.worldPosition;
@ -9895,63 +9945,101 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
[RPC_Server]
[RPC_Server.FromOwner(false)]
[RPC_Server.CallsPerSecond(1uL)]
public void OnPlayerReported(RPCMessage msg)
public async void OnPlayerReported(RPCMessage msg)
{
string text = msg.read.String();
string text2 = msg.read.StringMultiLine();
string message = ((text2 != null && text2.Length > 1400) ? text2.Substring(0, 1400) : text2);
string type = msg.read.String();
string text3 = msg.read.String();
string text4 = msg.read.String();
DebugEx.Log($"[PlayerReport] {this} reported {text4}[{text3}] - \"{text}\"");
RCon.Broadcast(RCon.LogType.Report, new
try
{
PlayerId = UserIDString,
PlayerName = displayName,
TargetId = text3,
TargetName = text4,
Subject = text,
Message = message,
Type = type
});
string text = msg.read.String();
string text2 = msg.read.StringMultiLine();
string message = ((text2 != null && text2.Length > 1400) ? text2.Substring(0, 1400) : text2);
string text3 = msg.read.String();
string text4 = msg.read.String();
string text5 = msg.read.String();
DebugEx.Log($"[PlayerReport] {this} reported {text5}[{text4}] - \"{text}\"");
RCon.Broadcast(RCon.LogType.Report, new
{
PlayerId = UserIDString,
PlayerName = displayName,
TargetId = text4,
TargetName = text5,
Subject = text,
Message = message,
Type = text3
});
if (!string.IsNullOrEmpty(ConVar.Server.reportsServerEndpoint))
{
ReportType type = ReportType.Abuse;
if (text3.Equals("cheat"))
{
type = ReportType.Cheat;
}
if (text3.Equals("break_server_rules"))
{
type = ReportType.BreakingServerRules;
}
Facepunch.Models.Feedback feedback = new Facepunch.Models.Feedback
{
Subject = text,
Message = message,
TargetReportType = text3,
TargetId = text4,
TargetName = text5,
Type = type
};
DebugEx.Log("[OnPlayerReported to endpoint] " + await Facepunch.Feedback.ServerReport(ConVar.Server.reportsServerEndpoint, userID, ConVar.Server.reportsServerEndpointKey, feedback));
}
}
catch (Exception ex)
{
Debug.LogWarning("[OnPlayerReported] Exception occurred when sending F7 report to endpoint: " + ex.Message);
Debug.LogException(ex);
}
}
[RPC_Server]
[RPC_Server.FromOwner(false)]
[RPC_Server.CallsPerSecond(1uL)]
public void OnFeedbackReport(RPCMessage msg)
public async void OnFeedbackReport(RPCMessage msg)
{
if (ConVar.Server.printReportsToConsole || !string.IsNullOrEmpty(ConVar.Server.reportsServerEndpoint))
try
{
string text = msg.read.String();
string text2 = msg.read.StringMultiLine();
string text3 = ((text2 != null && text2.Length > 1400) ? text2.Substring(0, 1400) : text2);
ReportType reportType = (ReportType)Mathf.Clamp(msg.read.Int32(), 0, 5);
if (ConVar.Server.printReportsToConsole)
if (ConVar.Server.printReportsToConsole || !string.IsNullOrEmpty(ConVar.Server.reportsServerEndpoint))
{
DebugEx.Log($"[FeedbackReport] {this} reported {reportType} - \"{text}\" \"{text3}\"");
RCon.Broadcast(RCon.LogType.Report, new
string text = msg.read.String();
string text2 = msg.read.StringMultiLine();
string text3 = ((text2 != null && text2.Length > 1400) ? text2.Substring(0, 1400) : text2);
ReportType reportType = (ReportType)Mathf.Clamp(msg.read.Int32(), 0, 6);
if (ConVar.Server.printReportsToConsole)
{
PlayerId = UserIDString,
PlayerName = displayName,
Subject = text,
Message = text3,
Type = reportType
});
}
if (!string.IsNullOrEmpty(ConVar.Server.reportsServerEndpoint) && reportType != ReportType.BreakingServerRules)
{
string image = msg.read.StringMultiLine(60000);
Facepunch.Models.Feedback feedback = new Facepunch.Models.Feedback
DebugEx.Log($"[FeedbackReport] {this} reported {reportType} - \"{text}\" \"{text3}\"");
RCon.Broadcast(RCon.LogType.Report, new
{
PlayerId = UserIDString,
PlayerName = displayName,
Subject = text,
Message = text3,
Type = reportType
});
}
if (!string.IsNullOrEmpty(ConVar.Server.reportsServerEndpoint))
{
Type = reportType,
Message = text3,
Subject = text
};
feedback.AppInfo.Image = image;
Facepunch.Feedback.ServerReport(ConVar.Server.reportsServerEndpoint, userID, ConVar.Server.reportsServerEndpointKey, feedback);
string image = msg.read.StringMultiLine(60000);
Facepunch.Models.Feedback feedback = new Facepunch.Models.Feedback
{
Type = reportType,
Message = text3,
Subject = text
};
feedback.AppInfo.Image = image;
DebugEx.Log("[OnFeedbackReport to endpoint] " + await Facepunch.Feedback.ServerReport(ConVar.Server.reportsServerEndpoint, userID, ConVar.Server.reportsServerEndpointKey, feedback));
}
}
}
catch (Exception ex)
{
Debug.LogWarning("[OnFeedbackReport] Exception occurred when sending F7 report to endpoint: " + ex.Message);
Debug.LogException(ex);
}
}
public void StartDemoRecording()
@ -10030,6 +10118,12 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
{
}
public override void OnKilled()
{
CancelInvoke(OfflineMetabolism);
base.OnKilled();
}
public int GetIdealSlot(BasePlayer player, ItemContainer container, Item item)
{
if (container.HasFlag(ItemContainer.Flag.Clothing))
@ -11727,7 +11821,6 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
private static void FinalizeTickParallel(float deltaTime, PlayerCache playerCache)
{
DebugStage = "ProcessPlayers";
using (TimeWarning.New("ProcessPlayers"))
{
NativeListEx.Expand(ref PlayersToFinalize, playerCache.PlayerCount, copyContents: false);
@ -11744,28 +11837,23 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
}
}
}
DebugStage = "PlayersToFinalize Check";
if (PlayersToFinalize.IsEmpty)
{
return;
}
DebugStage = "Water NativeArrays Expansion";
ReadOnlySpan<BasePlayer> players = playerCache.Players;
NativeArrayEx.Expand(ref WaterInfos, players.Length, NativeArrayOptions.UninitializedMemory);
NativeArrayEx.Expand(ref WaterFactors, players.Length, NativeArrayOptions.UninitializedMemory);
NativeArrayEx.Expand(ref CachedStates, players.Length, NativeArrayOptions.UninitializedMemory);
NativeArrayEx.Expand(ref PlayerLocalPos, players.Length, NativeArrayOptions.UninitializedMemory);
NativeArrayEx.Expand(ref PlayerLocalRots, players.Length, NativeArrayOptions.UninitializedMemory);
DebugStage = "RecacheTransforms";
RecacheTransforms jobData = new RecacheTransforms
{
LocalPos = PlayerLocalPos,
LocalRots = PlayerLocalRots
};
IJobParallelForTransformExtensions.RunReadOnlyByRef(ref jobData, PlayerTransformsAccess);
DebugStage = "GetWaterFactors";
GetWaterFactors(playerCache, PlayerLocalPos.AsReadOnly(), PlayerLocalRots.AsReadOnly(), PlayersToFinalize.AsReadOnly(), WaterInfos, WaterFactors);
DebugStage = "UpdateWaterCache";
UpdateWaterCache jobData2 = new UpdateWaterCache
{
States = CachedStates,
@ -11774,9 +11862,7 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
Indices = PlayersToFinalize.AsReadOnly()
};
IJobExtensions.RunByRef(ref jobData2);
DebugStage = "TickCacheView";
TickInterpolatorCache.ReadOnlyState readOnly = TickCache.ReadOnly;
DebugStage = "GatherPosToValidateJob";
NativeArrayEx.Expand(ref PositionChanges, players.Length, NativeArrayOptions.UninitializedMemory);
NativeListEx.Expand(ref PlayersToValidate, PlayersToFinalize.Length, copyContents: false);
GatherPosToValidateJob jobData3 = new GatherPosToValidateJob
@ -11787,18 +11873,16 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
Indices = PlayersToFinalize.AsReadOnly()
};
IJobExtensions.RunByRef(ref jobData3);
DebugStage = "ValidateMoves";
NativeListEx.Expand(ref PlayersToRecache, PlayersToValidate.Length, copyContents: false);
AntiHack.ValidateMoves(playerCache, readOnly, CachedStates, PlayersToValidate.AsReadOnly(), PositionChanges);
DebugStage = "GatherPositionChanged";
using (TimeWarning.New("GatherPositionChanged"))
{
foreach (int item in PlayersToValidate)
{
BasePlayer basePlayer = players[item];
if (PositionChanges[item] == PositionChange.Valid)
{
PlayersToRecache.AddNoResize(item);
BasePlayer basePlayer = players[item];
basePlayer.transform.localPosition = basePlayer.tickInterpolator.EndPoint;
basePlayer.ticksPerSecond.Increment();
basePlayer.tickHistory.AddPoint(basePlayer.tickInterpolator.EndPoint, basePlayer.tickHistoryCapacity);
@ -11808,7 +11892,6 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
}
if (!PlayersToRecache.IsEmpty)
{
DebugStage = "RecachingPlayerState";
using (TimeWarning.New("RecachingPlayerState"))
{
IJobParallelForTransformExtensions.RunReadOnlyByRef(ref jobData, PlayerTransformsAccess);
@ -11825,10 +11908,13 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
}
using (TimeWarning.New("FinalizePlayers"))
{
DebugStage = "FinalizePlayers";
foreach (int item2 in PlayersToFinalize)
{
BasePlayer basePlayer2 = players[item2];
if (basePlayer2.IsRealNull())
{
continue;
}
CachedState tickState = CachedStates[item2];
PositionChange num = PositionChanges[item2];
bool flag = num == PositionChange.Valid;
@ -11872,7 +11958,6 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
}
basePlayer2.tickDeltaTime = 0f;
}
DebugStage = "Exit";
}
}
@ -11943,16 +12028,7 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
private static bool ValidateTransformCache(PlayerCache playerCache)
{
using (TimeWarning.New("ValidateTransformCache"))
{
int length = PlayerTransformsAccess.length;
if (length != playerCache.Players.Length)
{
Debug.LogError($"UsePlayerUpdateJobs: Mismatching length of transform cache ({length}) and player cache({playerCache.Players.Length})!");
return false;
}
return true;
}
return true;
}
public bool IsCraftingTutorialBlocked(ItemDefinition def, out bool forceUnlock)
@ -12673,22 +12749,10 @@ public class BasePlayer : BaseCombatEntity, LootPanel.IHasLootPanel, IIdealSlotE
flag = false;
ConVar.Server.UsePlayerUpdateJobs = false;
}
IsUpdateActive = true;
try
if (!ServerUpdateParallel(deltaTime, playerCache))
{
if (!ServerUpdateParallel(deltaTime, playerCache))
{
flag = false;
ConVar.Server.UsePlayerUpdateJobs = false;
}
}
catch (Exception)
{
throw;
}
finally
{
IsUpdateActive = false;
flag = false;
ConVar.Server.UsePlayerUpdateJobs = false;
}
}
}

View file

@ -742,7 +742,7 @@ public class BaseProjectile : AttackEntity
return aiAimCone;
}
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Transform originOverride = null, bool useBulletThickness = true)
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Matrix4x4? originOverride = null, bool useBulletThickness = true)
{
if (base.isClient || HasAttackCooldown())
{
@ -773,10 +773,10 @@ public class BaseProjectile : AttackEntity
StartAttackCooldownRaw(repeatDelay);
Vector3 vector = (flag ? ownerPlayer.eyes.position : MuzzlePoint.transform.position);
Vector3 inputVec = MuzzlePoint.transform.forward;
if (originOverride != null)
if (originOverride.HasValue)
{
vector = originOverride.position;
inputVec = originOverride.forward;
vector = originOverride.Value.GetPosition();
inputVec = originOverride.Value.MultiplyVector(Vector3.forward);
}
ItemModProjectile ammoInfo = primaryMagazine.ammoType.GetComponent<ItemModProjectile>();
SignalBroadcast(Signal.Attack, string.Empty, null, GetAttackEffect());

View file

@ -9,6 +9,8 @@ using UnityEngine.Assertions;
public abstract class BaseSiegeWeapon : GroundVehicle, IEngineControllerUser, IEntity, VehicleChassisVisuals<BaseSiegeWeapon>.IClientWheelUser, TriggerHurtNotChild.IHurtTriggerUser, CarPhysics<BaseSiegeWeapon>.ICar, ITowing
{
public SimpleCarVisualsController controller;
[Header("Siege Weapon")]
[SerializeField]
protected Transform centreOfMassTransform;

View file

@ -1,3 +1,17 @@
using UnityEngine;
public class BatteringRamVisuals : BaseSiegeWeaponVisuals, IClientComponent
{
private BatteringRam ram;
public Transform frontAxle;
public Transform middleAxle;
public Transform rearAxle;
[Space]
public ParticleSystem rockDoorParticle;
public ParticleSystem dirtDoorParticle;
}

View file

@ -0,0 +1,30 @@
using UnityEngine;
public class BiomeBenchmarkScene : BenchmarkScene
{
[Header("Biome Benchmark")]
public uint IslandWidth = 300u;
public uint IslandHeight = 1000u;
public uint IslandGap = 50u;
public float FlyingSpeed = 16f;
public GameObject WorldSetupPrefab;
public TerrainConfig TerrainConfig;
public TerrainBiome.Enum BiomesToTest = (TerrainBiome.Enum)(-1);
public float StreamingPause = 4f;
[Header("Biome Benchmark - Debug")]
public bool DebugMode;
[Range(0f, 4f)]
public int DebugIslandNum;
[Range(0f, 1f)]
public float DebugProgress;
}

View file

@ -43,7 +43,7 @@ public class Boomerang : BaseMelee
ClientRPC(RpcTarget.NetworkGroup("RPC_Caught"), thrown);
}
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Transform originOverride = null, bool useBulletThickness = true)
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Matrix4x4? originOverride = null, bool useBulletThickness = true)
{
if (!hasThrown)
{

View file

@ -83,11 +83,18 @@ public class BowWeapon : BaseProjectile
using (TimeWarning.New("BowWeapon.UpdateFireFlag"))
{
BasePlayer ownerPlayer = GetOwnerPlayer();
if (!IsOnFire() && ownerPlayer.modelState.aiming && primaryMagazine.ammoType == ArrowItemDefinitions.FireArrowItemDef)
if (!ownerPlayer.IsUnityNull())
{
SetFlag(Flags.OnFire, b: true);
if (!IsOnFire() && ownerPlayer.modelState.aiming && primaryMagazine.ammoType == ArrowItemDefinitions.FireArrowItemDef)
{
SetFlag(Flags.OnFire, b: true);
}
else if (IsOnFire() && (!ownerPlayer.modelState.aiming || primaryMagazine.ammoType != ArrowItemDefinitions.FireArrowItemDef))
{
SetFlag(Flags.OnFire, b: false);
}
}
else if (IsOnFire() && (!ownerPlayer.modelState.aiming || primaryMagazine.ammoType != ArrowItemDefinitions.FireArrowItemDef))
else
{
SetFlag(Flags.OnFire, b: false);
}

View file

@ -82,6 +82,8 @@ public class BuildingBlock : StabilityEntity
public OBBComponent AlternativePipeBounds;
public bool useCastNoClipChecks;
public const int WALLPAPER_MAXHEALTH = 100;
[HideInInspector]
@ -1025,6 +1027,15 @@ public class BuildingBlock : StabilityEntity
}
}
public override bool ShouldUseCastNoClipChecks()
{
if (!useCastNoClipChecks)
{
return base.ShouldUseCastNoClipChecks();
}
return true;
}
public bool HasWallpaper()
{
if (!(wallpaperHealth > 0f))

View file

@ -252,7 +252,7 @@ public class Chainsaw : BaseMelee
}
}
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Transform originOverride = null, bool useBulletThickness = true)
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Matrix4x4? originOverride = null, bool useBulletThickness = true)
{
base.ServerUse(damageModifier, speedModifier, originOverride, useBulletThickness);
SetAttackStatus(status: true);

View file

@ -3,6 +3,45 @@ using UnityEngine;
public class CommunityEntity : PointEntity
{
private class Countdown : MonoBehaviour
{
public enum TimerFormat
{
None,
SecondsHundreth,
MinutesSeconds,
MinutesSecondsHundreth,
HoursMinutes,
HoursMinutesSeconds,
HoursMinutesSecondsMilliseconds,
HoursMinutesSecondsTenths,
DaysHoursMinutes,
DaysHoursMinutesSeconds,
Custom
}
public string command = "";
public float endTime;
public float startTime;
public float step = 1f;
public float interval = 1f;
public TimerFormat timerFormat;
public string numberFormat = "0.####";
public bool destroyIfDone = true;
}
private class FadeOut : MonoBehaviour
{
public float duration;
}
public static CommunityEntity ServerInstance;
public static CommunityEntity ClientInstance;

View file

@ -165,7 +165,7 @@ public class Admin : ConsoleSystem
if (!flag && text.Length == 0)
{
text2 = text2 + "hostname: " + Server.hostname + "\n";
text2 = text2 + "version : " + 2590 + " secure (secure mode enabled, connected to Steam3)\n";
text2 = text2 + "version : " + 2592 + " secure (secure mode enabled, connected to Steam3)\n";
text2 = text2 + "map : " + Server.level + "\n";
text2 += $"players : {BasePlayer.activePlayerList.Count()} ({Server.maxplayers} max) ({SingletonComponent<ServerMgr>.Instance.connectionQueue.Queued} queued) ({SingletonComponent<ServerMgr>.Instance.connectionQueue.Joining} joining)\n\n";
}
@ -645,6 +645,25 @@ public class Admin : ConsoleSystem
arg.ReplyWith(textTable.ToString());
}
[ServerVar(Help = "Kills all bee swarms")]
public static void killbees(Arg arg)
{
int num = 0;
BeeSwarmMaster[] array = BaseEntity.Util.FindAll<BeeSwarmMaster>();
for (int i = 0; i < array.Length; i++)
{
array[i].AdminKill();
num++;
}
BeeSwarmAI[] array2 = BaseEntity.Util.FindAll<BeeSwarmAI>();
for (int i = 0; i < array2.Length; i++)
{
array2[i].AdminKill();
num++;
}
arg.ReplyWith($"Killed {num} bee swarms");
}
[ServerVar]
public static void killplayer(Arg arg)
{
@ -1221,11 +1240,10 @@ public class Admin : ConsoleSystem
if (!playerOrSleeper || playerOrSleeper.net == null || playerOrSleeper.net.connection == null)
{
arg.ReplyWith("Player not found");
return;
}
else
{
playerOrSleeper.SetPlayerFlag(BasePlayer.PlayerFlags.ChatMute, b: true);
}
playerOrSleeper.State.chatMuted = true;
playerOrSleeper.SetPlayerFlag(BasePlayer.PlayerFlags.ChatMute, b: true);
}
[ServerVar]
@ -1235,11 +1253,10 @@ public class Admin : ConsoleSystem
if (!playerOrSleeper || playerOrSleeper.net == null || playerOrSleeper.net.connection == null)
{
arg.ReplyWith("Player not found");
return;
}
else
{
playerOrSleeper.SetPlayerFlag(BasePlayer.PlayerFlags.ChatMute, b: false);
}
playerOrSleeper.State.chatMuted = false;
playerOrSleeper.SetPlayerFlag(BasePlayer.PlayerFlags.ChatMute, b: false);
}
[ServerVar(Help = "Print a list of currently muted players")]
@ -1882,7 +1899,7 @@ public class Admin : ConsoleSystem
NetworkOut = (int)((Network.Net.sv != null) ? Network.Net.sv.GetStat(null, BaseNetwork.StatTypeLong.BytesSent_LastSecond) : 0),
Restarting = SingletonComponent<ServerMgr>.Instance.Restarting,
SaveCreatedTime = SaveRestore.SaveCreatedTime.ToString(),
Version = 2590,
Version = 2592,
Protocol = Protocol.printable
};
}

View file

@ -361,7 +361,7 @@ public class AntiHack : ConsoleSystem
[ServerVar]
[Help("line of sight sphere cast radius, 0 == raycast")]
public static float eye_losradius = 0.18f;
public static float eye_losradius = 0.162f;
[ServerVar]
[Help("violation penalty to hand out when eye history mismatch is detected")]

View file

@ -17,6 +17,9 @@ public class Audio : ConsoleSystem
[ClientVar(Help = "Volume", Saved = true)]
public static float game = 1f;
[ClientVar(Help = "Volume", Saved = true)]
public static float ui = 1f;
[ClientVar(Help = "Volume", Saved = true)]
public static float voices = 1f;

View file

@ -17,6 +17,8 @@ namespace ConVar;
[Factory("debug")]
public class Debugging : ConsoleSystem
{
private const string NO_RECOVER_ARG = "--no-recover";
[ServerVar]
[ClientVar]
public static bool checktriggers = false;
@ -379,7 +381,7 @@ public class Debugging : ConsoleSystem
}
}
[ServerVar(ClientAdmin = true, Help = "Refills the vital of a target player. eg. debug.refillsvital jim - leave blank to target yourself, can take multiple players at once")]
[ServerVar(ClientAdmin = true, Help = "Refills the vital of a target player. eg. debug.refillsvital jim - leave blank to target yourself, can take multiple players at once. Will revive players if they are injured. To disable this, pass in --no-recover as the first argument.")]
public static void refillvitals(Arg arg)
{
BasePlayer basePlayer = arg.Player();
@ -387,15 +389,21 @@ public class Debugging : ConsoleSystem
{
return;
}
arg.HasArg("True", remove: true);
arg.HasArg("False");
if (arg.Args == null || arg.Args.Length == 0)
int num = 0;
bool shouldPlayerRecover = true;
if (arg.GetString(0) == "--no-recover")
{
RefillPlayerVitals(basePlayer);
shouldPlayerRecover = false;
num++;
}
arg.TryRemoveKeyBindEventArgs();
if (arg.Args == null || num >= arg.Args.Length)
{
RefillPlayerVitals(basePlayer, shouldPlayerRecover);
return;
}
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < arg.Args.Length; i++)
for (int i = num; i < arg.Args.Length; i++)
{
string text = arg.GetString(i);
BasePlayer basePlayer2 = ((!(text == basePlayer.displayName)) ? (string.IsNullOrEmpty(text) ? null : arg.GetPlayerOrSleeperOrBot(i)) : basePlayer);
@ -404,21 +412,22 @@ public class Debugging : ConsoleSystem
stringBuilder.AppendLine("Could not find player '" + text + "'");
continue;
}
RefillPlayerVitals(basePlayer2);
RefillPlayerVitals(basePlayer2, shouldPlayerRecover);
stringBuilder.AppendLine("Refilled '" + text + "' vitals");
}
arg.ReplyWith(stringBuilder.ToString());
}
[ServerVar(ClientAdmin = true, Help = "Refills the vitals of all active players on the server")]
[ServerVar(ClientAdmin = true, Help = "Refills the vitals of all active players on the server. Will revive players if they are injured. To disable this, pass in --no-recover as the first argument.")]
public static void refillvitalsall(Arg arg)
{
StringBuilder stringBuilder = new StringBuilder();
bool shouldPlayerRecover = arg.GetString(0) != "--no-recover";
foreach (BasePlayer activePlayer in BasePlayer.activePlayerList)
{
if (!(activePlayer == null))
{
RefillPlayerVitals(activePlayer);
RefillPlayerVitals(activePlayer, shouldPlayerRecover);
stringBuilder.AppendLine("Refilled player '" + activePlayer.displayName + "' vitals");
}
}
@ -426,15 +435,19 @@ public class Debugging : ConsoleSystem
{
if (!(bot == null))
{
RefillPlayerVitals(bot);
RefillPlayerVitals(bot, shouldPlayerRecover);
stringBuilder.AppendLine("Refilled bot '" + bot.displayName + "' vitals");
}
}
arg.ReplyWith(stringBuilder.ToString());
}
private static void RefillPlayerVitals(BasePlayer player)
private static void RefillPlayerVitals(BasePlayer player, bool shouldPlayerRecover)
{
if (shouldPlayerRecover && player.IsWounded())
{
player.StopWounded();
}
AdjustHealth(player, 1000f);
AdjustCalories(player, 1000f);
AdjustHydration(player, 1000f);
@ -442,10 +455,22 @@ public class Debugging : ConsoleSystem
AdjustBleeding(player, -10000f);
}
[ServerVar]
[ServerVar(Help = "To disable revival if player is downed, pass in --no-recover as the first argument.")]
public static void heal(Arg arg)
{
AdjustHealth(arg.Player(), arg.GetInt(0, 1));
BasePlayer basePlayer = arg.Player();
bool flag = true;
int num = 0;
if (arg.GetString(0) == "--no-recover")
{
flag = false;
num++;
}
if (flag && basePlayer.IsWounded())
{
basePlayer.StopWounded();
}
AdjustHealth(basePlayer, arg.GetInt(num, 1));
}
[ServerVar]
@ -711,6 +736,38 @@ public class Debugging : ConsoleSystem
}
}
[ServerVar]
public static void removeOverlappingStaticSpawnPoints(Arg arg)
{
using PooledList<StaticRespawnArea> pooledList = Facepunch.Pool.Get<PooledList<StaticRespawnArea>>();
foreach (StaticRespawnArea staticRespawnArea2 in StaticRespawnArea.staticRespawnAreas)
{
pooledList.Add(staticRespawnArea2);
}
int num = 0;
for (int i = 0; i < pooledList.Count; i++)
{
StaticRespawnArea staticRespawnArea = pooledList[i];
bool flag = false;
foreach (StaticRespawnArea item in pooledList)
{
if (item != staticRespawnArea && item.Distance(staticRespawnArea) < 1f)
{
flag = true;
break;
}
}
if (flag)
{
pooledList.RemoveAt(i);
i--;
num++;
staticRespawnArea.Kill();
}
}
arg.ReplyWith($"Destroyed {num} overlapping static spawn points");
}
[ServerVar(Help = "Spawn lots of IO entities to lag the server")]
public static void bench_io(Arg arg)
{

View file

@ -349,8 +349,11 @@ public class Global : ConsoleSystem
}
if (basePlayer.CanSuicide())
{
basePlayer.MarkSuicide();
basePlayer.Hurt(1000f, DamageType.Suicide, basePlayer, useProtection: false);
if (basePlayer.IsDead())
{
basePlayer.MarkSuicide();
}
}
else
{
@ -949,6 +952,20 @@ public class Global : ConsoleSystem
basePlayer.Teleport(worldPosition);
}
[ServerVar]
public static void teleport2mission(Arg arg)
{
BasePlayer basePlayer = arg.Player();
if (!(basePlayer == null))
{
BaseMission.MissionInstance activeMissionInstance = basePlayer.GetActiveMissionInstance();
if (activeMissionInstance != null)
{
TeleportToTopOfBase(basePlayer, activeMissionInstance.missionLocation);
}
}
}
[ServerVar]
[ClientVar]
public static void free(Arg args)

View file

@ -685,17 +685,13 @@ public class Inventory : ConsoleSystem
{
return;
}
arg.HasArg("True", remove: true);
arg.HasArg("False");
arg.TryRemoveKeyBindEventArgs();
BasePlayer basePlayer2 = basePlayer;
StringBuilder stringBuilder = new StringBuilder();
bool flag = false;
if (arg.Args == null || arg.Args.Length == 0)
{
basePlayer2.inventory.containerMain.Clear();
basePlayer2.inventory.containerBelt.Clear();
basePlayer2.inventory.containerWear.Clear();
basePlayer2.inventory.GetContainer(PlayerInventory.Type.BackpackContents)?.Clear();
stringBuilder.AppendLine("Whole inventory cleared");
flag = true;
}
else
{
@ -721,48 +717,63 @@ public class Inventory : ConsoleSystem
{
num = 1;
}
bool flag = false;
bool flag2 = false;
bool flag3 = false;
bool flag4 = false;
for (int i = num; i < arg.Args.Length; i++)
if (num == 1 && arg.Args.Length == 1)
{
switch (arg.GetString(i).ToLower())
flag = true;
}
else
{
bool flag2 = false;
bool flag3 = false;
bool flag4 = false;
bool flag5 = false;
for (int i = num; i < arg.Args.Length; i++)
{
case "--main":
flag = true;
break;
case "--belt":
flag2 = true;
break;
case "--wear":
flag3 = true;
break;
case "--backpack":
flag4 = true;
break;
switch (arg.GetString(i).ToLower())
{
case "--main":
flag2 = true;
break;
case "--belt":
flag3 = true;
break;
case "--wear":
flag4 = true;
break;
case "--backpack":
flag5 = true;
break;
}
}
if (flag2)
{
basePlayer2.inventory.containerMain.Clear();
stringBuilder.AppendLine("Cleared " + basePlayer2.displayName + "'s main inventory");
}
if (flag3)
{
basePlayer2.inventory.containerBelt.Clear();
stringBuilder.AppendLine("Cleared " + basePlayer2.displayName + "'s belt");
}
if (flag4)
{
basePlayer2.inventory.containerWear.Clear();
stringBuilder.AppendLine("Cleared " + basePlayer2.displayName + "'s clothings");
}
if (flag5 && basePlayer2.inventory.GetContainer(PlayerInventory.Type.BackpackContents) != null)
{
basePlayer2.inventory.GetContainer(PlayerInventory.Type.BackpackContents).Clear();
stringBuilder.AppendLine("Cleared " + basePlayer2.displayName + "'s backpack");
}
}
if (flag)
{
basePlayer2.inventory.containerMain.Clear();
stringBuilder.AppendLine("Cleared " + basePlayer2.displayName + "'s main inventory");
}
if (flag2)
{
basePlayer2.inventory.containerBelt.Clear();
stringBuilder.AppendLine("Cleared " + basePlayer2.displayName + "'s belt");
}
if (flag3)
{
basePlayer2.inventory.containerWear.Clear();
stringBuilder.AppendLine("Cleared " + basePlayer2.displayName + "'s clothings");
}
if (flag4 && basePlayer2.inventory.GetContainer(PlayerInventory.Type.BackpackContents) != null)
{
basePlayer2.inventory.GetContainer(PlayerInventory.Type.BackpackContents).Clear();
stringBuilder.AppendLine("Cleared " + basePlayer2.displayName + "'s backpack");
}
}
if (flag)
{
basePlayer2.inventory.containerMain.Clear();
basePlayer2.inventory.containerBelt.Clear();
basePlayer2.inventory.containerWear.Clear();
basePlayer2.inventory.GetContainer(PlayerInventory.Type.BackpackContents)?.Clear();
stringBuilder.AppendLine(basePlayer2.displayName + "'s whole inventory cleared");
}
arg.ReplyWith(stringBuilder.ToString());
ItemManager.DoRemoves();

View file

@ -153,7 +153,7 @@ public class PatrolHelicopter : ConsoleSystem
}
heliInstance.interestZoneOrigin = basePlayer.transform.position;
heliInstance.ExitCurrentState();
heliInstance.State_Flee_Enter(basePlayer.transform.position);
heliInstance.State_Flee_Enter();
}
}

View file

@ -17,4 +17,7 @@ public class Sentry : ConsoleSystem
[ServerVar(Help = "Prevents auto turrets getting added more than once to the IO queue")]
public static bool debugPreventDuplicates = true;
[ServerVar(Help = "How quickly can a turret acquire a potential target. Less is faster, but perf taxing")]
public static float scantimer = 1f;
}

View file

@ -1579,6 +1579,50 @@ public class Server : ConsoleSystem
}
}
[ServerVar(Help = "Unlock all static respawn points")]
public static void unlockrespawns(Arg arg)
{
BasePlayer basePlayer = arg.GetPlayer(0);
if (basePlayer == null)
{
if (arg.HasArgs())
{
arg.ReplyWith("Can't find player");
return;
}
basePlayer = arg.Player();
}
foreach (SleepingBag sleepingBag in SleepingBag.sleepingBags)
{
if (sleepingBag is StaticRespawnArea staticRespawnArea && !staticRespawnArea.IsAuthed(basePlayer.userID))
{
staticRespawnArea.Authorize(basePlayer.userID);
}
}
}
[ServerVar(Help = "Clear all static respawn points")]
public static void resetrespawns(Arg arg)
{
BasePlayer basePlayer = arg.GetPlayer(0);
if (basePlayer == null)
{
if (arg.HasArgs())
{
arg.ReplyWith("Can't find player");
return;
}
basePlayer = arg.Player();
}
foreach (SleepingBag sleepingBag in SleepingBag.sleepingBags)
{
if (sleepingBag is StaticRespawnArea staticRespawnArea && staticRespawnArea.IsAuthed(basePlayer.userID))
{
staticRespawnArea.Deauthorize(basePlayer.userID);
}
}
}
private static void OnEraChanged()
{
foreach (BaseNetworkable serverEntity in BaseNetworkable.serverEntities)

View file

@ -24,6 +24,9 @@ public class Stability : ConsoleSystem
[ServerVar]
public static float surroundingsqueue = 3f;
[ServerVar]
public static bool support_highest_stability = true;
[ServerVar]
public static void refresh_stability(Arg args)
{

View file

@ -0,0 +1,13 @@
namespace ConVar;
public static class party
{
[ServerVar]
public static int maxpartyspawnattempts = 50;
[ServerVar]
public static int maxpartyspawndistance = 100;
[ServerVar]
public static bool nearbypartyspawns = true;
}

View file

@ -67,7 +67,7 @@ public class ConnectionAuth : MonoBehaviour
Reject(connection, "Invalid SteamID");
return;
}
if (connection.protocol != 2590)
if (connection.protocol != 2592)
{
if (!DeveloperList.Contains(connection.userid))
{

View file

@ -14,7 +14,7 @@ using UnityEngine;
public class ConsoleGen
{
public static ConsoleSystem.Command[] All = new ConsoleSystem.Command[1559]
public static ConsoleSystem.Command[] All = new ConsoleSystem.Command[1570]
{
new ConsoleSystem.Command
{
@ -2124,6 +2124,19 @@ public class ConsoleGen
}
},
new ConsoleSystem.Command
{
Name = "killbees",
Parent = "global",
FullName = "global.killbees",
ServerAdmin = true,
Description = "Kills all bee swarms",
Variable = false,
Call = delegate(ConsoleSystem.Arg arg)
{
Admin.killbees(arg);
}
},
new ConsoleSystem.Command
{
Name = "killplayer",
Parent = "global",
@ -6682,6 +6695,7 @@ public class ConsoleGen
Parent = "debug",
FullName = "debug.heal",
ServerAdmin = true,
Description = "To disable revival if player is downed, pass in --no-recover as the first argument.",
Variable = false,
Call = delegate(ConsoleSystem.Arg arg)
{
@ -6783,7 +6797,7 @@ public class ConsoleGen
FullName = "debug.refillvitals",
ServerAdmin = true,
ClientAdmin = true,
Description = "Refills the vital of a target player. eg. debug.refillsvital jim - leave blank to target yourself, can take multiple players at once",
Description = "Refills the vital of a target player. eg. debug.refillsvital jim - leave blank to target yourself, can take multiple players at once. Will revive players if they are injured. To disable this, pass in --no-recover as the first argument.",
Variable = false,
Call = delegate(ConsoleSystem.Arg arg)
{
@ -6797,7 +6811,7 @@ public class ConsoleGen
FullName = "debug.refillvitalsall",
ServerAdmin = true,
ClientAdmin = true,
Description = "Refills the vitals of all active players on the server",
Description = "Refills the vitals of all active players on the server. Will revive players if they are injured. To disable this, pass in --no-recover as the first argument.",
Variable = false,
Call = delegate(ConsoleSystem.Arg arg)
{
@ -6805,6 +6819,18 @@ public class ConsoleGen
}
},
new ConsoleSystem.Command
{
Name = "removeoverlappingstaticspawnpoints",
Parent = "debug",
FullName = "debug.removeoverlappingstaticspawnpoints",
ServerAdmin = true,
Variable = false,
Call = delegate(ConsoleSystem.Arg arg)
{
Debugging.removeOverlappingStaticSpawnPoints(arg);
}
},
new ConsoleSystem.Command
{
Name = "renderinfo",
Parent = "debug",
@ -9115,6 +9141,18 @@ public class ConsoleGen
}
},
new ConsoleSystem.Command
{
Name = "teleport2mission",
Parent = "global",
FullName = "global.teleport2mission",
ServerAdmin = true,
Variable = false,
Call = delegate(ConsoleSystem.Arg arg)
{
Global.teleport2mission(arg);
}
},
new ConsoleSystem.Command
{
Name = "teleport2owneditem",
Parent = "global",
@ -10407,6 +10445,45 @@ public class ConsoleGen
Default = "True"
},
new ConsoleSystem.Command
{
Name = "maxpartyspawnattempts",
Parent = "party",
FullName = "party.maxpartyspawnattempts",
ServerAdmin = true,
Variable = true,
GetOveride = () => party.maxpartyspawnattempts.ToString(),
SetOveride = delegate(string str)
{
party.maxpartyspawnattempts = str.ToInt();
}
},
new ConsoleSystem.Command
{
Name = "maxpartyspawndistance",
Parent = "party",
FullName = "party.maxpartyspawndistance",
ServerAdmin = true,
Variable = true,
GetOveride = () => party.maxpartyspawndistance.ToString(),
SetOveride = delegate(string str)
{
party.maxpartyspawndistance = str.ToInt();
}
},
new ConsoleSystem.Command
{
Name = "nearbypartyspawns",
Parent = "party",
FullName = "party.nearbypartyspawns",
ServerAdmin = true,
Variable = true,
GetOveride = () => party.nearbypartyspawns.ToString(),
SetOveride = delegate(string str)
{
party.nearbypartyspawns = str.ToBool();
}
},
new ConsoleSystem.Command
{
Name = "bulletaccuracy",
Parent = "heli",
@ -11807,6 +11884,20 @@ public class ConsoleGen
Default = "12"
},
new ConsoleSystem.Command
{
Name = "scantimer",
Parent = "sentry",
FullName = "sentry.scantimer",
ServerAdmin = true,
Description = "How quickly can a turret acquire a potential target. Less is faster, but perf taxing",
Variable = true,
GetOveride = () => Sentry.scantimer.ToString(),
SetOveride = delegate(string str)
{
Sentry.scantimer = str.ToFloat();
}
},
new ConsoleSystem.Command
{
Name = "targetall",
Parent = "sentry",
@ -14365,6 +14456,19 @@ public class ConsoleGen
}
},
new ConsoleSystem.Command
{
Name = "resetrespawns",
Parent = "server",
FullName = "server.resetrespawns",
ServerAdmin = true,
Description = "Clear all static respawn points",
Variable = false,
Call = delegate(ConsoleSystem.Arg arg)
{
ConVar.Server.resetrespawns(arg);
}
},
new ConsoleSystem.Command
{
Name = "resetserveremoji",
Parent = "server",
@ -14836,6 +14940,19 @@ public class ConsoleGen
Default = "false"
},
new ConsoleSystem.Command
{
Name = "unlockrespawns",
Parent = "server",
FullName = "server.unlockrespawns",
ServerAdmin = true,
Description = "Unlock all static respawn points",
Variable = false,
Call = delegate(ConsoleSystem.Arg arg)
{
ConVar.Server.unlockrespawns(arg);
}
},
new ConsoleSystem.Command
{
Name = "updatebatch",
Parent = "server",
@ -15471,6 +15588,19 @@ public class ConsoleGen
}
},
new ConsoleSystem.Command
{
Name = "support_highest_stability",
Parent = "stability",
FullName = "stability.support_highest_stability",
ServerAdmin = true,
Variable = true,
GetOveride = () => Stability.support_highest_stability.ToString(),
SetOveride = delegate(string str)
{
Stability.support_highest_stability = str.ToBool();
}
},
new ConsoleSystem.Command
{
Name = "surroundingsqueue",
Parent = "stability",
@ -19374,6 +19504,18 @@ public class ConsoleGen
}
},
new ConsoleSystem.Command
{
Name = "sendofflineinvite",
Parent = "relationshipmanager",
FullName = "relationshipmanager.sendofflineinvite",
ServerUser = true,
Variable = false,
Call = delegate(ConsoleSystem.Arg arg)
{
RelationshipManager.sendofflineinvite(arg);
}
},
new ConsoleSystem.Command
{
Name = "sleeptoggle",
Parent = "relationshipmanager",

View file

@ -41,7 +41,7 @@ public class Construction : PrefabAttribute
public BasePlayer player;
public bool inBuildingPrivilege;
public bool buildingBlocked;
public bool isHoldingShift;
@ -114,6 +114,8 @@ public class Construction : PrefabAttribute
public LayerMask overridedPlacementLayer;
public LayerMask additionalPlacementLayer;
public Vector3 rotationAmount = new Vector3(0f, 90f, 0f);
public Vector3 applyStartingRotation = Vector3.zero;
@ -122,6 +124,7 @@ public class Construction : PrefabAttribute
public bool enforceLineOfSightCheckAgainstParentEntity;
[Tooltip("Axis Snapping for IO Entities.")]
public bool canSnap;
public float holdToPlaceDuration;
@ -438,7 +441,7 @@ public class Construction : PrefabAttribute
lastPlacementError = ConstructionErrors.NoPermission;
continue;
}
target.inBuildingPrivilege = flag;
target.buildingBlocked = flag;
transform.SetPositionAndRotation(placement.position, placement.rotation);
if ((!(target.player != null) || !target.player.IsInCreativeMode || !Creative.bypassHoldToPlaceDuration) && common.holdToPlaceDuration > 0f && target.player != null && isServer && target.player.GetHeldEntity() is Planner planner && (Vector3.Distance(target.player.transform.position, planner.serverStartDurationPlacementPosition) > 1f || Mathf.Abs((float)planner.serverStartDurationPlacementTime - common.holdToPlaceDuration) > 0.5f))
{
@ -536,6 +539,6 @@ public class Construction : PrefabAttribute
public virtual bool ShowAsNeutral(Target target)
{
return target.inBuildingPrivilege;
return target.buildingBlocked;
}
}

View file

@ -1,22 +1,3 @@
using UnityEngine;
public class ConversationManager : MonoBehaviour
public static class ConversationManager
{
public class Conversation : MonoBehaviour
{
public ConversationData data;
public int currentSpeechNodeIndex;
public IConversationProvider provider;
public int GetSpeechNodeIndex(string name)
{
if (data == null)
{
return -1;
}
return data.GetSpeechNodeIndex(name);
}
}
}

View file

@ -557,7 +557,7 @@ public class DecayEntity : BaseCombatEntity
}
}
private void StopBeingDemolishable()
public void StopBeingDemolishable()
{
SetFlag(Flags.Reserved2, b: false);
SendNetworkUpdate();

View file

@ -70,7 +70,7 @@ public class DensitySpawnPopulation : SpawnPopulationBase
}
if (flag && NpcRadiusCheckDistance > 0f)
{
PooledList<BaseNPC2> pooledList = Facepunch.Pool.Get<PooledList<BaseNPC2>>();
using PooledList<BaseNPC2> pooledList = Facepunch.Pool.Get<PooledList<BaseNPC2>>();
BaseEntity.Query.Server.GetBrainsInSphere(spawnPos, NpcRadiusCheckDistance, pooledList);
flag = pooledList.Count == 0;
}

View file

@ -0,0 +1,6 @@
public enum DeployableSnappingMode
{
Off,
Simple,
Advanced
}

View file

@ -443,6 +443,7 @@ public class Door : AnimatedBuildingBlock, INotifyTrigger, ISimpleUpgradable
NavMeshLink = forPoint.GetClosestNavMeshLink(base.transform.position);
}
DisableVehiclePhysBox();
UpdateColliderStates();
}
public override bool HasSlot(Slot slot)
@ -933,30 +934,45 @@ public class Door : AnimatedBuildingBlock, INotifyTrigger, ISimpleUpgradable
slot.SendMessage("Think");
}
}
GameObject[] busyColliderRoots;
if (BusyColliderRoots != null)
UpdateColliderStates();
}
private void UpdateColliderStates()
{
UpdateBusyColliderState();
UpdateClosedColliderState();
}
private void UpdateBusyColliderState()
{
if (BusyColliderRoots == null)
{
bool flag = HasFlag(Flags.Busy);
busyColliderRoots = BusyColliderRoots;
foreach (GameObject gameObject in busyColliderRoots)
return;
}
bool flag = HasFlag(Flags.Busy);
GameObject[] busyColliderRoots = BusyColliderRoots;
foreach (GameObject gameObject in busyColliderRoots)
{
if (gameObject != null && gameObject.gameObject.activeSelf != flag)
{
if (gameObject != null && gameObject.gameObject.activeSelf != flag)
{
gameObject.gameObject.SetActive(flag);
}
gameObject.gameObject.SetActive(flag);
}
}
}
private void UpdateClosedColliderState()
{
if (ClosedColliderRoots == null)
{
return;
}
bool flag2 = !HasFlag(Flags.Open) && !HasFlag(Flags.Busy);
busyColliderRoots = ClosedColliderRoots;
foreach (GameObject gameObject2 in busyColliderRoots)
bool flag = !HasFlag(Flags.Open) && !HasFlag(Flags.Busy);
GameObject[] closedColliderRoots = ClosedColliderRoots;
foreach (GameObject gameObject in closedColliderRoots)
{
if (gameObject2 != null && gameObject2.gameObject.activeSelf != flag2)
if (gameObject != null && gameObject.gameObject.activeSelf != flag)
{
gameObject2.gameObject.SetActive(flag2);
gameObject.gameObject.SetActive(flag);
}
}
}

View file

@ -204,25 +204,35 @@ public class DroppedItemContainer : BaseCombatEntity, LootPanel.IHasLootPanel, I
public static void TakeFractionOfItems(ItemContainer[] source, ItemContainer output, float movePercent)
{
output.containerVolume = source.Max((ItemContainer x) => x.containerVolume);
List<Item> list = Facepunch.Pool.Get<List<Item>>();
List<Item> obj = Facepunch.Pool.Get<List<Item>>();
ItemContainer[] array = source;
foreach (ItemContainer obj in array)
foreach (ItemContainer obj2 in array)
{
obj.RemoveFractionOfContainer(list, movePercent);
obj.MergeAllStacks();
obj2.RemoveFractionOfContainer(obj, movePercent);
obj2.MergeAllStacks();
}
foreach (Item item in list)
foreach (Item item in obj)
{
if (!item.MoveToContainer(output))
if (item.MoveToContainer(output))
{
array = source;
foreach (ItemContainer newcontainer in array)
continue;
}
bool flag = false;
array = source;
foreach (ItemContainer newcontainer in array)
{
if (item.MoveToContainer(newcontainer))
{
item.MoveToContainer(newcontainer);
flag = true;
break;
}
}
if (!flag)
{
item.DropAndTossUpwards(output.dropPosition);
}
}
Facepunch.Pool.Free(ref obj, freeElements: false);
}
[RPC_Server]

View file

@ -246,6 +246,15 @@ public class DudTimedExplosive : TimedExplosive, IIgniteable, ISplashable
return 1;
}
protected override bool ShouldBypassClippingWallCheck()
{
if (!IsWickBurning())
{
return true;
}
return false;
}
public override void Load(LoadInfo info)
{
base.Load(info);

View file

@ -0,0 +1,5 @@
using UnityEngine;
public class EggUpdater : MonoBehaviour
{
}

View file

@ -3,6 +3,13 @@ using UnityEngine;
[ExecuteInEditMode]
public class EnvironmentVolume : MonoBehaviour, IPrefabPreProcess
{
public enum VolumeShape
{
Cube,
Sphere,
Capsule
}
private static readonly Vector3[] volumeCorners = new Vector3[8]
{
new Vector3(-0.5f, -0.5f, -0.5f),
@ -33,6 +40,9 @@ public class EnvironmentVolume : MonoBehaviour, IPrefabPreProcess
[field: Tooltip("Controls the falloff amount of the negative axes of spatially aware volumes.")]
public Vector3 FalloffNegative { get; private set; } = Vector3.zero;
[field: SerializeField]
public VolumeShape SpatialVolumeShape { get; private set; }
public Matrix4x4 VolumeTransformation { get; private set; }
public Matrix4x4 VolumeTransformationInverse { get; private set; }
@ -63,7 +73,7 @@ public class EnvironmentVolume : MonoBehaviour, IPrefabPreProcess
public void PreProcess(IPrefabProcessor preProcess, GameObject rootObj, string name, bool serverside, bool clientside, bool bundling)
{
if (clientside && GetComponent<EnvironmentVolumeLOD>() == null)
if (clientside && IsSpatialVolume && !(base.gameObject == null) && GetComponent<EnvironmentVolumeLOD>() == null)
{
base.gameObject.AddComponent<EnvironmentVolumeLOD>();
}
@ -102,6 +112,12 @@ public class EnvironmentVolume : MonoBehaviour, IPrefabPreProcess
vector = Vector3.Min(vector, rhs);
vector2 = Vector3.Max(vector2, rhs);
}
if (IsSpatialVolume && SpatialVolumeShape == VolumeShape.Capsule)
{
float num = Mathf.Abs(vector2.y - vector.y) * 0.5f;
vector.y -= num;
vector2.y += num;
}
Bounds result = new Bounds(Vector3.zero, Vector3.one);
result.SetMinMax(vector, vector2);
return result;

View file

@ -4,7 +4,7 @@ using UnityEngine;
public static class Eqs
{
public class PooledScoreList : PooledList<(Vector3 pos, float score)>
public sealed class PooledScoreList : BasePooledList<(Vector3 pos, float score), PooledScoreList>
{
public void SortByScoreDesc(BaseEntity baseEntity = null)
{

View file

@ -0,0 +1,5 @@
using UnityEngine;
public class FPSLogger : MonoBehaviour
{
}

View file

@ -1,3 +1,5 @@
using Unity.IL2CPP.CompilerServices;
namespace Facepunch.MarchingCubes;
[Il2CppEagerStaticClassConstruction]

View file

@ -409,8 +409,8 @@ public static class Analytics
.AddField("ip_convar", global::Network.Net.sv.ip)
.AddField("port_convar", global::Network.Net.sv.port)
.AddField("net_protocol", global::Network.Net.sv.ProtocolId)
.AddField("protocol_network", 2590)
.AddField("protocol_save", 268)
.AddField("protocol_network", 2592)
.AddField("protocol_save", 269)
.AddField("changeset", BuildInfo.Current?.Scm.ChangeId ?? "0")
.AddField("unity_version", UnityEngine.Application.unityVersion)
.AddField("branch", BuildInfo.Current?.Scm.Branch ?? "empty")
@ -1126,7 +1126,7 @@ public static class Analytics
.AddField("message", message);
if (BuildInfo.Current != null)
{
eventRecord.AddField("changeset", BuildInfo.Current.Scm.ChangeId).AddField("network", 2590);
eventRecord.AddField("changeset", BuildInfo.Current.Scm.ChangeId).AddField("network", 2592);
}
switch (type)
{

View file

@ -348,7 +348,7 @@ public class PerformanceLogging
["unity"] = UnityEngine.Application.unityVersion ?? "editor",
["changeset"] = BuildInfo.Current?.Scm.ChangeId ?? "editor",
["branch"] = BuildInfo.Current?.Scm.Branch ?? "editor",
["network_version"] = 2590.ToString()
["network_version"] = 2592.ToString()
};
dictionary["eos_sdk"] = VersionInterface.GetVersion()?.ToString() ?? "disabled";
record.AddObject("hardware", data).AddObject("application", dictionary);

View file

@ -54,7 +54,7 @@ public class FileStorage : IDisposable
private MruDictionary<uint, CacheData> _cache = new MruDictionary<uint, CacheData>(1000);
public static FileStorage server = new FileStorage("sv.files." + 268, server: true);
public static FileStorage server = new FileStorage("sv.files." + 269, server: true);
protected FileStorage(string name, bool server)
{

View file

@ -288,7 +288,7 @@ public class FlameThrower : AttackEntity
SetFlameState(flameState);
}
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Transform originOverride = null, bool useBulletThickness = true)
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Matrix4x4? originOverride = null, bool useBulletThickness = true)
{
if (!IsOnFire() && !ServerIsReloading())
{

View file

@ -1,26 +0,0 @@
using UnityEngine;
public class FoliageGridBenchmarkScene : BenchmarkScene
{
private static TerrainMeta terrainMeta;
public GameObjectRef foliagePrefab;
private GameObject foliageInstance;
public GameObjectRef lodPrefab;
private GameObject lodInstance;
public GameObjectRef batchingPrefab;
private GameObject batchingInstance;
public Terrain terrain;
public Transform viewpointA;
public Transform viewpointB;
public bool moveVantangePoint = true;
}

View file

@ -83,6 +83,24 @@ public class Fridge : ContainerIOEntity, IFoodSpoilModifier
return base.PlayerOpenLoot(player, panelToOpen, doPositionChecks);
}
public override bool CanPickup(BasePlayer player)
{
bool flag = GetSlot(Slot.Lock) != null;
if (base.isClient)
{
if (base.CanPickup(player))
{
return !flag;
}
return false;
}
if ((!pickup.requireEmptyInv || base.inventory == null || base.inventory.itemList.Count == 0) && base.CanPickup(player))
{
return !flag;
}
return false;
}
public override int ConsumptionAmount()
{
return PowerConsumption;

View file

@ -153,7 +153,10 @@ public class GameModeSoftcore : GameModeVanilla
public override void OnPlayerRevived(BasePlayer instigator, BasePlayer victim)
{
SetInventoryLocked(victim, wantsLocked: false);
if (!victim.IsRestrained)
{
SetInventoryLocked(victim, wantsLocked: false);
}
base.OnPlayerRevived(instigator, victim);
}

View file

@ -2,6 +2,10 @@ public class GameModeSpawnGroup : SpawnGroup
{
public string[] gameModeTags;
protected override bool AllowOverlappingSpawns => true;
protected override bool BlockSpawnedEntitySaving => false;
public void ResetSpawnGroup()
{
Clear();
@ -11,6 +15,10 @@ public class GameModeSpawnGroup : SpawnGroup
public bool ShouldSpawn()
{
BaseGameMode activeGameMode = BaseGameMode.GetActiveGameMode(serverside: true);
if (activeGameMode == null && HasTag("vanilla"))
{
return true;
}
if (activeGameMode == null)
{
return false;
@ -26,6 +34,19 @@ public class GameModeSpawnGroup : SpawnGroup
return false;
}
private bool HasTag(string tag)
{
string[] array = gameModeTags;
for (int i = 0; i < array.Length; i++)
{
if (string.Equals(array[i], tag))
{
return true;
}
}
return false;
}
protected override void Spawn(int numToSpawn)
{
if (ShouldSpawn())

View file

@ -1,13 +1,271 @@
#define UNITY_ASSERTIONS
using System;
using GenerateErosionJobs;
using Unity.Collections;
using Unity.Jobs;
using Unity.Jobs.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
public class GenerateErosion : ProceduralComponent
{
public struct SplatPaintingData : IDisposable
{
public bool IsValid;
public readonly NativeArray<float> HeightMapDelta;
public readonly NativeArray<float> AngleMap;
public SplatPaintingData(NativeArray<float> heightMapDelta, NativeArray<float> angleMap)
{
HeightMapDelta = heightMapDelta;
AngleMap = angleMap;
IsValid = true;
}
public void Dispose()
{
IsValid = false;
if (HeightMapDelta.IsCreated)
{
HeightMapDelta.Dispose();
}
if (AngleMap.IsCreated)
{
AngleMap.Dispose();
}
}
public void Dispose(JobHandle inputDeps)
{
IsValid = false;
if (HeightMapDelta.IsCreated)
{
HeightMapDelta.Dispose(inputDeps);
}
if (AngleMap.IsCreated)
{
AngleMap.Dispose(inputDeps);
}
}
}
public static SplatPaintingData splatPaintingData;
public override void Process(uint seed)
{
if (World.Networked)
if (!World.Networked)
{
return;
GridErosion(seed);
}
}
private static int GetBatchSize(int length)
{
int num = length / JobsUtility.JobWorkerCount;
if (num < 64)
{
return 64;
}
return num;
}
private void GridErosion(uint seed)
{
using (TimeWarning.New("GridErosion"))
{
TerrainHeightMap heightMap = TerrainMeta.HeightMap;
heightMap.Push();
NativeArray<short> src = heightMap.src;
NativeArray<short> dst = heightMap.dst;
NativeArray<float> minTerrainHeightMap = new NativeArray<float>(heightMap.src.Length, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
NativeArray<float> waterMap = new NativeArray<float>(heightMap.src.Length, Allocator.Persistent);
NativeList<int> nativeList = new NativeList<int>(heightMap.src.Length, Allocator.Persistent);
NativeArray<float4> fluxMap = new NativeArray<float4>(heightMap.src.Length, Allocator.Persistent);
NativeArray<float2> velocityMap = new NativeArray<float2>(heightMap.src.Length, Allocator.Persistent);
NativeArray<float> nativeArray = new NativeArray<float>(heightMap.src.Length, Allocator.Persistent);
NativeArray<float> copyTarget = new NativeArray<float>(heightMap.src.Length, Allocator.Persistent);
NativeArray<float> angleMap = new NativeArray<float>(heightMap.src.Length, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
Debug.Assert(waterMap.Length == heightMap.src.Length);
Debug.Assert(fluxMap.Length == heightMap.src.Length);
Debug.Assert(velocityMap.Length == heightMap.src.Length);
Debug.Assert(nativeArray.Length == heightMap.src.Length);
float num = TerrainMeta.Size.x / (float)heightMap.res * TerrainMeta.Size.z / (float)heightMap.res;
float invGridCellSquareSize = 1f / num;
float pipeLength = 1f;
float pipeArea = 1f;
JobHandle dependsOn = default(JobHandle);
NativeArray<float> nativeArray2 = new NativeArray<float>(src.Length, Allocator.Persistent);
NativeArray<float> nativeArray3 = new NativeArray<float>(nativeArray2, Allocator.Persistent);
dependsOn = IJobParallelForBatchExtensions.Schedule(new PrepareMapJob
{
HeightMapAsShort = src.AsReadOnly(),
HeightMapAsFloat = nativeArray2,
OceanIndicesWriter = nativeList.AsParallelWriter(),
OceanLevel = WaterSystem.OceanLevel,
TerrainPositionY = TerrainMeta.Position.y,
TerrainSizeY = TerrainMeta.Size.y
}, src.Length, GetBatchSize(src.Length), dependsOn);
IJobParallelForExtensions.Schedule(new CalcMinHeightMapJob
{
TerrainHeightMap = nativeArray2.AsReadOnly(),
MinTerrainHeightMap = minTerrainHeightMap,
HeightMapRes = TerrainMeta.HeightMap.res,
TopologyMap = TerrainMeta.TopologyMap.src.AsReadOnly(),
TopologyMapRes = TerrainMeta.TopologyMap.res,
OceanHeight = WaterSystem.OceanLevel,
TerrainOneOverSizeX = TerrainMeta.OneOverSize.x
}, nativeArray2.Length, GetBatchSize(nativeArray2.Length), dependsOn).Complete();
dependsOn = default(JobHandle);
NativeArray<float> copyTarget2 = new NativeArray<float>(src.Length, Allocator.Persistent);
CopyArrayJob<float> jobData = new CopyArrayJob<float>
{
CopyTarget = copyTarget2,
CopySource = nativeArray2
};
dependsOn = JobHandle.CombineDependencies(job1: new CopyArrayJob<float>
{
CopyTarget = nativeArray3,
CopySource = nativeArray2
}.Schedule(dependsOn), job0: jobData.Schedule(dependsOn));
int num2 = 32;
int num3 = 32;
int num4 = (heightMap.res + num2 - 1) / num2;
int num5 = (heightMap.res + num3 - 1) / num3;
int num6 = num4 * num5;
for (int i = 0; i < 512; i++)
{
RefillOceanJob jobData2 = new RefillOceanJob
{
OceanIndices = nativeList.AsReadOnly(),
HeightMap = nativeArray2.AsReadOnly(),
OceanLevel = WaterSystem.OceanLevel,
WaterMap = waterMap
};
dependsOn = IJobParallelForExtensions.ScheduleByRef(ref jobData2, nativeList.Length, GetBatchSize(nativeList.Length), dependsOn);
WaterIncrementationJob jobData3 = new WaterIncrementationJob
{
WaterMap = waterMap,
WaterFillRate = 0.04f,
DT = 0.06f
};
dependsOn = IJobParallelForExtensions.ScheduleByRef(ref jobData3, waterMap.Length, GetBatchSize(waterMap.Length), dependsOn);
CalculateOutputFluxJob jobData4 = new CalculateOutputFluxJob
{
TerrainHeightMapFloatVal = nativeArray2.AsReadOnly(),
WaterMap = waterMap.AsReadOnly(),
FluxMap = fluxMap,
Res = heightMap.res,
DT = 0.06f,
GridCellSquareSize = num,
PipeLength = pipeLength,
PipeArea = pipeArea
};
dependsOn = IJobParallelForExtensions.ScheduleByRef(ref jobData4, fluxMap.Length, GetBatchSize(fluxMap.Length), dependsOn);
AdjustWaterHeightByFluxJob jobData5 = new AdjustWaterHeightByFluxJob
{
WaterMap = waterMap,
VelocityMap = velocityMap,
FluxMap = fluxMap.AsReadOnly(),
Res = heightMap.res,
DT = 0.06f,
InvGridCellSquareSize = invGridCellSquareSize
};
dependsOn = IJobParallelForExtensions.ScheduleByRef(ref jobData5, waterMap.Length, GetBatchSize(waterMap.Length), dependsOn);
TileCalculateAngleMap jobData6 = new TileCalculateAngleMap
{
AngleMap = angleMap,
TerrainHeightMapSrcFloat = nativeArray2.AsReadOnly(),
NormY = heightMap.normY,
Res = heightMap.res,
TileSizeX = num2,
TileSizeZ = num3,
NumXTiles = num4
};
dependsOn = IJobParallelForExtensions.ScheduleByRef(ref jobData6, num6, num6 / JobsUtility.JobWorkerCount, dependsOn);
ErosionAndDepositionJob jobData7 = new ErosionAndDepositionJob
{
SedimentMap = nativeArray,
MinTerrainHeightMap = minTerrainHeightMap.AsReadOnly(),
TerrainHeightMapSrcFloat = nativeArray2.AsReadOnly(),
TerrainHeightMapDstFloat = nativeArray3,
WaterMap = waterMap,
VelocityMap = velocityMap.AsReadOnly(),
AngleMap = angleMap.AsReadOnly(),
DT = 0.06f
};
dependsOn = IJobParallelForExtensions.ScheduleByRef(ref jobData7, nativeArray.Length, GetBatchSize(nativeArray.Length), dependsOn);
CopyArrayJob<float> jobData8 = new CopyArrayJob<float>
{
CopyTarget = copyTarget,
CopySource = nativeArray
};
dependsOn = IJobExtensions.ScheduleByRef(ref jobData8, dependsOn);
CopyArrayJob<float> jobData9 = new CopyArrayJob<float>
{
CopyTarget = nativeArray2,
CopySource = nativeArray3
};
TransportSedimentJob jobData10 = new TransportSedimentJob
{
SedimentMap = nativeArray,
SedimentReadOnlyMap = copyTarget.AsReadOnly(),
VelocityMap = velocityMap.AsReadOnly(),
Res = heightMap.res,
DT = 0.06f
};
dependsOn = JobHandle.CombineDependencies(IJobExtensions.ScheduleByRef(ref jobData9, dependsOn), IJobParallelForExtensions.ScheduleByRef(ref jobData10, nativeArray.Length, GetBatchSize(nativeArray.Length), dependsOn));
EvaporationJob jobData11 = new EvaporationJob
{
WaterMap = waterMap,
DT = 0.06f,
EvaporationRate = 0.015f
};
dependsOn = IJobParallelForExtensions.ScheduleByRef(ref jobData11, waterMap.Length, GetBatchSize(waterMap.Length), dependsOn);
}
CopyBackFloatHeightToShortHeightJob jobData12 = new CopyBackFloatHeightToShortHeightJob
{
HeightMapAsFloat = nativeArray2.AsReadOnly(),
HeightMapAsShort = dst,
TerrainOneOverSizeY = TerrainMeta.OneOverSize.y,
TerrainPositionY = TerrainMeta.Position.y
};
dependsOn = IJobParallelForExtensions.ScheduleByRef(ref jobData12, nativeArray2.Length, GetBatchSize(nativeArray2.Length), dependsOn);
NativeArray<float> nativeArray4 = new NativeArray<float>(nativeArray2.Length, Allocator.Persistent);
PopulateDeltaHeightJob jobData13 = new PopulateDeltaHeightJob
{
HeightMapOriginal = copyTarget2.AsReadOnly(),
HeightMap = nativeArray2.AsReadOnly(),
DeltaHeightMap = nativeArray4
};
dependsOn = IJobParallelForExtensions.ScheduleByRef(ref jobData13, nativeArray4.Length, GetBatchSize(nativeArray4.Length), dependsOn);
minTerrainHeightMap.Dispose(dependsOn);
waterMap.Dispose(dependsOn);
fluxMap.Dispose(dependsOn);
velocityMap.Dispose(dependsOn);
nativeArray.Dispose(dependsOn);
copyTarget.Dispose(dependsOn);
nativeArray2.Dispose(dependsOn);
nativeArray3.Dispose(dependsOn);
nativeList.Dispose(dependsOn);
copyTarget2.Dispose(dependsOn);
dependsOn.Complete();
heightMap.Pop();
splatPaintingData = new SplatPaintingData(nativeArray4, angleMap);
}
}
private void OnDestroy()
{
if (splatPaintingData.IsValid)
{
splatPaintingData.Dispose();
}
}
private void OldErosion(uint seed)
{
TerrainTopologyMap topologyMap = TerrainMeta.TopologyMap;
TerrainHeightMap heightmap = TerrainMeta.HeightMap;
TerrainSplatMap splatmap = TerrainMeta.SplatMap;

View file

@ -0,0 +1,60 @@
using System.Runtime.CompilerServices;
using Unity.Burst;
using Unity.Burst.CompilerServices;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct AdjustWaterHeightByFluxJob : IJobParallelFor
{
public NativeArray<float> WaterMap;
public NativeArray<float2> VelocityMap;
public NativeArray<float4>.ReadOnly FluxMap;
public int Res;
public float DT;
public float InvGridCellSquareSize;
public void Execute(int index)
{
int num = index % Res;
int num2 = index / Res;
ref float2 reference = ref BurstUtil.Get(in VelocityMap, index);
if (num == 0 || num2 == 0 || num == Res - 1 || num2 == Res - 1)
{
reference = float2.zero;
return;
}
float4 x = FluxMap[index];
float num3 = math.csum(x);
int4x2 int4x = new int4x2(new int4(num - 1, num + 1, num, num), new int4(num2, num2, num2 + 1, num2 - 1));
int4x.c0 = int4x.c1 * Res + int4x.c0;
float y = FluxMap[int4x.c0.x].y;
float x2 = FluxMap[int4x.c0.y].x;
float w = FluxMap[int4x.c0.z].w;
float z = FluxMap[int4x.c0.w].z;
float num4 = y + x2 + w + z;
float num5 = DT * (num4 - num3);
BurstUtil.Get(in WaterMap, index) += num5 * InvGridCellSquareSize;
float2 @float = new float2
{
x = y - x.x + x.y - x2,
y = w - x.z + x.w - z
};
@float *= 0.5f;
reference += @float * DT;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int ToIndex([AssumeRange(0L, 2147483647L)] int x, [AssumeRange(0L, 2147483647L)] int y, [AssumeRange(0L, 2147483647L)] int res)
{
return y * res + x;
}
}

View file

@ -0,0 +1,49 @@
using TerrainTopologyMapJobs;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct CalcMinHeightMapJob : IJobParallelFor
{
public NativeArray<float>.ReadOnly TerrainHeightMap;
public int HeightMapRes;
[WriteOnly]
public NativeArray<float> MinTerrainHeightMap;
public NativeArray<int>.ReadOnly TopologyMap;
public int TopologyMapRes;
public float OceanHeight;
public float TerrainOneOverSizeX;
public void Execute(int index)
{
float num = TerrainHeightMap[index];
if (!(num < OceanHeight))
{
int num2 = index % HeightMapRes;
int num3 = index / HeightMapRes;
float normX = ((float)num2 - 0.5f) / (float)HeightMapRes;
float normZ = ((float)num3 - 0.5f) / (float)HeightMapRes;
bool flag = (TerrainTopologyMapJobUtil.GetTopologyRadius(TopologyMap, TopologyMapRes, TerrainOneOverSizeX, 0f, normX, normZ) & 0x14080) != 0;
float x = 8f;
float num4 = 8f;
while (num4 > 0f && !flag && (TerrainTopologyMapJobUtil.GetTopologyRadius(TopologyMap, TopologyMapRes, TerrainOneOverSizeX, num4, normX, normZ) & 0x3C198) != 0)
{
x = num4;
num4 -= 0.25f;
}
float num5 = (flag ? 0f : math.unlerp(0f, 8f, x));
num = math.max(OceanHeight, num - 1f * num5);
}
MinTerrainHeightMap[index] = num;
}
}

View file

@ -0,0 +1,55 @@
using Unity.Burst;
using Unity.Burst.CompilerServices;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct CalculateOutputFluxJob : IJobParallelFor
{
public NativeArray<float>.ReadOnly TerrainHeightMapFloatVal;
public NativeArray<float>.ReadOnly WaterMap;
public NativeArray<float4> FluxMap;
public int Res;
public float DT;
public float GridCellSquareSize;
public float PipeLength;
public float PipeArea;
private const float Gravity = 10f;
[SkipLocalsInit]
public void Execute(int index)
{
ref float4 reference = ref BurstUtil.Get(in FluxMap, index);
int num = index % Res;
int num2 = index / Res;
if (num == 0 || num2 == 0 || num == Res - 1 || num2 == Res - 1)
{
reference = float4.zero;
return;
}
float num3 = TerrainHeightMapFloatVal[index];
float num4 = WaterMap[index];
float num5 = num3 + num4;
int4x2 int4x = new int4x2(new int4(num - 1, num + 1, num, num), new int4(num2, num2, num2 + 1, num2 - 1));
int4 @int = math.mad(int4x.c1, Res, int4x.c0);
float4 @float = default(float4);
@float.x = BurstUtil.GetReadonly(in TerrainHeightMapFloatVal, @int.x) + BurstUtil.GetReadonly(in WaterMap, @int.x);
@float.y = BurstUtil.GetReadonly(in TerrainHeightMapFloatVal, @int.y) + BurstUtil.GetReadonly(in WaterMap, @int.y);
@float.z = BurstUtil.GetReadonly(in TerrainHeightMapFloatVal, @int.z) + BurstUtil.GetReadonly(in WaterMap, @int.z);
@float.w = BurstUtil.GetReadonly(in TerrainHeightMapFloatVal, @int.w) + BurstUtil.GetReadonly(in WaterMap, @int.w);
reference = math.max(float4.zero, reference + DT * PipeArea * (10f * (num5 - @float) / PipeLength));
float num6 = math.min(1f, num4 * GridCellSquareSize / (math.csum(reference) * DT));
reference *= num6;
}
}

View file

@ -0,0 +1,20 @@
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct CopyArrayJob<T> : IJob where T : unmanaged
{
[WriteOnly]
public NativeArray<T> CopyTarget;
[Unity.Collections.ReadOnly]
public NativeArray<T> CopySource;
public void Execute()
{
CopyTarget.CopyFrom(CopySource);
}
}

View file

@ -0,0 +1,23 @@
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct CopyBackFloatHeightToShortHeightJob : IJobParallelFor
{
public NativeArray<float>.ReadOnly HeightMapAsFloat;
[WriteOnly]
public NativeArray<short> HeightMapAsShort;
public float TerrainOneOverSizeY;
public float TerrainPositionY;
public void Execute(int index)
{
HeightMapAsShort[index] = BitUtility.Float2Short(TerrainOneOverSizeY * (HeightMapAsFloat[index] - TerrainPositionY));
}
}

View file

@ -0,0 +1,50 @@
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct ErosionAndDepositionJob : IJobParallelFor
{
public NativeArray<float> SedimentMap;
public NativeArray<float>.ReadOnly MinTerrainHeightMap;
public NativeArray<float>.ReadOnly TerrainHeightMapSrcFloat;
public NativeArray<float> TerrainHeightMapDstFloat;
public NativeArray<float> WaterMap;
public NativeArray<float2>.ReadOnly VelocityMap;
public NativeArray<float>.ReadOnly AngleMap;
public float DT;
private const float SedimentCapacityConst = 0.0015f;
private const float DissolveRateConstant = 0.15f;
public void Execute(int index)
{
float x = math.max(0.01047198f, AngleMap[index]);
float2 x2 = VelocityMap[index];
float num = 0.0015f * math.sin(x) * math.length(x2);
ref float reference = ref BurstUtil.Get(in WaterMap, index);
float num2 = 1f - math.smoothstep(0f, 10f, reference);
ref float reference2 = ref BurstUtil.Get(in SedimentMap, index);
float num3 = DT * 0.15f * (num - reference2) * num2;
float x3 = math.select(-1f, 1f, num > reference2) * num3;
x3 = math.max(x3, 0f);
float num4 = TerrainHeightMapSrcFloat[index];
float x4 = num4 - x3;
x4 = math.max(x4, MinTerrainHeightMap[index]);
x3 = x4 - (num4 - x3);
TerrainHeightMapDstFloat[index] = x4;
reference2 += x3;
reference += x3;
}
}

View file

@ -0,0 +1,20 @@
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct EvaporationJob : IJobParallelFor
{
public NativeArray<float> WaterMap;
public float DT;
public float EvaporationRate;
public void Execute(int index)
{
WaterMap[index] *= 1f - EvaporationRate * DT;
}
}

View file

@ -0,0 +1,159 @@
using TerrainTopologyMapJobs;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct PaintSplatJob : IJobFor
{
[NativeDisableParallelForRestriction]
public NativeArray<float>.ReadOnly HeightMapDelta;
public int HeightMapRes;
[NativeDisableParallelForRestriction]
public NativeArray<float>.ReadOnly AngleMapDeg;
[NativeDisableParallelForRestriction]
public NativeArray<int>.ReadOnly TopologyMap;
public int TopologyMapRes;
[NativeDisableParallelForRestriction]
public NativeArray<byte> SplatMap;
public int SplatMapRes;
public int SplatNum;
[NativeDisableParallelForRestriction]
public NativeHashMap<int, int>.ReadOnly SplatType2Index;
public float TerrainOneOverSizeX;
public void Execute(int index)
{
int num = index % HeightMapRes;
int num2 = index / HeightMapRes;
float num3 = ((float)num - 0.5f) / (float)HeightMapRes;
float num4 = ((float)num2 - 0.5f) / (float)HeightMapRes;
if ((TerrainTopologyMapJobUtil.GetTopologyRadius(TopologyMap, TopologyMapRes, TerrainOneOverSizeX, 0f, num3, num4) & 0xB4990) != 0 || (TerrainTopologyMapJobUtil.GetTopologyRadius(TopologyMap, TopologyMapRes, TerrainOneOverSizeX, 8f, num3, num4) & 2) != 0 || AngleMapDeg[num2 * HeightMapRes + num] < 3f)
{
return;
}
float grad;
float num5 = ConcavityFactor(HeightMapDelta, HeightMapRes, num, num2, out grad);
if (!(num5 < 3.5762787E-07f))
{
int x = Index(num3, SplatMapRes);
int z = Index(num4, SplatMapRes);
float splat = GetSplat(SplatMap, SplatMapRes, SplatNum, SplatType2Index, num3, num4, 2);
float splat2 = GetSplat(SplatMap, SplatMapRes, SplatNum, SplatType2Index, num3, num4, 4);
if (splat > 0.25f || splat2 > 0.25f)
{
num5 = math.saturate(num5 * 3f);
grad = math.pow(grad, 2f);
AddSplat(SplatMap, SplatMapRes, SplatNum, SplatType2Index, x, z, 64, math.pow(num5, 0.8f) * grad);
AddSplat(SplatMap, SplatMapRes, SplatNum, SplatType2Index, x, z, 128, math.pow(num5, 1.5f) * grad);
}
else
{
num5 = math.saturate(num5 * 3f);
AddSplat(SplatMap, SplatMapRes, SplatNum, SplatType2Index, x, z, 1, math.pow(num5, 4f) * math.pow(grad, 1.5f));
grad = math.pow(grad, 2f);
AddSplat(SplatMap, SplatMapRes, SplatNum, SplatType2Index, x, z, 64, math.pow(num5, 0.8f) * grad);
AddSplat(SplatMap, SplatMapRes, SplatNum, SplatType2Index, x, z, 128, math.pow(num5, 1.4f) * grad);
}
}
static int Index(float normalized, int res)
{
int num6 = (int)(normalized * (float)res);
if (num6 >= 0)
{
if (num6 <= res - 1)
{
return num6;
}
return res - 1;
}
return 0;
}
}
private static void AddSplat(NativeArray<byte> src, int res, int splatNum, NativeHashMap<int, int>.ReadOnly type2Index, int x, int z, int id, float d)
{
float splat = GetSplat(src, res, splatNum, type2Index, x, z, id);
float num = math.saturate(splat + d);
int num2 = type2Index[id];
if (splat >= 1f)
{
return;
}
float num3 = (1f - num) / (1f - splat);
for (int i = 0; i < splatNum; i++)
{
if (i == num2)
{
src[(i * res + z) * res + x] = BitUtility.Float2Byte(num);
}
else
{
src[(i * res + z) * res + x] = BitUtility.Float2Byte(num3 * BitUtility.Byte2Float(src[(i * res + z) * res + x]));
}
}
}
private static float GetSplat(NativeArray<byte> src, int res, int splatNum, NativeHashMap<int, int>.ReadOnly type2Index, float xn, float zn, int mask)
{
int num = res - 1;
float num2 = xn * (float)num;
float num3 = zn * (float)num;
int num4 = Mathf.Clamp((int)num2, 0, num);
int num5 = Mathf.Clamp((int)num3, 0, num);
int x = Mathf.Min(num4 + 1, num);
int z = Mathf.Min(num5 + 1, num);
float a = Mathf.Lerp(GetSplat(src, res, splatNum, type2Index, num4, num5, mask), GetSplat(src, res, splatNum, type2Index, x, num5, mask), num2 - (float)num4);
float b = Mathf.Lerp(GetSplat(src, res, splatNum, type2Index, num4, z, mask), GetSplat(src, res, splatNum, type2Index, x, z, mask), num2 - (float)num4);
return Mathf.Lerp(a, b, num3 - (float)num5);
}
private static float GetSplat(NativeArray<byte> src, int res, int splatNum, NativeHashMap<int, int>.ReadOnly type2Index, int x, int z, int mask)
{
if (Mathf.IsPowerOfTwo(mask))
{
return BitUtility.Byte2Float(src[(type2Index[mask] * res + z) * res + x]);
}
int num = 0;
for (int i = 0; i < splatNum; i++)
{
if ((TerrainSplat.IndexToType(i) & mask) != 0)
{
num += src[(i * res + z) * res + x];
}
}
return Mathf.Clamp01(BitUtility.Byte2Float(num));
}
private static float ConcavityFactor(NativeArray<float>.ReadOnly data, int res, int x, int z, out float grad)
{
int num = x - 1;
int num2 = x + 1;
int num3 = z - 1;
int num4 = z + 1;
float num5 = data[z * res + x];
float num6 = data[z * res + num];
float num7 = data[z * res + num2];
float num8 = data[num4 * res + x];
float num9 = data[num3 * res + x];
float num10 = num6 + num7 + num8 + num9;
float num11 = data[num3 * res + num] + data[num3 * res + num2] + data[num4 * res + num] + data[num4 * res + num2];
float num12 = num7 - num6;
float num13 = num8 - num9;
grad = math.sqrt(num12 * num12 + num13 * num13);
return math.max(num10 / 4f + num11 / 4f - num5, 0f);
}
}

View file

@ -0,0 +1,21 @@
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct PopulateDeltaHeightJob : IJobParallelFor
{
public NativeArray<float>.ReadOnly HeightMapOriginal;
public NativeArray<float>.ReadOnly HeightMap;
[WriteOnly]
public NativeArray<float> DeltaHeightMap;
public void Execute(int index)
{
DeltaHeightMap[index] = HeightMapOriginal[index] - HeightMap[index];
}
}

View file

@ -0,0 +1,36 @@
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct PrepareMapJob : IJobParallelForBatch
{
public NativeArray<short>.ReadOnly HeightMapAsShort;
[WriteOnly]
public NativeArray<float> HeightMapAsFloat;
public NativeList<int>.ParallelWriter OceanIndicesWriter;
public float TerrainPositionY;
public float TerrainSizeY;
public float OceanLevel;
public void Execute(int startIndex, int count)
{
NativeList<int> list = new NativeList<int>(count, Allocator.Temp);
for (int i = startIndex; i < startIndex + count; i++)
{
float num = (HeightMapAsFloat[i] = TerrainPositionY + BitUtility.Short2Float(HeightMapAsShort[i]) * TerrainSizeY);
if (num <= OceanLevel)
{
list.Add(in i);
}
}
OceanIndicesWriter.AddRangeNoResize(list);
}
}

View file

@ -0,0 +1,26 @@
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct RefillOceanJob : IJobParallelFor
{
public NativeArray<int>.ReadOnly OceanIndices;
public NativeArray<float>.ReadOnly HeightMap;
[WriteOnly]
[NativeDisableParallelForRestriction]
public NativeArray<float> WaterMap;
public float OceanLevel;
public void Execute(int index)
{
int index2 = OceanIndices[index];
float num = HeightMap[index2];
WaterMap[index2] = OceanLevel - num;
}
}

View file

@ -0,0 +1,50 @@
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct TileCalculateAngleMap : IJobParallelFor
{
[NativeDisableParallelForRestriction]
[WriteOnly]
public NativeArray<float> AngleMap;
[Unity.Collections.ReadOnly]
public NativeArray<float>.ReadOnly TerrainHeightMapSrcFloat;
public float NormY;
public int Res;
public int NumXTiles;
public int TileSizeX;
public int TileSizeZ;
public void Execute(int index)
{
int num = index % NumXTiles;
int num2 = index / NumXTiles;
int num3 = math.max(num * TileSizeX, 1);
int num4 = math.max(num2 * TileSizeZ, 1);
int num5 = math.min(num3 + TileSizeX, Res - 1);
int num6 = math.min(num4 + TileSizeZ, Res - 1);
int4 @int = new int4(Res);
int2 int2 = new int2(1, -1);
for (int i = num4; i < num6; i++)
{
int4 int3 = (new int2(i) + int2).yyxy * @int;
for (int j = num3; j < num5; j++)
{
float4 @float = int3 + new int4(j + 1, j - 1, j - 1, j - 1);
float3 float2 = math.normalize(new float3((TerrainHeightMapSrcFloat[(int)@float.x] - TerrainHeightMapSrcFloat[(int)@float.y]) * -0.5f, z: (TerrainHeightMapSrcFloat[(int)@float.z] - TerrainHeightMapSrcFloat[(int)@float.w]) * -0.5f, y: NormY));
float num7 = math.dot(float2, float2);
AngleMap[i * Res + j] = math.acos(math.clamp(math.dot(math.up(), math.normalize(float2)) / num7, -1f, 1f));
}
}
}
}

View file

@ -0,0 +1,32 @@
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct TransportSedimentJob : IJobParallelFor
{
public NativeArray<float> SedimentMap;
public NativeArray<float>.ReadOnly SedimentReadOnlyMap;
public NativeArray<float2>.ReadOnly VelocityMap;
public int Res;
public float DT;
public void Execute(int index)
{
int num = index % Res;
int num2 = index / Res;
float2 @float = VelocityMap[index];
int x = (int)((float)num - DT * @float.x);
int x2 = (int)((float)num2 - DT * @float.y);
x = math.clamp(x, 0, Res - 1);
x2 = math.clamp(x2, 0, Res - 1);
SedimentMap[index] = SedimentReadOnlyMap[x2 * Res + x];
}
}

View file

@ -0,0 +1,20 @@
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
namespace GenerateErosionJobs;
[BurstCompile(FloatMode = FloatMode.Fast)]
internal struct WaterIncrementationJob : IJobParallelFor
{
public NativeArray<float> WaterMap;
public float WaterFillRate;
public float DT;
public void Execute(int index)
{
WaterMap[index] += WaterFillRate * DT;
}
}

View file

@ -0,0 +1,63 @@
#define UNITY_ASSERTIONS
using System.Collections.Generic;
using GenerateErosionJobs;
using Unity.Collections;
using Unity.Jobs;
using UnityEngine;
public class GenerateErosionSplat : ProceduralComponent
{
public override void Process(uint seed)
{
if (!World.Networked)
{
Debug.Assert(GenerateErosion.splatPaintingData.IsValid, "GenerateErosion.splatPaintingData is not populated, GenerateErosion likely missing from WorldSetup");
if (GenerateErosion.splatPaintingData.IsValid)
{
PaintSplat();
}
}
}
private void PaintSplat()
{
Debug.Assert(GenerateErosion.splatPaintingData.HeightMapDelta.IsCreated);
Debug.Assert(GenerateErosion.splatPaintingData.AngleMap.IsCreated);
TerrainSplatMap splatMap = TerrainMeta.SplatMap;
NativeArray<float> heightMapDelta = GenerateErosion.splatPaintingData.HeightMapDelta;
NativeArray<float> angleMap = GenerateErosion.splatPaintingData.AngleMap;
int res = TerrainMeta.HeightMap.res;
Parallel.For(1, res - 1, delegate(int z)
{
for (int i = 1; i < res - 1; i++)
{
angleMap[z * res + i] = TerrainMeta.HeightMap.GetSlope(i, z);
}
});
splatMap.Push();
NativeHashMap<int, int> nativeHashMap = new NativeHashMap<int, int>(splatMap.num, Allocator.TempJob);
foreach (var (key, item) in TerrainSplat.GetType2IndexDic())
{
nativeHashMap.Add(key, item);
}
JobHandle dependency = default(JobHandle);
PaintSplatJob jobData = new PaintSplatJob
{
HeightMapDelta = heightMapDelta.AsReadOnly(),
HeightMapRes = TerrainMeta.HeightMap.res,
AngleMapDeg = angleMap.AsReadOnly(),
TopologyMap = TerrainMeta.TopologyMap.src.AsReadOnly(),
TopologyMapRes = TerrainMeta.TopologyMap.res,
SplatMap = splatMap.dst,
SplatMapRes = splatMap.res,
SplatNum = splatMap.num,
SplatType2Index = nativeHashMap.AsReadOnly(),
TerrainOneOverSizeX = TerrainMeta.OneOverSize.x
};
dependency = IJobForExtensions.ScheduleByRef(ref jobData, heightMapDelta.Length, dependency);
nativeHashMap.Dispose(dependency);
GenerateErosion.splatPaintingData.Dispose(dependency);
dependency.Complete();
splatMap.Pop();
}
}

View file

@ -73,6 +73,8 @@ public class GestureConfig : ScriptableObject
public bool hideHeldEntity = true;
public bool unequipHeldEntity;
public bool canDuckDuringGesture;
public bool hasViewmodelAnimation = true;

View file

@ -77,27 +77,27 @@ public class GrowableGenes
private GrowableGenetics.GeneType PickWeightedGeneType()
{
BufferList<GrowableGenetics.GeneWeighting> obj = Pool.Get<BufferList<GrowableGenetics.GeneWeighting>>();
obj.CopyFrom(slotWeights);
obj.Sort((GrowableGenetics.GeneWeighting left, GrowableGenetics.GeneWeighting right) => left.Weighting.CompareTo(right.Weighting));
float num = 0f;
foreach (GrowableGenetics.GeneWeighting item in obj)
GrowableGenetics.GeneWeighting[] array = slotWeights;
for (int i = 0; i < array.Length; i++)
{
num += item.Weighting;
GrowableGenetics.GeneWeighting geneWeighting = array[i];
num += geneWeighting.Weighting;
}
GrowableGenetics.GeneType result = GrowableGenetics.GeneType.Empty;
float num2 = Random.Range(0f, num);
float num3 = 0f;
foreach (GrowableGenetics.GeneWeighting item2 in obj)
array = slotWeights;
for (int i = 0; i < array.Length; i++)
{
num3 += item2.Weighting;
GrowableGenetics.GeneWeighting geneWeighting2 = array[i];
num3 += geneWeighting2.Weighting;
if (num2 < num3)
{
result = item2.GeneType;
result = geneWeighting2.GeneType;
break;
}
}
Pool.FreeUnmanaged(ref obj);
return result;
}

View file

@ -144,7 +144,7 @@ public class HackableLockedCrate : LootContainer
{
if (StringPool.Get(info.HitBone) == "laptopcollision")
{
Effect.server.Run(shockEffect.resourcePath, info.HitPositionWorld, Vector3.up);
Effect.server.Run(shockEffect.resourcePath, this, info.HitBone, info.HitPositionLocal, Vector3.up);
hackSeconds -= 8f * (info.damageTypes.Total() / 50f);
if (hackSeconds < 0f)
{

View file

@ -502,7 +502,7 @@ public class HeldEntity : BaseEntity
return false;
}
public virtual void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Transform originOverride = null, bool useBulletThickness = true)
public virtual void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Matrix4x4? originOverride = null, bool useBulletThickness = true)
{
}

View file

@ -1,3 +1,10 @@
using UnityEngine;
public class HorseLeadingRope : FakePhysicsRope
{
public RidableHorse horse;
public Vector2 minMaxLength;
public Vector2 minMaxDistance;
}

View file

@ -1,5 +1,27 @@
using UnityEngine;
public class HorseSaddle : BaseVehicleSeat
{
[SerializeField]
private bool isDriver;
[SerializeField]
private Transform eyePosRef;
private RidableHorse _owner;
protected RidableHorse Owner
{
get
{
if (_owner == null)
{
_owner = GetComponentInParent<RidableHorse>();
}
return _owner;
}
}
public override void VehicleFixedUpdate()
{
}

View file

@ -2,7 +2,7 @@ public class HumanBodyResourceDispenser : ResourceDispenser
{
public override bool OverrideOwnership(Item item, AttackEntity weapon)
{
if (item.info.shortname == "skull.human")
if (item != null && item.info.shortname == "skull.human")
{
PlayerCorpse component = GetComponent<PlayerCorpse>();
if ((bool)component)

View file

@ -75,7 +75,7 @@ public class HuntingTrophy : StorageContainer
public Renderer[] HorseHairRenderers;
public const uint HORSE_PREFAB_ID = 1239439581u;
public const uint HORSE_PREFAB_ID = 497279334u;
public GameObject NameRoot;

View file

@ -1,4 +1,8 @@
using System.Collections.Generic;
public interface IConversationProvider
{
void GetGenericMissionList(List<BaseMission> foundMissions);
bool ProviderBusy();
}

View file

@ -0,0 +1,4 @@
public interface ICreateAssetCallback
{
void OnAssetCreated(string assetName);
}

View file

@ -116,7 +116,7 @@ public class InstrumentTool : HeldEntity
ClientRPC(RpcTarget.NetworkGroup("Client_StopNote"), arg, arg2, arg3);
}
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Transform originOverride = null, bool useBulletThickness = true)
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Matrix4x4? originOverride = null, bool useBulletThickness = true)
{
base.ServerUse(damageModifier, speedModifier, originOverride, useBulletThickness);
if (!IsInvoking(StopAfterTime))

View file

@ -923,7 +923,7 @@ public class Item : Facepunch.Pool.IPooled
using (TimeWarning.New("MoveToContainer"))
{
BasePlayer playerOwner = newcontainer.playerOwner;
if (playerOwner != null && playerOwner.IsDead())
if (playerOwner != null && playerOwner.IsDead() && parent != null)
{
return false;
}

View file

@ -0,0 +1,4 @@
public class ItemModConveyorOptions : ItemMod
{
public bool ForceShowInConveyorFilter;
}

View file

@ -8,19 +8,19 @@ public class ItemModFoodSpoiling : ItemMod
{
public class FoodSpoilingWorkQueue : PersistentObjectWorkQueue<Item>
{
private Dictionary<Item, TimeSince> lastUpdated = new Dictionary<Item, TimeSince>();
private Dictionary<ItemId, TimeSince> lastUpdated = new Dictionary<ItemId, TimeSince>();
protected override void RunJob(Item foodItem)
{
float timeToApply = 0f;
if (lastUpdated.TryGetValue(foodItem, out var value))
if (lastUpdated.TryGetValue(foodItem.uid, out var value))
{
timeToApply = value;
lastUpdated[foodItem] = 0f;
lastUpdated[foodItem.uid] = 0f;
}
else
{
lastUpdated.Add(foodItem, 0f);
lastUpdated.Add(foodItem.uid, 0f);
}
DeductTimeFromFoodItem(foodItem, timeToApply, setDirty: false);
}

View file

@ -11,7 +11,7 @@ public static class ItemSearchUtils
{
searchString = "BALLS BALLS BALLS";
}
return from y in ItemManager.itemList.Where((ItemDefinition x) => IsValidSearchResult(searchString, x, checkItemIsValid: true) && (validFilter == null || validFilter(x))).Take(60)
return from y in ItemManager.itemList.Where((ItemDefinition x) => IsValidSearchResult(searchString, x, validFilter == null) && (validFilter == null || validFilter(x))).Take(60)
orderby ScoreSearchResult(searchString, y)
select y;
}

View file

@ -23,7 +23,7 @@ public class MapMarkerGenericRadius : MapMarker
public void SendUpdate(bool fullUpdate = true)
{
float a = color1.a;
ClientRPC<Vector3, float, Vector3, float, float>(arg1: new Vector3(color1.r, color1.g, color1.b), arg3: new Vector3(color2.r, color2.g, color2.b), target: RpcTarget.NetworkGroup("MarkerUpdate"), arg2: a, arg4: alpha, arg5: radius);
ClientRPC(arg1: new Vector3(color1.r, color1.g, color1.b), arg3: new Vector3(color2.r, color2.g, color2.b), target: RpcTarget.NetworkGroup("MarkerUpdate"), arg2: a, arg4: alpha, arg5: radius);
}
public override AppMarker GetAppMarkerData()

View file

@ -0,0 +1,3 @@
public class MapMarkerHelicopterFlee : MapMarker
{
}

View file

@ -96,6 +96,8 @@ public class MapView : FacepunchBehaviour, IPointerDownHandler, IEventSystemHand
public CanvasLineRenderer FerryPath;
public CanvasLineRenderer HeliPath;
public UnityEvent onClicked;
public void OnPointerDown(PointerEventData eventData)

View file

@ -142,7 +142,7 @@ public class MedicalTool : AttackEntity
}
}
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Transform originOverride = null, bool useBulletThickness = true)
public override void ServerUse(float damageModifier = 1f, float speedModifier = 1f, Matrix4x4? originOverride = null, bool useBulletThickness = true)
{
if (base.isClient)
{

View file

@ -1,3 +1,3 @@
public class MeshColliderGroup : PooledList<MeshColliderInstance>
public sealed class MeshColliderGroup : BasePooledList<MeshColliderInstance, MeshColliderGroup>
{
}

View file

@ -1,3 +1,3 @@
public class MeshGroup : PooledList<MeshInstance>
public sealed class MeshGroup : BasePooledList<MeshInstance, MeshGroup>
{
}

View file

@ -1,3 +1,3 @@
public class MeshRendererGroup : PooledList<MeshRendererInstance>
public sealed class MeshRendererGroup : BasePooledList<MeshRendererInstance, MeshRendererGroup>
{
}

Some files were not shown because too many files have changed in this diff Show more