mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-22 19:05:11 -06:00
fuck arios
This commit is contained in:
parent
b388428d54
commit
9db6993beb
1 changed files with 28 additions and 34 deletions
|
|
@ -123,32 +123,20 @@ class EW2Listeners : InteractionListener {
|
|||
val mat = getVarbit(player, EW2CraneStateVarbit)
|
||||
val pos = getVarbit(player, EW2CranePosVarbit)
|
||||
|
||||
// crane location [1952, 5143, 2]
|
||||
//removeScenery(scenery)
|
||||
//addScenery(scenery)
|
||||
//getScenery(scenery)
|
||||
//replaceScenery(scenery)
|
||||
|
||||
val index = (mat * 4) + pos
|
||||
val newId = craneStates[index]
|
||||
val center = Location.create(1954, 5145, 2)
|
||||
val craneLoc = Location.create(1952, 5143, 2)
|
||||
val currentObject = getScenery(craneLoc)
|
||||
|
||||
for (x in -2..2) {
|
||||
for (y in -2..2) {
|
||||
val checkLoc = center.transform(x, y, 0)
|
||||
// check an object actually exists here
|
||||
if (currentObject != null) {
|
||||
|
||||
// look for the object at this specific tile
|
||||
val currentObject = RegionManager.getObject(checkLoc.z, checkLoc.x, checkLoc.y) ?: continue
|
||||
//val currentObject = getScenery(checkLoc.z, checkLoc.x, checkLoc.y) ?: continue
|
||||
// crane is an object not a scenery to get
|
||||
// check that the object is a crane
|
||||
if (craneStates.contains(currentObject.id)) {
|
||||
|
||||
|
||||
// check if the object at this tile is a crane
|
||||
if (craneStates.contains(currentObject.id)) {
|
||||
if (currentObject.id != newId) {
|
||||
replaceScenery(currentObject, newId, -1)
|
||||
}
|
||||
return
|
||||
// replace crane if current state doesn't match what is called for
|
||||
if (currentObject.id != newId) {
|
||||
replaceScenery(currentObject, newId, -1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -187,22 +175,10 @@ class EW2Listeners : InteractionListener {
|
|||
|
||||
// values for the cogs
|
||||
val cogRange = (Scenery.COG_18667..Scenery.COG_18684).toList().toIntArray() // 18 different cogs. That is enough to give each cog a static/fwd spin/rev spin animation.
|
||||
|
||||
val smallCogs = intArrayOf(Scenery.COG_18673, Scenery.COG_18667, Scenery.COG_18670) // pin 1, pin 2, pin 3
|
||||
val medCogs = intArrayOf(Scenery.COG_18674, Scenery.COG_18668, Scenery.COG_18671) // pin 1, pin 2, pin 3
|
||||
val largeCogs = intArrayOf(Scenery.COG_18675, Scenery.COG_18669, Scenery.COG_18672) // pin 1, pin 2, pin 3
|
||||
|
||||
// offset by 9 from the static cogs. this is a guess for now (see below)
|
||||
val smallMovingCogs = intArrayOf(Scenery.COG_18682, Scenery.COG_18676, Scenery.COG_18679)
|
||||
val medMovingCogs = intArrayOf(Scenery.COG_18683, Scenery.COG_18677, Scenery.COG_18680)
|
||||
val largeMovingCogs = intArrayOf(Scenery.COG_18684, Scenery.COG_18678, Scenery.COG_18681)
|
||||
|
||||
// todo it'd be nice to have a function that swapped the cog scenery for an animated version.
|
||||
// function to swap scenery values of the cogs based on the varbit settings. this makes them appear to spin.
|
||||
fun syncCogs(player: Player) {
|
||||
|
||||
}
|
||||
|
||||
// syncs the tank door based on state of varbit 2653
|
||||
fun syncTankDoor(player: Player) {
|
||||
val doorState = getVarbit(player, EW2TankDoorVarbit)
|
||||
|
|
@ -474,7 +450,6 @@ class EW2Listeners : InteractionListener {
|
|||
val craneMat = getVarbit(player, EW2CraneStateVarbit) // Crane State. 0 = broken, 1 = fixed/empty, 2 = ele bar, 3 = hot bar.
|
||||
val cartState = getVarbit(player, EW2JigCartVarbit) // Jig Cart state. 0 = Empty, 1 = ele bar, 2 = hot bar, 3 = smashed hot, 4 = smashed cooled, 5 = primed
|
||||
|
||||
// todo make sure the crane doesn't pick up other bars
|
||||
// facing north: pick up and drop off bar
|
||||
if (currentPos == 3 && nextPos == 2) {
|
||||
if (craneMat == 1 && (cartState == 1 || cartState == 2)) {
|
||||
|
|
@ -552,6 +527,7 @@ class EW2Listeners : InteractionListener {
|
|||
// todo animate the hammer smash
|
||||
1 -> { // ele bar
|
||||
setVarbit(player, EW2JigCartVarbit, 4)
|
||||
//replaceScenery(getScenery(1945, 5154, 3), 18644, 3)
|
||||
// "hardy" is the real word used. I thought it was a typo for 'hammer' but it's not. https://en.wikipedia.org/wiki/Hardy_tool
|
||||
sendDialogue(player, "You pull the lever and the press responds. The hardy comes down, hitting the elemental bar. The bar is not hot enough to flatten.")
|
||||
syncCart(player)
|
||||
|
|
@ -744,6 +720,23 @@ class EW2Listeners : InteractionListener {
|
|||
return@onUseWith true
|
||||
}
|
||||
|
||||
//todo Since Arios is shit (https://gitlab.com/2009scape/2009scape/-/issues/1841) we can't act directly with pin 2.
|
||||
// I have commented out what would be the correct function below in case the issue ever gets fixed.
|
||||
// As a hack, the player is only allowed to place the medium cog below the small cog.
|
||||
// You can't remove the medium cog because it throws an exception (resetting the varbit will 'remove' the cog). kill me.
|
||||
onUseWith(IntType.SCENERY, intArrayOf(Items.MEDIUM_COG_9725), 18673) { player, item, _ ->
|
||||
when(item.id) {
|
||||
Items.MEDIUM_COG_9725 -> {
|
||||
setVarbit(player, EW2CogVarbit2, 2, true)
|
||||
sendItemDialogue(player, item, "You put the medium cog onto the shaft.")
|
||||
animate(player, 537)
|
||||
removeItem(player, item)
|
||||
}
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
/*
|
||||
// use cog with pin 2
|
||||
// pin 2: 2656: val 0 is scenery 18664 (pin). val 1 is scenery 18667 (small cog). val 2 is scenery 18668 (med cog). val 3 is scenery 18669 (large cog)
|
||||
onUseWith(IntType.SCENERY, intArrayOf(Items.SMALL_COG_9726, Items.MEDIUM_COG_9725, Items.LARGE_COG_9724), Scenery.PIN_18664) { player, item, _ ->
|
||||
|
|
@ -769,6 +762,7 @@ class EW2Listeners : InteractionListener {
|
|||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
*/
|
||||
|
||||
// use cog with pin 3
|
||||
// pin 3: 2657: val 0 is scenery 18666 (pin). val 1 is scenery 18670 (small cog). val 2 is scenery 18671 (med cog). val 3 is scenery 18672 (large cog)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue