Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- EvilSensor_final.cs 2014-11-10 04:34:14.971671500 -0500
- +++ EvilSensor.cs 2014-11-10 04:51:31.420953000 -0500
- @@ -8,7 +8,7 @@
- using Sandbox.ModAPI.Ingame;
- using Sandbox.ModAPI.Interfaces;
- -namespace TestScript1
- +namespace EvilSensor
- {
- [MyEntityComponentDescriptor(typeof(MyObjectBuilder_SensorBlock))]
- public class EvilSensor : MyGameLogicComponent
- @@ -24,7 +24,7 @@
- public override MyObjectBuilder_EntityBase GetObjectBuilder(bool copy = false)
- {
- - throw new System.NullReferenceException();
- + return null;
- }
- public override void Init(MyObjectBuilder_EntityBase objectBuilder)
- @@ -61,10 +61,9 @@
- floatingBuilder.Item = new MyObjectBuilder_InventoryItem() { Amount = 100, Content = new MyObjectBuilder_Ore() { SubtypeName = ore } };
- floatingBuilder.PersistentFlags = MyPersistentEntityFlags2.InScene; // Very important
- floatingBuilder.PositionAndOrientation = new MyPositionAndOrientation(Sensor.WorldMatrix.Translation + Sensor.WorldMatrix.Forward * 1.5f, Sensor.WorldMatrix.Forward, Sensor.WorldMatrix.Up);
- - var floatingObject = Sandbox.ModAPI.MyAPIGateway.Entities.CreateFromObjectBuilder(floatingBuilder);
- - if (!floatingObject.IsVisible())
- + if (Sandbox.ModAPI.MyAPIGateway.Multiplayer.IsServer)
- {
- - Sandbox.ModAPI.MyAPIGateway.Entities.AddEntity(floatingObject);
- + 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