Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions DataStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Globalization;
using System.IO;
using Backtrace.Unity.Common;
using Bloodstone.API;
using Il2CppSystem.Linq;
using ProjectM;
using ProjectM.Network;
Expand Down Expand Up @@ -245,13 +244,15 @@ private static void AnnounceKill(PlayerStatistics victimUser, PlayerStatistics k
25 => $"<size=22>{killerName} is godlike!",
30 => $"<size=24>{killerName} is WICKED SICK!",
_ => null
};

ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, Markup.Prefix + message);
};

var announceMessage = new FixedString512Bytes(Markup.Prefix + message);
ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, ref announceMessage);

if (!string.IsNullOrEmpty(killMsg) && Settings.AnnounceKillstreak)
{
ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, Markup.Prefix + killMsg);
{
var killMessage = new FixedString512Bytes(Markup.Prefix + killMsg);
ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, ref killMessage);
}
}

Expand Down
14 changes: 3 additions & 11 deletions ECSExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

using System;
using Bloodstone.API;
using Il2CppInterop.Runtime;
using Unity.Entities;

Expand All @@ -12,18 +11,11 @@
#pragma warning disable CS8500
internal static class ECSExtensions
{
internal static void With<T>(this Entity entity, VExtensions.ActionRef<T> action) where T : struct
{
T item = entity.RW<T>();
action(ref item);
VWorld.Game.EntityManager.SetComponentData(entity, item);
}

internal static bool Has<T>(this Entity entity) where T : struct
{
int typeIndex = TypeManager.GetTypeIndex(Il2CppType.Of<T>());

return VWorld.Game.EntityManager.HasComponentRaw(entity, typeIndex);
return VWorld.Server.EntityManager.HasComponentRaw(entity, typeIndex);
}

internal static bool Has<T>(this Entity entity, out T value) where T : struct
Expand All @@ -41,7 +33,7 @@ internal static bool Has<T>(this Entity entity, out T value) where T : struct
internal unsafe static T RW<T>(this Entity entity) where T : struct
{
int typeIndex = TypeManager.GetTypeIndex(Il2CppType.Of<T>());
T* componentDataRawRW = (T*)VWorld.Game.EntityManager.GetComponentDataRawRW(entity, typeIndex);
T* componentDataRawRW = (T*)VWorld.Server.EntityManager.GetComponentDataRawRW(entity, typeIndex);
if (componentDataRawRW == null)
{
throw new InvalidOperationException($"Failure to access ReadWrite <{typeof(T).Name}> typeIndex({typeIndex}) on entity({entity}).");
Expand All @@ -52,7 +44,7 @@ internal unsafe static T RW<T>(this Entity entity) where T : struct
internal unsafe static T Read<T>(this Entity entity) where T : struct
{
int typeIndex = TypeManager.GetTypeIndex(Il2CppType.Of<T>());
T* componentDataRawRO = (T*)VWorld.Game.EntityManager.GetComponentDataRawRO(entity, typeIndex);
T* componentDataRawRO = (T*)VWorld.Server.EntityManager.GetComponentDataRawRO(entity, typeIndex);
if (componentDataRawRO == null)
{
throw new InvalidOperationException($"Failure to access ReadOnly <{typeof(T).Name}> typeIndex({typeIndex}) on entity({entity}).");
Expand Down
9 changes: 4 additions & 5 deletions Killfeed.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
<Copy SourceFiles="$(OutDir)\Killfeed.dll" DestinationFolder="$(ProjectDir)/dist" />
</Target>
<ItemGroup>
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.691" IncludeAssets="compile" />
<PackageReference Include="BepInEx.Core" Version="6.0.0-be.691" IncludeAssets="compile" />
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.733" IncludeAssets="compile" />
<PackageReference Include="BepInEx.Core" Version="6.0.0-be.733" IncludeAssets="compile" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.*" />
<PackageReference Include="VRising.Unhollowed.Client" Version="1.0.*" />
<PackageReference Include="VRising.VampireCommandFramework" Version="0.9.*" />
<PackageReference Include="VRising.Bloodstone" Version="0.2.*" />
<PackageReference Include="VRising.Unhollowed.Client" Version="1.1.*" />
<PackageReference Include="VRising.VampireCommandFramework" Version="0.10.*" />
</ItemGroup>
</Project>
2 changes: 0 additions & 2 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ namespace Killfeed;

[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
[BepInDependency("gg.deca.VampireCommandFramework")]
[BepInDependency("gg.deca.Bloodstone")]
[Bloodstone.API.Reloadable]
public partial class Plugin : BasePlugin
{
Harmony _harmony;
Expand Down
37 changes: 37 additions & 0 deletions VWorld.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using Unity.Entities;

static class VWorld
{
private static World? _serverWorld;

Check warning on line 6 in VWorld.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 6 in VWorld.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.


/// Extracted from bloodstone to make reintegrating bloodstone later easier if desired.

public static World Server
{
get
{
if (_serverWorld != null && _serverWorld.IsCreated)
return _serverWorld;

_serverWorld = GetWorld("Server")
?? throw new System.Exception("There is no Server world (yet). Did you install a server mod on the client?");
return _serverWorld;
}
}
private static World? GetWorld(string name)

Check warning on line 23 in VWorld.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 23 in VWorld.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
{
foreach (var world in World.s_AllWorlds)
{
if (world.Name == name)
{
_serverWorld = world;
return world;
}
}

return null;
}
}

1 change: 0 additions & 1 deletion VampireDownedHook.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Bloodstone.API;
using HarmonyLib;
using ProjectM;
using Unity.Collections;
Expand Down
Loading