Upload from upload_mods.ps1
This commit is contained in:
80
Harmony/Harmony_JunkSledgeFireController.cs
Normal file
80
Harmony/Harmony_JunkSledgeFireController.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
namespace Harmony.JunkSledgeFireControllerPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(JunkSledgeFireController))]
|
||||
[HarmonyPatch("hitTarget")]
|
||||
public class hitTargetPatch
|
||||
{
|
||||
public static bool Prefix(ref JunkSledgeFireController __instance,
|
||||
DamageMultiplier ___damageMultiplier
|
||||
)
|
||||
{
|
||||
//Log.Out("JunkSledgeFireControllerPatches-hitTarget START");
|
||||
|
||||
Vector3 position = __instance.Cone.transform.position;
|
||||
global::EntityAlive holdingEntity = GameManager.Instance.World.GetEntity(__instance.entityTurret.belongsPlayerId) as global::EntityAlive;
|
||||
float maxDistance = __instance.MaxDistance;
|
||||
Vector3 vector = __instance.Cone.transform.forward;
|
||||
vector *= -1f;
|
||||
Ray ray = new Ray(position + Origin.position, vector);
|
||||
Voxel.Raycast(GameManager.Instance.World, ray, maxDistance, -538750981, 128, 0.15f);
|
||||
|
||||
ItemValue itemValue = __instance.entityTurret.OriginalItemValue;
|
||||
|
||||
//Log.Out("JunkSledgeFireControllerPatches-hitTarget itemValue (BEFORE): " + itemValue.ItemClass.GetItemName());
|
||||
|
||||
global::EntityAlive myOwner = GameManager.Instance.World.GetEntity(__instance.entityTurret.belongsPlayerId) as global::EntityAlive;
|
||||
|
||||
ItemValue getItemValue = null;
|
||||
|
||||
if (myOwner != null)
|
||||
{
|
||||
//Log.Out("JunkSledgeFireControllerPatches-hitTarget myOwner: " + myOwner.EntityClass.entityClassName);
|
||||
getItemValue = RebirthUtilities.GetItemValue(myOwner, "JunkTurret", __instance.entityTurret.EntityClass.entityClassName);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("JunkSledgeFireControllerPatches-hitTarget myOwner == null");
|
||||
}
|
||||
|
||||
if (getItemValue != null)
|
||||
{
|
||||
itemValue = getItemValue;
|
||||
}
|
||||
|
||||
//Log.Out("JunkSledgeFireControllerPatches-hitTarget itemValue (AFTER): " + itemValue.ItemClass.GetItemName());
|
||||
|
||||
ItemActionAttack.Hit(Voxel.voxelRayHitInfo.Clone(),
|
||||
__instance.entityTurret.belongsPlayerId,
|
||||
EnumDamageTypes.Bashing,
|
||||
__instance.GetDamageBlock(
|
||||
itemValue,
|
||||
BlockValue.Air,
|
||||
holdingEntity,
|
||||
1),
|
||||
__instance.GetDamageEntity(
|
||||
itemValue,
|
||||
holdingEntity,
|
||||
1),
|
||||
1f,
|
||||
itemValue.PercentUsesLeft,
|
||||
0f,
|
||||
0f,
|
||||
"metal",
|
||||
___damageMultiplier,
|
||||
__instance.buffActions,
|
||||
new ItemActionAttack.AttackHitInfo(),
|
||||
1,
|
||||
0,
|
||||
0f,
|
||||
null,
|
||||
null,
|
||||
ItemActionAttack.EnumAttackMode.RealNoHarvesting,
|
||||
null,
|
||||
__instance.entityTurret.entityId,
|
||||
itemValue
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user