-- name: 1.3 Null Check Fix -- description: Fixes script errors introduced in all functions that take an object in v1.3. Tested with Tag and Gore/Hard Mode. I wasted like an hour on this and it's going to be obsolete in a week.\n\nMod By EmilyEmmi -- 90% of these are just object nil checks not working, so here we go -- name, default return local one_object_funcs = { {"network_init_object", nil}, {"network_send_object", nil}, {"area_get_warp_node_from_params", nil}, {"bhv_spawn_star_no_level_exit", nil}, {"obj_update_gfx_pos_and_angle", nil}, {"obj_rotate_towards_point", nil}, {"vec3f_to_object_pos", nil}, {"get_door_save_file_flag", 0}, {"get_mario_cap_flag", 0}, {"execute_mario_action", 0}, {"find_mario_anim_flags_and_translation", 0}, {"is_point_close_to_object", 0}, {"nearest_interacting_mario_state_to_object", nil}, {"nearest_interacting_player_to_object", nil}, {"nearest_mario_state_to_object", nil}, {"nearest_possible_mario_state_to_object", nil}, {"obj_flicker_and_disappear", 0}, {"obj_move_xyz_using_fvel_and_yaw", nil}, {"obj_orient_graph", nil}, {"obj_return_and_displace_home", nil}, {"obj_return_home_if_safe", 0}, {"obj_spawn_yellow_coins", nil}, {"set_object_visibility", nil}, {"cur_obj_disable_rendering_and_become_intangible", nil}, {"cur_obj_enable_rendering_and_become_tangible", nil}, {"cur_obj_lateral_dist_from_obj_to_home", 0}, {"cur_obj_set_pos_relative", nil}, {"cur_obj_start_cam_event", nil}, {"dist_between_object_and_point", 0}, {"obj_angle_to_point", 0}, {"obj_apply_scale_to_matrix", nil}, {"obj_apply_scale_to_transform", nil}, {"obj_attack_collided_from_other_object", nil}, {"obj_become_tangible", nil}, {"obj_build_relative_transform", nil}, {"obj_build_transform_from_pos_and_angle", nil}, {"obj_build_transform_relative_to_parent", nil}, {"obj_build_vel_from_transform", nil}, {"obj_create_transform_from_self", nil}, {"obj_has_behavior", 0}, {"obj_init_animation", nil}, {"obj_init_animation_with_accel_and_sound", nil}, {"obj_init_animation_with_sound", nil}, {"obj_is_hidden", nil}, {"obj_mark_for_deletion", nil}, -- tag {"obj_scale", nil}, {"obj_scale_random", nil}, {"obj_scale_xyz", nil}, {"obj_set_angle", nil}, {"obj_set_behavior", nil}, {"obj_set_billboard", nil}, {"obj_set_cylboard", nil}, {"obj_set_face_angle", nil}, {"obj_set_face_angle_to_move_angle", nil}, {"obj_set_gfx_angle", nil}, {"obj_set_gfx_pos", nil}, {"obj_set_gfx_pos_from_pos", nil}, {"obj_set_gfx_scale", nil}, {"obj_set_held_state", nil}, {"obj_set_hitbox", nil}, {"obj_set_hitbox_radius_and_height", nil}, {"obj_set_hurtbox_radius_and_height", nil}, {"obj_set_move_angle", nil}, {"obj_set_parent_relative_pos", nil}, {"obj_set_pos", nil}, {"obj_set_throw_matrix_from_transform", nil}, {"obj_spawn_loot_blue_coins", nil}, {"obj_spawn_loot_coins", nil}, {"obj_spawn_loot_yellow_coins", nil}, {"obj_translate_local", nil}, {"obj_translate_xyz_random", nil}, {"obj_translate_xz_random", nil}, {"spawn_water_droplet", nil}, {"set_object_respawn_info_bits", nil}, {"queue_rumble_data_object", nil}, {"smlua_anim_util_get_current_animation_name", nil}, {"smlua_anim_util_set_animation", nil}, {"obj_check_overlap_with_hitbox_params", nil}, {"obj_get_collided_object", nil}, {"obj_get_field_f32", nil}, {"obj_get_field_s16", nil}, {"obj_get_field_s32", nil}, {"obj_get_field_u32", nil}, {"obj_get_next", nil}, {"obj_get_model_id_extended", nil}, {"obj_get_nearest_object_with_behavior_id", nil}, -- gore {"obj_get_next_with_same_behavior_id", nil}, {"obj_get_next_with_same_behavior_id_and_field_f32", nil}, {"obj_get_next_with_same_behavior_id_and_field_s32", nil}, {"obj_has_behavior_id", 0}, {"obj_has_model_extended", 0}, {"obj_is_attackable", false}, {"obj_is_breakable_object", false}, {"obj_is_bully", false}, {"obj_is_coin", false}, {"obj_is_exclamation_box", false}, {"obj_is_grabbable", false}, {"obj_is_mushroom_1up", false}, {"obj_is_secret", false}, {"obj_is_valid_for_interaction", false}, {"obj_move_xyz", nil}, {"obj_set_field_f32", nil}, {"obj_set_field_s16", nil}, {"obj_set_field_s32", nil}, {"obj_set_field_u32", nil}, {"obj_set_model_extended", nil}, {"obj_set_vel", nil}, {"set_cutscene_focus", nil}, {"set_secondary_camera_focus", nil}, {"obj_get_surface_from_index", nil}, } -- name, default return local two_object_funcs = { {"dist_between_objects", 0}, -- super forms reborn {"lateral_dist_between_objects", 0}, {"is_nearest_player_to_object", 0}, {"obj_angle_to_object", 0}, -- sm64 remix v4 {"obj_check_hitbox_overlap", false}, -- gore {"obj_check_if_collided_with_object", 0}, {"obj_copy_angle", nil}, {"obj_copy_behavior_params", nil}, {"obj_copy_graph_y_offset", nil}, {"obj_copy_pos", nil}, {"obj_copy_pos_and_angle", nil}, {"obj_copy_scale", nil}, {"obj_pitch_to_object", 0}, {"obj_set_gfx_pos_at_obj_pos", nil}, {"obj_set_pos_relative", nil}, {"obj_turn_toward_object", nil}, } -- name, default return, where o is local other_object_funcs = { {"cutscene_object", 0, 2}, {"cutscene_object_with_dialog", 0, 2}, {"cutscene_object_without_dialog", 0, 2}, {"object_pos_to_vec3f", nil}, {"determine_interaction", 0, 2}, {"interact_bbh_entrance", 0, 3}, {"interact_bounce_top", 0, 3}, {"interact_bully", 0, 3}, {"interact_cannon_base", 0, 3}, {"interact_cap", 0, 3}, {"interact_clam_or_bubba", 0, 3}, {"interact_coin", 0, 3}, {"interact_damage", 0, 3}, {"interact_door", 0, 3}, {"interact_flame", 0, 3}, {"interact_grabbable", 0, 3}, {"interact_hit_from_below", 0, 3}, {"interact_hoot", 0, 3}, {"interact_igloo_barrier", 0, 3}, {"interact_koopa_shell", 0, 3}, {"interact_mr_blizzard", 0, 3}, {"interact_player", 0, 3}, {"interact_pole", 0, 3}, {"interact_shock", 0, 3}, {"interact_snufit_bullet", 0, 3}, {"interact_spiny_walking", 0, 3}, {"interact_star_or_key", 0, 3}, {"interact_strong_wind", 0, 3}, {"interact_text", 0, 3}, {"interact_tornado", 0, 3}, {"interact_warp", 0, 3}, {"interact_warp_door", 0, 3}, {"interact_water_ring", 0, 3}, {"interact_whirlpool", 0, 3}, {"mario_obj_angle_to_object", 0, 2}, {"should_push_or_pull_door", 0, 2}, {"take_damage_and_knock_back", 0, 2}, {"area_create_warp_node", 0, 6}, {"should_start_or_continue_dialog", 0, 2}, {"is_nearest_mario_state_to_object", 0, 2}, {"obj_update_pos_from_parent_transformation", 0, 2}, } for i, funcData in ipairs(one_object_funcs) do local funcName = funcData[1] _ENV["orig_"..funcName] = _ENV[funcName] _G[funcName] = function(o, ...) if not o then return funcData[2] end return _ENV["orig_"..funcName](o, ...) end end for i, funcData in ipairs(two_object_funcs) do local funcName = funcData[1] _ENV["orig_"..funcName] = _ENV[funcName] _G[funcName] = function(o1, o2, ...) if not (o1 and o2) then return funcData[2] end return _ENV["orig_"..funcName](o1, o2, ...) end end for i, funcData in ipairs(other_object_funcs) do local funcName = funcData[1] local oSpot = funcData[3] _ENV["orig_"..funcName] = _ENV[funcName] _G[funcName] = function(...) local o = arg[oSpot] if not o then return funcData[2] end return _ENV["orig_"..funcName](...) end end