• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-cqtcocoa誰得pythonphprubygameguibathyscaphec翻訳計画中(planning stage)omegatframeworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

VS plugin mod for Basic Armour


Commit MetaInfo

Révision50d2a76def4a964fe07f870a55d193f663d1cc0e (tree)
l'heure2019-05-19 06:49:05
Auteurmelchior <melchior@user...>
Commitermelchior

Message de Log

Fix for Crash on Multiplayer client
(possible race condition dodged)

Change Summary

Modification

--- a/ArmourMod/Armour/AmourMeshRenderer.cs
+++ b/ArmourMod/Armour/AmourMeshRenderer.cs
@@ -51,10 +51,19 @@ namespace ArmourMod
5151 {
5252 EntityArmourPlayer armouredPlayer = aPlayer.Entity as EntityArmourPlayer;
5353
54+ if (armouredPlayer == null) {
55+ ClientApi.Logger.Error("Could not cast EntityPlayer to EntityArmourPlayer");
56+ continue;
57+ }
58+
59+ if (armouredPlayer.RenderableWornArmours == null) {
60+ ClientApi.Logger.Error("RenderableWornArmours was NULL!");
61+ continue;
62+ }
63+
5464 if ( armouredPlayer.RenderableWornArmours.Count > 0 ) {
5565
5666 RenderWornArmour( armouredPlayer, rend, stage != EnumRenderStage.Opaque );
57-
5867 }
5968 }
6069 }
--- a/ArmourMod/Armour/EntityArmourPlayer.cs
+++ b/ArmourMod/Armour/EntityArmourPlayer.cs
@@ -1,7 +1,7 @@
11 using System;
22 using System.Collections.Generic;
33 using System.Linq;
4-
4+using System.Threading;
55
66 using Vintagestory.API.Common;
77 using Vintagestory.API.Client;
@@ -76,7 +76,7 @@ namespace ArmourMod
7676 Logger.VerboseDebug( "Side:{0}, gearInv == null?{1}", CoreAPI.Side.ToString( ), base.GearInventory == null );
7777 #endif
7878
79- //base.GearInventory.SlotModified += ClientWatchSlotModified;
79+
8080 ClientAPI.Event.PlayerJoin += ClientDelayHook;
8181 }
8282 }
@@ -251,12 +251,15 @@ namespace ArmourMod
251251 }
252252
253253
254-
255254 protected void ClientDelayHook(IClientPlayer byPlayer)
256- {
257-#if DEBUG
258- Logger.Debug("ClientDelayHook: Checking gearInv is null? {0}", base.GearInventory == null);
259-#endif
255+ {
256+ retry:
257+ Thread.Sleep(100);
258+ if (base.GearInventory == null) {
259+ Logger.Error("ClientDelayHook: base.GearInventory IS NULL! ");
260+
261+ goto retry;
262+ }
260263
261264 //CoreAPI.Event.UnregisterCallback(client_callback);
262265 base.GearInventory.SlotModified += ClientWatchSlotModified;
--- a/ArmourMod/modinfo.json
+++ b/ArmourMod/modinfo.json
@@ -3,7 +3,7 @@
33 "name": "Basic Armour Mod",
44 "description" : "Leather, Plate, Scale & More",
55 "authors": ["Melchior", "Bunnyviking"],
6- "version": "0.1.3",
6+ "version": "0.1.4",
77 "dependencies": {
88 "game": "1.9.3",
99 "survival": ""