public static void ClockPatches(UndertaleData data) { UndertaleGameObject go = new UndertaleGameObject(); go.Name = data.Strings.MakeString("obj_clock"); go.Sprite = null; go.Persistent = true; go.CollisionShape = 0; go.Depth = -1; go.Awake = true; go.Visible = true; CreateEvent(RabbitRunCode.coinstants, data, go, EventType.Create, 0u); CreateEvent(RabbitRunCode.yote, data, go, EventType.Other, (uint)EventSubtypeOther.RoomEnd); CreateEvent(RabbitRunCode.rabstart, data, go, EventType.Other, (uint)EventSubtypeOther.RoomStart); CreateEvent(RabbitRunCode.constantDrawer, data, go, EventType.Draw, (uint)EventSubtypeDraw.DrawGUIEnd); CreateEvent(RabbitRunCode.constantStepper, data, go, EventType.Step, (uint)EventSubtypeStep.Step); CreateEvent(RabbitRunCode.doneThisShit, data, go, EventType.Other, (uint)EventSubtypeOther.User0); data.GameObjects.Add(go); data.Code.ByName("gml_Script_pausegame").AppendGML("instance_activate_object(obj_clock);", data); UndertaleCode c = data.Code.ByName("gml_Script_goto_mainmenu"); c.AppendGML(RabbitRunCode.gohomebyebye, data); UndertaleCode endingCutscene = data.Code.ByName("gml_RoomCC_rm_n4_760_Create"); ReplaceInGML("t_scene_info = [", @"t_scene_info = [[cutscene_checkiflist, obj_constant.flagList, 191, 1, 1],[cutscene_activate_userevent, obj_clock,0],", data.Code.ByName("gml_RoomCC_rm_n4_760_Create"), data); ReplaceInGML("t_scene_info = [", @"t_scene_info = [[cutscene_activate_userevent, obj_clock,0],", data.Code.ByName("gml_RoomCC_rm_n5_33_Create"), data); var house = data.Rooms.ByName("rm_init"); UndertaleRoom.GameObject rogo = new UndertaleRoom.GameObject { ObjectDefinition = go, InstanceID = 108990u, GMS2_2_2 = true }; house.GameObjects.Add(rogo); house.Layers.Single((layer) => layer.LayerName.Content == "Instances").InstancesData.Instances.Add(rogo); }
public static void SpeedrunPatches(UndertaleData data) { UndertaleScript setboi = new UndertaleScript(); setboi.Name = data.Strings.MakeString("set_speedrun_category"); setboi.Code = new UndertaleCode(); setboi.Code.Name = data.Strings.MakeString("gml_Script_set_speedrun_category"); setboi.Code.ReplaceGML(RabbitRunCode.set_speedrun_category, data); data.Code.Add(setboi.Code); data.Scripts.Add(setboi); UndertaleScript sprun = new UndertaleScript(); sprun.Name = new UndertaleString("menu_speedrun_script"); data.Strings.Add(sprun.Name); sprun.Code = new UndertaleCode(); data.Code.Add(sprun.Code); sprun.Code.Name = new UndertaleString("gml_Script_menu_speedrun_script"); data.Strings.Add(sprun.Code.Name); sprun.Code.ReplaceGML(RabbitRunCode.menu_speedrun_script, data); sprun.Code.UpdateAddresses(); data.Scripts.Add(sprun); UndertaleCode ae = data.Code.ByName("gml_Script_setfile"); ae.AppendGML(RabbitRunCode.gml_Script_setfile, data); ae.UpdateAddresses(); UndertaleCode ee = data.Code.ByName("gml_Object_obj_mainmenus_Create_0"); ReplaceInGML("GAME\", 1, 8],", "GAME\", 1, 8], [\"SPEEDBUN\", 1, 19], ", ee, data); ee.UpdateAddresses(); ReplaceInGML("i = 0", RabbitRunCode.speedrunMenuInit, ee, data); UndertaleCode ie = data.Code.ByName("gml_Script_cKeys_beginstep"); ie.AppendGML(RabbitRunCode.tasBeginStepInput, data); UndertaleCode oe = data.Code.ByName("gml_Object_obj_init_Create_0"); oe.AppendGML(@"global.playRun = false; global.watchRun = false; global.speedrunning = true; global.inrun = false; global.onehun = false;//one hundred percent global.allbun = false;//all cuties global.anyper = false;//any percent", data); UndertaleCode ue = data.Code.ByName("gml_Script_SaveStringToFile"); ue.ReplaceGML(RabbitRunCode.saveStringFile, data); UndertaleSprite mico = data.Sprites.ByName("spr_menuicons"); UndertaleSprite.TextureEntry te = new UndertaleSprite.TextureEntry(); UndertaleTexturePageItem ti = mico.Textures[1].Texture; UndertaleTexturePageItem to = data.Sprites.ByName("spr_antibunidle").Textures[0].Texture; te.Texture = new UndertaleTexturePageItem(); te.Texture.TargetX = ti.TargetX; te.Texture.TargetY = ti.TargetY; te.Texture.SourceX = to.SourceX; te.Texture.SourceY = to.SourceY; te.Texture.BoundingHeight = ti.BoundingHeight; te.Texture.BoundingWidth = ti.BoundingWidth; te.Texture.SourceWidth = 16; te.Texture.TargetWidth = 16; te.Texture.SourceHeight = 15; te.Texture.TargetHeight = 15; te.Texture.TexturePage = to.TexturePage; data.TexturePageItems.Add(te.Texture); mico.Textures.Insert(2, te); }