hide dead NPCs for EntityHider (#1197)

This commit is contained in:
kecleon
2019-07-30 07:17:39 -07:00
committed by Lucwousin
parent 3701cfa294
commit 659bfe889c
5 changed files with 40 additions and 0 deletions

View File

@@ -1478,6 +1478,13 @@ public interface Client extends GameShell
*/
void setProjectilesHidden(boolean state);
/**
* Sets whether dead NPCs are hidden.
*
* @param state new NPC hidden state
*/
void setDeadNPCsHidden(boolean state);
/**
* Gets an array of tile collision data.
* <p>

View File

@@ -153,4 +153,15 @@ public interface EntityHiderConfig extends Config
return false;
}
@ConfigItem(
position = 12,
keyName = "hideDeadNPCs",
name = "Hide Dead NPCs",
description = "Configures whether or not NPCs that just died are hidden"
)
default boolean hideDeadNPCs()
{
return false;
}
}

View File

@@ -112,6 +112,8 @@ public class EntityHiderPlugin extends Plugin
client.setAttackersHidden(config.hideAttackers());
client.setProjectilesHidden(config.hideProjectiles());
client.setDeadNPCsHidden(config.hideDeadNPCs());
}
@Override
@@ -136,6 +138,8 @@ public class EntityHiderPlugin extends Plugin
client.setAttackersHidden(false);
client.setProjectilesHidden(false);
client.setDeadNPCsHidden(false);
}
private boolean isPlayerRegionAllowed()

View File

@@ -64,6 +64,9 @@ public abstract class EntityHiderBridgeMixin implements RSClient
@Inject
public static boolean hideProjectiles;
@Inject
public static boolean hideDeadNPCs;
@Inject
public static String hideNPCsNames;
@@ -151,4 +154,11 @@ public abstract class EntityHiderBridgeMixin implements RSClient
{
hideProjectiles = state;
}
@Inject
@Override
public void setDeadNPCsHidden(boolean state)
{
hideDeadNPCs = state;
}
}

View File

@@ -79,6 +79,9 @@ public abstract class EntityHiderMixin implements RSScene
@Shadow("hideProjectiles")
private static boolean hideProjectiles;
@Shadow("hideDeadNPCs")
private static boolean hideDeadNPCs;
@Copy("newGameObject")
abstract boolean addEntityMarker(int var1, int var2, int var3, int var4, int var5, int x, int y, int var8, RSEntity renderable, int var10, boolean var11, long var12, int var13);
@@ -164,6 +167,11 @@ public abstract class EntityHiderMixin implements RSScene
}
}
if (hideDeadNPCs && npc.getHealthRatio() == 0)
{
return false;
}
for (String name : names)
{
if (name != null && !name.equals(""))