rework patches

This commit is contained in:
Mister_Nebula 2021-06-18 21:54:32 +01:00
parent c50978b68b
commit 5c7abe164a
26 changed files with 477 additions and 264 deletions

217
QSB.editorconfig Normal file
View File

@ -0,0 +1,217 @@
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = tab
tab_width = 4
# New line preferences
end_of_line = crlf
insert_final_newline = false
#### .NET Coding Conventions ####
# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = false
file_header_template = unset
# this. and Me. preferences
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_qualification_for_field = false
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
dotnet_style_predefined_type_for_member_access = true:warning
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members
# Expression-level preferences
dotnet_style_coalesce_expression = true
dotnet_style_collection_initializer = true
dotnet_style_explicit_tuple_names = true
dotnet_style_namespace_match_folder = true
dotnet_style_null_propagation = true
dotnet_style_object_initializer = true
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_compound_assignment = true
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true
dotnet_style_prefer_inferred_tuple_names = true
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
dotnet_style_prefer_simplified_boolean_expressions = true
dotnet_style_prefer_simplified_interpolation = true
# Field preferences
dotnet_style_readonly_field = true
# Parameter preferences
dotnet_code_quality_unused_parameters = all
# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none
# New line preferences
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
dotnet_style_allow_statement_immediately_after_block_experimental = false:warning
#### C# Coding Conventions ####
# var preferences
csharp_style_var_elsewhere = true:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
# Expression-bodied members
csharp_style_expression_bodied_accessors = true
csharp_style_expression_bodied_constructors = false
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_operators = false
csharp_style_expression_bodied_properties = true
# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true
csharp_style_pattern_matching_over_is_with_cast_check = true
csharp_style_prefer_not_pattern = true
csharp_style_prefer_pattern_matching = true:suggestion
csharp_style_prefer_switch_expression = true
# Null-checking preferences
csharp_style_conditional_delegate_call = true
# Modifier preferences
csharp_prefer_static_local_function = true
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
# Code-block preferences
csharp_prefer_braces = true:suggestion
csharp_prefer_simple_using_statement = false
# Expression-level preferences
csharp_prefer_simple_default_expression = true
csharp_style_deconstructed_variable_declaration = true
csharp_style_implicit_object_creation_when_type_is_apparent = true
csharp_style_inlined_variable_declaration = true
csharp_style_pattern_local_over_anonymous_function = true
csharp_style_prefer_index_operator = true
csharp_style_prefer_range_operator = true
csharp_style_throw_expression = true
csharp_style_unused_value_assignment_preference = discard_variable
csharp_style_unused_value_expression_statement_preference = discard_variable
# 'using' directive preferences
csharp_using_directive_placement = outside_namespace
# New line preferences
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false:warning
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:warning
csharp_style_allow_embedded_statements_on_same_line_experimental = false:warning
#### C# Formatting Rules ####
# New line preferences
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true
#### Naming styles ####
# Naming rules
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# Symbol specifications
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

View File

@ -18,27 +18,16 @@ namespace QSB.Animation.NPC.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPrefix<CharacterAnimController>("OnAnimatorIK", typeof(CharacterAnimationPatches), nameof(AnimController_OnAnimatorIK));
QSBCore.HarmonyHelper.AddPrefix<CharacterAnimController>("OnZoneEntry", typeof(CharacterAnimationPatches), nameof(AnimController_OnZoneEntry));
QSBCore.HarmonyHelper.AddPrefix<CharacterAnimController>("OnZoneExit", typeof(CharacterAnimationPatches), nameof(AnimController_OnZoneExit));
QSBCore.HarmonyHelper.AddPrefix<FacePlayerWhenTalking>("OnStartConversation", typeof(CharacterAnimationPatches), nameof(FacePlayerWhenTalking_OnStartConversation));
QSBCore.HarmonyHelper.AddPrefix<CharacterDialogueTree>("StartConversation", typeof(CharacterAnimationPatches), nameof(CharacterDialogueTree_StartConversation));
QSBCore.HarmonyHelper.AddPrefix<CharacterDialogueTree>("EndConversation", typeof(CharacterAnimationPatches), nameof(CharacterDialogueTree_EndConversation));
QSBCore.HarmonyHelper.AddPrefix<KidRockController>("Update", typeof(CharacterAnimationPatches), nameof(KidRockController_Update));
Prefix(nameof(CharacterAnimController_OnAnimatorIK));
Prefix(nameof(CharacterAnimController_OnZoneEntry));
Prefix(nameof(CharacterAnimController_OnZoneExit));
Prefix(nameof(FacePlayerWhenTalking_OnStartConversation));
Prefix(nameof(CharacterDialogueTree_StartConversation));
Prefix(nameof(CharacterDialogueTree_EndConversation));
Prefix(nameof(KidRockController_Update));
}
public override void DoUnpatches()
{
QSBCore.HarmonyHelper.Unpatch<CharacterAnimController>("OnAnimatorIK");
QSBCore.HarmonyHelper.Unpatch<CharacterAnimController>("OnZoneEntry");
QSBCore.HarmonyHelper.Unpatch<CharacterAnimController>("OnZoneExit");
QSBCore.HarmonyHelper.Unpatch<FacePlayerWhenTalking>("OnStartConversation");
QSBCore.HarmonyHelper.Unpatch<CharacterDialogueTree>("StartConversation");
QSBCore.HarmonyHelper.Unpatch<CharacterDialogueTree>("EndConversation");
QSBCore.HarmonyHelper.Unpatch<KidRockController>("Update");
}
public static bool AnimController_OnAnimatorIK(
public static bool CharacterAnimController_OnAnimatorIK(
CharacterAnimController __instance,
float ___headTrackingWeight,
bool ___lookOnlyWhenTalking,
@ -114,14 +103,14 @@ namespace QSB.Animation.NPC.Patches
}
public static bool AnimController_OnZoneExit(CharacterAnimController __instance)
public static bool CharacterAnimController_OnZoneExit(CharacterAnimController __instance)
{
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBCharacterAnimController, CharacterAnimController>(__instance);
QSBEventManager.FireEvent(EventNames.QSBExitHeadZone, qsbObj.ObjectId);
return false;
}
public static bool AnimController_OnZoneEntry(CharacterAnimController __instance)
public static bool CharacterAnimController_OnZoneEntry(CharacterAnimController __instance)
{
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBCharacterAnimController, CharacterAnimController>(__instance);
QSBEventManager.FireEvent(EventNames.QSBEnterHeadZone, qsbObj.ObjectId);

View File

@ -10,8 +10,8 @@ namespace QSB.Animation.Patches
{
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
public override void DoPatches() => QSBCore.HarmonyHelper.AddPrefix<PlayerAnimController>("LateUpdate", typeof(PlayerAnimationPatches), nameof(PlayerAnimController_LateUpdate));
public override void DoUnpatches() => QSBCore.HarmonyHelper.Unpatch<PlayerAnimController>("LateUpdate");
public override void DoPatches()
=> Prefix(nameof(PlayerAnimController_LateUpdate));
public static bool PlayerAnimController_LateUpdate(
PlayerAnimController __instance,

View File

@ -9,8 +9,7 @@ namespace QSB.CampfireSync.Patches
{
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
public override void DoPatches() => QSBCore.HarmonyHelper.AddPrefix<Campfire>("OnPressInteract", typeof(CampfirePatches), nameof(Campfire_OnPressInteract));
public override void DoUnpatches() => QSBCore.HarmonyHelper.Unpatch<Campfire>("OnPressInteract");
public override void DoPatches() => Prefix(nameof(Campfire_OnPressInteract));
public static bool Campfire_OnPressInteract(Campfire __instance, Campfire.State ____state)
{

View File

@ -13,21 +13,13 @@ namespace QSB.ConversationSync.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPostfix<DialogueNode>("GetNextPage", typeof(ConversationPatches), nameof(Node_GetNextPage));
QSBCore.HarmonyHelper.AddPrefix<CharacterDialogueTree>("InputDialogueOption", typeof(ConversationPatches), nameof(Tree_InputDialogueOption));
QSBCore.HarmonyHelper.AddPrefix<CharacterDialogueTree>("StartConversation", typeof(ConversationPatches), nameof(Tree_StartConversation));
QSBCore.HarmonyHelper.AddPrefix<CharacterDialogueTree>("EndConversation", typeof(ConversationPatches), nameof(Tree_EndConversation));
Postfix(nameof(DialogueNode_GetNextPage));
Prefix(nameof(CharacterDialogueTree_InputDialogueOption));
Prefix(nameof(CharacterDialogueTree_StartConversation));
Prefix(nameof(CharacterDialogueTree_EndConversation));
}
public override void DoUnpatches()
{
QSBCore.HarmonyHelper.Unpatch<DialogueNode>("GetNextPage");
QSBCore.HarmonyHelper.Unpatch<CharacterDialogueTree>("InputDialogueOption");
QSBCore.HarmonyHelper.Unpatch<CharacterDialogueTree>("StartConversation");
QSBCore.HarmonyHelper.Unpatch<CharacterDialogueTree>("EndConversation");
}
public static void Tree_StartConversation(CharacterDialogueTree __instance)
public static void CharacterDialogueTree_StartConversation(CharacterDialogueTree __instance)
{
var index = QSBWorldSync.OldDialogueTrees.FindIndex(x => x == __instance);
if (index == -1)
@ -38,7 +30,7 @@ namespace QSB.ConversationSync.Patches
ConversationManager.Instance.SendConvState(index, true);
}
public static bool Tree_EndConversation(CharacterDialogueTree __instance)
public static bool CharacterDialogueTree_EndConversation(CharacterDialogueTree __instance)
{
if (!__instance.enabled)
{
@ -56,7 +48,7 @@ namespace QSB.ConversationSync.Patches
return true;
}
public static bool Tree_InputDialogueOption(int optionIndex, DialogueBoxVer2 ____currentDialogueBox)
public static bool CharacterDialogueTree_InputDialogueOption(int optionIndex, DialogueBoxVer2 ____currentDialogueBox)
{
if (optionIndex < 0)
{
@ -70,7 +62,7 @@ namespace QSB.ConversationSync.Patches
return true;
}
public static void Node_GetNextPage(string ____name, List<string> ____listPagesToDisplay, int ____currentPage)
public static void DialogueNode_GetNextPage(string ____name, List<string> ____listPagesToDisplay, int ____currentPage)
{
var key = ____name + ____listPagesToDisplay[____currentPage];
// Sending key so translation can be done on client side - should make different language-d clients compatible

View File

@ -16,27 +16,27 @@ namespace QSB.DeathSync.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPrefix<DeathManager>("KillPlayer", typeof(DeathPatches), nameof(PreFinishDeathSequence));
QSBCore.HarmonyHelper.AddPostfix<DeathManager>("KillPlayer", typeof(DeathPatches), nameof(BroadcastDeath));
QSBCore.HarmonyHelper.Transpile<ShipDetachableLeg>("Detach", typeof(DeathPatches), nameof(ReturnNull));
QSBCore.HarmonyHelper.Transpile<ShipDetachableModule>("Detach", typeof(DeathPatches), nameof(ReturnNull));
QSBCore.HarmonyHelper.EmptyMethod<ShipEjectionSystem>("OnPressInteract");
QSBCore.HarmonyHelper.AddPostfix<ShipDamageController>("Awake", typeof(DeathPatches), nameof(DamageController_Exploded));
QSBCore.HarmonyHelper.AddPrefix<DestructionVolume>("VanishShip", typeof(DeathPatches), nameof(DestructionVolume_VanishShip));
QSBCore.HarmonyHelper.AddPrefix<HighSpeedImpactSensor>("FixedUpdate", typeof(DeathPatches), nameof(HighSpeedImpactSensor_FixedUpdate));
QSBCore.HarmonyHelper.AddPrefix<PlayerResources>("OnImpact", typeof(DeathPatches), nameof(PlayerResources_OnImpact));
Prefix(nameof(DeathManager_KillPlayer_Prefix));
Postfix(nameof(DeathManager_KillPlayer_Postfix));
Prefix(nameof(ShipDetachableLeg_Detach));
Prefix(nameof(ShipDetachableModule_Detach));
Empty("ShipEjectionSystem_OnPressInteract");
Postfix(nameof(ShipDamageController_Awake));
Prefix(nameof(DestructionVolume_VanishShip));
Prefix(nameof(HighSpeedImpactSensor_FixedUpdate));
Prefix(nameof(PlayerResources_OnImpact));
}
public override void DoUnpatches()
public static bool ShipDetachableLeg_Detach(ref OWRigidbody __result)
{
QSBCore.HarmonyHelper.Unpatch<DeathManager>("KillPlayer");
QSBCore.HarmonyHelper.Unpatch<ShipDetachableLeg>("Detach");
QSBCore.HarmonyHelper.Unpatch<ShipDetachableModule>("Detach");
QSBCore.HarmonyHelper.Unpatch<ShipEjectionSystem>("OnPressInteract");
QSBCore.HarmonyHelper.Unpatch<ShipDamageController>("Awake");
QSBCore.HarmonyHelper.Unpatch<DestructionVolume>("VanishShip");
QSBCore.HarmonyHelper.Unpatch<HighSpeedImpactSensor>("FixedUpdate");
QSBCore.HarmonyHelper.Unpatch<PlayerResources>("OnImpact");
__result = null;
return false;
}
public static bool ShipDetachableModule_Detach(ref OWRigidbody __result)
{
__result = null;
return false;
}
public static bool PlayerResources_OnImpact(ImpactData impact, PlayerResources __instance, float ____currentHealth)
@ -181,7 +181,7 @@ namespace QSB.DeathSync.Patches
return false;
}
public static bool PreFinishDeathSequence(DeathType deathType)
public static bool DeathManager_KillPlayer_Prefix(DeathType deathType)
{
if (RespawnOnDeath.Instance == null)
{
@ -204,10 +204,10 @@ namespace QSB.DeathSync.Patches
return false;
}
public static void BroadcastDeath(DeathType deathType)
public static void DeathManager_KillPlayer_Postfix(DeathType deathType)
=> QSBEventManager.FireEvent(EventNames.QSBPlayerDeath, deathType);
public static void DamageController_Exploded(ref bool ____exploded)
public static void ShipDamageController_Awake(ref bool ____exploded)
=> ____exploded = true;
public static IEnumerable<CodeInstruction> ReturnNull(IEnumerable<CodeInstruction> instructions)

View File

@ -10,15 +10,14 @@ namespace QSB.ElevatorSync.Patches
{
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
public static void StartLift(Elevator __instance)
public static void Elevator_StartLift(Elevator __instance)
{
var isGoingUp = __instance.GetValue<bool>("_goingToTheEnd");
var id = QSBWorldSync.GetIdFromUnity<QSBElevator, Elevator>(__instance);
QSBEventManager.FireEvent(EventNames.QSBStartLift, id, isGoingUp);
}
public override void DoPatches() => QSBCore.HarmonyHelper.AddPostfix<Elevator>("StartLift", typeof(ElevatorPatches), nameof(StartLift));
public override void DoUnpatches() => QSBCore.HarmonyHelper.Unpatch<Elevator>("StartLift");
public override void DoPatches()
=> Postfix(nameof(Elevator_StartLift));
}
}

View File

@ -9,20 +9,14 @@ namespace QSB.FrequencySync.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPostfix<AudioSignal>("IdentifyFrequency", typeof(FrequencyPatches), nameof(IdentifyFrequency));
QSBCore.HarmonyHelper.AddPostfix<AudioSignal>("IdentifySignal", typeof(FrequencyPatches), nameof(IdentifySignal));
Postfix(nameof(AudioSignal_IdentifyFrequency));
Postfix(nameof(AudioSignal_IdentifySignal));
}
public override void DoUnpatches()
{
QSBCore.HarmonyHelper.Unpatch<AudioSignal>("IdentifyFrequency");
QSBCore.HarmonyHelper.Unpatch<AudioSignal>("IdentifySignal");
}
public static void IdentifyFrequency(SignalFrequency ____frequency)
public static void AudioSignal_IdentifyFrequency(SignalFrequency ____frequency)
=> QSBEventManager.FireEvent(EventNames.QSBIdentifyFrequency, ____frequency);
public static void IdentifySignal(SignalName ____name)
public static void AudioSignal_IdentifySignal(SignalName ____name)
=> QSBEventManager.FireEvent(EventNames.QSBIdentifySignal, ____name);
}
}

View File

@ -6,7 +6,6 @@ namespace QSB.GeyserSync.Patches
{
public override QSBPatchTypes Type => QSBPatchTypes.OnNonServerClientConnect;
public override void DoPatches() => QSBCore.HarmonyHelper.EmptyMethod<GeyserController>("Update");
public override void DoUnpatches() => QSBCore.HarmonyHelper.Unpatch<GeyserController>("Update");
public override void DoPatches() => Empty("GeyserController_Update");
}
}

View File

@ -7,10 +7,7 @@ namespace QSB.Inputs.Patches
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
public override void DoPatches()
=> QSBCore.HarmonyHelper.AddPrefix<OWInput>("Update", typeof(InputPatches), nameof(OWInput_Update));
public override void DoUnpatches()
=> QSBCore.HarmonyHelper.Unpatch<OWInput>("Update");
=> Prefix(nameof(OWInput_Update));
public static bool OWInput_Update()
=> QSBInputManager.Instance.InputsEnabled;

View File

@ -13,20 +13,11 @@ namespace QSB.ItemSync.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPrefix<ItemTool>("MoveItemToCarrySocket", typeof(ItemPatches), nameof(ItemTool_MoveItemToCarrySocket));
QSBCore.HarmonyHelper.AddPrefix<ItemTool>("SocketItem", typeof(ItemPatches), nameof(ItemTool_SocketItem));
QSBCore.HarmonyHelper.AddPrefix<ItemTool>("StartUnsocketItem", typeof(ItemPatches), nameof(ItemTool_StartUnsocketItem));
QSBCore.HarmonyHelper.AddPrefix<ItemTool>("CompleteUnsocketItem", typeof(ItemPatches), nameof(ItemTool_CompleteUnsocketItem));
QSBCore.HarmonyHelper.AddPrefix<ItemTool>("DropItem", typeof(ItemPatches), nameof(ItemTool_DropItem));
}
public override void DoUnpatches()
{
QSBCore.HarmonyHelper.Unpatch<ItemTool>("MoveItemToCarrySocket");
QSBCore.HarmonyHelper.Unpatch<ItemTool>("SocketItem");
QSBCore.HarmonyHelper.Unpatch<ItemTool>("StartUnsocketItem");
QSBCore.HarmonyHelper.Unpatch<ItemTool>("CompleteUnsocketItem");
QSBCore.HarmonyHelper.Unpatch<ItemTool>("DropItem");
Prefix(nameof(ItemTool_MoveItemToCarrySocket));
Prefix(nameof(ItemTool_SocketItem));
Prefix(nameof(ItemTool_StartUnsocketItem));
Prefix(nameof(ItemTool_CompleteUnsocketItem));
Prefix(nameof(ItemTool_DropItem));
}
public static bool ItemTool_MoveItemToCarrySocket(OWItem item)

View File

@ -7,7 +7,7 @@ namespace QSB.LogSync.Patches
{
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
public static void RevealFact(string id, bool saveGame, bool showNotification, bool __result)
public static void ShipLogManager_RevealFact(string id, bool saveGame, bool showNotification, bool __result)
{
if (!__result)
{
@ -16,8 +16,6 @@ namespace QSB.LogSync.Patches
QSBEventManager.FireEvent(EventNames.QSBRevealFact, id, saveGame, showNotification);
}
public override void DoPatches() => QSBCore.HarmonyHelper.AddPostfix<ShipLogManager>("RevealFact", typeof(LogPatches), nameof(RevealFact));
public override void DoUnpatches() => QSBCore.HarmonyHelper.Unpatch<ShipLogManager>("RevealFact");
public override void DoPatches() => Postfix(nameof(ShipLogManager_RevealFact));
}
}

View File

@ -9,7 +9,7 @@ namespace QSB.OrbSync.Patches
{
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
public static void StartDragCallEvent(bool __result, NomaiInterfaceOrb __instance)
public static void NomaiInterfaceOrb_StartDragFromPosition(bool __result, NomaiInterfaceOrb __instance)
{
if (__result)
{
@ -17,7 +17,7 @@ namespace QSB.OrbSync.Patches
}
}
public static bool CheckOrbCollision(ref bool __result, NomaiInterfaceSlot __instance, NomaiInterfaceOrb orb,
public static bool NomaiInterfaceSlot_CheckOrbCollision(ref bool __result, NomaiInterfaceSlot __instance, NomaiInterfaceOrb orb,
bool ____ignoreDraggedOrbs, float ____radius, float ____exitRadius, ref NomaiInterfaceOrb ____occupyingOrb)
{
if (____ignoreDraggedOrbs && orb.IsBeingDragged())
@ -57,14 +57,8 @@ namespace QSB.OrbSync.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPostfix<NomaiInterfaceOrb>("StartDragFromPosition", typeof(OrbPatches), nameof(StartDragCallEvent));
QSBCore.HarmonyHelper.AddPrefix<NomaiInterfaceSlot>("CheckOrbCollision", typeof(OrbPatches), nameof(CheckOrbCollision));
}
public override void DoUnpatches()
{
QSBCore.HarmonyHelper.Unpatch<NomaiInterfaceOrb>("StartDragFromPosition");
QSBCore.HarmonyHelper.Unpatch<NomaiInterfaceSlot>("CheckOrbCollision");
Postfix(nameof(NomaiInterfaceOrb_StartDragFromPosition));
Prefix(nameof(NomaiInterfaceSlot_CheckOrbCollision));
}
}
}

View File

@ -1,9 +1,100 @@
namespace QSB.Patches
using Harmony;
using OWML.Common;
using OWML.Utils;
using QSB.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace QSB.Patches
{
public abstract class QSBPatch
{
public abstract QSBPatchTypes Type { get; }
public abstract void DoPatches();
public abstract void DoUnpatches();
public void DoUnpatches()
{
var instance = QSBCore.Helper.HarmonyHelper.GetValue<HarmonyInstance>("_harmony");
foreach (var item in _patchedMethods)
{
DebugLog.DebugWrite($"[Unpatch] {item.DeclaringType}.{item.Name}", MessageType.Info);
instance.Unpatch(item, HarmonyPatchType.All);
}
_patchedMethods.Clear();
}
private List<MethodInfo> _patchedMethods = new List<MethodInfo>();
public void Empty(string patchName)
{
DebugLog.DebugWrite($"[Empty] {patchName}", MessageType.Info);
var method = GetMethodInfo(patchName);
QSBCore.Helper.HarmonyHelper.EmptyMethod(method);
}
public void Prefix(string patchName)
=> DoPrefixPostfix(true, patchName);
public void Postfix(string patchName)
=> DoPrefixPostfix(false, patchName);
private void DoPrefixPostfix(bool isPrefix, string patchName)
{
var method = GetMethodInfo(patchName);
if (method != null)
{
if (isPrefix)
{
QSBCore.Helper.HarmonyHelper.AddPrefix(method, GetType(), patchName);
}
else
{
QSBCore.Helper.HarmonyHelper.AddPostfix(method, GetType(), patchName);
}
_patchedMethods.Add(method);
}
DebugLog.DebugWrite($"{(isPrefix ? "[Prefix]" : "[Postfix]")} {patchName}", method == null ? MessageType.Error : MessageType.Success);
}
private MethodInfo GetMethodInfo(string patchName)
{
var splitName = patchName.Split('_');
var typeName = splitName[0];
var methodName = splitName[1];
var type = GetFirstTypeByName(typeName);
if (type == null)
{
DebugLog.DebugWrite($"Error - Couldn't find type for patch name {patchName}!", MessageType.Error);
return null;
}
var method = type.GetAnyMethod(methodName);
if (method == null)
{
DebugLog.DebugWrite($"Error - Couldn't find method for patch name {patchName}!", MessageType.Error);
return null;
}
return method;
}
private Type GetFirstTypeByName(string typeName)
{
var a = typeof(OWRigidbody).Assembly;
var assemblyTypes = a.GetTypes();
for (int j = 0; j < assemblyTypes.Length; j++)
{
if (assemblyTypes[j].Name == typeName)
{
return assemblyTypes[j];
}
}
return null;
}
}
}

View File

@ -8,14 +8,8 @@ namespace QSB.Player.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPrefix<PlayerCrushedController>("CrushPlayer", typeof(PlayerPatches), nameof(PlayerCrushedController_CrushPlayer));
QSBCore.HarmonyHelper.AddPrefix<PauseMenuManager>("OnExitToMainMenu", typeof(PlayerPatches), nameof(PauseMenuManager_OnExitToMainMenu));
}
public override void DoUnpatches()
{
QSBCore.HarmonyHelper.Unpatch<PlayerCrushedController>("CrushPlayer");
QSBCore.HarmonyHelper.Unpatch<PauseMenuManager>("OnExitToMainMenu");
Prefix(nameof(PlayerCrushedController_CrushPlayer));
Prefix(nameof(PauseMenuManager_OnExitToMainMenu));
}
public static bool PlayerCrushedController_CrushPlayer()

View File

@ -8,32 +8,27 @@ namespace QSB.PoolSync.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraPlatform>("Awake", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraPlatform>("Update", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraPlatform>("OnSocketableRemoved", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraPlatform>("OnSocketableDonePlacing", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraPlatform>("OnPedestalContact", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("FixedUpdate", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("OnSectorOccupantAdded", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("OnSectorOccupantRemoved", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("OnEntry", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("OnExit", typeof(PoolPatches), nameof(ReturnFalse));
Prefix(nameof(NomaiRemoteCameraPlatform_Awake));
Prefix(nameof(NomaiRemoteCameraPlatform_Update));
Prefix(nameof(NomaiRemoteCameraPlatform_OnSocketableRemoved));
Prefix(nameof(NomaiRemoteCameraPlatform_OnSocketableDonePlacing));
Prefix(nameof(NomaiRemoteCameraPlatform_OnPedestalContact));
Prefix(nameof(NomaiRemoteCameraStreaming_FixedUpdate));
Prefix(nameof(NomaiRemoteCameraStreaming_OnSectorOccupantAdded));
Prefix(nameof(NomaiRemoteCameraStreaming_OnSectorOccupantRemoved));
Prefix(nameof(NomaiRemoteCameraStreaming_OnEntry));
Prefix(nameof(NomaiRemoteCameraStreaming_OnExit));
}
public override void DoUnpatches()
{
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraPlatform>("Awake");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraPlatform>("Update");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraPlatform>("OnSocketableRemoved");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraPlatform>("OnSocketableDonePlacing");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraPlatform>("OnPedestalContact");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("FixedUpdate");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("OnSectorOccupantAdded");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("OnSectorOccupantRemoved");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("OnEntry");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("OnExit");
}
public static bool ReturnFalse() => false;
public static bool NomaiRemoteCameraPlatform_Awake() => false;
public static bool NomaiRemoteCameraPlatform_Update() => false;
public static bool NomaiRemoteCameraPlatform_OnSocketableRemoved() => false;
public static bool NomaiRemoteCameraPlatform_OnSocketableDonePlacing() => false;
public static bool NomaiRemoteCameraPlatform_OnPedestalContact() => false;
public static bool NomaiRemoteCameraStreaming_FixedUpdate() => false;
public static bool NomaiRemoteCameraStreaming_OnSectorOccupantAdded() => false;
public static bool NomaiRemoteCameraStreaming_OnSectorOccupantRemoved() => false;
public static bool NomaiRemoteCameraStreaming_OnEntry() => false;
public static bool NomaiRemoteCameraStreaming_OnExit() => false;
}
}

View File

@ -55,7 +55,6 @@ namespace QSB
public class QSBCore : ModBehaviour
{
public static IModHelper Helper { get; private set; }
public static IHarmonyHelper HarmonyHelper => Helper.HarmonyHelper;
public static IModUnityEvents UnityEvents => Helper.Events.Unity;
public static string DefaultServerIP { get; private set; }
public static int Port { get; private set; }
@ -246,4 +245,28 @@ namespace QSB
ShowLinesInDebug = config.GetSettingsValue<bool>("showLinesInDebug");
}
}
}
}
/*
* _nebula's music thanks
* I listen to music constantly while programming/working - here's my thanks to them for keeping me entertained :P
*
* Wintergatan
* HOME
* C418
* Lupus Nocte
* Max Cooper
* Darren Korb
* Harry Callaghan
* Toby Fox
* Andrew Prahlow
* Valve (Mike Morasky, Kelly Bailey)
* Joel Nielsen
* Vulfpeck
* Detektivbyrån
* Ben Prunty
* ConcernedApe
* Jake Chudnow
* Murray Gold
* Teleskärm
*/

View File

@ -9,19 +9,14 @@ namespace QSB.QuantumSync.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPrefix<QuantumMoon>("ChangeQuantumState", typeof(ClientQuantumPatches), nameof(ReturnFalsePatch));
QSBCore.HarmonyHelper.AddPostfix<QuantumMoon>("Start", typeof(ClientQuantumPatches), nameof(Moon_CollapseOnStart));
Prefix(nameof(QuantumMoon_ChangeQuantumState));
Postfix(nameof(QuantumMoon_Start));
}
public override void DoUnpatches()
{
QSBCore.HarmonyHelper.Unpatch<QuantumMoon>("ChangeQuantumState");
QSBCore.HarmonyHelper.Unpatch<QuantumMoon>("Start");
}
public static void Moon_CollapseOnStart(QuantumMoon __instance)
public static void QuantumMoon_Start(QuantumMoon __instance)
=> __instance.GetType().GetMethod("SetSurfaceState", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { -1 });
public static bool ReturnFalsePatch() => false;
public static bool QuantumMoon_ChangeQuantumState()
=> false;
}
}

View File

@ -18,43 +18,28 @@ namespace QSB.QuantumSync.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPrefix<SocketedQuantumObject>("ChangeQuantumState", typeof(QuantumPatches), nameof(Socketed_ChangeQuantumState));
QSBCore.HarmonyHelper.AddPostfix<SocketedQuantumObject>("MoveToSocket", typeof(QuantumPatches), nameof(Socketed_MoveToSocket));
QSBCore.HarmonyHelper.AddPrefix<QuantumShuffleObject>("ChangeQuantumState", typeof(QuantumPatches), nameof(Shuffle_ChangeQuantumState));
QSBCore.HarmonyHelper.AddPrefix<MultiStateQuantumObject>("ChangeQuantumState", typeof(QuantumPatches), nameof(MultiState_ChangeQuantumState));
QSBCore.HarmonyHelper.AddPostfix<QuantumState>("SetVisible", typeof(QuantumPatches), nameof(QuantumState_SetVisible));
QSBCore.HarmonyHelper.AddPrefix<QuantumShrine>("IsPlayerInDarkness", typeof(QuantumPatches), nameof(Shrine_IsPlayerInDarkness));
QSBCore.HarmonyHelper.AddPrefix<QuantumShrine>("ChangeQuantumState", typeof(QuantumPatches), nameof(Shrine_ChangeQuantumState));
QSBCore.HarmonyHelper.AddPrefix<QuantumShrine>("OnEntry", typeof(QuantumPatches), nameof(Shrine_OnEntry));
QSBCore.HarmonyHelper.AddPrefix<QuantumShrine>("OnExit", typeof(QuantumPatches), nameof(Shrine_OnExit));
QSBCore.HarmonyHelper.AddPrefix<QuantumMoon>("CheckPlayerFogProximity", typeof(QuantumPatches), nameof(Moon_CheckPlayerFogProximity));
QSBCore.HarmonyHelper.AddPrefix<QuantumObject>("IsLockedByPlayerContact", typeof(QuantumPatches), nameof(Object_IsLockedByPlayerContact));
QSBCore.HarmonyHelper.AddPrefix<MultiStateQuantumObject>("Start", typeof(QuantumPatches), nameof(MultiState_Start));
Prefix(nameof(SocketedQuantumObject_ChangeQuantumState));
Postfix(nameof(SocketedQuantumObject_MoveToSocket));
Prefix(nameof(QuantumShuffleObject_ChangeQuantumState));
Prefix(nameof(MultiStateQuantumObject_ChangeQuantumState));
Postfix(nameof(QuantumState_SetVisible));
Prefix(nameof(QuantumShrine_IsPlayerInDarkness));
Prefix(nameof(QuantumShrine_ChangeQuantumState));
Prefix(nameof(QuantumShrine_OnEntry));
Prefix(nameof(QuantumShrine_OnExit));
Prefix(nameof(QuantumMoon_CheckPlayerFogProximity));
Prefix(nameof(QuantumObject_IsLockedByPlayerContact));
Prefix(nameof(MultiStateQuantumObject_Start));
}
public override void DoUnpatches()
{
QSBCore.HarmonyHelper.Unpatch<SocketedQuantumObject>("ChangeQuantumState");
QSBCore.HarmonyHelper.Unpatch<SocketedQuantumObject>("MoveToSocket");
QSBCore.HarmonyHelper.Unpatch<QuantumShuffleObject>("ChangeQuantumState");
QSBCore.HarmonyHelper.Unpatch<MultiStateQuantumObject>("ChangeQuantumState");
QSBCore.HarmonyHelper.Unpatch<QuantumState>("SetVisible");
QSBCore.HarmonyHelper.Unpatch<QuantumShrine>("IsPlayerInDarkness");
QSBCore.HarmonyHelper.Unpatch<QuantumShrine>("ChangeQuantumState");
QSBCore.HarmonyHelper.Unpatch<QuantumShrine>("OnEntry");
QSBCore.HarmonyHelper.Unpatch<QuantumShrine>("OnExit");
QSBCore.HarmonyHelper.Unpatch<QuantumMoon>("CheckPlayerFogProximity");
QSBCore.HarmonyHelper.Unpatch<QuantumObject>("IsLockedByPlayerContact");
}
public static bool Object_IsLockedByPlayerContact(ref bool __result, QuantumObject __instance)
public static bool QuantumObject_IsLockedByPlayerContact(ref bool __result, QuantumObject __instance)
{
var playersEntangled = QuantumManager.GetEntangledPlayers(__instance);
__result = playersEntangled.Count() != 0 && __instance.IsIlluminated();
return false;
}
public static bool Socketed_ChangeQuantumState(
public static bool SocketedQuantumObject_ChangeQuantumState(
SocketedQuantumObject __instance,
ref bool __result,
bool skipInstantVisibilityCheck,
@ -161,7 +146,7 @@ namespace QSB.QuantumSync.Patches
return false;
}
public static void Socketed_MoveToSocket(SocketedQuantumObject __instance, QuantumSocket socket)
public static void SocketedQuantumObject_MoveToSocket(SocketedQuantumObject __instance, QuantumSocket socket)
{
if (!WorldObjectManager.AllReady)
{
@ -194,7 +179,7 @@ namespace QSB.QuantumSync.Patches
__instance.transform.localRotation);
}
public static bool Shuffle_ChangeQuantumState(
public static bool QuantumShuffleObject_ChangeQuantumState(
QuantumShuffleObject __instance,
ref List<int> ____indexList,
ref Vector3[] ____localPositions,
@ -239,7 +224,7 @@ namespace QSB.QuantumSync.Patches
return false;
}
public static bool MultiState_Start(MultiStateQuantumObject __instance, Sector ____sector, bool ____collapseOnStart)
public static bool MultiStateQuantumObject_Start(MultiStateQuantumObject __instance, Sector ____sector, bool ____collapseOnStart)
{
if (!WorldObjectManager.AllReady)
{
@ -272,7 +257,7 @@ namespace QSB.QuantumSync.Patches
return false;
}
public static bool MultiState_ChangeQuantumState(MultiStateQuantumObject __instance)
public static bool MultiStateQuantumObject_ChangeQuantumState(MultiStateQuantumObject __instance)
{
if (!WorldObjectManager.AllReady)
{
@ -313,7 +298,7 @@ namespace QSB.QuantumSync.Patches
stateIndex);
}
public static bool Shrine_IsPlayerInDarkness(ref bool __result, Light[] ____lamps, float ____fadeFraction, bool ____isProbeInside, NomaiGateway ____gate)
public static bool QuantumShrine_IsPlayerInDarkness(ref bool __result, Light[] ____lamps, float ____fadeFraction, bool ____isProbeInside, NomaiGateway ____gate)
{
foreach (var lamp in ____lamps)
{
@ -359,14 +344,14 @@ namespace QSB.QuantumSync.Patches
return false;
}
public static bool Shrine_ChangeQuantumState(QuantumShrine __instance)
public static bool QuantumShrine_ChangeQuantumState(QuantumShrine __instance)
{
var shrineWorldObject = QSBWorldSync.GetWorldFromUnity<QSBSocketedQuantumObject, SocketedQuantumObject>(__instance);
var isInControl = shrineWorldObject.ControllingPlayer == QSBPlayerManager.LocalPlayerId;
return isInControl;
}
public static bool Shrine_OnEntry(
public static bool QuantumShrine_OnEntry(
GameObject hitObj,
ref bool ____isPlayerInside,
ref bool ____fading,
@ -387,7 +372,7 @@ namespace QSB.QuantumSync.Patches
return false;
}
public static bool Shrine_OnExit(
public static bool QuantumShrine_OnExit(
GameObject hitObj,
ref bool ____isPlayerInside,
ref bool ____fading,
@ -408,7 +393,7 @@ namespace QSB.QuantumSync.Patches
return false;
}
public static bool Moon_CheckPlayerFogProximity(
public static bool QuantumMoon_CheckPlayerFogProximity(
QuantumMoon __instance,
int ____stateIndex,
float ____eyeStateFogOffset,

View File

@ -13,22 +13,12 @@ namespace QSB.QuantumSync.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPrefix<ShapeVisibilityTracker>("IsVisibleUsingCameraFrustum", typeof(QuantumVisibilityPatches), nameof(ShapeIsVisibleUsingCameraFrustum));
QSBCore.HarmonyHelper.AddPrefix<ShapeVisibilityTracker>("IsVisible", typeof(QuantumVisibilityPatches), nameof(ShapeIsVisible));
QSBCore.HarmonyHelper.AddPrefix<RendererVisibilityTracker>("IsVisibleUsingCameraFrustum", typeof(QuantumVisibilityPatches), nameof(RenderIsVisibleUsingCameraFrustum));
QSBCore.HarmonyHelper.AddPrefix<VisibilityObject>("CheckIllumination", typeof(QuantumVisibilityPatches), nameof(CheckIllumination));
QSBCore.HarmonyHelper.AddPostfix<Shape>("OnEnable", typeof(QuantumVisibilityPatches), nameof(Shape_OnEnable));
QSBCore.HarmonyHelper.AddPostfix<Shape>("OnDisable", typeof(QuantumVisibilityPatches), nameof(Shape_OnDisable));
}
public override void DoUnpatches()
{
QSBCore.HarmonyHelper.Unpatch<ShapeVisibilityTracker>("IsVisibleUsingCameraFrustum");
QSBCore.HarmonyHelper.Unpatch<ShapeVisibilityTracker>("IsVisible");
QSBCore.HarmonyHelper.Unpatch<RendererVisibilityTracker>("IsVisibleUsingCameraFrustum");
QSBCore.HarmonyHelper.Unpatch<VisibilityObject>("CheckIllumination");
QSBCore.HarmonyHelper.Unpatch<Shape>("OnEnable");
QSBCore.HarmonyHelper.Unpatch<Shape>("OnDisable");
Prefix(nameof(ShapeVisibilityTracker_IsVisibleUsingCameraFrustum));
Prefix(nameof(ShapeVisibilityTracker_IsVisible));
Prefix(nameof(RendererVisibilityTracker_IsVisibleUsingCameraFrustum));
Prefix(nameof(VisibilityObject_CheckIllumination));
Postfix(nameof(Shape_OnEnable));
Postfix(nameof(Shape_OnDisable));
}
public static void Shape_OnEnable(Shape __instance)
@ -39,13 +29,13 @@ namespace QSB.QuantumSync.Patches
// ShapeVisibilityTracker patches
public static bool ShapeIsVisibleUsingCameraFrustum(ShapeVisibilityTracker __instance, ref bool __result)
public static bool ShapeVisibilityTracker_IsVisibleUsingCameraFrustum(ShapeVisibilityTracker __instance, ref bool __result)
{
__result = QuantumManager.IsVisibleUsingCameraFrustum(__instance, false).First;
return false;
}
public static bool ShapeIsVisible(ShapeVisibilityTracker __instance, ref bool __result)
public static bool ShapeVisibilityTracker_IsVisible(ShapeVisibilityTracker __instance, ref bool __result)
{
__result = QuantumManager.IsVisible(__instance, false);
return false;
@ -53,7 +43,7 @@ namespace QSB.QuantumSync.Patches
// RendererVisibilityTracker patches - probably not needed as i don't think RendererVisibilityTracker is ever used?
public static bool RenderIsVisibleUsingCameraFrustum(RendererVisibilityTracker __instance, ref bool __result, Renderer ____renderer, bool ____checkFrustumOcclusion)
public static bool RendererVisibilityTracker_IsVisibleUsingCameraFrustum(RendererVisibilityTracker __instance, ref bool __result, Renderer ____renderer, bool ____checkFrustumOcclusion)
{
__result = QSBPlayerManager.GetPlayersWithCameras()
.Any(x => GeometryUtility.TestPlanesAABB(x.Camera.GetFrustumPlanes(), ____renderer.bounds))
@ -66,7 +56,7 @@ namespace QSB.QuantumSync.Patches
// VisibilityObject
public static bool CheckIllumination(VisibilityObject __instance, ref bool __result, bool ____checkIllumination, Vector3 ____localIlluminationOffset, float ____illuminationRadius, Light[] ____lightSources)
public static bool VisibilityObject_CheckIllumination(VisibilityObject __instance, ref bool __result, bool ____checkIllumination, Vector3 ____localIlluminationOffset, float ____illuminationRadius, Light[] ____lightSources)
{
if (!____checkIllumination)
{

View File

@ -14,12 +14,9 @@ namespace QSB.QuantumSync.Patches
public override QSBPatchTypes Type => QSBPatchTypes.OnServerClientConnect;
public override void DoPatches()
=> QSBCore.HarmonyHelper.AddPrefix<QuantumMoon>("ChangeQuantumState", typeof(ServerQuantumPatches), nameof(Moon_ChangeQuantumState));
=> Prefix(nameof(QuantumMoon_ChangeQuantumState));
public override void DoUnpatches()
=> QSBCore.HarmonyHelper.Unpatch<QuantumMoon>("ChangeQuantumState");
public static bool Moon_ChangeQuantumState(
public static bool QuantumMoon_ChangeQuantumState(
QuantumMoon __instance,
ref bool __result,
bool skipInstantVisibilityCheck,

View File

@ -10,16 +10,11 @@ namespace QSB.RoastingSync.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPrefix<RoastingStickController>("UpdateMarshmallowInput", typeof(RoastingPatches), nameof(RoastingStickController_UpdateMarshmallowInput));
QSBCore.HarmonyHelper.AddPrefix<Marshmallow>("Burn", typeof(RoastingPatches), nameof(Marshmallow_Burn));
QSBCore.HarmonyHelper.AddPrefix<Marshmallow>("Shrivel", typeof(RoastingPatches), nameof(Marshmallow_Shrivel));
QSBCore.HarmonyHelper.AddPrefix<Marshmallow>("RemoveMallow", typeof(RoastingPatches), nameof(Marshmallow_RemoveMallow));
QSBCore.HarmonyHelper.AddPrefix<Marshmallow>("SpawnMallow", typeof(RoastingPatches), nameof(Marshmallow_SpawnMallow));
}
public override void DoUnpatches()
{
// TODO : add unpatches
Prefix(nameof(RoastingStickController_UpdateMarshmallowInput));
Prefix(nameof(Marshmallow_Burn));
Prefix(nameof(Marshmallow_Shrivel));
Prefix(nameof(Marshmallow_RemoveMallow));
Prefix(nameof(Marshmallow_SpawnMallow));
}
public static bool Marshmallow_SpawnMallow()

View File

@ -12,18 +12,10 @@ namespace QSB.ShipSync.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPrefix<HatchController>("OnPressInteract", typeof(ShipPatches), nameof(HatchController_OnPressInteract));
QSBCore.HarmonyHelper.AddPrefix<HatchController>("OnEntry", typeof(ShipPatches), nameof(HatchController_OnEntry));
QSBCore.HarmonyHelper.AddPrefix<ShipTractorBeamSwitch>("OnTriggerExit", typeof(ShipPatches), nameof(ShipTractorBeamSwitch_OnTriggerExit));
QSBCore.HarmonyHelper.AddPrefix<InteractZone>("UpdateInteractVolume", typeof(ShipPatches), nameof(InteractZone_UpdateInteractVolume));
}
public override void DoUnpatches()
{
QSBCore.HarmonyHelper.Unpatch<HatchController>("OnPressInteract");
QSBCore.HarmonyHelper.Unpatch<HatchController>("OnEntry");
QSBCore.HarmonyHelper.Unpatch<ShipTractorBeamSwitch>("OnTriggerExit");
QSBCore.HarmonyHelper.Unpatch<InteractZone>("UpdateInteractVolume");
Prefix(nameof(HatchController_OnPressInteract));
Prefix(nameof(HatchController_OnEntry));
Prefix(nameof(ShipTractorBeamSwitch_OnTriggerExit));
Prefix(nameof(InteractZone_UpdateInteractVolume));
}
public static bool HatchController_OnPressInteract()

View File

@ -10,12 +10,9 @@ namespace QSB.StatueSync.Patches
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
public override void DoPatches()
=> QSBCore.HarmonyHelper.AddPrefix<MemoryUplinkTrigger>("Update", typeof(StatuePatches), nameof(Statue_Update));
=> Prefix(nameof(MemoryUplinkTrigger_Update));
public override void DoUnpatches()
=> QSBCore.HarmonyHelper.Unpatch<MemoryUplinkTrigger>("Update");
public static bool Statue_Update(bool ____waitForPlayerGrounded)
public static bool MemoryUplinkTrigger_Update(bool ____waitForPlayerGrounded)
{
if (StatueManager.Instance.HasStartedStatueLocally)
{

View File

@ -7,10 +7,7 @@ namespace QSB.TimeSync.Patches
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
public override void DoPatches()
=> QSBCore.HarmonyHelper.AddPrefix<PlayerCameraEffectController>("OnStartOfTimeLoop", typeof(TimePatches), nameof(PlayerCameraEffectController_OnStartOfTimeLoop));
public override void DoUnpatches()
=> QSBCore.HarmonyHelper.Unpatch<PlayerCameraEffectController>("OnStartOfTimeLoop");
=> Prefix(nameof(PlayerCameraEffectController_OnStartOfTimeLoop));
public static bool PlayerCameraEffectController_OnStartOfTimeLoop()
=> false;

View File

@ -11,19 +11,12 @@ namespace QSB.TranslationSync.Patches
public override void DoPatches()
{
QSBCore.HarmonyHelper.AddPrefix<NomaiWallText>("SetAsTranslated", typeof(SpiralPatches), nameof(Wall_SetAsTranslated));
QSBCore.HarmonyHelper.AddPrefix<NomaiComputer>("SetAsTranslated", typeof(SpiralPatches), nameof(Computer_SetAsTranslated));
QSBCore.HarmonyHelper.AddPrefix<NomaiVesselComputer>("SetAsTranslated", typeof(SpiralPatches), nameof(VesselComputer_SetAsTranslated));
Prefix(nameof(NomaiWallText_SetAsTranslated));
Prefix(nameof(NomaiComputer_SetAsTranslated));
Prefix(nameof(NomaiVesselComputer_SetAsTranslated));
}
public override void DoUnpatches()
{
QSBCore.HarmonyHelper.Unpatch<NomaiWallText>("SetAsTranslated");
QSBCore.HarmonyHelper.Unpatch<NomaiComputer>("SetAsTranslated");
QSBCore.HarmonyHelper.Unpatch<NomaiVesselComputer>("SetAsTranslated");
}
public static bool Wall_SetAsTranslated(NomaiWallText __instance, int id)
public static bool NomaiWallText_SetAsTranslated(NomaiWallText __instance, int id)
{
if (__instance.IsTranslated(id))
{
@ -37,7 +30,7 @@ namespace QSB.TranslationSync.Patches
return true;
}
public static bool Computer_SetAsTranslated(NomaiComputer __instance, int id)
public static bool NomaiComputer_SetAsTranslated(NomaiComputer __instance, int id)
{
if (__instance.IsTranslated(id))
{
@ -51,7 +44,7 @@ namespace QSB.TranslationSync.Patches
return true;
}
public static bool VesselComputer_SetAsTranslated(NomaiVesselComputer __instance, int id)
public static bool NomaiVesselComputer_SetAsTranslated(NomaiVesselComputer __instance, int id)
{
if (__instance.IsTranslated(id))
{