summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/HighJump.java
blob: 3e81b7668ad11ff9d456aea274fe0af854184e6d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*    */ 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)
/*    */   {
/* 25 */     super(id, name);
/*    */   }
/*    */   
/*    */   public HighJump(String id, String name, int qty)
/*    */   {
/* 30 */     super(id, name, qty);
/*    */   }
/*    */   
/*    */   public HighJump(HighJump in)
/*    */   {
/* 35 */     super(in);
/*    */   }
/*    */   
/*    */   public InventoryItem cloneItem()
/*    */   {
/* 40 */     return new HighJump(this);
/*    */   }
/*    */   
/*    */   private SmoothDriver findSD(Pilot p)
/*    */   {
/* 45 */     for (Enumeration<Object> e = p.getHandlers(); e.hasMoreElements();)
/*    */     {
/* 47 */       Object o = e.nextElement();
/* 48 */       if ((o instanceof SmoothDriver)) {
/* 49 */         return (SmoothDriver)o;
/*    */       }
/*    */     }
/* 52 */     return null;
/*    */   }
/*    */   
/*    */   public boolean doAction()
/*    */   {
/* 57 */     if (this.itemQuantity_ > 0)
/*    */     {
/* 59 */       Pilot p = Pilot.getActive();
/* 60 */       if (p == null) {
/* 61 */         return false;
/*    */       }
/*    */       
/* 64 */       this.sd = findSD(p);
/* 65 */       if (this.sd == null)
/* 66 */         return false;
/* 67 */       if (this.sd != null) {
/* 68 */         Main.register(this);
/* 69 */         this.start = Std.getRealTime();
/* 70 */         this.itemQuantity_ -= 1;
/*    */       }
/* 72 */       return true;
/*    */     }
/* 74 */     return false;
/*    */   }
/*    */   
/*    */   public void mainCallback()
/*    */   {
/* 79 */     int now = Std.getFastTime();
/* 80 */     if (now > this.start + 6000)
/*    */     {
/* 82 */       Main.unregister(this);
/* 83 */       this.sd.setEyeHeight(150.0F);
/*    */     }
/*    */     else
/*    */     {
/* 87 */       float t = 1.0F - (float)Math.pow(1.0F - (now - this.start) / 3000.0F, 4.0D);
/* 88 */       this.sd.setEyeHeight(150.0F + 150.0F * t);
/*    */     }
/*    */   }
/*    */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\HighJump.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */