Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Sandbox.Game;
- using Sandbox.Game.Entities;
- using Sandbox.ModAPI;
- using VRage.Game;
- using VRage.Game.Components;
- namespace Axebeard.ShippingContract
- {
- [MySessionComponentDescriptor(MyUpdateOrder.NoUpdate)]
- public class Klime : MySessionComponentBase
- {
- public override void Init(MyObjectBuilder_SessionComponent sessionComponent)
- {
- base.Init(sessionComponent);
- MyAPIGateway.Utilities.MessageEntered += UtilitiesOnMessageEntered;
- }
- private void UtilitiesOnMessageEntered(string messagetext, ref bool sendtoothers)
- {
- MyVisualScriptLogicProvider.SendChatMessage("Attempting to spawn cargo...");
- var spawnpoint = MyEntities.FindFreePlace(MyAPIGateway.Session.Player.Character.WorldVolume.Center, 500);
- //MyVisualScriptLogicProvider.SpawnPrefab("Axe_ShippingContainer", spawnpoint, Vector3D.Forward, Vector3D.Up);
- //MyEntities.CreateFromObjectBuilderAndAdd(new MyObjectBuilder_CubeGrid "LargeBlockLargeContainer", true);
- var cargo = new MyCargoContainer();
- cargo.DisplayName = "My Cargo Container";
- var cubeBlock = cargo.GetObjectBuilderCubeBlock();
- }
- private static readonly MyObjectBuilder_CubeGrid CubeGridBuilder = new MyObjectBuilder_CubeGrid()
- {
- EntityId = 0,
- GridSizeEnum = MyCubeSize.Large,
- IsStatic = false,
- Skeleton = new List<BoneInfo>(),
- LinearVelocity = Vector3.Zero,
- AngularVelocity = Vector3.Zero,
- ConveyorLines = new List<MyObjectBuilder_ConveyorLine>(),
- BlockGroups = new List<MyObjectBuilder_BlockGroup>(),
- Handbrake = false,
- XMirroxPlane = null,
- YMirroxPlane = null,
- ZMirroxPlane = null,
- PersistentFlags = MyPersistentEntityFlags2.InScene,
- Name = "My Cargo Container",
- DisplayName = "My Cargo Container",
- CreatePhysics = true,
- DestructibleBlocks = true,
- PositionAndOrientation = new MyPositionAndOrientation(spawnpoint, Vector3D.Forward, Vector3D.Up),
- CubeBlocks = new List<MyObjectBuilder_CubeBlock>() { cubeBlock }
- };
- //string contmsg = "Shipping Container spawned at " + spawnpoint;
- //MyVisualScriptLogicProvider.SendChatMessage(contmsg);
- }
- protected override void UnloadData()
- {
- MyAPIGateway.Utilities.MessageEntered -= UtilitiesOnMessageEntered;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement