Guest User

EvilSensor Patch #1

a guest
Nov 10th, 2014
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.52 KB | None | 0 0
  1. --- EvilSensor.cs   2014-09-19 18:22:06.000000000 -0400
  2. +++ EvilSensor_patched.cs   2014-11-10 01:36:34.873948800 -0500
  3. @@ -1,10 +1,4 @@
  4. -using System;
  5. -using System.Collections.Generic;
  6. -using System.Linq;
  7. -using System.Text;
  8. -using System.Threading.Tasks;
  9. -
  10. -using Sandbox.Common;
  11. +using Sandbox.Common;
  12.  using Sandbox.Common.Components;
  13.  using Sandbox.Common.ObjectBuilders;
  14.  using Sandbox.Definitions;
  15. @@ -19,7 +13,7 @@
  16.      [MyEntityComponentDescriptor(typeof(MyObjectBuilder_SensorBlock))]
  17.      public class EvilSensor : MyGameLogicComponent
  18.      {
  19. -        static String[] OreNames;
  20. +        static System.String[] OreNames;
  21.  
  22.          IMySensorBlock Sensor;
  23.  
  24. @@ -28,6 +22,11 @@
  25.              Sensor.StateChanged -= sensor_StateChanged;
  26.          }
  27.  
  28. +        public override MyObjectBuilder_EntityBase GetObjectBuilder(bool copy = false)
  29. +        {
  30. +            throw new System.NullReferenceException();
  31. +        }
  32. +
  33.          public override void Init(MyObjectBuilder_EntityBase objectBuilder)
  34.          {
  35.              if (OreNames == null)
  36. @@ -47,7 +46,7 @@
  37.  
  38.              foreach(var o in OreNames)
  39.              {
  40. -                if (Sensor.CustomName.StartsWith(o, StringComparison.InvariantCultureIgnoreCase))
  41. +                if (Sensor.CustomName.StartsWith(o, System.StringComparison.InvariantCultureIgnoreCase))
  42.                  {
  43.                      ore = o;
  44.                      break;
  45. @@ -61,13 +60,7 @@
  46.              MyObjectBuilder_FloatingObject floatingBuilder = new MyObjectBuilder_FloatingObject();
  47.              floatingBuilder.Item = new MyObjectBuilder_InventoryItem() { Amount = 100, Content = new MyObjectBuilder_Ore() { SubtypeName = ore } };
  48.              floatingBuilder.PersistentFlags = MyPersistentEntityFlags2.InScene; // Very important
  49. -            floatingBuilder.PositionAndOrientation = new MyPositionAndOrientation()
  50. -            {
  51. -                Position = Sensor.WorldMatrix.Translation + Sensor.WorldMatrix.Forward * 1.5f, // Spawn ore 1.5m in front of the sensor
  52. -                Forward = Sensor.WorldMatrix.Forward,
  53. -                Up = Sensor.WorldMatrix.Up,
  54. -            };
  55. -
  56. +            floatingBuilder.PositionAndOrientation = new MyPositionAndOrientation(Sensor.WorldMatrix.Translation + Sensor.WorldMatrix.Forward * 1.5f, Sensor.WorldMatrix.Forward, Sensor.WorldMatrix.Up);
  57.              var floatingObject = Sandbox.ModAPI.MyAPIGateway.Entities.CreateFromObjectBuilderAndAdd(floatingBuilder);
  58.  
  59.              // Now it only creates ore, we will throw it later
Advertisement
Add Comment
Please, Sign In to add comment