diff options
| author | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
| commit | c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch) | |
| tree | df9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/scape/HighJump.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/scape/HighJump.java')
| -rw-r--r-- | NET/worlds/scape/HighJump.java | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/NET/worlds/scape/HighJump.java b/NET/worlds/scape/HighJump.java new file mode 100644 index 0000000..722a5ed --- /dev/null +++ b/NET/worlds/scape/HighJump.java @@ -0,0 +1,78 @@ +package NET.worlds.scape; + +import NET.worlds.console.Main; +import NET.worlds.console.MainCallback; +import NET.worlds.core.Std; +import java.util.Enumeration; + +public class HighJump extends InventoryAction implements MainCallback { + int start; + SmoothDriver sd; + + public HighJump(String id, String name) { + super(id, name); + } + + public HighJump(String id, String name, int qty) { + super(id, name, qty); + } + + public HighJump(HighJump in) { + super(in); + } + + @Override + public InventoryItem cloneItem() { + return new HighJump(this); + } + + private SmoothDriver findSD(Pilot p) { + Enumeration e = p.getHandlers(); + + while (e.hasMoreElements()) { + Object o = e.nextElement(); + if (o instanceof SmoothDriver) { + return (SmoothDriver)o; + } + } + + return null; + } + + @Override + public boolean doAction() { + if (this.itemQuantity_ > 0) { + Pilot p = Pilot.getActive(); + if (p == null) { + return false; + } else { + this.sd = this.findSD(p); + if (this.sd == null) { + return false; + } else { + if (this.sd != null) { + Main.register(this); + this.start = Std.getRealTime(); + this.itemQuantity_--; + } + + return true; + } + } + } else { + return false; + } + } + + @Override + public void mainCallback() { + int now = Std.getFastTime(); + if (now > this.start + 6000) { + Main.unregister(this); + this.sd.setEyeHeight(150.0F); + } else { + float t = 1.0F - (float)Math.pow(1.0F - (now - this.start) / 3000.0F, 4.0); + this.sd.setEyeHeight(150.0F + 150.0F * t); + } + } +} |