rollback unrelated changes

This commit is contained in:
bushtail 2023-06-13 22:06:43 -04:00
parent 5790dc3fb9
commit 39ac51b109

View file

@ -0,0 +1,51 @@
package BetterShiftDrop
import plugin.Plugin
import plugin.annotations.PluginMeta
import plugin.api.API
import plugin.api.MiniMenuEntry
import rt4.Cheat
import rt4.Keyboard
@PluginMeta(
author = "bushtail",
description = "Better dropping and destroying while holding shift. Use ::bsd command to toggle. If for some reason after installing the plugin, Better Shift Drop does not activate, run the command to activate it.",
version = 2.0
)
class plugin : Plugin() {
override fun Init() {
if(API.GetData("bsd-toggle") == null) {
API.StoreData("bsd-toggle", true)
Cheat.shiftClick = false
} else if(API.GetData("bsd-toggle") == true) {
Cheat.shiftClick = false
}
}
override fun OnMiniMenuCreate(currentEntries: Array<out MiniMenuEntry>?) {
if(currentEntries == null) return
if(API.GetData("bsd-toggle") == true) {
if(API.IsKeyPressed(Keyboard.KEY_SHIFT)) {
for(entry in currentEntries) {
if(entry.verb.toLowerCase() == "drop" || entry.verb.toLowerCase() == "destroy") continue
if(!entry.isStrictlySecondary) entry.toggleStrictlySecondary()
}
}
}
}
override fun ProcessCommand(commandStr: String?, args: Array<out String>?) {
super.ProcessCommand(commandStr, args)
when(commandStr) {
"::bsd" -> {
if(API.GetData("bsd-toggle") == true) {
API.StoreData("bsd-toggle", false)
} else if(API.GetData("bsd-toggle") == false) {
API.StoreData("bsd-toggle", true)
} else {
API.StoreData("bsd-toggle", true)
}
}
}
}
}