Skip to content

Commit

Permalink
Added config for cart damage and fixed object name
Browse files Browse the repository at this point in the history
  • Loading branch information
Radvo committed Nov 9, 2022
1 parent 8db0515 commit 85c3ba1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -446,3 +446,4 @@ Please see [CONTRIBUTING.md](/CONTRIBUTING.md) for details on compiling V+ for d
* An 'Hachidan' N. - https://github.com/ahnguyen09
* Abra - https://github.com/Abrackadabra
* Increddibelly - https://github.com/increddibelly
* Radvo - https://github.com/Radvo
Expand Up @@ -9,6 +9,8 @@ public class StructuralIntegrityConfiguration : ServerSyncConfig<StructuralInteg
public bool disableStructuralIntegrity { get; internal set; } = false;
public bool disableDamageToPlayerStructures { get; internal set; } = false;
public bool disableDamageToPlayerBoats { get; internal set; } = false;
public bool disableDamageToPlayerCarts { get; internal set; } = false;
public bool disableWaterDamageToPlayerBoats { get; internal set; } = false;
public bool disableWaterDamageToPlayerCarts { get; internal set; } = false;
}
}
12 changes: 6 additions & 6 deletions ValheimPlus/GameClasses/WearNTear.cs
Expand Up @@ -72,13 +72,13 @@ private static bool Prefix(ref WearNTear __instance, ref float damage)

return true;
}
if (__instance.m_piece.m_name.StartsWith("$cart"))
if (__instance.m_piece.m_name.StartsWith("$tool_cart"))
{
if (Configuration.Current.StructuralIntegrity.disableDamageToPlayerStructures ||
(Configuration.Current.StructuralIntegrity.disableDamageToPlayerStructures &&
stackTrace.GetFrame(15).GetMethod().Name == "UpdateWaterForce")) return false;
return true;
if (Configuration.Current.StructuralIntegrity.disableDamageToPlayerCarts ||
(Configuration.Current.StructuralIntegrity.disableWaterDamageToPlayerCarts &&
stackTrace.GetFrame(15).GetMethod().Name == "UpdateWaterForce")) return false;

return true;
}
return !Configuration.Current.StructuralIntegrity.disableDamageToPlayerStructures;
}
Expand Down
10 changes: 10 additions & 0 deletions vplusconfig.json
Expand Up @@ -1464,6 +1464,16 @@
"defaultValue": "false",
"defaultType": "bool"
},
"disableDamageToPlayerCarts": {
"description": "Disables any damage from anything to all player built carts",
"defaultValue": "false",
"defaultType": "bool"
},
"disableWaterDamageToPlayerCarts": {
"description": "Disables water force damage to all player built carts",
"defaultValue": "false",
"defaultType": "bool"
},
"wood": {
"description": "Each of these values reduce the loss of structural integrity by distance by %.",
"defaultValue": "0",
Expand Down

0 comments on commit 85c3ba1

Please sign in to comment.