Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

Modding API - changes in modding interface

Discussion in 'Modding API' started by joeblack616, Oct 22, 2014.

Thread Status:
Not open for further replies.
This last post in this thread was made more than 31 days old.
  1. Digi Senior Engineer

    Messages:
    2,385
    @DuneD
    Just a heads up, you won't get the actual asteroid center from that code since the maximum boundary is larger than the asteroid itself.

    I know because I'm also doing exacly the same mod =) http://forums.keenswh.com/post/wip-natural-gravity-7241283?pid=1285949227
     
    Last edited by a moderator: Jan 30, 2015
  2. joeblack616 Apprentice Engineer

    Messages:
    225
    actually its also our issue. We changed loading and api gateway is initialized after update calls can occur,
    will be fixed in todays update
     
  3. DuneD Junior Engineer

    Messages:
    948
    It actually does get the center of the asteroid :confused: But if you take a look at my code you can check that I use the default size of the asteroid (since I'm using 3 custom asteroids I made), I dont try to retrieve the size by code, since it only returns the bounding box.

    Edit: Seeing your video was what inspired me to do this on my planet mod, and also to start scripting again, thanks :)
     
    Last edited by a moderator: Jan 30, 2015
  4. joeblack616 Apprentice Engineer

    Messages:
    225
    Hi, from now on, you can find automatically generated documentation in game folder. Hope it will helps.
    Also :
    added :

    void Save(out byte[] outCompressedData) to IMyStorage


    IMyStorage CreateStorage(byte[] data)
    IMyVoxelMap CreateVoxelMap(string storageName, IMyStorage storage, Vector3D position) to IMyVoxelMaps
    void SetDamageEffect(bool start) to IMyCubeBlock
     
  5. midspace Senior Engineer

    Messages:
    2,224
    CreateVoxelMap() appears to only create a Cube shaped storage, and does not allow rectangular shaped storage.
    A Size of 512,64,128, will create a 512,512,512 sized storage.
    Is this by design, or a bug?

    (I would point it, that it is very strange to use a Vector to hold 3 values if the size is restricted to a cube. One value is sufficient.)
     
    Last edited by a moderator: Feb 6, 2015
  6. joeblack616 Apprentice Engineer

    Messages:
    225
    In next release BoundingBox will have Size, Volume,Perimeter and SurfaceArea as property and not method.
    Vector will have Sum and Volume as property and not method.
     
    Last edited by a moderator: Feb 6, 2015
  7. joeblack616 Apprentice Engineer

    Messages:
    225
    its by design.
     
  8. midspace Senior Engineer

    Messages:
    2,224
    Joe, can we get a sample mod on how to properly use the Objectives, and GetObjectiveLine to create multiple goals for the player, that be achieved and cleared when each objective is met?

    Will it be difficult to use Objectives, when two or more mods are creating objectives for the player?

    How do we go about using Objectives if we have objective text which needs to be changed as the player is progressing (ie., time, position, or directional information)?

    Might it make more sense to change Objectives to a Dictionary<int, string> and CurrentObjective to int, thus allowing us to use a Key to the objective and change the text as required without changing the objective?
     
  9. Digi Senior Engineer

    Messages:
    2,385
    MySessionComponentBase seems to have a HandleInput() and it seems to be triggered constantly... how do we tell which key is pressed, if any ?
    It would be nice to be able to get what actions are pressed or what keys.
     
    Last edited by a moderator: Feb 15, 2015
  10. Digi Senior Engineer

    Messages:
    2,385
    Hmm... using MyAPIGateway.Multiplayer.SendMessageToOthers() from a client, would it directly send data to other clients in a peer2peer method or does it use the server as a relay ?

    And if that is peer2peer and the 'reliable' argument is set to true but the two players don't have a direct connection between them... what then ? :woot:

    I know I can use the server as a relay manually but I'm just curious if *ToOthers() already relays or if it's peer2peer AND reliable.
     
    Last edited by a moderator: Feb 17, 2015
  11. Gwindalmir Senior Engineer

    Messages:
    1,004
    I ended up removing that code after I revamped my mod, however what I did was call SendMessageToOthers() on the server, and SendMessageToServer() from clients. Seemed to work while I used it. Other clients still received the message.

    Sorry I can't directly answer your question. Oh, and reliable defaults to true.
     
    Last edited by a moderator: Feb 17, 2015
  12. Digi Senior Engineer

    Messages:
    2,385
    Well I guess there's also an internal limit to calling SendMessageTo() or something because I've been using it to send from client to server and from server to each client individually, but the message never came back to the client (with just me on the server)... so I'm using ToOthers() now on server-side.
     
  13. joeblack616 Apprentice Engineer

    Messages:
    225
    Hi guys, added :

    IMyVoxelShapeBox GetBoxVoxelHand();
    IMyVoxelShapeCapsule GetCapsuleVoxelHand();
    IMyVoxelShapeSphere GetSphereVoxelHand();
    IMyVoxelShapeRamp GetRampVoxelHand();

    void PaintInShape(
    IMyVoxelMap voxelMap,
    IMyVoxelShape voxelShape,
    byte materialIdx);
    void CutOutShape(
    IMyVoxelMap voxelMap,
    IMyVoxelShape voxelShape);
    void FillInShape(
    IMyVoxelMap voxelMap,
    IMyVoxelShape voxelShape,
    byte materialIdx);

    int VoxelMaterialCount
    {
    get;
    }
    into IMyVoxelMaps
     
    Last edited by a moderator: Mar 5, 2015
  14. joeblack616 Apprentice Engineer

    Messages:
    225
    added :
    void TrackTarget(IMyEntity entity);
    void TrackTarget(Vector3D pos, Vector3 velocity);
    void SetTarget(IMyEntity Entity);
    void SetTarget(Vector3D pos);

    float Elevation { get; set; }
    void SyncElevation();
    float Azimuth { get; set; }
    void SyncAzimuth();
    bool EnableIdleRotation { get; set; }

    void SyncEnableIdleRotation();
    bool AIEnabled { get; }
    void ResetTargetingToDefault();

    to Sandbox.ModAPI.Ingame.IMyLargeTurretBase
     
  15. DuneD Junior Engineer

    Messages:
    948
    Nice! and welcome back Joe :)
     
  16. Gwindalmir Senior Engineer

    Messages:
    1,004
    What's interesting is this is posted before the actual update. You tease. :)
     
  17. joeblack616 Apprentice Engineer

    Messages:
    225
    I almost always did it like this. P.S. : Don't worry update is coming. ;)
     
    Last edited by a moderator: Mar 5, 2015
  18. TheEndersWAR Apprentice Engineer

    Messages:
    381
    I Sense Glory :)
     
  19. Digi Senior Engineer

    Messages:
    2,385
    Just a heads up, the MyAPIGateway.Session.VoxelMaps.FillInShape() has the same limits as normal voxel hands, if there's anything inside its shape range it won't do anything!
     
  20. midspace Senior Engineer

    Messages:
    2,224
    Also, trying to call it from within MyAPIGateway.Parallel, doesn't appear to move the processing to a background thread. It does cause the main UI thread to lock up during long running processing.
    And yet, I can do background processing with IMyStorage.WriteRange without issues (As long as voxelMap.Physics.Enabled is false during the calls to WriteRange).

    Edit: looks like my methods are very stable with large asteroids, causing unusual an exception either in the Havok engine, or the Space Engineers code.
     
    Last edited by a moderator: Mar 10, 2015
  21. joeblack616 Apprentice Engineer

    Messages:
    225
    Hi all , please check your scripts, we did some refactoring with namespaces.
     
  22. fabricator77 Apprentice Engineer

    Messages:
    399
    That's an understatement.

    Error loading code-completion information for Sandbox.Audio from Sandbox.Audio.dll
    Error loading code-completion information for Sandbox.Input from Sandbox.Input.dll
    Error loading code-completion information for VRage.Common from VRage.Common.dll

    at a guess Sandbox.Input is shifted to Sandbox.Common.Input

    VRage.Common is now VRage with some structure changes. eg MyVRageUtils -> MyUtils
     
  23. midspace Senior Engineer

    Messages:
    2,224
    A breakdown on the changes.
    • The game has removed "Vrage.Common.dll"
    • The game has added "Vrage.dll" in its place.
    • You will have to update any project references accordingly.
    • Most places where you have a "Vrage.Common.xxxx", you will have to replace with "Vrage.xxxx"
     
    Last edited by a moderator: Mar 20, 2015
  24. Gwindalmir Senior Engineer

    Messages:
    1,004
    Sandbox.Audio and .Input moved to VRage.Audio and .Input, respectively, it appears.
    I didn't even know we had audio control. Does that mean we can play custom sounds without a soundblock?

    Otherwise it doesn't look like any of those changes affected me. My scripts still compile unmodified.
     
  25. midspace Senior Engineer

    Messages:
    2,224
    Changes in 01.080 API

    Sun properties is accessible again!
    Code:
    var ob = (MyObjectBuilder_EnvironmentDefinition)MyDefinitionManager.Static.EnvironmentDefinition.GetObjectBuilder();
    ... = ob.SunDirection;
    And Sandbox.ModAPI.Ingame.IMyMotorStator now has an Angle property in Radians.
    This is much more accurate than using DetailedInfo which only displays whole numbers.

    As for the most significant change of all...
    You can figure that out for yourselves. ;)
     
    • Like Like x 1
  26. Lynnux Junior Engineer

    Messages:
    881
    Did I see

    IMyGps

    in Sandbox.ModAPI or am I taking drugs ?

    Edit: no drugs. So e.g.

    Code:
    int NumberOfAddedContacts = MyAPIGateway.Session.Gps.ScanText("GPS:Waypoint1:1.0:1.0:1.0:GPS:Waypoint2:2.0:2.0:2.0:","The two waypoints");
    will enter two waypoints with description "The two waypoints" into the GPS window which can be activated manually.
    Each call of this method is refreshing the GPS window, though, which feels like "freezing" the window if done too frequently.
     
    Last edited: May 8, 2015
  27. midspace Senior Engineer

    Messages:
    2,224
    Yes, stop taking drugs.

    Also, the:
    Sandbox.ModAPI.Ingame.IMyShipController
    Sandbox.ModAPI.Ingame.IMyLargeTurretBase
    have new property "IsUnderControl", so you can detect if a player is piloting or controlling a craft or a turret.

    This should help with creating scripts when a player disconnects or is removed from a ship.
     
  28. Digi Senior Engineer

    Messages:
    2,385
    Sandbox.ModAPI.Ingame.IMyTextPanel also has some new methods, get/write private text/title, image removal, clearing images and setting private text to show on screen.
     
  29. Lynnux Junior Engineer

    Messages:
    881
    Gps has been further enhanced in Sandbox.ModAPI:
    IMyGps is the type of one entry. I don't see the ScanText interface anymore.
    But to handle entries there is the IMyGpsCollection now. As explained there, use Create then AddGps to add to all clients in network or AddLocalGps to just add the entry on this client.

    long identityID is the player ID.
     
  30. baronmoll Trainee Engineer

    Messages:
    40
    How does this IMyGpsCollection Modify thingy work? It sais it needs the player Id and a gps and then sends a network request to change things, but what gps does it need?

    Edit: Question moved to its own thread since it's off topic.
     
    Last edited: Jun 16, 2015
Thread Status:
Not open for further replies.
This last post in this thread was made more than 31 days old.