Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.56 KB | None | 0 0
  1. using Sandbox.Game;
  2. using Sandbox.Game.Entities;
  3. using Sandbox.ModAPI;
  4. using VRage.Game;
  5. using VRage.Game.Components;
  6.  
  7.  
  8. namespace Axebeard.ShippingContract
  9. {
  10.     [MySessionComponentDescriptor(MyUpdateOrder.NoUpdate)]
  11.     public class Klime : MySessionComponentBase
  12.     {
  13.         public override void Init(MyObjectBuilder_SessionComponent sessionComponent)
  14.         {
  15.             base.Init(sessionComponent);
  16.             MyAPIGateway.Utilities.MessageEntered += UtilitiesOnMessageEntered;
  17.         }
  18.  
  19.         private void UtilitiesOnMessageEntered(string messagetext, ref bool sendtoothers)
  20.         {
  21.             MyVisualScriptLogicProvider.SendChatMessage("Attempting to spawn cargo...");
  22.             var spawnpoint = MyEntities.FindFreePlace(MyAPIGateway.Session.Player.Character.WorldVolume.Center, 500);
  23.             //MyVisualScriptLogicProvider.SpawnPrefab("Axe_ShippingContainer", spawnpoint, Vector3D.Forward, Vector3D.Up);
  24.             //MyEntities.CreateFromObjectBuilderAndAdd(new MyObjectBuilder_CubeGrid "LargeBlockLargeContainer", true);
  25.  
  26.             var cargo = new MyCargoContainer();
  27.             cargo.DisplayName = "My Cargo Container";
  28.             var cubeBlock = cargo.GetObjectBuilderCubeBlock();
  29.         }
  30.  
  31.         private static readonly MyObjectBuilder_CubeGrid CubeGridBuilder = new MyObjectBuilder_CubeGrid()
  32.         {
  33.             EntityId = 0,
  34.             GridSizeEnum = MyCubeSize.Large,
  35.             IsStatic = false,
  36.             Skeleton = new List<BoneInfo>(),
  37.             LinearVelocity = Vector3.Zero,
  38.             AngularVelocity = Vector3.Zero,
  39.             ConveyorLines = new List<MyObjectBuilder_ConveyorLine>(),
  40.             BlockGroups = new List<MyObjectBuilder_BlockGroup>(),
  41.             Handbrake = false,
  42.             XMirroxPlane = null,
  43.             YMirroxPlane = null,
  44.             ZMirroxPlane = null,
  45.             PersistentFlags = MyPersistentEntityFlags2.InScene,
  46.             Name = "My Cargo Container",
  47.             DisplayName = "My Cargo Container",
  48.             CreatePhysics = true,
  49.             DestructibleBlocks = true,
  50.             PositionAndOrientation = new MyPositionAndOrientation(spawnpoint, Vector3D.Forward, Vector3D.Up),
  51.  
  52.             CubeBlocks = new List<MyObjectBuilder_CubeBlock>() { cubeBlock }
  53.         };
  54.  
  55.         //string contmsg = "Shipping Container spawned at " + spawnpoint;
  56.         //MyVisualScriptLogicProvider.SendChatMessage(contmsg);
  57.  
  58.         }
  59.  
  60.         protected override void UnloadData()
  61.         {
  62.             MyAPIGateway.Utilities.MessageEntered -= UtilitiesOnMessageEntered;
  63.         }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement