mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
minecarts push you, but they are wacky.
This commit is contained in:
parent
e5af17760c
commit
c63654ea12
4 changed files with 190 additions and 4 deletions
|
|
@ -1,15 +1,14 @@
|
||||||
package content.region.morytania.handlers
|
package content.region.morytania.quest.hauntedmine
|
||||||
|
|
||||||
import content.global.skill.slayer.dungeon.AncientCavern
|
import content.data.tables.BirdNest
|
||||||
import core.api.*
|
import core.api.*
|
||||||
import core.game.global.action.DoorActionHandler
|
import core.game.global.action.DoorActionHandler
|
||||||
import core.game.interaction.IntType
|
import core.game.interaction.IntType
|
||||||
import core.game.interaction.InteractionListener
|
import core.game.interaction.InteractionListener
|
||||||
import core.game.node.entity.combat.ImpactHandler.HitsplatType
|
|
||||||
import core.game.node.entity.npc.NPC
|
import core.game.node.entity.npc.NPC
|
||||||
import core.game.node.entity.player.Player
|
import core.game.node.entity.player.Player
|
||||||
|
import core.game.node.item.Item
|
||||||
import core.game.world.map.Location
|
import core.game.world.map.Location
|
||||||
import core.tools.RandomFunction
|
|
||||||
import org.rs09.consts.Items
|
import org.rs09.consts.Items
|
||||||
import org.rs09.consts.NPCs
|
import org.rs09.consts.NPCs
|
||||||
import org.rs09.consts.Scenery
|
import org.rs09.consts.Scenery
|
||||||
|
|
@ -327,6 +326,10 @@ class AbandonedMineListeners : InteractionListener {
|
||||||
|
|
||||||
// handles spawning the possessed pickaxe
|
// handles spawning the possessed pickaxe
|
||||||
private fun takePickaxe(player: Player, npc: NPC) {
|
private fun takePickaxe(player: Player, npc: NPC) {
|
||||||
|
|
||||||
|
// todo try this later instead of spawning and removing to fix the pick not respawning issue.
|
||||||
|
// transformNpc(npc, NPCs.POSSESSED_PICKAXE_1536, 400)
|
||||||
|
|
||||||
val spawn: NPC = NPC.create(
|
val spawn: NPC = NPC.create(
|
||||||
NPCs.POSSESSED_PICKAXE_1536,
|
NPCs.POSSESSED_PICKAXE_1536,
|
||||||
npc.getLocation()
|
npc.getLocation()
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
package content.region.morytania.quest.hauntedmine
|
||||||
|
|
||||||
|
import core.api.Container
|
||||||
|
import core.api.addItem
|
||||||
|
import core.api.addItemOrDrop
|
||||||
|
import core.api.amountInInventory
|
||||||
|
import core.api.inInventory
|
||||||
|
import core.api.removeItem
|
||||||
|
import core.api.sendMessage
|
||||||
|
import core.game.node.entity.Entity
|
||||||
|
import core.game.node.entity.player.Player
|
||||||
|
import core.game.node.item.Item
|
||||||
|
import core.game.world.map.zone.MapZone
|
||||||
|
import core.game.world.map.zone.ZoneBorders
|
||||||
|
import core.game.world.map.zone.ZoneBuilder
|
||||||
|
import core.plugin.Initializable
|
||||||
|
import core.plugin.Plugin
|
||||||
|
import org.rs09.consts.Items
|
||||||
|
|
||||||
|
@Initializable
|
||||||
|
|
||||||
|
// if you leave the abandoned mine, any instances of Glowing Fungus in your inventory should be removed and replaced with ashes.
|
||||||
|
class AbandonedMineZone : MapZone("Abandoned Mine", true), Plugin<Any?> {
|
||||||
|
|
||||||
|
override fun newInstance(arg: Any?): Plugin<Any?> {
|
||||||
|
ZoneBuilder.configure(this)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun fireEvent(identifier: String?, vararg args: Any?): Any {
|
||||||
|
return Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun leave(e: Entity?, logout: Boolean): Boolean {
|
||||||
|
|
||||||
|
//todo come back to this and fix it the leave logic.
|
||||||
|
// Right now if you go from floor 2 to 1 it gets rid of the fungus.
|
||||||
|
// I could also just leave as-is. It doesn't impact the quest and still accomplishes the correct goal.
|
||||||
|
if (e!!.isPlayer){
|
||||||
|
// remove any glowing fungus the player is carrying.
|
||||||
|
val fungi = amountInInventory(e as Player, Items.GLOWING_FUNGUS_4075)
|
||||||
|
if(removeItem(e, Item(Items.GLOWING_FUNGUS_4075, fungi), Container.INVENTORY)){
|
||||||
|
addItemOrDrop(e, Items.ASHES_592, fungi)
|
||||||
|
sendMessage(e, "The strange fungus you are carrying crumbles to dust.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.leave(e, logout)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun configure() {
|
||||||
|
// mine floor 1
|
||||||
|
register(ZoneBorders(3395, 9609, 3448, 9664))
|
||||||
|
|
||||||
|
// mine floors 2-6
|
||||||
|
register(ZoneBorders(2680, 4415, 2820, 4609))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If you enter level 5 of the abandoned mine, any tinderboxes with you should become damp tinderboxes.
|
||||||
|
// Light sources should also be extinguished. This is so that when you try to go to mine level 5 and the
|
||||||
|
// player says "i need a light source", it'll force you to get a glowing fungus.
|
||||||
|
class AbandonedMineL5Zone : MapZone("Abandoned Mine Level 5", true), Plugin<Any?> {
|
||||||
|
|
||||||
|
override fun newInstance(arg: Any?): Plugin<Any?> {
|
||||||
|
ZoneBuilder.configure(this)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun fireEvent(identifier: String?, vararg args: Any?): Any {
|
||||||
|
return Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun enter(e: Entity?): Boolean {
|
||||||
|
if (e!!.isPlayer){
|
||||||
|
val tindies = amountInInventory(e as Player, Items.TINDERBOX_1553)
|
||||||
|
if(removeItem(e, Item(Items.TINDERBOX_1553, tindies), Container.INVENTORY)){
|
||||||
|
addItemOrDrop(e, Items.DAMP_TINDERBOX_4073, tindies)
|
||||||
|
}
|
||||||
|
//todo extinguish light sources.
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.enter(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun leave(e: Entity?, logout: Boolean): Boolean {
|
||||||
|
|
||||||
|
if (e!!.isPlayer){
|
||||||
|
val tindies = amountInInventory(e as Player, Items.DAMP_TINDERBOX_4073)
|
||||||
|
if(removeItem(e, Item(Items.DAMP_TINDERBOX_4073, tindies), Container.INVENTORY)){
|
||||||
|
addItemOrDrop(e, Items.TINDERBOX_1553, tindies)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.leave(e, logout)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun configure() {
|
||||||
|
register(ZoneBorders(2680, 4415, 2755, 4480))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -62,6 +62,16 @@ class HauntedMineListeners : InteractionListener {
|
||||||
|
|
||||||
// points settings
|
// points settings
|
||||||
on(Scenery.POINTS_SETTINGS_4949, IntType.SCENERY, "Check") { player, node ->
|
on(Scenery.POINTS_SETTINGS_4949, IntType.SCENERY, "Check") { player, node ->
|
||||||
|
// open iface 144
|
||||||
|
|
||||||
|
return@on true
|
||||||
|
}
|
||||||
|
|
||||||
|
// you can't drop the fungus
|
||||||
|
on(Items.GLOWING_FUNGUS_4075, IntType.ITEM, "Drop") { player, node ->
|
||||||
|
removeItem(player,node)
|
||||||
|
produceGroundItem(player, Items.ASHES_592)
|
||||||
|
sendMessage(player,"When you drop the fungus it crumbles mysteriously to dust.")
|
||||||
|
|
||||||
return@on true
|
return@on true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
package content.region.morytania.quest.hauntedmine
|
||||||
|
|
||||||
|
import core.api.*
|
||||||
|
import core.game.node.entity.npc.NPC
|
||||||
|
import core.game.node.entity.npc.NPCBehavior
|
||||||
|
import core.game.node.entity.player.Player
|
||||||
|
import core.game.world.map.Location
|
||||||
|
import core.tools.RandomFunction.random
|
||||||
|
import org.rs09.consts.NPCs
|
||||||
|
|
||||||
|
// covers the behavior of the animated minecarts. They move back and forth along set paths,
|
||||||
|
// and if the player runs into one they push the player back with them while causing continuous 0-2 damage.
|
||||||
|
|
||||||
|
// mine cart 1544 is used on level 6 during the Trayus Dayth fight.
|
||||||
|
|
||||||
|
/*
|
||||||
|
@Initializable
|
||||||
|
class MinecartNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
|
||||||
|
|
||||||
|
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
|
||||||
|
return MinecartNPC(id, location)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getIds(): IntArray {
|
||||||
|
return intArrayOf(NPCs.MINE_CART_1544, NPCs.MINE_CART_1545, NPCs.MINE_CART_1546, NPCs.MINE_CART_1547, NPCs.MINE_CART_1548)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
class MinecartNPCBehavior : NPCBehavior(NPCs.MINE_CART_1544, NPCs.MINE_CART_1545, NPCs.MINE_CART_1546, NPCs.MINE_CART_1547, NPCs.MINE_CART_1548) {
|
||||||
|
|
||||||
|
override fun onCreation(self: NPC) {
|
||||||
|
|
||||||
|
if (self.id == NPCs.MINE_CART_1545 && self.properties.spawnLocation == location(2727,4509,0)) {
|
||||||
|
val movementPath = arrayOf(Location.create(2727, 4517, 0), Location.create(2727, 4489, 0))
|
||||||
|
self.configureMovementPath(*movementPath)
|
||||||
|
self.isWalks = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.id == NPCs.MINE_CART_1546 && self.properties.spawnLocation == location(2697,4498,0)) {
|
||||||
|
val movementPath = arrayOf(Location.create(2696, 4498, 0), Location.create(2711, 4498, 0))
|
||||||
|
self.configureMovementPath(*movementPath)
|
||||||
|
self.isWalks = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.id == NPCs.MINE_CART_1547 && self.properties.spawnLocation == location(2715,4517,0)) {
|
||||||
|
val movementPath = arrayOf(Location.create(2696, 4498, 0), Location.create(2711, 4498, 0))
|
||||||
|
self.configureMovementPath(*movementPath)
|
||||||
|
self.isWalks = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.id == NPCs.MINE_CART_1548 && self.properties.spawnLocation == location(2739,4528,0)) {
|
||||||
|
val movementPath = arrayOf(Location.create(2739, 4531, 0), Location.create(2739, 4528, 0))
|
||||||
|
self.configureMovementPath(*movementPath)
|
||||||
|
self.isWalks = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// logic to check for, push, and damage players.
|
||||||
|
override fun tick(self: NPC): Boolean {
|
||||||
|
for (p in self.viewport.currentPlane.players) {
|
||||||
|
// todo come back and refine the pushing, it doesn't work very well.
|
||||||
|
if (p.location == self.location /*|| p.location == self.location.transform(self.direction,1)*/) {
|
||||||
|
forceMove(p, p.location,self.location.transform(self.direction,1),0,0)
|
||||||
|
impact(p,random(0,2))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue