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 - broken things

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. blilli Trainee Engineer

    Messages:
    19
    midspace, you are right!
    I've added waiting code, and my problem has gone. Thank you!
    Code:
    public override void UpdateBeforeSimulation()
    {
                if (!inited)
                {
                    //waiting interface is ready
                    if (MyAPIGateway.Session == null) return;
                    if (MyAPIGateway.Session.Player == null) return;
                    //init
                    MyInit();
                }
    ....
    }
    
     
  2. joeblack616 Apprentice Engineer

    Messages:
    225
    Hi I will take a look at this. Sorry guys for not being active, hopefully I will have more time in next weeks.
     
  3. joeblack616 Apprentice Engineer

    Messages:
    225
    Hi, moving of asteroids after creation is not supported.
     
  4. Ravenal Apprentice Engineer

    Messages:
    362
    Hey Joe, I know how you feel, I am a programmer as a day job as well. When your on a project, any little distractions can reset the whole 'development' mindset for an entire day, so sometimes you have to shut yourself out of the world to get things done, otherwise... Well.... You can't disappoint Marek lol, or well He'll place you on Mars and leave you....
     
  5. joeblack616 Apprentice Engineer

    Messages:
    225
    Yes, thing is I'm really sorry for not responding to You (I mean all of You guy) on time. You guys are creating amazing thing and keeping game up. In your free time, for free. I really admire You. But you know : When I'm not responding to bat signal, I'm busy somewhere else. So please keep up the good work !
     
  6. Ravenal Apprentice Engineer

    Messages:
    362
    Thanks Joe, I know everyone here would say that you try your very best to answer our questions and make things possible within reasons. That is what most of us would ask for. And I have been part of other gaming communities you among the first to care about what the community desires, that is why Space Engineers will be a game of the century (IMO).
     
  7. fabricator77 Apprentice Engineer

    Messages:
    399
    It's not directly API related, but I've found I cannot spawn drone ships as cargo ships.
    That is ships with a Remote Control block instead of a Cockpit.
    It crashes with a NPE.
    Code:
    2014-12-19 16:47:18.366 - Thread:   1 ->  MyGlobalEvents.StartGlobalEvent
    2014-12-19 16:47:18.366 - Thread:   1 ->  globalEvent.Name = Cargo ship
    2014-12-19 16:47:18.454 - Thread:   1 ->  Exception occured: System.NullReferenceException: Object reference not set to an instance of an object.
       at AAC05F537A6F0F6775339593FBDFC564.B1B405D06E570C0174AA774BF49981A0.B2185D204084A7515313A4159B8D253F(List`1 B2ED8470953C2FFA583ACE377A2D2F24, String E96EAA02F4DE5184E4308E0C092314D9, Vector3D B5E4038B250C8BAC9C79E8EB98E50DED, Vector3 658160618DA12713267E3BCCAFB1FE80, Vector3 7A71263A1D83E77D53DDB7DE770A57DD, Vector3 D3DAEE3094D078F6B7DA204D22E08063, Vector3 FC2EA41D08609870B821DE2BE1C2AD85, String 2962735111A48CF29DFEF00858306618, 834D510F2BCB95EE2E8EB59865EA239C D4A4802668F2D5C687FB0289CA1E878F, Boolean 846F3B3903AB0B6A3BA4177532A714DF)
       at AAC05F537A6F0F6775339593FBDFC564.F9CE794E1568507B14CA98E86F57F341.142EF1B2C50BE92B3692DAACDCEAEDD3(Object ABD01156490C16F30140AFEE2EF86422)
       at AAC05F537A6F0F6775339593FBDFC564.811328A5C358A77B575F7ACCA74C134F.UpdateBeforeSimulation()
       at AAC05F537A6F0F6775339593FBDFC564.D580AE7552E79DAB03A3D64B1F7B67F9.F672BBF9E192151CE8FD7E91E62B997D()
       at AAC05F537A6F0F6775339593FBDFC564.D580AE7552E79DAB03A3D64B1F7B67F9.EC90B1C44E3C361983D093F355FF0CC8(MyTimeSpan 9916A9BA14FB0BB1A36908E2E8C15A74)
       at B337879D0C82A5F9C44D51D954769590.B3531963E948FB4FA1D057C4340C61B4.A334C6A474A5D5A9182791A5A96D3653()
       at 168638249D29224100DB50BB468E7C07.7BAD4AFD06B91BCD63EA57F7C0D4F408.2457E95BE2F0D1F1A4A009B2B1DBBDA4()
       at 168638249D29224100DB50BB468E7C07.398AD1E315E6E4D570C424BD0D168FC1.858DA51EB20785A82D9A03614304088A.0187A29A24275EC024A192E7E235CC2E.9C41E76459B99591F991CBA0833BD17E()
       at 168638249D29224100DB50BB468E7C07.6E0E814918D8AD6B2DC9CA5005102256.7719B48DAFB7D3BDC540EAD5EE6A8650(9AA159E6C22F64A542015EED199D04B9 148A5BA193EB90E55F5E805EF96CAD48)
       at 168638249D29224100DB50BB468E7C07.398AD1E315E6E4D570C424BD0D168FC1.7719B48DAFB7D3BDC540EAD5EE6A8650(9AA159E6C22F64A542015EED199D04B9 148A5BA193EB90E55F5E805EF96CAD48)
       at B337879D0C82A5F9C44D51D954769590.B3531963E948FB4FA1D057C4340C61B4.246E732EE67F7F6F88C4FF63B3901107(Boolean FF8E4184144DE7049FF5EC07D594DAB6, Action 8CF1B812E214DD1C51DD894D4C05D44A)
       at 83BCBFA49B3A2A6EC1BC99583DA2D399.49BCFF86BA276A9C7C0D269C2924DE2D.523C8831DA5DAB3A19F6D33A2C6437B5(String[] 954514EA42AFFE4302240CE14E5D6683)
       at 83BCBFA49B3A2A6EC1BC99583DA2D399.49BCFF86BA276A9C7C0D269C2924DE2D.0D8AAA624C2EEA412F85ABB3AEFAF743(String[] 954514EA42AFFE4302240CE14E5D6683)
    
    Example mod:
    https://www.dropbox.com/s/a2ivnzwnrprianx/NPC%20Cargo%20Ships%20-%20drones.zip?dl=0

    Would be nice to be able to spawn remote control operated ships, to have wandering around. At least do a null check in the code so it doesn't crash the entire game.

    ps: keep the ship in the mod, it's a design out of one of the keen update videos anyway.
     
    Last edited by a moderator: Dec 19, 2014
  8. joeblack616 Apprentice Engineer

    Messages:
    225
    Thanks,
    im just investigating this issue
     
  9. midspace Senior Engineer

    Messages:
    2,224
    I've tried to make use of MyAPIGateway.TerminalActionsHelper.GetActions(), but it always returns no results.

    I've tried it with the following types.

    Code:
    var resultList = new List<ITerminalAction>();
    MyAPIGateway.TerminalActionsHelper.GetActions(typeof(IMyMotorStator), resultList);
    MyAPIGateway.TerminalActionsHelper.GetActions(typeof(IMyFunctionalBlock), resultList);
    MyAPIGateway.TerminalActionsHelper.GetActions(typeof(IMyTerminalBlock), resultList);
    
     
  10. joeblack616 Apprentice Engineer

    Messages:
    225
    Hi, it should be working fine. I will check it when I will return to work.
     
  11. joeblack616 Apprentice Engineer

    Messages:
    225
    Hi, problem is that interfaces doesn't have actions. Only blocks have actions, so instead of IMyMotorStator you need to pass MyRotorStator. But you can't because you don't have access to it. Instead you need to pass FatBlock to GetActions.
     
  12. midspace Senior Engineer

    Messages:
    2,224
    Okay, I'm confused.
    GetActions requires a Type.
    void GetActions(Type blockType, ...

    FatBlock is a property on IMySlimBlock, of IMyCubeBlock. It doesn't present either MyObjectBuilderType or Type.

    How is this supposed to work? :(
     
  13. Gwindalmir Senior Engineer

    Messages:
    1,006
    FatBlock.GetType() should work.

    GetType is a standard .NET method, available on every single object (inherited from Object). It returns the type of itself (as a System.Type).
     
    Last edited by a moderator: Dec 26, 2014
  14. midspace Senior Engineer

    Messages:
    2,224
    To be precise.
    If I had a IMySlimBlock.FatBlock,

    I could simply call the following, which does work.
    Code:
    var terminal = (IMyTerminalBlock)block.FatBlock;
    var resultList = new List<ITerminalAction>();
    terminal.GetActions(resultList);
    
    What I wanted to do was to prefetch actions for an arbitrary type, using the TerminalActionsHelper. With no predefined object.
    It just does not appear to work. It doesn't even appear to clear the resultList;
    Code:
    var resultList = new List<ITerminalAction>();
    MyAPIGateway.TerminalActionsHelper.GetActions(typeof(someSortOfDefintionHere), resultList); 
    
     
  15. joeblack616 Apprentice Engineer

    Messages:
    225
    Hi, sorry for confusion,
    currently you cannot prefetch action without having block in grid. E.g. if you want to have actions of sensor, you need to have sensor inside of grid. You need to pass typeof(IMySlimBlock.FatBlock), to get actions for block (for you there is no other way of getting actions via TerminalActionsHelper.GetActions)

    IMyTerminalBlock.GetActions calls MyAPIGateway.TerminalActionsHelper.GetActions internally with typeof(this).
     
    Last edited by a moderator: Dec 27, 2014
  16. fabricator77 Apprentice Engineer

    Messages:
    399
    Hi Joe, my Drone ships now spawn properly as Cargo Ships.

    Question for you, how hard would it be to get ScenarioDefinition available for mods ?
    I can define it in sbx files, but it's ignored unless it's in the source Scenarios.sbx file.
     
  17. Gwindalmir Senior Engineer

    Messages:
    1,006
    Ah, sorry. I thought you didn't know what to put there.
    Sounds like that function is just plain not working.
     
    Last edited by a moderator: Dec 27, 2014
  18. sonix Trainee Engineer

    Messages:
    31
    Hi

    Code:
    MyAPIGateway.Utilities.ShowMissionScreen("Just a Test");
    
    Doesn't do anything. Anyone have the same problem?
     
  19. noos Trainee Engineer

    Messages:
    3
    I'm trying to retrieve the entity of a projected grid created by a Projector.

    The MyObjectBuilder_CubeGrid stored in the ProjectedGrid of the MyObjectBuilder_Projector does contain a seemingly valid entityId, however this ID is not selectable through any of the regular functions like GetEntities or GetEntityById. I've dumped a list of all entities in the game to disk and the entityId indeed does not appear there.

    is this a known issue ?
     
  20. joeblack616 Apprentice Engineer

    Messages:
    225
    Hi, when are you calling ShowMissionScreen ?
     
  21. joeblack616 Apprentice Engineer

    Messages:
    225
    Are you trying to get entityID while grid is projected ? I will clarify this, but maybe projected grid isn't between entities in scene.
     
  22. noos Trainee Engineer

    Messages:
    3
    Yup exactly, projection is active and i'm looking for its entity. i am able to get the entity using GetEntitiesInSphere or GetEntitiesInAABB using guesstimated vectors in its general direction, but this is a very unreliable method for my purposes.
     
  23. sonix Trainee Engineer

    Messages:
    31
    Code:
    MyAPIGateway.Utilities.MessageEntered += MessageEntered;
    
    [CODE][COLOR= blue]private[/COLOR] [COLOR= blue]void[/COLOR] MessageEntered([COLOR= blue]string[/COLOR] messageText, [COLOR= blue]ref[/COLOR] [COLOR= blue]bool[/COLOR] sendToOthers)
    {
    ...            
    [COLOR= #2b91af]MyAPIGateway[/COLOR].Utilities.ShowMissionScreen("Just a Test");
    ...
    }
    [/CODE]

    Other code that is in "MessageEntered" is executed properly.
     
  24. Sp[a]cemarine Apprentice Engineer

    Messages:
    101
    MyAPIGateway.Utilities.ShowMissionScreen() doesn't work for me either. I didn't change the code and it worked before.
     
  25. Gwindalmir Senior Engineer

    Messages:
    1,006
    I don't know if this is 'broken' or not, but I have an issue with CustomName.
    I can attach to the event handler and keep track of it fine. No problems.

    However when the map is reloaded, I can't find that value anymore.
    During Init(), the entity doesn't have CustomName set, and DisplayNameText has the original, not the custom value. Yet, the custom value is still shown in the control panel.

    So, how do I check the previously entered CustomName on map load (from Init)?
     
    Last edited by a moderator: Dec 28, 2014
  26. midspace Senior Engineer

    Messages:
    2,224
    The Init is too early to check for it, as it the Entity's ObjectBuilder hasn't been completely initialized.

    I find the "public override void UpdateOnceBeforeFrame()" is the best place to check for it the very first time.
    It only runs once after the object has been created.
     
  27. Gwindalmir Senior Engineer

    Messages:
    1,006
    OMG! Thank you!
    That worked.

    I always wondered what that function was.

    I always thought the ObjectBuilder itself was already set up at that time, as it's used to create the object.
     
    Last edited by a moderator: Dec 28, 2014
  28. fabricator77 Apprentice Engineer

    Messages:
    399
    Yes dead here as well.
    This pretty kills any mission that use this in scripting. As the mission will stop dead if it's waiting for the player to click OK on the mission screen.

    No idea on the current status of the entire Nvidia/Keen competition topic (2nd round of voting), it's no longer prominent on the top of the board. Given this bug is easily capable of breaking once working levels, Keen sadly have another headache/delay on the horizon.
     
    Last edited by a moderator: Dec 28, 2014
  29. joeblack616 Apprentice Engineer

    Messages:
    225
    Hi guys, sorry for this issue , I'll be back from my vacation at Friday, but I will try to push fixing of this issue to regular Thursday update. So mission screen doesn't show at all ?
     
    Last edited by a moderator: Dec 28, 2014
  30. Sp[a]cemarine Apprentice Engineer

    Messages:
    101
    Exactly. The method is executed without throwing an exception but the screen doesn't pop up.
     
Thread Status:
Not open for further replies.
This last post in this thread was made more than 31 days old.