Skip to content

Commit

Permalink
Merge branch 'Patch15Fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hydraxous committed Apr 21, 2024
2 parents 373be31 + af7eeb1 commit 657f74d
Show file tree
Hide file tree
Showing 190 changed files with 271 additions and 143 deletions.
1 change: 1 addition & 0 deletions Components/Debugging/CoroutineRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ private void Update()
public Coroutine RunCoroutine(IEnumerator coroutine)
{
DontDestroyOnLoad(gameObject);
gameObject.hideFlags = HideFlags.HideAndDontSave;
return StartCoroutine(RunExternalCoroutine(coroutine));
}

Expand Down
2 changes: 1 addition & 1 deletion Components/WeaponDeployer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void DisposeWeapons()
}

//TODO optimization
public void DeployWeapons(bool firstTime = false)
public void DeployWeapons()
{
DisposeWeapons();

Expand Down
62 changes: 31 additions & 31 deletions Components/WeaponManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void DeployWeapons(bool firstTime = false, bool force = false)
}
}

deployer.DeployWeapons(firstTime);
deployer.DeployWeapons();
}

private static void OnLevelChanged(InGameCheck.UKLevelType levType)
Expand Down Expand Up @@ -80,36 +80,36 @@ private static void Prep()

private static void InitStyleItems()
{
NewStyleItem("vaporized", "<color=cyan>VAPORIZED</color>");
NewStyleItem("vibecheck", "VIBE-CHECKED");
NewStyleItem("v2kill", "<color=#ff33001>OXIDIZED</color>");
NewStyleItem("gabrielkill", "<color=#ff0051>L-DISTRIBUTED</color>");
NewStyleItem("wickedkill", "<color=#919191>NOT WICKED ENOUGH</color>");
NewStyleItem("minoskill", "<color=#03ffa7>JUDGED</color>");
NewStyleItem("orbited", "ORBITAL LAUNCH");
NewStyleItem("egged", "EGGED");
NewStyleItem("eggstrike", "TACTICAL EGG STRIKE");
NewStyleItem("eggsplosion", "<color=yellow>EGGSPLOSION</color>");
NewStyleItem("refractionhit", "BUG ZAPPER");
NewStyleItem("discohit", "DISCO INFERNO");
NewStyleItem("dodgeballhit", "OUTPLAYED");
NewStyleItem("dodgeballparry", "BOOST BALL");
NewStyleItem("dodgeballparryhit", "<color=orange>SLAM DUNK</color>");
NewStyleItem("dodgeballreversehit", "REBOUND");
NewStyleItem("fingergunhit", "BANG'D");
NewStyleItem("fingergunfullpenetrate", "<color=cyan>KABOOMA!</color>");
NewStyleItem("fingergunprojhit", "DENIAL");
NewStyleItem("admingunkill", "<color=red>GAMING CHAIR</color>");
NewStyleItem("brickmindkill", "<color=orange>SOUL ASSIMILATION</color>");
NewStyleItem("brickparrykill", "BRICKED");
NewStyleItem("tricksniperquickscope", "QUICKSCOPE");
NewStyleItem("tricksniper360", "<color=cyan>TRICKSHOT</color>");
NewStyleItem("tricksnipernoscope", "<color=orange>NOSCOPE</color>");
NewStyleItem("tricksniperbankshot", "<color=orange>BANKSHOT</color>");
NewStyleItem("ultragunsuperchargekill", "<color=cyan>EXPRESS BILLING</color>");
NewStyleItem("ultragunkill", "BILLED");
NewStyleItem("ultragunrainkill", "<color=red>WHAT GOES UP</color>");
NewStyleItem("ultragunaerialkill", "DEATH FROM ABOVE");
NewStyleItem("vaporized", CustomStyleDefinitions.VAPORIZED);
NewStyleItem("vibecheck", CustomStyleDefinitions.VIBE_CHECK);
NewStyleItem("v2kill", CustomStyleDefinitions.V2_KILL);
NewStyleItem("gabrielkill", CustomStyleDefinitions.GABRIEL_KILL);
NewStyleItem("wickedkill", CustomStyleDefinitions.WICKED_KILL);
NewStyleItem("minoskill", CustomStyleDefinitions.MINOS_KILL);
NewStyleItem("orbited", CustomStyleDefinitions.ORBITED);
NewStyleItem("egged", CustomStyleDefinitions.EGGED);
NewStyleItem("eggstrike", CustomStyleDefinitions.EGG_STRIKE);
NewStyleItem("eggsplosion", CustomStyleDefinitions.EGG_SPLOSION);
NewStyleItem("refractionhit", CustomStyleDefinitions.LASER_REFRACTION_HIT);
NewStyleItem("discohit", CustomStyleDefinitions.LASER_DISCO_HIT);
NewStyleItem("dodgeballhit", CustomStyleDefinitions.DODGEBALL_HIT);
NewStyleItem("dodgeballparry", CustomStyleDefinitions.DODGEBALL_PARRY);
NewStyleItem("dodgeballparryhit", CustomStyleDefinitions.DODGEBALL_PARRY_HIT);
NewStyleItem("dodgeballreversehit", CustomStyleDefinitions.DODGEBALL_REVERSE_HIT);
NewStyleItem("fingergunhit", CustomStyleDefinitions.FINGER_GUN_HIT);
NewStyleItem("fingergunfullpenetrate", CustomStyleDefinitions.FINGER_GUN_PENETRATE);
NewStyleItem("fingergunprojhit", CustomStyleDefinitions.FINGER_GUN_PROJECTILE_HIT);
NewStyleItem("admingunkill", CustomStyleDefinitions.ADMIN_GUN_KILL);
NewStyleItem("brickmindkill", CustomStyleDefinitions.BRICK_MIND_KILL);
NewStyleItem("brickparrykill", CustomStyleDefinitions.BRICK_PARRY_KILL);
NewStyleItem("tricksniperquickscope", CustomStyleDefinitions.TRICKSNIPER_QUICKSCOPE);
NewStyleItem("tricksniper360", CustomStyleDefinitions.TRICKSNIPER_360);
NewStyleItem("tricksnipernoscope", CustomStyleDefinitions.TRICKSNIPER_NOSCOPE);
NewStyleItem("tricksniperbankshot", CustomStyleDefinitions.TRICKSNIPER_BANKSHOT);
NewStyleItem("ultragunsuperchargekill", CustomStyleDefinitions.ULTRAGUN_SUPERCHARGE_KILL);
NewStyleItem("ultragunkill", CustomStyleDefinitions.ULTRAGUN_KILL);
NewStyleItem("ultragunrainkill", CustomStyleDefinitions.ULTRAGUN_RAIN_KILL);
NewStyleItem("ultragunaerialkill", CustomStyleDefinitions.ULTRAGUN_AERIAL_KILL);

}

Expand Down
3 changes: 0 additions & 3 deletions Components/Weapons/Brick/ThrownBrick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ private bool CheckEnemyHit(Collision col)
if(eid2 != eid)
{
GuidedLob(homingTarget,Vector3.up*0.25f);
//LobAtTarget(homingTarget.position);
}
}else
{
Expand Down Expand Up @@ -315,7 +314,6 @@ public void Break()

private void LobAtTarget(Vector3 target)
{
//Vector3 newVelocity = HydraUtils.GetVelocityTrajectory(transform.position, target, brickShooter.BrickParryFlightTime);
Trajectory brickTrajectory = new Trajectory(transform.position, target, brickShooter.BrickParryFlightTime/(enemyParries+1));
Vector3 newVelocity = brickTrajectory.GetRequiredVelocity();
rb.velocity = newVelocity;
Expand Down Expand Up @@ -403,7 +401,6 @@ private void Parry(Vector3 inDirection)
if (EnemyTools.TryGetHomingTarget(transform.position, out Transform homingTarget, out EnemyIdentifier eid))
{
GuidedLob(homingTarget);
//LobAtTarget(homingTarget.position);
}
else
{
Expand Down
12 changes: 6 additions & 6 deletions Components/Weapons/ColossalHammer/ColossalHammer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public class ColossalHammer : UltraFunGunBase

private float charge;
[Configgable("Weapons/GigaHammer")]
private static float chargeRate = 0.1f;
private static float chargeRate = 1f;

[Configgable("Weapons/GigaHammer")]
private static float hitstop = 0.05f;
private static float hitstop = 0.06f;

[Configgable("Weapons/GigaHammer")]
private static float camShake = 0.5f;
private static float camShake = 0.75f;

[Configgable("Weapons/GigaHammer")]
private static float maxCharge = 1f;
Expand All @@ -31,13 +31,13 @@ public class ColossalHammer : UltraFunGunBase
private static float maxRange = 4f;

[Configgable("Weapons/GigaHammer")]
private static float minCharge = 0.3f;
private static float minCharge = 0.6f;

[Configgable("Weapons/GigaHammer")]
private static float fireDelay = 0.15f;
private static float fireDelay = 0.14f;

[Configgable("Weapons/GigaHammer")]
private static float damage = 4f;
private static float damage = 15f;

[Configgable("Weapons/GigaHammer")]
private static float scalar = 1f;
Expand Down
4 changes: 3 additions & 1 deletion Components/Weapons/Dodgeball/ThrownDodgeball.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private void Awake()
rb = GetComponent<Rigidbody>();

animator = GetComponent<Animator>();
//DISGUSTING
ballMesh = transform.Find("DodgeballMesh");
bigHitSound = transform.Find("Audios/BigHit").GetComponent<AudioSource>();
homingSound = transform.Find("Audios/HomingSound").GetComponent<AudioSource>();
Expand All @@ -76,7 +77,7 @@ private void Start()
homingSound.Play();
homingSound.Pause();

//Fix stupid hitreg.
//Fix stupid beam hitreg.
GameObject hitbox = transform.Find("LimbHitbox").gameObject;
hitbox.tag = "Breakable";
}
Expand Down Expand Up @@ -413,6 +414,7 @@ private Vector3 CalculateVelocity(Vector3 direction)

private void OnTriggerEnter(Collider col)
{
//why he check name??!?!
if(col.gameObject.name == "DodgeballCatcher")
{
StopHomingAttack();
Expand Down
2 changes: 1 addition & 1 deletion Components/Weapons/ULTRAGUN/UltraBullet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ private void HitEnemy(EnemyIdentifier eid, Collision col)
float damageValue = (IsDivision) ? Damage * divisionScale : Damage;
damageValue = (Supercharged) ? damageValue * 1.5f : damageValue;

//Petty damage boost for guttertank, bc I hate them :)
//Guttertank can have double damage as a treat
if(eid.enemyType == EnemyType.Guttertank)
{
damageValue *= 2f;
Expand Down
24 changes: 24 additions & 0 deletions Components/Weapons/VoxelHand/Data/CustomVoxelData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;

namespace UltraFunGuns
{
[Serializable]
public class CustomVoxelData : VoxelData
{
public string BehaviourStateID { get; }
public string MeshOverrideID { get; }
public string AudioPath { get; }
public string TexturePath { get; }

public CustomVoxelData(string iD, string displayName, Material material, AudioClip sound, string stateID, string texturePath, string audioPath, string meshOverrideID) : base(iD, displayName, material, sound)
{
BehaviourStateID = stateID;
TexturePath = texturePath;
AudioPath = audioPath;
MeshOverrideID = meshOverrideID;
}
}
}
7 changes: 6 additions & 1 deletion Components/Weapons/VoxelHand/Data/VoxelData.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
Expand All @@ -9,7 +10,11 @@ public class VoxelData
{
public string ID { get; }
public string DisplayName { get; }

[JsonIgnore]
public Material Material { get; }

[JsonIgnore]
public AudioClip Sound { get; }

public VoxelData(string iD, string displayName, Material material, AudioClip sound)
Expand Down
45 changes: 37 additions & 8 deletions Components/Weapons/VoxelHand/Data/VoxelDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public static class VoxelDatabase

private static Dictionary<string, VoxelData> voxelRegistry;
private static Dictionary<string, VoxelData> customBlocks = new Dictionary<string, VoxelData>();
private static Dictionary<string, VoxelData> placeholderDatas = new Dictionary<string, VoxelData>();

private static HashSet<string> checkedPathes = new HashSet<string>();

//Blacklisted from being in the usable pool
//TODO move this to the UI Code when able.
Expand Down Expand Up @@ -65,7 +68,7 @@ public static void OpenCustomVoxelFolder()
Application.OpenURL($"file://{customVoxelsFolder}");
}

public static void ImportCustomBlocksAsync(Action onComplete)
public static void ImportCustomBlocksAsync()
{
if (IsImportingTextures)
return;
Expand All @@ -92,6 +95,7 @@ private static IEnumerator ImportCustomTexturesAsync(Action onComplete)
pathes.AddRange(Directory.GetFiles(customVoxelsFolder, "*.png", SearchOption.AllDirectories));
pathes.AddRange(Directory.GetFiles(customVoxelsFolder, "*.jpg", SearchOption.AllDirectories));
pathes.AddRange(Directory.GetFiles(customVoxelsFolder, "*.jpeg", SearchOption.AllDirectories));

if (useCyberGrindTextures.Value)
{
pathes.AddRange(Directory.GetFiles(cyberGrindTextureFolder, "*.png", SearchOption.AllDirectories));
Expand All @@ -107,9 +111,11 @@ private static IEnumerator ImportCustomTexturesAsync(Action onComplete)
TextureImportProgress = (float)indexProcessed / ((float)totalCount);
++indexProcessed;

if (loadedTextures.ContainsKey(path))
if (loadedTextures.ContainsKey(path) || checkedPathes.Contains(path))
continue;

checkedPathes.Add(path);

yield return new WaitForEndOfFrame();

if (!TextureLoader.TryLoadTexture(path, out Texture2D tex))
Expand Down Expand Up @@ -186,17 +192,20 @@ public static void RegisterCustomVoxelData(VoxelData voxelData)
customBlocks.Add(voxelData.ID, voxelData);
}


private static void InitializeVoxelDatabase()
{
ImportPackagedVoxels();
ImportCustomBlocksAsync(null);

SceneManager.sceneLoaded += SceneManager_sceneLoaded;
ImportCustomBlocksAsync();
}

private static void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
public static void Flush()
{
ImportCustomBlocksAsync(null);
builtInVoxelData = null;
voxelRegistry = null;
customBlocks.Clear();
loadedTextures.Clear();
checkedPathes.Clear();
}

public static VoxelData GetVoxelData(string id)
Expand All @@ -216,7 +225,27 @@ public static VoxelData GetVoxelData(string id)
//Used for custom blocks, fe they dont exist anymore.
public static VoxelData GetPlaceholderVoxelData(string id)
{
return new VoxelData(id, id, VoxelMaterialManager.GetDefaultMaterial(), defaultClip);
if (!placeholderDatas.ContainsKey(id))
{
VoxelData placeholderData = new VoxelData(id, id, VoxelMaterialManager.GetDefaultMaterial(), defaultClip);
placeholderDatas.Add(id, placeholderData);
}

return placeholderDatas[id];
}

public static bool VoxelIsPlaceholder(VoxelData voxelData)
{
return placeholderDatas.ContainsKey(voxelData.ID);
}

public static bool VoxelExists(string id)
{
if (voxelRegistry == null)
InitializeVoxelDatabase();

return voxelRegistry.ContainsKey(id) || customBlocks.ContainsKey(id);
}

}
}
2 changes: 0 additions & 2 deletions Components/Weapons/VoxelHand/UI/VoxelFileInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ public void CreationMode()
menu.Open();
});

//guh this is still broken TODO
fileNameInputField.SetTextWithoutNotify(Path.GetFileNameWithoutExtension(header.FilePath));
fileNameInputField.onEndEdit.RemoveAllListeners();
fileNameInputField.onValueChanged.RemoveAllListeners();
Expand Down Expand Up @@ -285,7 +284,6 @@ private void InitializeReferences()

fileNameInputField = LocateComponent<InputField>("InputField_FileName");


descriptionInputField = LocateComponent<InputField>("InputField_WorldDescription");
descriptionInputField.characterLimit = MAX_DESCRIPTION_CHARACTERS;

Expand Down
7 changes: 1 addition & 6 deletions Components/Weapons/VoxelHand/UI/VoxelSelectionMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,6 @@ public void CloseMenu()
return;
}

//OptionsManager.Instance.paused = false;
//CameraController.Instance.enabled = true;
//Time.timeScale = 1f;
//GameStateManager.Instance.PopState(voxelSelectGameState.key);
container.SetActive(false);
}

Expand All @@ -303,7 +299,6 @@ private void ClearMenu()
instancedButtons.Clear();
}

//TODO this is horrid. Assumes the VoxelHand calls OpenMenu and provides it's SetHeldVoxel method as onSelect. Disgusting... Fix this. she dont know sry.
public void Button_DeselectHeldVoxel()
{
voxelHand?.SetHeldVoxel(null);
Expand All @@ -314,7 +309,7 @@ public void Button_RefreshVoxels()
if (VoxelDatabase.IsImportingTextures)
return;

VoxelDatabase.ImportCustomBlocksAsync(null);
VoxelDatabase.ImportCustomBlocksAsync();
}

public void Button_OpenCustomVoxelFolder()
Expand Down
Loading

0 comments on commit 657f74d

Please sign in to comment.