Skip to content

Instantly share code, notes, and snippets.

@NoahRoseLedesma
Created February 7, 2024 06:04
Show Gist options
  • Save NoahRoseLedesma/fb8a8539195451b8fb5654f94d388f1c to your computer and use it in GitHub Desktop.
Save NoahRoseLedesma/fb8a8539195451b8fb5654f94d388f1c to your computer and use it in GitHub Desktop.
Auto Improvement Mod for Mad Games Tycoon 2
// Add the following line to the end of `public void BUTTON_Start()` in `Menu_DevGame`
ModUtilities.StartAllImprovements(this.guiMain_, taskGame.gameID);
using UnityEngine;
using System.IO;
public static class ModUtilities
{
enum RoomType : int {
QA_ROOM_TYPE = 3,
GRAPHICS_ROOM_TYPE = 4,
SOUND_ROOM_TYPE = 5,
MOCAP_ROOM_TYPE = 10
}
// Starts all improvement tasks for QA, Graphics, Sound Design, and Motion
// Capture for a given game.
public static void StartAllImprovements(GUI_Main guiMain, int gameId) {
roomScript qaRoom = getBestRoomForTask((int)RoomType.QA_ROOM_TYPE);
if (qaRoom) {
taskGameplayVerbessern task = guiMain.AddTask_GameplayVerbessern();
task.Init(false);
task.targetID = gameId;
for (int i = 0; i < task.adds.Length; i++) {
task.adds[i] = true;
}
task.autoBugfix = true;
task.FindNewAdd();
qaRoom.taskID = task.myID;
}
roomScript graphicsRoom = getBestRoomForTask((int)RoomType.GRAPHICS_ROOM_TYPE);
if (graphicsRoom) {
taskGrafikVerbessern task = guiMain.AddTask_GrafikVerbessern();
task.Init(false);
task.targetID = gameId;
for (int i = 0; i < task.adds.Length; i++) {
task.adds[i] = true;
}
task.FindNewAdd();
graphicsRoom.taskID = task.myID;
}
roomScript soundRoom = getBestRoomForTask((int)RoomType.SOUND_ROOM_TYPE);
if (soundRoom) {
taskSoundVerbessern task = guiMain.AddTask_SoundVerbessern();
task.Init(false);
task.targetID = gameId;
for (int i = 0; i < task.adds.Length; i++) {
task.adds[i] = true;
}
task.FindNewAdd();
soundRoom.taskID = task.myID;
}
roomScript mocapRoom = getBestRoomForTask((int)RoomType.MOCAP_ROOM_TYPE);
if (mocapRoom) {
taskAnimationVerbessern task = guiMain.AddTask_AnimationVerbessern();
task.Init(false);
task.targetID = gameId;
for (int i = 0; i < task.adds.Length; i++) {
task.adds[i] = true;
}
task.FindNewAdd();
mocapRoom.taskID = task.myID;
}
}
// Determines the best room of the given type to assign a task to, or null
// if no applicable room exists. The quality of the room is determined by
// the number of objects. Only rooms which have no task are considered.
public static roomScript getBestRoomForTask(int roomType) {
roomScript bestRoom = null;
int bestRoomScore = -1;
foreach (GameObject gameObject in GameObject.FindGameObjectsWithTag("Room")) {
roomScript room = gameObject.GetComponent<roomScript>();
if (room && room.typ == roomType && room.taskID == -1 && room.listInventar.Count > bestRoomScore) {
bestRoom = room;
bestRoomScore = room.listInventar.Count;
}
}
return bestRoom;
}
}
@NoahRoseLedesma
Copy link
Author

If you trust a stranger enough to give you binaries: Assembly-CSharp.dll.

Simply replace the version in Mad Games Tycoon 2\Mad Games Tycoon 2_Data\Managed with the provided dll. This patched binary will likely not work once the game updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment