Changeset 228 for binary-improvements/AllocsCommands/Commands
- Timestamp:
- Apr 10, 2015, 1:05:26 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/TeleportPlayer.cs
r227 r228 8 8 public class TeleportPlayer : ConsoleCommand 9 9 { 10 private MethodInfo NetConnection_SendPackage = null;11 12 10 public TeleportPlayer (ConsoleSdtd cons) : base(cons) 13 11 { 14 Type typeClientInfo = Assembly.GetAssembly (typeof(ClientInfo)).GetType ("ClientInfo");15 Type typeNetConnection = typeClientInfo.GetField ("netConnection").FieldType.GetElementType ();16 MethodInfo[] mis = typeNetConnection.GetMethods ();17 foreach (MethodInfo mi in mis) {18 ParameterInfo[] pis = mi.GetParameters ();19 if (pis.Length == 1) {20 if (typeof (Package).Equals (pis[0].ParameterType)) {21 NetConnection_SendPackage = mi;22 }23 }24 }25 12 } 26 13 … … 81 68 82 69 p1.Entity.position = p2.Entity.GetPosition(); 70 p1.Entity.position.y += 1; 71 p1.Entity.position.z += 1; 83 72 } 84 73 85 74 NetPackage_EntityTeleport pkg = new NetPackage_EntityTeleport (p1.Entity); 86 75 87 if (NetConnection_SendPackage != null) { 88 NetConnection_SendPackage.Invoke (p1.ClientInfo.netConnection [0], new object[] {pkg}); 89 } else { 90 m_Console.SendResult ("SendPackage method not found"); 91 } 76 ConnectionManager.Instance.SendPackage (pkg, new PackageDestinationSingleEntityID (p1.ClientInfo.entityId)); 92 77 } 93 78 } catch (Exception e) {
Note:
See TracChangeset
for help on using the changeset viewer.