コード例 #1
0
ファイル: WingsItem.cs プロジェクト: Morphan1/Voxalia
 public void OpenWings(PlayerEntity player)
 {
     PlaneEntity plane = new PlaneEntity("planeifound", player.TheRegion); // TODO: Player-wings model!
     plane.SetMass(100);
     plane.SetPosition(player.GetPosition());
     player.TheRegion.SpawnEntity(plane);
     plane.SetOrientation(Quaternion.CreateFromAxisAngle(Vector3.UnitX, -90.0 * Utilities.PI180));
     plane.DriverSeat.Accept(player);
     player.Wings = plane;
     // JUST IN CASE: Enforce the correct default orientation!
     // TODO: Make this not needed!
     player.TheRegion.TheWorld.Schedule.ScheduleSyncTask(() =>
     {
         plane.SetOrientation(Quaternion.CreateFromAxisAngle(Vector3.UnitX, -90.0 * Utilities.PI180));
     }, 0.05);
 }
コード例 #2
0
 // TODO: Should non-players be allowed here?
 public void Copy(PlayerEntity player, ItemStack item)
 {
     try
     {
         Structure structure = new Structure(player.TheRegion, player.Selection.Min, player.Selection.Max, player.GetPosition().GetBlockLocation());
         int c = 0;
         while (player.TheServer.Files.Exists("structures/" + item.SecondaryName + c + ".str"))
         {
             c++;
         }
         player.TheServer.Files.WriteBytes("structures/" + item.SecondaryName + c + ".str", structure.ToBytes());
         player.SendMessage(TextChannel.DEBUG_INFO, "^2Saved structure as " + item.SecondaryName + c);
         // TODO: Click sound!
         player.LastBlockBreak = player.TheRegion.GlobalTickTime;
     }
     catch (Exception ex)
     {
         Utilities.CheckException(ex);
         player.SendMessage(TextChannel.DEBUG_INFO, "^1Failed to create structure: " + ex.Message);
     }
 }