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 - new requests

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
    Can we get a way to set rotation of an object without messing with the WorldMatrix ?

    Because stuff like these tend to happen:
    [​IMG]

    [​IMG]
    [​IMG]
     
  2. Digi Senior Engineer

    Messages:
    2,385
    Another request :} For MyAPIGateway.CubeBuilder, can we have a method to disable/toggle block painting ?

    Or preferably that input actions reading and maybe blocking, that way we can just block the action when the player ues the paint action.
     
    Last edited by a moderator: Feb 22, 2015
  3. Gwindalmir Senior Engineer

    Messages:
    1,004
    I get that too. I would think, as you as you know you're modifying it correctly, it should work.
    It seems to think the skew was changed, when it hasn't. Try that on a station, you get permanent object alteration.

    That fact that items get compressed to 2D (or inside-out, I've found) I think is a bug. At least it goes away once you move it (except stations).

    Personally, I'd like SetWorldMatrix to work properly. I need to set both rotation and position, and I'd like to do it in one step.
     
  4. midspace Senior Engineer

    Messages:
    2,224
    Get we get the BlockDefiniton and BlockOriention made available on the IMySlimBlock. After using IMyCubrGrid.GetBlocks, I want to look at the definitions of every block, regardless of whether it is functional, armor or otherwise.


    Code:
    var blocks = new List<IMySlimBlock>();
    cubeGrid.GetBlocks(blocks);
    foreach (var block in blocks)
    {
        if (block.FatBlock != null)
        {
            definition = MyDefinitionManager.Static.GetCubeBlockDefinition(block.FatBlock.BlockDefinition);
            orientation = block.FatBlock.Orientation;
        }
        else
        {
            var ob = block.GetObjectBuilder();
            definition = MyDefinitionManager.Static.GetCubeBlockDefinition(ob);
            orientation = ob.BlockOrientation;
        }
    
     
    Last edited by a moderator: Mar 3, 2015
  5. plaYer2k Master Engineer

    Messages:
    3,160
    I would like to see System.Type whitelisted for ingame programming.
    My currently intended use is to read all interfaces per IMyEntity instead of "trying them".

    Furthermore as i did not notice this suggestion thread early enough, which is focused on the ModAPI instead of the whole "modding", i would like to link to my suggestions made in the New modding features request thread:
    http://forums.keenswh.com/post/show_single_post?pid=1286409871&postcount=181
    http://forums.keenswh.com/post/show_single_post?pid=1286431119&postcount=185
    http://forums.keenswh.com/post/show_single_post?pid=1286431691&postcount=187
     
    Last edited by a moderator: Mar 8, 2015
  6. midspace Senior Engineer

    Messages:
    2,224
    Can the MyAPIGateway.Session.VoxelMaps.FillInShape() return a bool to indicate if it failed, as there appears to be nothing to indicate if your call fails due to a ship or player occupying the space when you call it.
     
  7. plaYer2k Master Engineer

    Messages:
    3,160
    Well would it maybe useful to know who blocked the FIllInShape too? Then it could return a List<IMyEntity> which is null for success and otherwise contains all blocking entities.
    I just guess that getting more informations why something didnt work as intended would always be useful.
     
  8. midspace Senior Engineer

    Messages:
    2,224
    Can we get access to the System.Diagnostics.StopWatch on the whitelist?
     
  9. plaYer2k Master Engineer

    Messages:
    3,160
    Extending the IMyOreDetector interface to something like this
    Code:
    public interface IMyOreDetector : IMyFunctionalBlock, IMyTerminalBlock, IMyCubeBlock, IMyEntity
    {
      // These two are present currently
      float Range;
      bool BroadcastUsingAntennas;
      // This is the list of all the detected ores
      List<IMyOre> detectedOres;
      // This is the list of all the ores we currently detect by their TypeName
      List<string> detectingOres;
      // This is the amount of ores that has to be exceeded in order to detect it (according to this change http://forums.keenswh.com/post/please-change-the-ore-detector-back-to-how-it-was-7219230)
      float minimumAmount
    }
    // This is a new struct containing informations about the ore
    public struct IMyOre
    {
      // the position of the ores
      Vector3 Position;
      // the type of the ore like: gold, iron
      string TypeName;
    }
    previously suggested here
    http://forums.keenswh.com/threads/ore-detector-options-show-specific-ore.6884679
     
    Last edited: Apr 25, 2015
    • Like Like x 1
  10. Digi Senior Engineer

    Messages:
    2,385
    I still hope for a simple input API :( something like:

    Code:
    [Flags]
    public enum InputAction
    {
        MoveForward,
        MoveBackward,
        MoveLeft,
        MoveRight,
        MoveUp,
        MoveDown,
        FirePrimary,
        FireSecondary,
        Use,
        UseTerminal,
        etc
    }
    
    [Flags]
    public enum InputKey
    {
        A,B,C,D,E,F,G,H,I,J,K,L,M,N,etc
    }
    
    public interface IMyUserInputComponent
    {
        void HandleInput(InputAction actions, InputKey keys);
    }
    
    public abstract class MySessionComponentBase : IMyUserInputComponent
    {
        //...
        public virtual void HandleInput(InputAction actions, InputKey keys)
        {
        }
        //...
    }
    
    // Example
    public class MyMod : MySessionComponentBase
    {
        public override void HandleInput(InputAction actions, InputKey keys)
        {
            if((actions &amp; InputAction.FirePrimary) == InputAction.FirePrimary)
            {
                // player holds down the fire button
            }
        }
    }
    Or instead use registering actions/keys for callbacks:

    Code:
    public class MyMod : MySessionComponentBase
    {
        public override void LoadData()
        {
            MyAPIGateway.Utilities.RegisterAction(InputAction.FirePrimary, FiredWeapon, StoppedFiring);
            //MyAPIGateway.Utilities.RegisterKey(InputKey.Mouse1, Clicked);
        }
        
        protected override void UnloadData()
        {
            MyAPIGateway.Utilities.UnregisterAction(InputAction.FirePrimary, FiredWeapon, StoppedFiring);
        }
        
        public void FiredWeapon()
        {
            // Firing!
        }
    
        public void StoppedFiring()
        {
            // Stopped holding action/key down, should be an optional callback :}
        }
    }
     
    Last edited by a moderator: Mar 19, 2015
  11. Digi Senior Engineer

    Messages:
    2,385
    Another request, can we have a raytrace method to shoot an immaginary line towards a direction and get the position where it hits, entity that it hits and the plane normal vector ? Maybe even have some ignore flags/entity types.

    I know there's one for raytracing blocks, but I'm looking for one that can also detect the surface of an asteroid or the surface of a ship for example, and return the collission's normal vector direction.
     
  12. fabricator77 Apprentice Engineer

    Messages:
    399
    The current Asteroid modding is still incomplete. There is no corresponding API calls to make use of this guide http://steamcommunity.com/sharedfiles/filedetails/?id=391149836

    I can put my own asteroids in a mod, paste them in in creative mode, create a new blank asteroid and edit it, or edit an asteroid already in the save.

    Cannot actually insert any existing asteroid into the game using the API, not even the one in my own mod. All the Voxel constructors are locked down, so people can't use them to read binary files.
    Also cannot get a list of available asteroids, or create a new procedural asteroid.

    Could we please have:
    1. a way to read VoxelMapStorageDefinition(s) as a list, so we can find existing game/mod asteroids. Could be a simple string array with the SubtypeId values.
    2. A simple method add an asteroid to game, takes (String storageDefinitionName , String newStorageName , Vector3 position) and returns true/false for success.
    Should prove moron/hacker proof, as it reads an existing asteroid and checks it, saves it as a new name, and plonks it in world, no binary data exposed.

    None of these are remotely complicated to implement, I'll be annoyed if it take forever (like the last one that's 7 weeks and counting). Was honestly expecting it in this week's update, given last week's added the ability to include asteroids in mods, and the APIs sometimes lag behind.

    ps: I have 10 other API things I could ask for, but I'm not.
     
    Last edited by a moderator: Mar 20, 2015
  13. Digi Senior Engineer

    Messages:
    2,385
    @fabricator77
    You can already do those.
    First, reference VRage.dll and 'using VRage.Voxels;' (previously in VRage.Common.dll)

    For your explicit requests:
    1. MyDefinitionManager.Static.GetVoxelMapStorageDefinitions()
    2. I don't know how you missed these, but if you really want a method like that, here you go:
    Code:
    IMyVoxelMap CreateAsteroid(string name, int size, Vector3D position)
    {
        IMyStorage storage = MyAPIGateway.Session.VoxelMaps.CreateStorage(new Vector3I(size));
        IMyVoxelMap map = MyAPIGateway.Session.VoxelMaps.CreateVoxelMap(name, storage, position, 0);
        
        return map;
    }
    And check if the returned value is not null (not sure if it even can be).
    It's more useful to return the actual entity instead of just true/false.

    Also have a look at this mod: http://steamcommunity.com/sharedfiles/filedetails/?id=399791753
     
    Last edited by a moderator: Mar 21, 2015
  14. midspace Senior Engineer

    Messages:
    2,224
    Digi, there is a significant gap in that code that fabricator77 was referring to in step 2, that is to create an asteroid in game from a MyVoxelMapStorageDefinition.
     
  15. The Legacy Trainee Engineer

    Messages:
    27
    Hi! I'm looking to make some variety of weapons. My simple requests are:

    - Ability to adjust reload duration in SmallMissileLauncherReload.*
    - Ability to adjust number of rounds fired before reloading in SmallMissileLauncherReload.*
    - Ability to add penetration values to ProjectileProperties. This could easily be done by adding hitpoints to a round, and using that value to determine how much penetration it has before the round is destroyed. So if a ship has 10,000HP worth of blocks in the path of a round, and a round has 5,000HP worth of durability, then the round will go through half of the ship before disappearing.
    - Ability to add width/size of the round to ProjectileProperties, for larger caliber rounds.
    - Ability to add multi-barrel firing (ie. Darth's Minotaur Cannons) and removing then need to add a rotary barrel to ProjectileProperties, eliminating the need to resort to LargeMissileTurret (as that adds a reloading delay between volleys).
    - Ability to add hit points to MissileProperties, to kill three birds with one stone (one, missile durability vs anti-missile weaponry ie. Gatling guns, two, durability from being destroyed by nearby missiles, three, eliminate proximity-detonation from the firing craft.
    - Ability to add immunity to own-explosion for MissileProperties. This is an alterative to the HP idea above.

    Note that these requests I hope can be done within the text files for the mod, instead of using the API itself. Thanks!

    * - High-Priority; I'm needing this to modify this in order to finish a work-in-progress mod.
     
  16. Digi Senior Engineer

    Messages:
    2,385
    Ah I see, a method to load asteroids from MyVoxelMapStorageDefinition would indeed be useful.

    Making procedural asteroids (get generated fast and don't get saved until mined) would also be awesome to have too.

    Heh, I have around 5 mods that just sit around unfinished because of I hit a bump in the API :/ And one is released with fiddly workarounds (like using the lights key to activate the tool... :p)
     
    Last edited by a moderator: Mar 21, 2015
  17. The Legacy Trainee Engineer

    Messages:
    27
    Indeed. :p Well, thankfully I also have a workaround. The problem is, is that in the meantime, it's going to be...slightly overpowered. :woot:
     
  18. Digi Senior Engineer

    Messages:
    2,385
    Not sure if this is being worked on or is the game's internal interface for input, but can we please have access to VRage.Input.MyInput ? :}

    Code:
    bool mouse1 = MyInput.Static.IsMousePressed(MyMouseButtonsEnum.Left);
    MyAPIGateway.Utilities.ShowNotification("mouse1="+mouse1, 17, MyFontEnum.Red);
    :(
     
  19. midspace Senior Engineer

    Messages:
    2,224
    Add a new property to the Sandbox.ModAPI.Ingame.IMyShipController, to indicate if it is occupied or under control. (Cockpit or Remote).
     
  20. fabricator77 Apprentice Engineer

    Messages:
    399
    "not allowed in script" = we made this public so other parts of the game can use it, but it's blocked in the API.
    It's a real pain when you find something neat, spend a while feeding it the right data so it doesn't error, then get that thrown.

    If it's blocked, it usually for some security reason, though some are due to problems it would create in the game. Hopefully Joe will be around to give you a yes/no answer on your request.
     
  21. RA2lover Trainee Engineer

    Messages:
    96
    DetailedInfo properties should be expanded for thrusters/gyroscopes.
    Thrusters should display maximum/current power inputs, and gyroscopes should display current torque output per axis.
     
  22. Digi Senior Engineer

    Messages:
    2,385
    Can we have a helmet boolean for MyObjectBuilder_Character ? It's pretty hard to tell if the player has the helmet on or off when it comes to modded characters, for vanilla it's as easy as checking the model suffix for "_no_helmet" but not everybody will use that I belive :woot:

    Also, how can we disable shadows on certain entities ? I've tried messing with the EntityFlags and the persistent flags but none of them remove the shadow.
     
    Last edited: Apr 20, 2015
  23. plaYer2k Master Engineer

    Messages:
    3,160
    Why only to the object builder and not the Sandbox.ModAPI.IMyPlayer interface too aswell as exposing it to the ingame programming api?
    Afaik getting the object builder is very intensive and sometimes even ansynchronous.
     
  24. Digi Senior Engineer

    Messages:
    2,385
  25. dirtyredz Apprentice Engineer

    Messages:
    208
    Id like to see an interface for Sandbox.Game.GameSystems.MyGridOxygenSystem, specifically methods/fields/properties:
    private List<MyOxygenRoom> m_rooms;
    private bool isPressurizing;
    private int RoomIndex();
    private bool IsPressurized();
    internal float[] GetOxygenAmount();

    Sandbox.Game.GameSystems.MyOxygenRoom;

    Thanks much appreciated.
     
  26. Orange_Slime_ Junior Engineer

    Messages:
    560
    I have to say, I don't know shit about modding, but I think that first of all, the mods should be stored locally, and second, open up the multiplayer server system up so people can do things like limiting shit weights and stuff via server mods.
     
  27. Gwindalmir Senior Engineer

    Messages:
    1,004
    I came here to vote up this one.
    Type information is useful to determine if there's conflicting mods installed.
     
  28. Digi Senior Engineer

    Messages:
    2,385
    They are stored locally, the 'downloading mods' progress thing only checks the mods and downloads updates if necessary.

    And you can change block weights, but I'm not really sure what you mean by "shit weights", or what that has to do with MP :woot:
     
  29. Orange_Slime_ Junior Engineer

    Messages:
    560
    I meant ship, sorry, and I was thinking things like the external voting rewards and npc spawns.
    also, I don't think the mods work while offline, so I was talking about that (may have changed, but I haven't gotten around to checking in awhile)
     
  30. Digi Senior Engineer

    Messages:
    2,385
    Ah I see, that's a diferent issue because mods are stored locally but the game tries to verify that they're updated and if you don't have an internet connection it just fails :p
     
Thread Status:
Not open for further replies.
This last post in this thread was made more than 31 days old.