summaryrefslogtreecommitdiff
path: root/NET/worlds/console/BBTeleportCommand.java
blob: 78f002fc1f30544733678e44e5968c23433f2530 (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
/*    */ package NET.worlds.console;
/*    */ 
/*    */ import NET.worlds.scape.Drone;
/*    */ import NET.worlds.scape.HoloPilot;
/*    */ import NET.worlds.scape.Pilot;
/*    */ import NET.worlds.scape.Point3Temp;
/*    */ import NET.worlds.scape.TeleportAction;
/*    */ import NET.worlds.scape.TeleportStatus;
/*    */ import java.io.DataInputStream;
/*    */ import java.io.DataOutputStream;
/*    */ import java.io.IOException;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class BBTeleportCommand
/*    */   extends BlackBoxCommand
/*    */   implements TeleportStatus
/*    */ {
/*    */   private String location;
/*    */   
/*    */   public BBTeleportCommand()
/*    */   {
/* 24 */     this.commandType = 1;
/*    */   }
/*    */   
/*    */   public BBTeleportCommand(String pLocation) {
/* 28 */     this();
/* 29 */     if (pLocation != null) {
/* 30 */       this.location = new String(pLocation);
/*    */     }
/*    */   }
/*    */   
/*    */   public boolean execute() {
/* 35 */     if (this.location != null)
/* 36 */       TeleportAction.teleport(this.location, this);
/* 37 */     return true;
/*    */   }
/*    */   
/*    */   public void save(DataOutputStream dos) throws IOException
/*    */   {
/* 42 */     super.save(dos);
/* 43 */     if (this.location == null) {
/* 44 */       dos.writeUTF("");
/*    */     } else {
/* 46 */       dos.writeUTF(this.location);
/*    */     }
/*    */   }
/*    */   
/*    */   public void load(DataInputStream dis) throws IOException {
/* 51 */     super.load(dis);
/* 52 */     this.location = dis.readUTF();
/* 53 */     if (this.location.equals("")) {
/* 54 */       this.location = null;
/*    */     }
/*    */   }
/*    */   
/*    */   public void teleportStatus(String err, String targetURL) {
/* 59 */     Pilot p = Pilot.getActive();
/* 60 */     if ((p instanceof HoloPilot)) {
/* 61 */       HoloPilot hp = (HoloPilot)p;
/* 62 */       Drone d = hp.getInternalDrone();
/* 63 */       if (d != null) {
/* 64 */         short dir = (short)(int)(-p.getYaw() + 90.0F);
/* 65 */         dir = (short)(dir % 360);
/* 66 */         while (dir < 0) {
/* 67 */           dir = (short)(dir + 360);
/*    */         }
/* 69 */         dir = (short)(90 - dir);
/* 70 */         dir = (short)(360 - dir);
/*    */         
/* 72 */         Point3Temp pos = p.getPosition();
/* 73 */         d.reset((short)(int)pos.x, (short)(int)pos.y, 
/* 74 */           (short)(int)p.getFootHeight(), dir);
/*    */       }
/*    */     }
/*    */     
/* 78 */     if (err == null) {
/* 79 */       doCallback(true);
/*    */     } else {
/* 81 */       doCallback(false);
/*    */     }
/*    */   }
/*    */ }


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