public static bool Prefix(ref SpawnConsoleCommand __instance, NotificationCenter.Notification n) { if (n != null && n.data != null && n.data.Count > 0) { string text = (string)n.data[0]; TechType techType; if (UWE.Utils.TryParseEnum <TechType>(text, out techType)) { if (techType == TechType.Seamoth && n.data.Count <= 2) { GameObject prefabForTechType = CraftData.GetPrefabForTechType(techType, true); if (prefabForTechType != null) { int num = 1; int num2; if (n.data.Count > 1 && int.TryParse((string)n.data[1], out num2)) { num = num2; } float maxDist = 12f; if (n.data.Count > 2) { maxDist = float.Parse((string)n.data[2]); } Debug.LogFormat("Spawning {0} {1}", new object[] { num, techType }); for (int i = 0; i < num; i++) { GameObject gameObject = global::Utils.CreatePrefab(prefabForTechType, maxDist, i > 0); LargeWorldEntity.Register(gameObject); CrafterLogic.NotifyCraftEnd(gameObject, techType); gameObject.SendMessage("StartConstruction", SendMessageOptions.DontRequireReceiver); } } return(false); } return(true); } else { return(true); } } return(true); }
public static bool Prefix(SpawnConsoleCommand __instance) { __instance.gameObject.AddComponent <Multiplayer>(); return(true); }