Skip to content

Commit

Permalink
1.1.4.1542
Browse files Browse the repository at this point in the history
  • Loading branch information
SphereII committed Oct 4, 2024
1 parent 5a2af80 commit 8121511
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 38 deletions.
46 changes: 12 additions & 34 deletions Mods/0-SCore/Harmony/NPCFeatures/EntityAlivePatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,7 @@ public class UtilsDrawLine
private static readonly string Feature = "EnhancedFeatures";


//[HarmonyPatch(typeof(global::EntityAlive))]
//[HarmonyPatch("Attack")]
//public class EntityAliveAttack
//{
// private static bool Prefix(global::EntityAlive __instance)
// {
// // Check if this feature is enabled.
// if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
// return true;

// // Check if there's a door in our way, then open it.
// if (__instance.GetAttackTarget() == null)
// {
// // If it's an animal, don't let them attack blocks
// var animal = __instance as EntityAliveFarmingAnimalSDX;
// if (animal)
// if (__instance.GetAttackTarget() == null)
// return false;
// }

// if (__instance.GetAttackTarget() != null)
// __instance.RotateTo(__instance.GetAttackTarget(), 30f, 30f);

// return true;
// }
//}



// Disables the friendly fire of allies
[HarmonyPatch(typeof(global::EntityAlive))]
Expand All @@ -50,6 +24,7 @@ public class EntityAliveDamageEntity
{
private static bool Prefix(global::EntityAlive __instance, ref int __result, DamageSource _damageSource)
{

if (!EntityUtilities.UseFactionTargeting(__instance))
return true;

Expand Down Expand Up @@ -131,14 +106,17 @@ public class ItemActionDynamicHitTarget
private static bool Prefix(
ItemActionDynamic __instance,
ItemActionData _actionData,
WorldRayHitInfo hitInfo)
{
if (!EntityUtilities.UseFactionTargeting(_actionData.invData.holdingEntity))
return true;
WorldRayHitInfo hitInfo) {

// Only checking if we are hitting an entity, otherwise, let the damage through.
var target = ItemActionAttack.GetEntityFromHit(hitInfo);
if (target is not global::EntityAlive entityAlive) return true;

// if it's already dead, then no faction targeting. Let the players carve their friends.
if (entityAlive.IsDead()) return true;
if (!EntityUtilities.UseFactionTargeting(_actionData.invData.holdingEntity)) return true;
return EntityTargetingUtilities.CanDamage(_actionData.invData.holdingEntity, ItemActionAttack.GetEntityFromHit(hitInfo));

return EntityTargetingUtilities.CanDamage(
_actionData.invData.holdingEntity,
ItemActionAttack.GetEntityFromHit(hitInfo));
}
}

Expand Down
2 changes: 1 addition & 1 deletion Mods/0-SCore/ModInfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<Description value="SCore Mod" />
<DisplayName value="0-SCore" />
<Website value="" />
<Version value="1.1.4.1015" />
<Version value="1.1.4.1542" />
</xml>
4 changes: 2 additions & 2 deletions Mods/0-SCore/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
// [assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("20.0.*")]

[assembly: AssemblyVersion("1.1.4.1015")]
[assembly: AssemblyFileVersion("1.1.4.1015")]
[assembly: AssemblyVersion("1.1.4.1542")]
[assembly: AssemblyFileVersion("1.1.4.1542")]
12 changes: 11 additions & 1 deletion Mods/0-SCore/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,19 @@ Direct Download to the 0-SCore.zip available on gitlab mirror: https://github.co
### Change Logs

[ Change Log ]
Version: 1.1.4.1542
[ Entity Targetting ]
- Updated the code for the ItemItemAction to first check if it's hitting an EntityAlive
- Then checks if the entity alive is dead. If so, let the damage through.
- If it's an EntityAlive, and it's alive, do the faction checks.

Version: 1.1.4.1015
[ SCore Options ]
- Hide SCore Options window when in prefab editor

[ ConfigBlock ]
- Pathing cube reverted to 1,1,1 multidim.

[ Challenges ]
- Fixed a typo in the comment section of StealthKill showing an example.

Expand Down Expand Up @@ -54,8 +63,9 @@ Version: 1.1.4.1015

- I also refactored the logic to determine when an entity should use faction targeting. It was already repeated in two
places in the code, and I would need to repeat it a third time in my patch.
- I did test to make sure that there were no regressions. I tested with a friendly NPC (Baker), and enemy NPC (Harley), and animal (bear),
and zombies (mainly Boe). I made sure that I could still shock everyone except the Baker, and that when they attacked each other, they did damage.

I did test to make sure that there were no regressions. I tested with a friendly NPC (Baker), and enemy NPC (Harley), and animal (bear), and zombies (mainly Boe). I made sure that I could still shock everyone except the Baker, and that when they attacked each other, they did damage.
Version: 1.0.94.1336
[ Challenges ]
- Created an Interface for challenges to help future development work
Expand Down
Binary file modified Mods/0-SCore/SCore.dll
Binary file not shown.
Binary file modified Mods/0-SCore/SCore.pdb
Binary file not shown.

0 comments on commit 8121511

Please sign in to comment.