Catch gear break event
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
bin/
|
||||
obj/
|
29
.idea/.idea.GearToLife/.idea/workspace.xml
generated
29
.idea/.idea.GearToLife/.idea/workspace.xml
generated
@ -10,23 +10,10 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="7a23d6a2-8a03-45c3-b4f4-ba70e6386a3d" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/.idea.GearToLife/.idea/encodings.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/.idea.GearToLife/.idea/indexLayout.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/.idea.GearToLife/.idea/projectSettingsUpdater.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/.idea.GearToLife/.idea/workspace.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/GearToLife.sln" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/GearToLife/.gitignore" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/GearToLife/GearToLife.sln" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/GearToLife/GearToLife/GearToLife.csproj" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/GearToLife/GearToLife/GearToLifeModSystem.cs" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/GearToLife/GearToLife/Properties/launchSettings.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/GearToLife/GearToLife/assets/geartolife/lang/en.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/GearToLife/GearToLife/modinfo.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/GearToLife/ZZCakeBuild/CakeBuild.csproj" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/GearToLife/ZZCakeBuild/Program.cs" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/GearToLife/build.ps1" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/GearToLife/build.sh" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/GearToLife/GearToLife/Patches/KnifePatch.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="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/GearToLife/GearToLifeModSystem.cs" beforeDir="false" afterPath="$PROJECT_DIR$/GearToLife/GearToLife/GearToLifeModSystem.cs" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -39,6 +26,12 @@
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<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/b4/8111d97a/ModSystem.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/ae66fe3dcb4e4d08b5173bd19fa1fd242b7200/b7/cc8f3c36/EntityBehaviorTemporalStabilityAffected.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo"><![CDATA[{
|
||||
"associatedIndex": 0
|
||||
}]]></component>
|
||||
@ -127,7 +120,7 @@
|
||||
<updated>1751123667023</updated>
|
||||
<workItem from="1751123668534" duration="26000" />
|
||||
<workItem from="1751128070781" duration="223000" />
|
||||
<workItem from="1751129068738" duration="1611000" />
|
||||
<workItem from="1751129068738" duration="11848000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
9
GearToLife.sln.DotSettings.user
Normal file
9
GearToLife.sln.DotSettings.user
Normal file
@ -0,0 +1,9 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEntityBehaviorTemporalStabilityAffected_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae66fe3dcb4e4d08b5173bd19fa1fd242b7200_003Fb7_003Fcc8f3c36_003FEntityBehaviorTemporalStabilityAffected_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AItemTemporalGearPatches_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F0c42f62c19174521b2d3845ff1c760a82400_003F7e_003Fd3044f89_003FItemTemporalGearPatches_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModSystem_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F185df8fd8a7e41f3aa8086976f138a921db000_003Fb4_003F8111d97a_003FModSystem_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATemporalLifeModSystem_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F0c42f62c19174521b2d3845ff1c760a82400_003F80_003F2430a869_003FTemporalLifeModSystem_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="D:\VintageStory\Lib\0Harmony.dll" />
|
||||
<Assembly Path="C:\Users\Den\RiderProjects\GearToLife\TemporalLife.dll" />
|
||||
</AssemblyExplorer></s:String></wpf:ResourceDictionary>
|
@ -1,26 +1,23 @@
|
||||
using Vintagestory.API.Client;
|
||||
using Vintagestory.API.Server;
|
||||
using Vintagestory.API.Config;
|
||||
using HarmonyLib;
|
||||
using Vintagestory.API.Common;
|
||||
|
||||
namespace GearToLife;
|
||||
|
||||
public class GearToLifeModSystem : ModSystem
|
||||
{
|
||||
// Called on server and client
|
||||
// Useful for registering block/entity classes on both sides
|
||||
private Harmony patcher;
|
||||
|
||||
public override void Start(ICoreAPI api)
|
||||
{
|
||||
Mod.Logger.Notification("Hello from template mod: " + api.Side);
|
||||
if (!Harmony.HasAnyPatches(Mod.Info.ModID))
|
||||
{
|
||||
patcher = new Harmony(Mod.Info.ModID);
|
||||
patcher.PatchCategory(Mod.Info.ModID);
|
||||
}
|
||||
}
|
||||
|
||||
public override void StartServerSide(ICoreServerAPI api)
|
||||
public override void Dispose()
|
||||
{
|
||||
Mod.Logger.Notification("Hello from template mod server side: " + Lang.Get("geartolife:hello"));
|
||||
}
|
||||
|
||||
public override void StartClientSide(ICoreClientAPI api)
|
||||
{
|
||||
Mod.Logger.Notification("Hello from template mod client side: " + Lang.Get("geartolife:hello"));
|
||||
patcher?.UnpatchAll(Mod.Info.ModID);
|
||||
}
|
||||
}
|
21
GearToLife/GearToLife/Patches/KnifePatch.cs
Normal file
21
GearToLife/GearToLife/Patches/KnifePatch.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using HarmonyLib;
|
||||
using Vintagestory.API.Common;
|
||||
using Vintagestory.API.Common.Entities;
|
||||
using Vintagestory.GameContent;
|
||||
|
||||
namespace GearToLife.Patches;
|
||||
|
||||
[HarmonyPatchCategory("geartolife")]
|
||||
internal static class KnifePatch
|
||||
{
|
||||
[HarmonyPostfix()]
|
||||
[HarmonyPatch(typeof(ItemKnife), "OnHeldInteractStop")]
|
||||
public static void AfterBreakingGear(float secondsUsed, ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel)
|
||||
{
|
||||
if (byEntity.Attributes.GetBool("isInsertGear") && secondsUsed >= 1.95f)
|
||||
{
|
||||
// Пример события
|
||||
byEntity.Ignite();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user