Skip to content

Commit

Permalink
1.1.5
Browse files Browse the repository at this point in the history
Fix shotgun displays, prevent player from using arm0 but do not unequip
  • Loading branch information
TRPG0 committed Jul 5, 2023
1 parent ebd6511 commit 92520af
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 94 deletions.
1 change: 0 additions & 1 deletion mod/ArchipelagoULTRAKILL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@
<Compile Include="Patches\ShopButton.cs" />
<Compile Include="Patches\ShopCategory.cs" />
<Compile Include="Patches\ShopZone.cs" />
<Compile Include="Patches\Shotgun.cs" />
<Compile Include="Patches\StatsManager.cs" />
<Compile Include="Patches\VariationInfo.cs" />
<Compile Include="Patches\WeaponPickUp.cs" />
Expand Down
53 changes: 42 additions & 11 deletions mod/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Core : UKMod
{
public const string ModGUID = "trpg.archipelagoultrakill";
public const string ModName = "Archipelago";
public const string ModVersion = "1.1.4";
public const string ModVersion = "1.1.5";
public const string ModDescription = "Connect to an Archipelago server to play ULTRAKILL randomizer.";

public static ManualLogSource logger = BepInEx.Logging.Logger.CreateLogSource("Archipelago");
Expand Down Expand Up @@ -219,7 +219,6 @@ public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
if (!inIntro) OptionsManager.Instance.optionsMenu.gameObject.AddComponent<OptionsMenuState>();

if (DataExists() && UIManager.log != null) UIManager.AdjustLogBounds();
if (DataExists() && SceneHelper.CurrentScene == "Level 0-1" && HasNoArms()) LevelManager.DeactivatePlanks();
if (DataExists() && SceneHelper.CurrentScene == "Level 1-2" && GameProgressSaver.GetGeneralProgress().nai0 == 0) LevelManager.DeactivateNailgun();
}

Expand Down Expand Up @@ -351,6 +350,38 @@ public static void SpawnSoap()
}
}

public static string GetHeldWeapon()
{
if (GunControl.Instance.currentWeapon.GetComponent<Revolver>())
{
switch (GunControl.Instance.currentWeapon.GetComponent<Revolver>().gunVariation)
{
case 0:
default:
return "rev0";
case 1:
return "rev2";
case 2:
return "rev1";
}
}
else if (GunControl.Instance.currentWeapon.GetComponent<Shotgun>()) return $"sho{GunControl.Instance.currentWeapon.GetComponent<Shotgun>().variation}";
else if (GunControl.Instance.currentWeapon.GetComponent <Nailgun>())
{
switch (GunControl.Instance.currentWeapon.GetComponent<Nailgun>().variation)
{
case 0:
default:
return "nai1";
case 1:
return "nai0";
}
}
else if (GunControl.Instance.currentWeapon.GetComponent<Railcannon>()) return $"rai{GunControl.Instance.currentWeapon.GetComponent<Railcannon>().variation}";
else if (GunControl.Instance.currentWeapon.GetComponent<RocketLauncher>()) return $"rock{GunControl.Instance.currentWeapon.GetComponent<RocketLauncher>().variation}";
else return "?";
}

void Update()
{
if (playerActive && DataExists())
Expand Down Expand Up @@ -390,7 +421,12 @@ void Update()
if (!NewMovement.Instance.gc.onGround) Traverse.Create(NewMovement.Instance).Field<bool>("falling").Value = true;
}

if (data.randomizeFire2 && !data.unlockedFire2.Contains("rev0") && GunControl.Instance.currentSlot == 1 && GunControl.Instance.currentWeapon.GetComponent<Revolver>().gunVariation == 0 && !CheatsManager.Instance.GetCheatState("ultrakill.no-weapon-cooldown"))
if (!data.hasArm && FistControl.Instance.currentPunch.type == FistType.Standard)
{
FistControl.Instance.currentPunch.ready = false;
}

if (data.randomizeFire2 && !data.unlockedFire2.Contains("rev0") && GetHeldWeapon() == "rev0" && !CheatsManager.Instance.GetCheatState("ultrakill.no-weapon-cooldown"))
{
if (GameProgressSaver.GetGeneralProgress().rev0 == 1)
{
Expand Down Expand Up @@ -419,22 +455,17 @@ void Update()
WeaponCharges.Instance.rev2charge = 0;
}

if (data.randomizeFire2 && !data.unlockedFire2.Contains("sho0") && GunControl.Instance.currentSlot == 2 && GunControl.Instance.currentWeapon.GetComponent<Shotgun>().variation == 0 && !CheatsManager.Instance.GetCheatState("ultrakill.no-weapon-cooldown"))
if (data.randomizeFire2 && ((!data.unlockedFire2.Contains("sho0") && GetHeldWeapon() == "sho0") || (!data.unlockedFire2.Contains("sho1") && GetHeldWeapon() == "sho1")) && !CheatsManager.Instance.GetCheatState("ultrakill.no-weapon-cooldown"))
{
if (InputManager.Instance.InputSource.Fire2.IsPressed)
{
Traverse shotgun = Traverse.Create(GunControl.Instance.currentWeapon.GetComponent<Shotgun>());
shotgun.Field<bool>("charging").Value = false;
shotgun.Field<float>("grenadeForce").Value = 0;
}
Traverse.Create(InputManager.Instance.InputSource.Fire2).Property("IsPressed").SetValue(false);
}

if (data.randomizeFire2 && !data.unlockedFire2.Contains("nai0") && !CheatsManager.Instance.GetCheatState("ultrakill.no-weapon-cooldown"))
{
WeaponCharges.Instance.naiMagnetCharge = 0;
}

if (data.randomizeFire2 && !data.unlockedFire2.Contains("nai1") && GunControl.Instance.currentSlot == 3 && GunControl.Instance.currentWeapon.GetComponent<Nailgun>().variation == 0 && !CheatsManager.Instance.GetCheatState("ultrakill.no-weapon-cooldown"))
if (data.randomizeFire2 && !data.unlockedFire2.Contains("nai1") && GetHeldWeapon() == "nai1" && !CheatsManager.Instance.GetCheatState("ultrakill.no-weapon-cooldown"))
{
Traverse.Create(GunControl.Instance.currentWeapon.GetComponent<Nailgun>()).Field<float>("heatSinks").Value = 0;
WeaponCharges.Instance.naiHeatsinks = 0;
Expand Down
26 changes: 0 additions & 26 deletions mod/LevelManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,32 +249,6 @@ public static void AddDoorClosers()
}
}

public static void DeactivatePlanks()
{
GameObject room;
if (GameObject.Find("1 - Starting Room"))
{
room = GameObject.Find("1 - Starting Room");
for (int i = 0; i < room.transform.childCount; i++)
{
GameObject child = room.transform.GetChild(i).gameObject;

if (child.name.Contains("Plank")) child.SetActive(false);
}
}
else if (GameObject.Find("1Alt - Short Starting Room"))
{
room = GameObject.Find("1Alt - Short Starting Room");
for (int i = 0; i < room.transform.childCount; i++)
{
GameObject child = room.transform.GetChild(i).gameObject;

if (child.name.Contains("Plank")) child.SetActive(false);
}
}

}

public static void DeactivateNailgun()
{
foreach (GearCheckEnabler gce in Resources.FindObjectsOfTypeAll<GearCheckEnabler>())
Expand Down
1 change: 1 addition & 0 deletions mod/LocationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public static void GetUKItem(UKItem item, string sendingPlayer = null)
}
else
{
if (!Core.data.hasArm && item.item_name == "Knuckleblaster") PrefsManager.Instance.SetInt("weapon.arm0", 0);
GameProgressSaver.AddGear(GetWeaponIdFromName(item.item_name));
PrefsManager.Instance.SetInt("weapon." + GetWeaponIdFromName(item.item_name), 1);
if (Core.playerActive && Core.inLevel)
Expand Down
5 changes: 3 additions & 2 deletions mod/Multiworld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public static bool Connect()
if (Core.data.musicRandomizer) Core.data.music = JsonConvert.DeserializeObject<Dictionary<string, string>>(success.SlotData["music"].ToString());

PrefsManager.Instance.SetInt("difficulty", 3);
PrefsManager.Instance.SetInt("weapon.arm0", 1);
GameProgressSaver.SetIntro(true);
GameProgressSaver.SetTutorial(true);
GameProgressSaver.SaveProgress(26);
Expand All @@ -121,8 +122,8 @@ public static bool Connect()
Core.SaveData();
}

if (!Core.data.hasArm) PrefsManager.Instance.SetInt("weapon.arm0", 0);
else PrefsManager.Instance.SetInt("weapon.arm0", 1);
//if (!Core.data.hasArm) PrefsManager.Instance.SetInt("weapon.arm0", 0);
//else PrefsManager.Instance.SetInt("weapon.arm0", 1);

LocationManager.locations.Clear();
LocationManager.ukitems.Clear();
Expand Down
2 changes: 1 addition & 1 deletion mod/Patches/RocketLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public static bool Prefix()
else return true;
}
}
}
}
49 changes: 0 additions & 49 deletions mod/Patches/Shotgun.cs

This file was deleted.

4 changes: 2 additions & 2 deletions mod/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.5")]
[assembly: AssemblyFileVersion("1.1.5")]
6 changes: 5 additions & 1 deletion package/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
## 1.1.5

- Fixed: The displays on the side of the Core Eject and Pump Charge shotguns wouldn't work.
- Fixed: Shotguns would get jammed after parrying an attack.

## 1.1.4

- Fixed: Various weird things about the blue skull in 1-2.
- Fixed: Shotguns could sometimes become impossible to fire after parrying with them.
- Fixed: Plando can now be used to place a specific weapon at the beginning of the game.

## 1.1.3
Expand Down
2 changes: 1 addition & 1 deletion package/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Archipelago",
"version_number": "1.1.4",
"version_number": "1.1.5",
"website_url": "https://github.com/TRPG0/ArchipelagoULTRAKILL",
"description": "Connect to an Archipelago server to play ULTRAKILL randomizer.",
"dependencies": [
Expand Down

0 comments on commit 92520af

Please sign in to comment.