Skip to content

Instantly share code, notes, and snippets.

@Azzurite
Last active June 14, 2017 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Azzurite/989df9475b2eccc4ab67525de184c202 to your computer and use it in GitHub Desktop.
Save Azzurite/989df9475b2eccc4ab67525de184c202 to your computer and use it in GitHub Desktop.
using ICities;
using System.Collections.Generic;
namespace ParkRebalance {
public class ParkRebalanceMod : IUserMod, ILoadingExtension {
class BuildingEntertainmentValues {
private string name;
public string Name {
get{ return name; }
}
private int acc;
public int Acc {
get{ return acc; }
}
private int radius;
public int Radius {
get{ return radius; }
}
public BuildingEntertainmentValues(string name, int acc, int radius) {
this.name = name;
this.acc = acc;
this.radius = radius;
}
}
public string Name {
get { return "Park Rebalance"; }
}
public string Description {
get { return "Rebalances Parks to make them all worthwhile."; }
}
public void OnCreated(ILoading loading) {}
public void OnReleased() {}
public void OnLevelUnloading() {}
public void OnLevelLoaded(LoadMode mode) {
var buildingValues = new List<BuildingEntertainmentValues>{
new BuildingEntertainmentValues("Basketball Court", 130, 400),
new BuildingEntertainmentValues("Beachvolley Court", 175, 312),
new BuildingEntertainmentValues("Botanical garden", 150, 488),
new BuildingEntertainmentValues("MerryGoRound", 125, 400),
new BuildingEntertainmentValues("Cross-Country Skiing", 150, 512),
new BuildingEntertainmentValues("Curling Park", 125, 416),
new BuildingEntertainmentValues("Public Firepit", 100, 468),
new BuildingEntertainmentValues("2x8_FishingPier", 60, 532),
new BuildingEntertainmentValues("2x2_winter_fishing_pier", 60, 532),
new BuildingEntertainmentValues("3x2_Fishing tours", 100, 420),
new BuildingEntertainmentValues("Ice Hockey Rink", 150, 380),
new BuildingEntertainmentValues("Ice Sculpture Park", 111, 404),
new BuildingEntertainmentValues("JapaneseGarden", 160, 316),
new BuildingEntertainmentValues("2x2_Jet_ski_rental", 170, 300),
new BuildingEntertainmentValues("Expensive Playground", 125, 464),
new BuildingEntertainmentValues("MagickaPark", 125, 520),
new BuildingEntertainmentValues("4x4_Marina", 125, 448),
new BuildingEntertainmentValues("Expensive Park", 75, 644),
new BuildingEntertainmentValues("Expensive Plaza", 145, 400),
new BuildingEntertainmentValues("Regular Plaza", 110, 400),
new BuildingEntertainmentValues("2x4_RestaurantPier", 125, 440),
new BuildingEntertainmentValues("9x15_RidingStable", 125, 528),
new BuildingEntertainmentValues("Skating Rink", 140, 364),
new BuildingEntertainmentValues("Ski Lodge", 100, 412),
new BuildingEntertainmentValues("Sled_Hill", 140, 376),
new BuildingEntertainmentValues("Regular Park", 100, 504),
new BuildingEntertainmentValues("Regular Playground", 126, 400),
new BuildingEntertainmentValues("Snowman_Park", 125, 360),
new BuildingEntertainmentValues("Snowmobile Track", 175, 420),
new BuildingEntertainmentValues("Tennis_Court_EU", 130, 400)
};
buildingValues.ForEach(UpdateBuilding);
}
private void UpdateBuilding(BuildingEntertainmentValues buildingValues) {
var buildingInfo = PrefabCollection<BuildingInfo>.FindLoaded(buildingValues.Name);
if (buildingInfo == null) {
return;
}
var buildingAI = (ParkAI) buildingInfo.GetAI();
buildingAI.m_entertainmentAccumulation = buildingValues.Acc;
buildingAI.m_entertainmentRadius = buildingValues.Radius;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment