Skip to content

Commit

Permalink
Cyborg Farmer Redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
Void-n-Null committed Jun 4, 2024
1 parent ddfc948 commit b150b9c
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 52 deletions.
18 changes: 3 additions & 15 deletions BananaFarmerMod.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#region imports

using System;
using Il2CppAssets.Scripts.Models.GenericBehaviors;
using Il2CppAssets.Scripts.Models.GenericBehaviors;
using Il2CppAssets.Scripts.Models.Towers;
using Il2CppAssets.Scripts.Models.Towers.Behaviors;
using Il2CppAssets.Scripts.Models.Towers.Behaviors.Attack;
Expand All @@ -14,15 +11,6 @@
using Il2CppAssets.Scripts.Models.TowerSets;
using VoidBananaFarmer.Tower;

#endregion

/*
Credits
Kosmic#4494 for some great sprite work
1330 Studios discord for help with recommending and explaining certain behaviors (https://discord.gg/BxauzvUUjE)
BTD6 Mods & Discussion discord for great and efficient problem solving and debugging (https://discord.gg/dV682SPepR)
*/

[assembly: MelonGame("Ninja Kiwi", "BloonsTD6")]
[assembly: MelonColor(255,255,255,255)]
[assembly: MelonAuthorColor(255,0,0,139)]
Expand Down Expand Up @@ -53,8 +41,8 @@ public override void ModifyBaseTowerModel(TowerModel towerModel)
towerModel.range = 45;
towerModel.AddBehavior(new CollectCashZoneModel("CollectCashZoneModel_",45,19,3,"",true,true,true,true));
}

public override bool IsValidCrosspath(int[] tiers) => ModHelper.HasMod("Ultimate Crosspathing") ? true : base.IsValidCrosspath(tiers);
public override bool IsValidCrosspath(params int[] tiers) => ModHelper.HasMod("Ultimate Crosspathing") || base.IsValidCrosspath(tiers);
}
}
}
34 changes: 2 additions & 32 deletions Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ namespace VoidBananaFarmer
{
public static class Helper
{
private static readonly int MainTex = Shader.PropertyToID("_MainTex");
public static TowerModel BaseBananaFarmer => Game.instance.model.GetTowerFromId("BananaFarmer");
public static string BananaFarmerDisplay => BaseBananaFarmer.display.guidRef;

public static void UpdateHatTexture(UnityDisplayNode node, Texture tex)
{
node.genericRenderers[0].materials[1].SetTexture("_MainTex", tex);
node.genericRenderers[0].materials[1].SetTexture(MainTex, tex);
}

public static void UpdateAttackModelRange(TowerModel spainico)
Expand All @@ -28,37 +29,6 @@ public static void UpdateAttackModelRange(TowerModel spainico)
}
}
}

// public static UnityDisplayNode GetNode(string guid)
// {
// UnityDisplayNode udn = null;
// Game.instance.GetDisplayFactory().FindAndSetupPrototypeAsync(guid, (Action<UnityDisplayNode>)delegate (UnityDisplayNode node)
// {
// udn = node;
// });
// return udn;
// }

/* public static Texture2D Duplicate(this Texture texture, Rect? proj = null)
{
if (proj == null) proj = new Rect(0, 0, texture.width, texture.height);
var rect = (Rect)proj;
texture.filterMode = FilterMode.Point;
RenderTexture rt = RenderTexture.GetTemporary(texture.width, texture.height);
rt.filterMode = FilterMode.Point;
RenderTexture.active = rt;
Graphics.Blit(texture, rt);
Texture2D texture2 = new Texture2D((int)rect.width, (int)rect.height);
texture2.ReadPixels(new Rect(rect.x, texture.height - rect.height - rect.y, rect.width, rect.height), 0, 0);
texture2.Apply();
RenderTexture.active = null;
return texture2;
}
*//* publ*//*ic static void CustomSaveToPng(string Path, Texture tex)
{
Texture2D texture = tex.Duplicate();
File.WriteAllBytes($"{Path}.png", ImageConversion.EncodeToPNG(texture));
}*/
}
}

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
# Example
![](https://raw.githubusercontent.com/Void-n-Null/Banana-Farmer-Tower/main/BananaFarmerShowoff.gif)

[![Requires BTD6 Mod Helper](https://raw.githubusercontent.com/gurrenm3/BTD-Mod-Helper/master/banner.png)](https://github.com/gurrenm3/BTD-Mod-Helper#readme)
[![Requires BTD6 Mod Helper](https://raw.githubusercontent.com/gurrenm3/BTD-Mod-Helper/master/banner.png)](https://github.com/gurrenm3/BTD-Mod-Helper#readme)
File renamed without changes
File renamed without changes
Binary file modified Resources/CyborgFarmer-Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/CyborgFarmer_Texture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions Tower/Upgrades/ParagonUpgrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ public class ParagonUpgrade
{
public class Paragon : ModParagonUpgrade<BananaFarmerMod.BananaFarmerTower>
{
//public override string Name => "PotassiumSupreme";
public override string DisplayName => "Potassium Supreme";
public override int Cost => 700000;
public override string Description => "The embodiment of the monkey economy itself.";

public override string Icon => "Paragon-Icon";
public override string Portrait => "Paragon-Portrait";

Expand Down Expand Up @@ -58,7 +56,7 @@ public override void ApplyUpgrade(TowerModel towerModel)
bananaGunProj.pierce = 9;
bananaGunProj.ApplyDisplay<Displays.ProjectileDisplays.GoldenBananaProjectileDisplay>();


//Edit Banana Farm Cash and Collect Cash Zone Models
var BananaFarmAttackModel = Game.instance.model.GetTowerFromId("BananaFarm").GetAttackModel().Duplicate();
BananaFarmAttackModel.name = "BananaFarm_";
BananaFarmAttackModel.weapons[0].GetBehavior<EmissionsPerRoundFilterModel>().count = 40;
Expand Down
5 changes: 4 additions & 1 deletion Tower/Upgrades/TopPathUpgrades.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ public class CyborgFarmerDisplay : ModDisplay
public override string BaseDisplay => BananaFarmerDisplay;
public override void ModifyDisplayNode(UnityDisplayNode node)
{
foreach (Renderer genericRenderer in node.genericRenderers)
foreach (var genericRenderer in node.genericRenderers)
{
genericRenderer.material.mainTexture = GetTexture("CyborgFarmer_Texture");
genericRenderer.SetOutlineColor(new Color(0, 0.45f, 0.45f, 0.45f));
}
}
}
}
Expand Down

0 comments on commit b150b9c

Please sign in to comment.