Upload from upload_mods.ps1
This commit is contained in:
76
Harmony/Harmony_TileEntityWorkstation.cs
Normal file
76
Harmony/Harmony_TileEntityWorkstation.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Harmony.TileEntityWorkstationPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(TileEntityWorkstation))]
|
||||
[HarmonyPatch(MethodType.Constructor)]
|
||||
[HarmonyPatch(new Type[] { typeof(Chunk) })]
|
||||
public static class TileEntityWorkstationConstructor
|
||||
{
|
||||
public static void Postfix(ref ItemStack[] ___output)
|
||||
{
|
||||
___output = ItemStack.CreateArray(16);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(TileEntityWorkstation))]
|
||||
[HarmonyPatch("UpdateTick")]
|
||||
public class UpdateTickPatch
|
||||
{
|
||||
public static void Postfix(TileEntityWorkstation __instance, World world
|
||||
)
|
||||
{
|
||||
if (__instance.IsBurning)
|
||||
{
|
||||
if (__instance.blockValue.Block.GetBlockName().Contains("FuriousRamsayScreamerSignalTier"))
|
||||
{
|
||||
if ((Time.time - RebirthVariables.screamerCheck) > 10f)
|
||||
{
|
||||
//Log.Out("XUiC_ScreamerSignalWindowGroup-Update BlockName: " + __instance.blockValue.Block.GetBlockName());
|
||||
RebirthVariables.screamerCheck = Time.time;
|
||||
|
||||
RebirthUtilities.SpawnScreamer(__instance.ToWorldPos());
|
||||
|
||||
Vector3i position = __instance.ToWorldPos();
|
||||
|
||||
int searchDistance = 150;
|
||||
|
||||
List<Entity> entitiesInBounds = world.GetEntitiesInBounds(typeof(EntityPlayer), BoundsUtils.BoundsForMinMax(position.x - searchDistance, position.y - 50, position.z - searchDistance, position.x + searchDistance, position.y + 50, position.z + searchDistance), new List<Entity>());
|
||||
|
||||
//Log.Out("XUiC_ScreamerSignalWindowGroup-Update entitiesInBounds: " + entitiesInBounds.Count);
|
||||
|
||||
for (int i = 0; i < entitiesInBounds.Count; i++)
|
||||
{
|
||||
EntityPlayer entityPlayer = (EntityPlayer)entitiesInBounds[i];
|
||||
|
||||
//Log.Out("XUiC_ScreamerSignalWindowGroup-Update entityPlayer: " + entityPlayer.EntityName);
|
||||
|
||||
if (entityPlayer != null)
|
||||
{
|
||||
//Log.Out("XUiC_ScreamerSignalWindowGroup-Update ADDE BUFF");
|
||||
entityPlayer.Buffs.AddBuff("FuriousRamsayScreamerSignalActive");
|
||||
}
|
||||
}
|
||||
|
||||
entitiesInBounds = world.GetEntitiesInBounds(typeof(EntityNPCRebirth), BoundsUtils.BoundsForMinMax(position.x - searchDistance, position.y - 50, position.z - searchDistance, position.x + searchDistance, position.y + 50, position.z + searchDistance), new List<Entity>());
|
||||
|
||||
//Log.Out("XUiC_ScreamerSignalWindowGroup-Update entitiesInBounds: " + entitiesInBounds.Count);
|
||||
|
||||
for (int i = 0; i < entitiesInBounds.Count; i++)
|
||||
{
|
||||
EntityNPCRebirth npc = (EntityNPCRebirth)entitiesInBounds[i];
|
||||
|
||||
//Log.Out("XUiC_ScreamerSignalWindowGroup-Update entityPlayer: " + entityPlayer.EntityName);
|
||||
|
||||
if (npc != null)
|
||||
{
|
||||
//Log.Out("XUiC_ScreamerSignalWindowGroup-Update ADDE BUFF");
|
||||
npc.Buffs.AddBuff("FuriousRamsayScreamerSignalActive");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user