• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

First Machine Age's Mods (Combined repo.)


Commit MetaInfo

Revision298c75d5f431d9923380c32300afaf1d57b1e595 (tree)
Time2022-07-08 07:36:59
Authormelchior <melchior@user...>
Commitermelchior

Log Message

WIP New features

Change Summary

Incremental Difference

--- a/AnvilMetalRecovery/AnvilMetalRecovery.csproj
+++ b/AnvilMetalRecovery/AnvilMetalRecovery.csproj
@@ -86,6 +86,7 @@
8686 <Compile Include="Harmony\GenericItemMortalityDetector.cs" />
8787 <Compile Include="Data\AMR_Config.cs" />
8888 <Compile Include="Data\RecoveryEntryTable.cs" />
89+ <Compile Include="CollectableBehaviors\DirectSprayCooler_Behavior.cs" />
8990 </ItemGroup>
9091 <ItemGroup>
9192 <None Include="modinfo.json">
@@ -125,6 +126,9 @@
125126 <None Include="assets\fma\lang\ru.json">
126127 <CopyToOutputDirectory>Always</CopyToOutputDirectory>
127128 </None>
129+ <None Include="assets\fma\patches\wateringcan_behavior.json">
130+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
131+ </None>
128132 </ItemGroup>
129133 <ItemGroup>
130134 <Folder Include="assets\" />
@@ -146,6 +150,7 @@
146150 <Folder Include="Data\" />
147151 <Folder Include="Items\" />
148152 <Folder Include="Harmony\" />
153+ <Folder Include="CollectableBehaviors\" />
149154 </ItemGroup>
150155 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
151156 </Project>
\ No newline at end of file
--- a/AnvilMetalRecovery/Data/AMR_Config.cs
+++ b/AnvilMetalRecovery/Data/AMR_Config.cs
@@ -13,13 +13,15 @@ namespace AnvilMetalRecovery
1313 public AMRConfig( )
1414 {
1515 ToolFragmentRecovery = true;
16- VoxelEquivalentValue = MetalRecoverySystem.IngotVoxelDefault;
16+ VoxelEquivalentValue = MetalRecoverySystem.IngotVoxelDefault;
17+ ToolRecoveryRate = 1.0f;
1718 }
1819
19- public AMRConfig(bool setDefaultBL)
20+ public AMRConfig(bool setDefaultBL)
2021 {
2122 ToolFragmentRecovery = true;
2223 VoxelEquivalentValue = MetalRecoverySystem.IngotVoxelDefault;
24+ ToolRecoveryRate = 1.0f;
2325 if (setDefaultBL) {
2426 BlackList = new List<AssetLocation> {
2527 new AssetLocation(@"game:metalplate"),
@@ -42,13 +44,16 @@ namespace AnvilMetalRecovery
4244 [ProtoMember(3)]
4345 public List<AssetLocation> BlackList;
4446
45-
47+ [ProtoMember(4)]
48+ public float ToolRecoveryRate;
4649
4750
4851 [ProtoAfterDeserialization]
4952 private void ClampRange( )
5053 {
5154 VoxelEquivalentValue = Math.Max(1f, Math.Min(VoxelEquivalentValue, MetalRecoverySystem.IngotVoxelDefault));
55+ ToolRecoveryRate = Math.Min(1f, ToolRecoveryRate);
56+ ToolRecoveryRate = Math.Max(0.1f, ToolRecoveryRate);
5257 }
5358
5459
--- a/AnvilMetalRecovery/Items/VariableMetalItem.cs
+++ b/AnvilMetalRecovery/Items/VariableMetalItem.cs
@@ -101,9 +101,9 @@ namespace AnvilMetalRecovery
101101 //virtual bool CanBePlacedInto(ItemStack stack, ItemSlot slot) //?
102102 //virtual void OnModifiedInInventorySlot //Only for new-Inserts (?)
103103
104- public void ApplyMetalProperties(RecoveryEntry recoveryData, ref ItemStack contStack)
104+ public void ApplyMetalProperties(RecoveryEntry recoveryData, ref ItemStack contStack, float percentAdjust = 1.0f)
105105 {
106- contStack.Attributes.SetInt(metalQuantityKey, ( int )recoveryData.Quantity);
106+ contStack.Attributes.SetInt(metalQuantityKey, ( int )(recoveryData.Quantity * percentAdjust));
107107 contStack.Attributes.SetString(metalIngotCodeKey, recoveryData.IngotCode.ToString( ));
108108
109109 RegenerateCombustablePropsFromStack(contStack);
--- a/AnvilMetalRecovery/MetalRecoverySystem.cs
+++ b/AnvilMetalRecovery/MetalRecoverySystem.cs
@@ -7,10 +7,16 @@ using HarmonyLib;
77 using Vintagestory.API.Client;
88 using Vintagestory.API.Common;
99 using Vintagestory.API.Server;
10+using Vintagestory.API.Util;
1011 using Vintagestory.Client.NoObf;
1112 using Vintagestory.GameContent;
1213 using Vintagestory.Server;
1314
15+/* IDEAS / ISSUES
16+ * # Watering Can (molten-metal state) Ingot Cooling *Tssss*
17+ * # Ingot breaks -> Metal fragments / bits (or a blob?)
18+ * # Tool-break configurable ratio
19+*/
1420 namespace AnvilMetalRecovery
1521 {
1622 public partial class MetalRecoverySystem : ModSystem
@@ -20,9 +26,12 @@ namespace AnvilMetalRecovery
2026 internal const string metalFragmentsCode = @"fma:metal_fragments";
2127 internal const string metalShavingsCode = @"metal_shaving";
2228 internal const string itemFilterListCacheKey = @"AMR_ItemFilters";
29+
2330 public const float IngotVoxelDefault = 2.38f;
2431 public const string ItemDamageChannelName = @"ItemDamageEvents";
2532
33+
34+
2635 internal IServerNetworkChannel _ConfigDownlink;
2736 internal IClientNetworkChannel _ConfigUplink;
2837
@@ -101,6 +110,7 @@ namespace AnvilMetalRecovery
101110 this.CoreAPI = api;
102111
103112 RegisterItemMappings( );
113+ RegisterBlockBehaviors( );
104114
105115 #if DEBUG
106116 //Harmony.DEBUG = true;
@@ -127,9 +137,8 @@ namespace AnvilMetalRecovery
127137 PrepareDownlinkChannel( );
128138 ServerAPI.Event.PlayerJoin += SendClientConfigMessage;
129139 ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.Shutdown, PersistServersideConfig);
130- ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.GameReady, MaterialDataGathering);
131- //ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.WorldReady, CacheRecoveryDataTable);//This does not appear to work?!
132- ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.RunGame, CacheRecoveryDataTable);
140+ ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.GameReady, MaterialDataGathering);
141+ ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.RunGame, CacheRecoveryDataTable);
133142
134143 SetupGeneralObservers( );
135144
@@ -152,7 +161,7 @@ namespace AnvilMetalRecovery
152161 Mod.Logger.Error("Cannot access 'ClientCoreAPI' class: API (implimentation) has changed, Contact Developer!");
153162 return;
154163 }
155-
164+
156165 ListenForServerConfigMessage( );
157166 Mod.Logger.VerboseDebug("Anvil Metal Recovery - should be installed...");
158167 }
@@ -164,7 +173,13 @@ namespace AnvilMetalRecovery
164173 this.CoreAPI.RegisterItemClass(@"SmartSmeltableItem", typeof(SmartSmeltableItem));
165174 }
166175
167-
176+ private void RegisterBlockBehaviors()
177+ {
178+ #if DEBUG
179+ Mod.Logger.Debug("RegisterBlockBehaviors");
180+ #endif
181+ this.CoreAPI.RegisterBlockBehaviorClass(DirectSprayCooler_Behavior.ClassName, typeof(DirectSprayCooler_Behavior));
182+ }
168183
169184 private void SetupGeneralObservers( ){
170185 ServerCore.Event.RegisterEventBusListener(Item_DamageEventReciever, 1.0f, ItemDamageChannelName);
--- a/AnvilMetalRecovery/MetalRecoverySystem_Components.cs
+++ b/AnvilMetalRecovery/MetalRecoverySystem_Components.cs
@@ -146,7 +146,7 @@ namespace AnvilMetalRecovery
146146
147147 VariableMetalItem variableMetal = ServerAPI.World.GetItem(new AssetLocation(metalFragmentsCode)) as VariableMetalItem;
148148 ItemStack metalFragmentsStack = new ItemStack(variableMetal, 1);
149- variableMetal.ApplyMetalProperties(rec, ref metalFragmentsStack);
149+ variableMetal.ApplyMetalProperties(rec, ref metalFragmentsStack, CachedConfiguration.ToolRecoveryRate);
150150 hotSlot.Itemstack = metalFragmentsStack;
151151 hotSlot.Itemstack.ResolveBlockOrItem(ServerAPI.World);
152152 hotSlot.MarkDirty( );
@@ -160,7 +160,7 @@ namespace AnvilMetalRecovery
160160
161161 VariableMetalItem variableMetal = ServerAPI.World.GetItem(new AssetLocation(metalFragmentsCode)) as VariableMetalItem;
162162 ItemStack metalFragmentsStack = new ItemStack(variableMetal, 1);
163- variableMetal.ApplyMetalProperties(rec, ref metalFragmentsStack);
163+ variableMetal.ApplyMetalProperties(rec, ref metalFragmentsStack, CachedConfiguration.ToolRecoveryRate);
164164 if (spim.TryGiveItemstack(metalFragmentsStack, true) == false)
165165 {
166166 //Player with full Inv.
--- a/AnvilMetalRecovery/assets/fma/shapes/item/metal/fragments.json
+++ b/AnvilMetalRecovery/assets/fma/shapes/item/metal/fragments.json
@@ -8,7 +8,7 @@
88 "textureSizes": {
99 },
1010 "textures": {
11- "metal": "block/metal/ingot/lead"
11+ "metal": "game:block/metal/ingot/lead"
1212 },
1313 "elements": [
1414 {