Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- EvilSensor.cs 2014-09-19 18:22:06.000000000 -0400
- +++ EvilSensor_patched.cs 2014-11-10 01:36:34.873948800 -0500
- @@ -1,10 +1,4 @@
- -using System;
- -using System.Collections.Generic;
- -using System.Linq;
- -using System.Text;
- -using System.Threading.Tasks;
- -
- -using Sandbox.Common;
- +using Sandbox.Common;
- using Sandbox.Common.Components;
- using Sandbox.Common.ObjectBuilders;
- using Sandbox.Definitions;
- @@ -19,7 +13,7 @@
- [MyEntityComponentDescriptor(typeof(MyObjectBuilder_SensorBlock))]
- public class EvilSensor : MyGameLogicComponent
- {
- - static String[] OreNames;
- + static System.String[] OreNames;
- IMySensorBlock Sensor;
- @@ -28,6 +22,11 @@
- Sensor.StateChanged -= sensor_StateChanged;
- }
- + public override MyObjectBuilder_EntityBase GetObjectBuilder(bool copy = false)
- + {
- + throw new System.NullReferenceException();
- + }
- +
- public override void Init(MyObjectBuilder_EntityBase objectBuilder)
- {
- if (OreNames == null)
- @@ -47,7 +46,7 @@
- foreach(var o in OreNames)
- {
- - if (Sensor.CustomName.StartsWith(o, StringComparison.InvariantCultureIgnoreCase))
- + if (Sensor.CustomName.StartsWith(o, System.StringComparison.InvariantCultureIgnoreCase))
- {
- ore = o;
- break;
- @@ -61,13 +60,7 @@
- MyObjectBuilder_FloatingObject floatingBuilder = new MyObjectBuilder_FloatingObject();
- floatingBuilder.Item = new MyObjectBuilder_InventoryItem() { Amount = 100, Content = new MyObjectBuilder_Ore() { SubtypeName = ore } };
- floatingBuilder.PersistentFlags = MyPersistentEntityFlags2.InScene; // Very important
- - floatingBuilder.PositionAndOrientation = new MyPositionAndOrientation()
- - {
- - Position = Sensor.WorldMatrix.Translation + Sensor.WorldMatrix.Forward * 1.5f, // Spawn ore 1.5m in front of the sensor
- - Forward = Sensor.WorldMatrix.Forward,
- - Up = Sensor.WorldMatrix.Up,
- - };
- -
- + floatingBuilder.PositionAndOrientation = new MyPositionAndOrientation(Sensor.WorldMatrix.Translation + Sensor.WorldMatrix.Forward * 1.5f, Sensor.WorldMatrix.Forward, Sensor.WorldMatrix.Up);
- var floatingObject = Sandbox.ModAPI.MyAPIGateway.Entities.CreateFromObjectBuilderAndAdd(floatingBuilder);
- // Now it only creates ore, we will throw it later
Advertisement
Add Comment
Please, Sign In to add comment