Skip to content

Commit 4f68c1d

Browse files
authored
New patch for battle brawl update
Last patch broken, caused playermodel to freeze when selected Caused by running: // GameObject gorillachest = GameObject.Find("Global/Local VRRig/Local Gorilla Player/rig/body/gorillachest").gameObject; gorillachest.GetComponent<Renderer>().forcerenderingOff = true; // Freezes even by setting it manually from unity-explorer Solution: fixed by switching the gorillachest material to a transparent material created from runtime
1 parent de53403 commit 4f68c1d

File tree

5 files changed

+288
-245
lines changed

5 files changed

+288
-245
lines changed

PlayerModel.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@
7575
<Reference Include="MonoMod.Utils">
7676
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\BepInEx\core\MonoMod.Utils.dll</HintPath>
7777
</Reference>
78-
<Reference Include="Newtonsoft.Json">
79-
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\BepInEx\core\Newtonsoft.Json.dll</HintPath>
80-
</Reference>
8178
<Reference Include="Oculus.Platform">
8279
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\Gorilla Tag_Data\Managed\Oculus.Platform.dll</HintPath>
8380
</Reference>
@@ -147,9 +144,6 @@
147144
<Reference Include="Unity.Mathematics">
148145
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\Gorilla Tag_Data\Managed\Unity.Mathematics.dll</HintPath>
149146
</Reference>
150-
<Reference Include="Unity.TextMeshPro">
151-
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\BepInEx\unity-libs\Unity.TextMeshPro.dll</HintPath>
152-
</Reference>
153147
<Reference Include="Unity.Timeline">
154148
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\Gorilla Tag_Data\Managed\Unity.Timeline.dll</HintPath>
155149
</Reference>

Plugin.cs

Lines changed: 97 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,31 @@ public void Start()
3737
public static string[] page;
3838
public static List<Material> materials = new List<Material>();
3939
public static Material defMat;
40-
40+
public static Material matalpha;
41+
public static Material chestmat;
42+
GameObject gorillachest;
43+
4144
void OnGameInitialized(object sender, EventArgs e)
4245
{
46+
gorillachest = GameObject.Find("Global/Local VRRig/Local Gorilla Player/rig/body/gorillachest");
47+
48+
49+
matalpha = new Material(Shader.Find("Standard"));
50+
matalpha.SetColor("_Color", new Color(1, 0, 0, 0.0f));
51+
matalpha.SetFloat("_Mode", 3);
52+
matalpha.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
53+
matalpha.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
54+
matalpha.EnableKeyword("_ALPHABLEND_ON");
55+
matalpha.renderQueue = 3000;
56+
57+
58+
59+
//GameObject gorillachest = GorillaTagger.Instance.offlineVRRig.mainSkin.transform.parent.Find("rig/body/gorillachest").gameObject;
60+
/*GameObject gorillachest = GameObject.Find("Global/Local VRRig/Local Gorilla Player/rig/body/gorillachest").gameObject;
61+
62+
gorillachest.GetComponent<Renderer>().material = Plugin.matalpha;
63+
System.Console.WriteLine("Chest material set to: " + gorillachest.GetComponent<Renderer>().material.name);
64+
*/
4365
StartCoroutine(StartPlayerModel());
4466
}
4567

@@ -69,8 +91,6 @@ IEnumerator StartPlayerModel()
6991
webClient.DownloadFile("https://drive.google.com/uc?export=download&id=18niPks_72vsBnIbaWpvT4iwD7YA7nyoA", playerpath + @"\character stump.gtmodel");
7092
webClient.DownloadFile("https://drive.google.com/uc?export=download&id=1tz41u9au0TxWjRFQ5sYAqp2rnoIaTmP4", playerpath + @"\Kyle The Robot.gtmodel");
7193
webClient.DownloadFile("https://drive.google.com/uc?export=download&id=1niqY3Rnz0VPAwNYE4gtEaGwaRGqWtTGJ", playerpath + @"\Lar Gibbon.gtmodel");
72-
webClient.DownloadFile("https://drive.google.com/uc?export=download&id=1qlSpAT8L8qdt684TDDEYszG18uUVYNYp", playerpath + @"\Noob.gtmodel");
73-
webClient.DownloadFile("https://drive.google.com/uc?export=download&id=1C6vybxwFJ7IGu6NMO7rTnnXLg_dgh3hB", playerpath + @"\Proboscis Monke.gtmodel");
7494
webClient.DownloadFile("https://drive.google.com/uc?export=download&id=1aXc6nbGFQnA7R8F64LUUthhDEToLP5qF", playerpath + @"\Siamang Gibbon.gtmodel");
7595
webClient.DownloadFile("https://drive.google.com/uc?export=download&id=12L-F8T_AIG8xzpdgfZ_5H0UmOOHOljoU", playerpath + @"\The Ape.gtmodel");
7696
webClient.DownloadFile("https://drive.google.com/uc?export=download&id=1izFz5mBLcNWUn4oq7qaPup9_CzlTRUhC", playerpath + @"\The Chimp.gtmodel");
@@ -261,7 +281,17 @@ public static void ButtonPress(int button)
261281
}
262282

263283
public float currentTime = 0;
264-
284+
285+
public void hidechest()
286+
{
287+
gorillachest.GetComponent<Renderer>().material = matalpha;
288+
Debug.Log("material set to alpha");
289+
}
290+
public void showchest()
291+
{
292+
gorillachest.GetComponent<Renderer>().material = chestmat;
293+
Debug.Log("material set to gorilla");
294+
}
265295
public void Update()
266296
{
267297
if (Time.time < currentTime)
@@ -278,6 +308,9 @@ public void Update()
278308
public void FixedUpdate()
279309
{
280310

311+
if (!STARTPLAYERMOD)
312+
return;
313+
281314
if (Keyboard.current.jKey.wasPressedThisFrame)
282315
SelectButton.GetComponent<PlayerModelButton>().Press();
283316

@@ -287,88 +320,88 @@ public void FixedUpdate()
287320
if (Keyboard.current.kKey.wasPressedThisFrame)
288321
RightButton.GetComponent<PlayerModelButton>().Press();
289322

290-
if (STARTPLAYERMOD == true)
323+
PlayerModelController.rotationY -= 0.5f;
324+
//Debug.Log(IsGorilla);
325+
if (PhotonNetwork.InRoom)
291326
{
292-
PlayerModelController.rotationY -= 0.5f;
293-
294-
if (PhotonNetwork.InRoom)
327+
if (IsGorilla == true)//in a room, is gorilla model
328+
{
329+
PlayerModelAppearance.ShowOnlineRig();
330+
PlayerModelAppearance.ShowOfflineRig();
331+
showchest();
332+
flag_inroom = true;
333+
PlayerModelAppearance.flag1 = true;
334+
335+
clone_body = null;
336+
}
337+
else//in a room, is playermodel
295338
{
296-
if (IsGorilla == true)//in a room, is gorilla model
339+
if (clone_body != null && playermodel != null)
297340
{
298-
299-
flag_inroom = true;
300-
PlayerModelAppearance.flag1 = true;
341+
PlayerModelAppearance.HideOnlineRig();
342+
PlayerModelAppearance.HideOfflineRig();
343+
hidechest();
301344

302-
PlayerModelAppearance.SetRigRenderering(true, true);
303-
PlayerModelAppearance.SetRigRenderering(true, false);
345+
if (PlayerModelController.CustomColors)
346+
PlayerModelAppearance.AssignColor(playermodel);
304347

305-
clone_body = null;
348+
if (PlayerModelController.GameModeTextures)
349+
PlayerModelAppearance.AssignMaterial(clone_body, playermodel);
306350
}
307-
else//in a room, is playermodel
308-
{
309-
if (clone_body != null && playermodel != null)
310-
{
311-
312-
PlayerModelAppearance.SetRigRenderering(false, true);
313-
PlayerModelAppearance.SetRigRenderering(false, false);
314-
315-
if (PlayerModelController.CustomColors)
316-
PlayerModelAppearance.AssignColor(playermodel);
317-
318-
if (PlayerModelController.GameModeTextures)
319-
PlayerModelAppearance.AssignMaterial(clone_body, playermodel);
320-
}
321351

322-
if (clone_body == null)
323-
clone_body = GameObject.Find("Global/GorillaParent/GorillaVRRigs/Gorilla Player Networked(Clone)/gorilla");
352+
if (clone_body == null)
353+
clone_body = GameObject.Find("Global/GorillaParent/GorillaVRRigs/Gorilla Player Networked(Clone)/gorilla");
324354

325-
if (playermodel == null)
355+
if (playermodel == null)
356+
{
357+
while (playermodel == null)
326358
{
327-
while (playermodel == null)
328-
{
329-
PlayerModelController.LoadModel(assignedIndex);
330-
playermodel = GameObject.Find("playermodel.body");
331-
PlayerModelController.AssignModel();
332-
}
359+
PlayerModelController.LoadModel(assignedIndex);
360+
playermodel = GameObject.Find("playermodel.body");
361+
PlayerModelController.AssignModel();
333362
}
334363
}
335364
}
336-
else if (!PhotonNetwork.InRoom)
365+
}
366+
else if (!PhotonNetwork.InRoom)
367+
{
368+
Debug.Log("test");
369+
flag_inroom = false;
370+
clone_body = null;
371+
if (IsGorilla == true)//not in a room, is gorilla model
337372
{
338-
339-
flag_inroom = false;
340-
clone_body = null;
341-
if (IsGorilla == true)//not in a room, is gorilla model
373+
374+
PlayerModelAppearance.flag1 = true;
375+
PlayerModelAppearance.ShowOfflineRig();
376+
showchest();
377+
}
378+
else//not in a room, is playermodel
379+
{
380+
playermodel = GameObject.Find("playermodel.body");
381+
if (playermodel != null)
342382
{
343-
PlayerModelAppearance.flag1 = true;
344-
PlayerModelAppearance.SetRigRenderering(true, false);
383+
PlayerModelAppearance.ResetMaterial(playermodel);
384+
PlayerModelAppearance.HideOfflineRig();
385+
hidechest();
386+
345387

388+
if (PlayerModelController.CustomColors)
389+
PlayerModelAppearance.AssignColor(playermodel);
346390
}
347-
else//not in a room, is playermodel
391+
else
348392
{
349-
playermodel = GameObject.Find("playermodel.body");
350-
if (playermodel != null)
351-
{
352-
PlayerModelAppearance.ResetMaterial(playermodel);
353-
PlayerModelAppearance.SetRigRenderering(false, false);
354-
if (PlayerModelController.CustomColors)
355-
PlayerModelAppearance.AssignColor(playermodel);
356-
}
357-
else
393+
while (playermodel == null)
358394
{
359-
while (playermodel == null)
360-
{
361-
PlayerModelController.LoadModel(playerIndex);
362-
playermodel = GameObject.Find("playermodel.body");
395+
PlayerModelController.LoadModel(playerIndex);
396+
playermodel = GameObject.Find("playermodel.body");
363397

364-
}
365-
assignedIndex = playerIndex;
366-
IsGorilla = false;
367-
PlayerModelController.AssignModel();
368398
}
399+
assignedIndex = playerIndex;
400+
IsGorilla = false;
401+
PlayerModelController.AssignModel();
369402
}
370-
371403
}
404+
372405
}
373406

374407
}//fixedupdate

PluginInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ class PluginInfo
88
{
99
public const string GUID = "com.nachoengine.playermodel";
1010
public const string Name = "PlayerModel";
11-
public const string Version = "1.0.3";
11+
public const string Version = "1.0.4";
1212
}
1313
}

0 commit comments

Comments
 (0)