Skip to content

Commit

Permalink
Merge pull request #40 from Hydraxous/merge-fix
Browse files Browse the repository at this point in the history
Fixes for sharpshooter update.
  • Loading branch information
Hydraxous authored Apr 28, 2023
2 parents f4ef969 + 79a6b8d commit fbaff56
Show file tree
Hide file tree
Showing 34 changed files with 734 additions and 628 deletions.
47 changes: 42 additions & 5 deletions Components/Debugging/DebuggingDummy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
using System.Runtime.CompilerServices;
using HydraDynamics.Events;
using UltraFunGuns.Util;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.ResourceManagement.ResourceLocations;
using JetBrains.Annotations;

namespace UltraFunGuns
{
Expand All @@ -32,24 +36,24 @@ private void Update()
if (Input.GetKeyDown(KeyCode.Keypad8))
{
PlayerDeathPatch.god = !PlayerDeathPatch.god;
if(PlayerDeathPatch.god)
if (PlayerDeathPatch.god)
{
SonicReverberator.vineBoom_Loud.PlayAudioClip();
}
}

if(Input.GetKeyDown(KeyCode.Keypad0))
if (Input.GetKeyDown(KeyCode.Keypad0))
{
Vector3 playerPos = NewMovement.Instance.transform.position;
Vector3 cameraPos = CameraController.Instance.transform.position;

Vector3 hitPosition = Vector3.zero;

if(HydraUtils.SphereCastMacro(cameraPos, 0.001f, CameraController.Instance.transform.forward, Mathf.Infinity, out RaycastHit hit))
if (HydraUtils.SphereCastMacro(cameraPos, 0.001f, CameraController.Instance.transform.forward, Mathf.Infinity, out RaycastHit hit))
{
hitPosition = hit.point;
Visualizer.DrawSphere(hitPosition, 0.25f, 5.0f);
Visualizer.DrawLine(5.0f,cameraPos, hitPosition);
Visualizer.DrawLine(5.0f, cameraPos, hitPosition);
}


Expand All @@ -60,7 +64,40 @@ private void Update()

HydraLogger.Log(message, DebugChannel.Warning);
}


if (Input.GetKeyDown(KeyCode.Keypad4))
{
var allLocations = new List<IResourceLocation>();
foreach (var resourceLocator in Addressables.ResourceLocators)
{
if (resourceLocator is ResourceLocationMap map)
{
foreach (var locations in map.Locations.Values)
{
allLocations.AddRange(locations);
}
}
}

string data = "";

foreach (IResourceLocation rlocation in allLocations)
{
data += FormatResourceLocation(rlocation);
}


System.IO.File.WriteAllText("Z:/QuickThings/iodump/rlocation.txt", data);
}
}

private string FormatResourceLocation(IResourceLocation rlocation)
{
string msg = "=================================\n";
msg += "PKEY: " + rlocation.PrimaryKey + "\n";
msg += "INTID: " + rlocation.InternalId + "\n";
msg += "RTYPE: " + rlocation.ResourceType.Name + "\n";
return msg;
}

}
Expand Down
4 changes: 2 additions & 2 deletions Components/Entity/BasketballHoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ private void UpdateScore()
Data.SaveInfo.Data.basketballHighScore = currentScore;
}

highScoreText.text = highScore.ToString("000");
scoreText.text = currentScore.ToString("000");
highScoreText.text = (highScore > 99999999) ? "ERROR" : highScore.ToString("000");
scoreText.text = (currentScore > 99999999) ? "ERROR" : currentScore.ToString("000");
}

private void Start()
Expand Down
16 changes: 8 additions & 8 deletions Components/WeaponManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static class WeaponManager
public static void Init()
{
RegisterWeapons();
UKAPIP.OnLevelChanged += OnLevelChanged;
InGameCheck.OnLevelChanged += OnLevelChanged;
CrossModEvents.SubscribeToModEvents(CheckEvent, "WeaponDeployer");
}

Expand All @@ -56,7 +56,7 @@ private static void CheckEvent(ModEventData data)

private static void DeInit()
{
UKAPIP.OnLevelChanged -= OnLevelChanged;
InGameCheck.OnLevelChanged -= OnLevelChanged;
weapons.Clear();
WeaponsRegistered = false;
}
Expand All @@ -68,7 +68,7 @@ private static void DeInit()
[Commands.UFGDebugMethod("Deploy Weapons", "Redeploy weapons")]
public static void DeployWeapons(bool firstTime = false, bool force = false)
{
if(!UKAPIP.InLevel() && !force && !inventoryMade)
if(!InGameCheck.InLevel() && !force && !inventoryMade)
{
return;
}
Expand All @@ -89,11 +89,11 @@ public static void DeployWeapons(bool firstTime = false, bool force = false)
deployer.DeployWeapons(firstTime);
}

private static void OnLevelChanged(UKAPIP.UKLevelType levType)
private static void OnLevelChanged(InGameCheck.UKLevelType levType)
{
inventoryMade = false;

if (!UKAPIP.InLevel())
if (!InGameCheck.InLevel())
{
return;
}
Expand Down Expand Up @@ -383,7 +383,7 @@ public static void NewStyleItem(string name, string text)

public static void AddStyle(int points, string key, GameObject sourceWeapon = null, EnemyIdentifier eid = null, int count = -1, string prefix = "", string postfix ="")
{
if(!UKAPIP.InLevel())
if(!InGameCheck.InLevel())
{
return;
}
Expand All @@ -393,7 +393,7 @@ public static void AddStyle(int points, string key, GameObject sourceWeapon = nu

public static void AddStyle(StyleEntry entry)
{
if (!UKAPIP.InLevel())
if (!InGameCheck.InLevel())
{
return;
}
Expand All @@ -418,7 +418,7 @@ public static void SetWeaponUnlocked(string weaponKey, bool unlocked)
Data.Loadout.Data.SetUnlocked(weaponKey, unlocked);
Data.Loadout.Save();

if(unlocked && UKAPIP.InLevel())
if(unlocked && InGameCheck.InLevel())
{
HudMessageReceiver.Instance.SendHudMessage($"You have unlocked a new weapon. Press [<color=orange>{InventoryControllerDeployer.inventoryKey.KeyCode}</color>] to open UFG Inventory.");
}
Expand Down
4 changes: 2 additions & 2 deletions Components/Weapons/AdminGun/AdminGun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private void FireBullet(Ray newShot, bool reflection = false)
}
else
{
Action styleCallback = new Action(() => { WeaponManager.AddStyle((gamerMode) ? 1 : 5, "admingunkill", gameObject, enemy); });
Action styleCallback = new Action(() => { WeaponManager.AddStyle((gamerMode) ? -500 : 0, "admingunkill", gameObject, enemy); });
enemy.gameObject.EnsureComponent<EnemyOverride>().AddDeathCallback(styleCallback);
enemy.DeliverDamage(hits[x].collider.gameObject, newShot.direction.normalized * 10000.0f, hits[x].point, 2.0f, false, 1.0f, gameObject);
}
Expand Down Expand Up @@ -190,7 +190,7 @@ private void CoinReflect(Vector3 coinPosition)
EnemyIdentifier[] enemies = EnemyTracker.Instance.GetCurrentEnemies().Where(x=>(!x.dead && !x.blessed)).ToArray();

Instantiate(Prefabs.ShittyExplosionFX, coinPosition, Quaternion.identity);
Prefabs.ShittyExplosionSound.Asset.PlayAudioClip(coinPosition, 1.3f, 1.0f, 0.7f);
Prefabs.ShittyExplosionSound?.PlayAudioClip(coinPosition, 1.3f, 1.0f, 0.7f);

for (int i=0; i<enemies.Length; i++)
{
Expand Down
1 change: 0 additions & 1 deletion Components/Weapons/Dodgeball/Dodgeball.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public override void OnAwakeFinished()
basketBallMode = Data.Config.Data.BasketBallMode;
standardSkin = transform.Find("viewModelWrapper/Armature/Upper_Arm/Forearm/Hand/DodgeballMesh").GetComponent<MeshRenderer>().material;
SetSkin(!basketBallMode);
weaponIcon.variationColor = 2;
catcherCollider = transform.Find("firePoint/DodgeballCatcher").gameObject;
catcherCollider.SetActive(false);
catcherCollider.gameObject.layer = 14;
Expand Down
1 change: 0 additions & 1 deletion Components/Weapons/FingerGun/FingerGun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public int CurrentAmmo

public override void OnAwakeFinished()
{
weaponIcon.variationColor = (int) weaponInfo.IconColor;
AddSFX("BangSound", "GunReady", "Reload", "Kabooma");
ammoCounter = transform.GetComponentInChildren<Text>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public class FocalyzerAlternate : UltraFunGunBase
public override void OnAwakeFinished()
{
style = MonoSingleton<StyleHUD>.Instance;
weaponIcon.variationColor = 0;
tubeController = transform.Find("viewModelWrapper/FocalyzerGunModel/Tubes").gameObject.AddComponent<FocalyzerTubeControllerAlternate>();
aimSpot = GameObject.Instantiate<GameObject>(new GameObject(), Vector3.zero, Quaternion.identity).transform;
aimSpot.name = "PylonTarget";
Expand Down
1 change: 0 additions & 1 deletion Components/Weapons/Focalyzer/Standard/Focalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class Focalyzer : UltraFunGunBase

public override void OnAwakeFinished()
{
weaponIcon.variationColor = 2;
tubeController = transform.Find("viewModelWrapper/FocalyzerGunModel/Tubes").gameObject.AddComponent<FocalyzerTubeController>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private void Explode(params Vector3[] positions)
for (int i = 0; i < positions.Length; i++)
{
GameObject newExplosionFX = Instantiate(Prefabs.ShittyExplosionFX, positions[i], Quaternion.identity);
Prefabs.ShittyExplosionSound.Asset.PlayAudioClip(positions[i], 1, 1, 0.6f);
Prefabs.ShittyExplosionSound?.PlayAudioClip(positions[i], 1, 1, 0.6f);
}

Destroy(gameObject);
Expand Down
7 changes: 7 additions & 0 deletions Components/Weapons/Payloader/PlushieCannon/PlushieCannon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ public class PlushieCannon : UltraFunGunBase
Prefabs.MandyPlush.Asset,
Prefabs.V1Plush.Asset,
Prefabs.ScottPlush.Asset,
Prefabs.CabalCrowPlush.Asset,
Prefabs.QuetzalPlush.Asset,
Prefabs.HealthBJPlush.Asset,
Prefabs.HealthJakePlush.Asset,
Prefabs.HealthJohnPlush.Asset,
Prefabs.LenvalPlush.Asset,
Prefabs.WeytePlush.Asset,
Prefabs.HydraPlushie
};

Expand Down
Loading

0 comments on commit fbaff56

Please sign in to comment.