Fix spectator issue

This commit is contained in:
2025-07-08 22:48:39 +03:00
parent af9a5f6548
commit d4a2557ca2
3 changed files with 30 additions and 29 deletions

View File

@ -10,15 +10,9 @@
</component>
<component name="ChangeListManager">
<list default="true" id="7a23d6a2-8a03-45c3-b4f4-ba70e6386a3d" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/GearToLife/GearToLife/ModConfig.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.GearToLife/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.GearToLife/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GearToLife.sln.DotSettings.user" beforeDir="false" afterPath="$PROJECT_DIR$/GearToLife.sln.DotSettings.user" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GearToLife/GearToLife/GearToLife.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/GearToLife/GearToLife/GearToLife.csproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GearToLife/GearToLife/GearToLifeModSystem.cs" beforeDir="false" afterPath="$PROJECT_DIR$/GearToLife/GearToLife/GearToLifeModSystem.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GearToLife/GearToLife/Patches/KnifePatch.cs" beforeDir="false" afterPath="$PROJECT_DIR$/GearToLife/GearToLife/Patches/TemporalGearPatches.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GearToLife/GearToLife/assets/geartolife/lang/en.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/GearToLife/GearToLife/modicon.png" beforeDir="false" afterPath="$PROJECT_DIR$/GearToLife/GearToLife/modicon.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GearToLife/GearToLife/modinfo.json" beforeDir="false" afterPath="$PROJECT_DIR$/GearToLife/GearToLife/modinfo.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GearToLife/GearToLife/Patches/TemporalGearPatches.cs" beforeDir="false" afterPath="$PROJECT_DIR$/GearToLife/GearToLife/Patches/TemporalGearPatches.cs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -34,6 +28,7 @@
<component name="HighlightingSettingsPerFile">
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/0c42f62c19174521b2d3845ff1c760a82400/7e/d3044f89/ItemTemporalGearPatches.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/0c42f62c19174521b2d3845ff1c760a82400/80/2430a869/TemporalLifeModSystem.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/185df8fd8a7e41f3aa8086976f138a921db000/4d/70c8b96d/IServerPlayer.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/185df8fd8a7e41f3aa8086976f138a921db000/59/b0654600/EnumAppSide.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/185df8fd8a7e41f3aa8086976f138a921db000/b4/8111d97a/ModSystem.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/185df8fd8a7e41f3aa8086976f138a921db000/c7/55ed9fec/EnumChatType.cs" root0="FORCE_HIGHLIGHTING" />
@ -48,26 +43,26 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
".NET Launch Settings Profile.GearToLife: Client.executor": "Run",
".NET Launch Settings Profile.GearToLife: Server.executor": "Run",
".NET Project.CakeBuild.executor": "Run",
"ModuleVcsDetector.initialDetectionPerformed": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
"RunOnceActivity.git.unshallow": "true",
"git-widget-placeholder": "master",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"settings.editor.selected.configurable": "dotNetConsole",
"vue.rearranger.settings.migration": "true"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;.NET Launch Settings Profile.GearToLife: Client.executor&quot;: &quot;Run&quot;,
&quot;.NET Launch Settings Profile.GearToLife: Server.executor&quot;: &quot;Run&quot;,
&quot;.NET Project.CakeBuild.executor&quot;: &quot;Run&quot;,
&quot;ModuleVcsDetector.initialDetectionPerformed&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;dotNetConsole&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}]]></component>
<component name="RunManager" selected=".NET Project.CakeBuild">
}</component>
<component name="RunManager" selected=".NET Launch Settings Profile.GearToLife: Client">
<configuration name="CakeBuild" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
@ -134,7 +129,10 @@
<workItem from="1751129068738" duration="12452000" />
<workItem from="1751184684862" duration="604000" />
<workItem from="1751194709803" duration="1551000" />
<workItem from="1751723280140" duration="17500000" />
<workItem from="1751723280140" duration="19501000" />
<workItem from="1751804540358" duration="2112000" />
<workItem from="1751808744287" duration="6498000" />
<workItem from="1752003269468" duration="688000" />
</task>
<task id="LOCAL-00001" summary="Catch gear break event">
<option name="closed" value="true" />

View File

@ -68,7 +68,7 @@ public class GearToLifeModSystem : ModSystem
return player.WorldData.GetModData("geartolife:lives", Config.InitialLivesAmount);
}
private static void SetLives(IServerPlayer player, int value)
private static void SetLives(IServerPlayer player, int value)
{
player.WorldData.SetModData("geartolife:lives", value);
}
@ -104,6 +104,9 @@ public class GearToLifeModSystem : ModSystem
if (GetLives(player) > 0) return;
player.WorldData.CurrentGameMode = EnumGameMode.Spectator;
player.WorldData.NoClip = true;
player.WorldData.FreeMove = true;
player.BroadcastPlayerData();
Notify(player, "geartolife:respawn.spectator", GetLives(player));
}

View File

@ -10,7 +10,7 @@ namespace GearToLife.Patches;
[HarmonyPatchCategory("geartolife")]
internal static class TemporalGearPatches
{
[HarmonyPostfix()]
[HarmonyPostfix]
[HarmonyPatch(typeof(ItemTemporalGear), "OnHeldInteractStop")]
public static void AfterUsingGear(float secondsUsed, ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel)
{