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.

ModAPI : Basics reference / Getting Started

Discussion in 'Modding API' started by Albino, Sep 20, 2014.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Albino Trainee Engineer

    Messages:
    22
    Im certainly not the most appropriate person to start such a thread, seeing as im very lost my self (and have no experience with C#) but ill try to compile here some usefull basic informations you might need to start modding Space Engineers with ModAPI.

    Ill start with very little information, and should append new stuff as I learn more about the API.

    Disclaimer: I know next to nothing about both c# and the ModAPI, im still exploring, so there's good chance I write total bullshit from time to time, in this case please tell me so I can fix it asap.

    Contents
    * Base Setup *
    * Basic Script Structure *
    * ModAPI/Game Notions *
    * Essential Commands Reference *
    * Other Tips *



    Base setup

    Basic Script Structure


    ModAPI/Game Notions
    Essential Commands Reference</div>



    Other Tips


    WORK IN PROGRESS
    </div>
     
    Last edited by a moderator: Sep 26, 2014
    • Like Like x 1
  2. Proximo Trainee Engineer

    Messages:
    6
    Good Tutorial allready.

    I knew that much allready, but the F5 tip is very very useful, and i am sure it will help others more than it has me.

    Thank you
     
  3. Albino Trainee Engineer

    Messages:
    22
    Thanks for your feedback. Please dont hesitate to share any knowledge you have to be added to the guide so it becomes usefull asap :)
     
  4. Mad3ngineer Trainee Engineer

    Messages:
    12
    How would one apply this code:
    Code:
    [MyEntityComponentDescriptor(typeof(MyObjectBuilder_Beacon))]
    
    to a custom block? IDE does not recognise the custom block, and spits out errors.

    Thanks for the guide man, I will be using this a lot!
     
  5. Albino2 Trainee Engineer

    Messages:
    16
    <del>Wild speculation : maybe you could create the custom block inside this line ?
    Code:
    [MyEntityComponentDescriptor(typeof(new CustomBlock (IHaveNoIdeaHowToCreateCustomBlocks = 1;)))]
    I think I dont know enough C# to offer any other suggestion :x</del><del>
    </del>
     
  6. Albino2 Trainee Engineer

    Messages:
    16
    That was not applicable sorry.

    Toug maybe its possible to create a custom block entirely in a script, bypassing the CubeBlocks.sbc file ?
     
  7. Killili Trainee Engineer

    Messages:
    15
    Hi, these are called Annotations and are there for the Engine to find stuff and attach them to a the right stuff.

    You cant create classes in the namespace where these definitions are from, so you cant do stuff like that. But youre block is always a decendent of a Superclass thats inside that namespace. That said, just use MyObjectBuilder_CubeBlock this should be called for youre block anyway. And filter later by typeid or something you set inside the XML portion of youre modded block.
     
    • Informative Informative x 1
  8. Mad3ngineer Trainee Engineer

    Messages:
    12
    Ah, ok then. Thanks for the answer Killili! That's another thing for the list, eh albino? :)
     
  9. Daft Hunk Trainee Engineer

    Messages:
    1
    Hello, I have just a little question :
    Can we add fonctionnalities to the Terminal ?
    I'm working on a mod and I can't figure out how making that x)

    Thanks in advance ;)
     
  10. Blue Dragon Trainee Engineer

    Messages:
    6
    Is there a possibility to get instances off all blocks of a specific type in the world?
     
  11. tyrsis Junior Engineer

    Messages:
    862
    Yes, iterate through all the grids and all blocks on those grids.
     
  12. Albino2 Trainee Engineer

    Messages:
    16
    Hello, just a little note to say since I dun goofed when changing the mail adress of my account, im stuck on that temporary one and cant edit the guide for a while.


    Daft Hunk > So far its not afaik. It might be possible in future versions of the API.
     
  13. Albino Trainee Engineer

    Messages:
    22
    Thanks to Keen Support, Im back with my main account. Updated the guide to add instruction on how to create / spawn a prefab.
     
  14. eobando Trainee Engineer

    Messages:
    96
    Great reference Albino. Saved me a lot of time of study.
     
  15. Spamasaurus Trainee Engineer

    Messages:
    16
    Does anyone know the event which is raised when a timer block is triggered? I've looked in the object browser under Sandbox.ModAPI.Ingame which contains the events for sensors, pistons etc. But there isn't one for timers. Does the mod API just not have this feature yet?
     
  16. Cursedth Apprentice Engineer

    Messages:
    111
Thread Status:
This last post in this thread was made more than 31 days old.