mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-21 09:02:07 -07:00
Ice trolls can now attack the miner NPCs.
Removed debug code from the packet write queue
This commit is contained in:
parent
7d5624239e
commit
4a4333550e
3 changed files with 44 additions and 1 deletions
|
|
@ -593,6 +593,16 @@ object ContentAPI {
|
|||
return RegionManager.getLocalNpcs(entity).firstOrNull { it.id == id }
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of nearby NPCs that match the given IDs.
|
||||
* @param entity the entity to check around
|
||||
* @param ids the IDs of the NPCs to look for
|
||||
*/
|
||||
@JvmStatic
|
||||
fun findLocalNPCs(entity: Entity, ids: IntArray): List<NPC>{
|
||||
return RegionManager.getSurroundingNPCs(entity).filter { it.id in ids }.toList()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of an attribute key from the Entity's attributes store
|
||||
* @param entity the entity to get the attribute from
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package rs09.game.node.entity.npc.other
|
||||
|
||||
import api.ContentAPI
|
||||
import core.game.node.entity.npc.AbstractNPC
|
||||
import core.game.world.map.Location
|
||||
import core.plugin.Initializable
|
||||
import core.tools.RandomFunction
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.system.SystemLogger
|
||||
|
||||
@Initializable
|
||||
class IceTrollJatizsoCaves : AbstractNPC {
|
||||
//Constructor spaghetti because Arios I guess
|
||||
constructor() : super(NPCs.ICE_TROLL_MALE_5474, null, true) {}
|
||||
private constructor(id: Int, location: Location) : super(id, location) {}
|
||||
|
||||
override fun construct(id: Int, location: Location, vararg objects: Any?): AbstractNPC {
|
||||
return IceTrollJatizsoCaves(id, location)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.ICE_TROLL_MALE_5474,NPCs.ICE_TROLL_RUNT_5473,NPCs.ICE_TROLL_FEMALE_5475)
|
||||
}
|
||||
|
||||
override fun tick() {
|
||||
val nearbyMiner = ContentAPI.findLocalNPC(this, NPCs.MINER_5497) ?: return super.tick()
|
||||
if(!inCombat() && nearbyMiner.location.withinDistance(location, 8)){
|
||||
attack(nearbyMiner)
|
||||
}
|
||||
super.tick()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -23,7 +23,6 @@ object PacketWriteQueue {
|
|||
|
||||
@JvmStatic
|
||||
fun <T> queue(packet: OutgoingPacket<T>, context: T){
|
||||
SystemLogger.logInfo("Queueing ${packet.javaClass.simpleName}")
|
||||
PacketsToWrite.add(QueuedPacket(packet,context))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue