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. joeblack616 Apprentice Engineer

    Messages:
    225
    Old Thread. Replacement here: https://forum.keenswh.com/threads/modapi-feature-requests.7397672/

    <3 rexxar




    Hi fellow modders,
    I created this forum for you to post request for new things for Mod API. You can request new namespaces to whitelist, new features inside APIGateway. Everything what you think can help you. Please do not report issues with already existing scripts here. Add only requests for new thinks that you would like.
     
    Last edited by a moderator: Oct 10, 2017
  2. tyrsis Junior Engineer

    Messages:
    862
    XmlSerializer
    Threading (with the note to everyone who uses threads that game objects and all interfaces are NOT thread safe.)

    Add IMyUtilities.MessageReceived event

    An event like MessageEntered, but is raised when a chat message is received. With the following parameters:

    long playerId - playerId of player who sent the message (or steamid with a conversion utility function)
    String message - text of message
    bool hide - if set to true, the message is hidden from chat
     
    Last edited by a moderator: Oct 22, 2014
  3. antarcite Trainee Engineer

    Messages:
    86
    Hi

    I like to make a suggestion: Mod for sensors:
    More range to sensors in order to make co-op scenarios with NPC enemy's.

    I'd like to make scenarios with some enemy/NPC bases to play in survival mode with my friends, so i ask a mod who give more range to sensors, in this way i can build a enemy bases who will activate their defenses only with players in range, when there is no players on vincity, the base is in sleep mode. When players are close to the station, defense system turn on and fight until is there no players in vicinity.. 50 max range is not enough..

    I could use solar panels, but is not a good idea, because players can destroy it, come later and station have no power.
    I could put many uranium lingots, but is not a good idea so.. survival mode could take mutch time and i don't want in survival mode players get unrealistic amount of uranium when scavenge, or attack a base with no power for turrets...

    I just need more range in sensors, not just 50 but 200, 300, .. or more. At lesat at guns range...

    Thanks for help....
     
  4. beelzerob Apprentice Engineer

    Messages:
    429
    MyObjectBuilder_InteriorLight doesn't seem to work, or be available as a block that can be manipulated. That would be nice if it could be, as I'd like to be able to manipulate the lights based on certain events.
     
  5. Semaphorism Apprentice Engineer

    Messages:
    186
    Whitelist MySQL's libraries. That way we can make mods that store data.
     
  6. Vdragon Apprentice Engineer

    Messages:
    326
    I'll continue on the way tyrsis's suggestion started:
    Add a way to add a new type of block (that will use a different TypeID, have custom proprieties that can be set in the .xml (aka fix the XML serializer) and use a logic fully set by the user).
    Also, an access to GUI functions would be nice as well as a way to exchange information between the client and the server.
    An access to the player's proprieties (to the level that a script could control the player in its totality) as well as the possibility to create "virtual players" (like the actual npc players, but with an actual physical body) .
    And please, make the scripts work on dedicated servers.
     
  7. eobando Trainee Engineer

    Messages:
    96
    I would really love GUI access.
     
    Last edited by a moderator: Oct 23, 2014
  8. JustBurn Trainee Engineer

    Messages:
    60
    I should LOVE this feature, replacing the behavior of vanilla blocks that already exist in the game when you want to include a complete new block that has nothing to do with them is just wrong.

    For example you want to include a speaker (now that sound modding is possible), which "MyObjectBuilder_*" that already exist in the game you should "hack"? It just doesn't feel right.

    Since there's no console or GUI access yet, I guess the only way to talk to those blocks for now is by Chat?
     
    Last edited by a moderator: Oct 23, 2014
  9. joeblack616 Apprentice Engineer

    Messages:
    225
    System.Array is now whitelisted.
     
  10. joeblack616 Apprentice Engineer

    Messages:
    225
    MyApiGateway should be initialized on DS.
     
  11. joeblack616 Apprentice Engineer

    Messages:
    225
    @tyrsis XmlSerializer: I can create methods for you that will serialize/deserialize object into xml string. It's enough for you ?
     
  12. Sp[a]cemarine Apprentice Engineer

    Messages:
    101
    Hello,

    I "dug" me into the API lately and here is my first feedback/some requests:
    First of all I think the API is great. The only problem is that there is no documentation. For lazy people like me, it is very hard to keep motivation up and don't say "screw this" or something similar. I'm sure the community would help you to create a documentation. It may be a long process but finally there would be some scripts more in the workshop.
    So, lets focus on the API itself. There is one thing I noticed: When we have "Sandbox.ModAPI.IMyEntities.GetEntity(System.Func&lt;IMyEntity,bool> match)" why are there also methods like "Sandbox.ModAPI.IMyEntities.GetEntityById(long entityId)" and "Sandbox.ModAPI.IMyEntities.GetEntityByName(string name)"? For people who aren't familiar with labda expressions? I just don't understand it. If that is the case, you should create a method "Sandbox.ModAPI.IMyEntities.GetAllEntities()" that returns a List&lt;IMyEntity>() with all entities available. With this list everyone could work who can work with for loops. Well, this is just a thought so ignore it if you want.
    Regarding that the MyAPIGateway should be initialized on DS, will there be a bool "IMyMultiplayer.IsDedicatedServer"? Whould be smoother than a null check to the player object. Furthermore it would be nice to have a class on servers that can be overridden to store there some server wide data. Like players who have the permission to do sth. or some messages. I think there will be enough options that justify such a class if it is possible to make it. Concerning this request we come to another one. I would like to have the following events: "IMyPlayer.OnPickup", "IMyCubeBlock.OnCreated" and "IMyCubeBlock.OnDamaged". "OnPickup" should be called when someone tries to pick up something like components, ores or tools and have the parameter "IMyEntity pickedUpEntity (not sure if that will be an entity but you know what I mean), IMyPlayer player, bool apply". "OnCreated" should be called when someone is attempting to create a block and have the parameters "IMyCubeBlock cubeblock, IMyPlayer creator, bool apply". With this event I could prohibit the creation of blocks in certain cases. E.g. on a server or in a mission in certain areas that must not be changed and if I want to establish a permission system. "OnDamage" should be called whenever an entity gets damaged or grinded (that includes players) and have the arguments "IMyEntity damagedEntity, IMyDamageCause cause, bool apply". "IMyDamageCause" should be a class that contains the cause this should include if it was a collision (and if that is the case with whom), energy was low (for players), someone started grinding the block, it was damaged by ammo, etc. (this is just a suggestion how to implement the damage cause, it is just important that I can get all the information I need. Also I don't know who (client or server) applies the damage to a certain block, so it is not necessary that it is implemented like I suggested but that I can to what I intend to do). At last I also need an option to adjust the available respawn ships to prevent ramming. If you want a reason why I request this things is quite easy. Watch the Q&amp;A moderated by solutiongaming (I think he was called like that, wasn't he?). The "trolling" could be "easily" (I know it's a huge effort to create it, but easily for the user) prevented with a mod using this events. Therefor also the class that can be overridden to store data that should be accessed. E.g. the client requests if he has the permission to grind a certain block. The currently available permission levels (user and admin) are very limiting. It would also be nice if you could extend "event System.Action&lt;IMyControllableEntity,IMyControllableEntity> IMyEntityController.ControlledEntityChanged" to "event System.Action&lt;IMyControllableEntity, IMyControllableEntity, bool> IMyEntityController.ControlledEntityChanged" also a bool that might be set to "false" if the player should not take control of a certain entity.

    I hope you can do something about this.

    Best regards,
    Spacemarine
     
  13. Sp[a]cemarine Apprentice Engineer

    Messages:
    101
    And could you please add 'System.Threading' to the whitelist?

    Thank you.
     
    Last edited by a moderator: Oct 29, 2014
  14. joeblack616 Apprentice Engineer

    Messages:
    225
    Hi :
    "First of all I think the API is great. The only problem is that there is no documentation." I totally understand this, I'm also integrating 3rd party library in my private project and documentation is what really matters.
    I would like to create documentation, but it's really time consuming and currently there are more important task than this. Sad, but true.

    About other thing, I will think about it, in first iteration we just mirrored existing methods on objects into API. That's reason for your question about Sandbox.ModAPI.IMyEntities. I will talk in team about your proposal to create special methods for API itself, maybe we also could use them.
     
  15. Sp[a]cemarine Apprentice Engineer

    Messages:
    101
    Ah ok, now that makes sense. I just was wondering. :D
    I think, without creating special methods for the API, the API will remain limiting and at a certain point it will be frustrating for us modders when we have nice ideas and can not implement them. It also may not be on high priority but from time to time progress in the API will be necessary and Of course I am aware that this means more work for the team but it might be rewarded with great mods and too special things must not be implemented. I hope for good news, so let us know when a decision was made.
     
  16. eobando Trainee Engineer

    Messages:
    96
    Joe,

    Do you have an idea/timeline of when more of the API will be accessible? I notice that mod-users request that many things be HUD-friendly. I'd love to know when I can advise users that features of a specific mod will be GUI friendly.
     
  17. Ravenal Apprentice Engineer

    Messages:
    362
    Hi joe,

    Can we have BinaryWriter and BinaryReader part of the IMyUtilities, It should be easy and safe to use as the ability to store binary data could help with the project I am doing. And maybe even whitelist the LitJson in VRage.Library? Or certain stuff like JsonMapper, JsonReader and JsonWriter?

    Another important thing that I think should be opened is XmlTextWriter and XmlTextReader. Buffer could be nice too and Array.

    Right now I created my own binary to string and string back to binary data, but it would be nice to just write pure binary into the stream.

    If you need to know why I can private message you what I am doing and what not, it may clear up some answers on why.

    Maybe some little ideas.

    Session.OnSave event, and Session.OnLoad event maybe? So basically right before the server world is loaded you can do something and when the world is saving we may need to save stuff in the local/global storage.

    Right now I am doing it based on when you close the game or exit, but I hate that, it should be executed when manual save occurs, or autosave.

    Just my requests that I hope make it in
     
  18. joeblack616 Apprentice Engineer

    Messages:
    225
    Hi, currently we are focused on bug fixes (next week or two), after that new features will come, we can provide you new parts of engine as API. We already have some ideas, I will let you know. What exactly would you like to be able to do in HUD ?
     
  19. moroder Apprentice Engineer

    Messages:
    170
    Apart from the ability to create GUI input elements and custom blocks (still #1), it would be very nice to have a simple helper function to draw lines and points in space for debugging purposes.

    Turns out there already seems to be something like it:

    Sandbox.Graphics.MySimpleObjectDraw.DrawLine(VRageMath.Vector3, VRageMath.Vector3, string, ref VRageMath.Vector4, float)

    ..except, it's not whitelisted! Can we please whitelist some of these for debugging purposes?

    thx
     
  20. eobando Trainee Engineer

    Messages:
    96
    That sounds fantastic!

    I have a mod that has quite a bit of information to display. I'd like to wrap that data into a hud window to display the information. I'm using the ShowNotification() method at present, but as you can guess not everything gets displayed and anything that changes creates multiple lines.
     
  21. Derthmonuter Trainee Engineer

    Messages:
    44
    I'm not tyrsis, but would this allow us to save and load CubeGrids? The first thing I tried doing was serializing and deserializing a ship I'd made, but it wasn't whitelisted. If that's what this does, I'd love it! If not...well, then that's my suggestion.

    Being able to save and load CubeGrids, preferably from a directory or server if the SQL libraries are whitelisted.
     
  22. Ravenal Apprentice Engineer

    Messages:
    362
    I second that, one of my major features of my navigation system is to be able to draw waypoint paths, and or autopilot paths. Not really for the purpose of debugging but as well for other purposes. I'll be doing a lot of GUI stuff and some of the things I'll need will require some rendering capability as well.
     
  23. Draygo Senior Engineer

    Messages:
    1,297
    MyAPIGateway.Session.WorldSizeKm does not exist, can this be exposed?
     
  24. tyrsis Junior Engineer

    Messages:
    862
    MyAPIGateway.Entities.WorldHalfExtent();
    MyAPIGateway.Entities.WorldSafeHalfExtent();

    Yes, strange.
     
  25. Draygo Senior Engineer

    Messages:
    1,297
    Strange spot to put it.
     
  26. Sp[a]cemarine Apprentice Engineer

    Messages:
    101
    Could you please create sth like "IMyPlayer.IsAdmin"? It would be really useful.
    And how about adding 'System.Threading' to the whitelist? I asked for it yesterday but you missed it probably.
     
  27. Ravenal Apprentice Engineer

    Messages:
    362
    No they didn't miss about System.Threading, there are major reasons why they are just not going to whitelist it right away. I think they will be making some sort of wrappers to use it with, that internally uses threading.

    As for an request:

    It would be nice to be able to send an 'notification' directly to a specific player, and from that we could loop to a specific notification to a set of players.

    MyAPIGateway.Utilities.SendNotificationTo( player, "Warning, your station is under attack!", 2000, Red ); for example, etc.
     
  28. joeblack616 Apprentice Engineer

    Messages:
    225
    Hi, no we didn't miss it.
    Anything you post in this thread can be considered as "seen by developer" (hope you know what I mean). I hope that this quote don't backfire at me in future :D.

    I will discuss threading and let you know.

    Edit: We could give you access to our threading library/pools. It's ok for you ?
     
    Last edited by a moderator: Oct 31, 2014
  29. tyrsis Junior Engineer

    Messages:
    862
    We actually already have access to threadpools, but you have to go through hoops to use them. And with no locks and no way to run things in the game thread, it becomes very unsafe to use them. Here is what is required if you don't want to completely whitelist threading:

    First off, we need access to locks and events. You can give access to your FastResourceLock(), or lock() is fine. Whatever you guys think is better. Second we need specific access to this function:

    B337879D0C82A5F9C44D51D954769590.B3531963E948FB4FA1D057C4340C61B4.0172226C0BA7DAE0B1FCE0AF8BC7F735(Action action)

    (I'm assuming you can reverse obfuscation to see what that points to). It's the function that allows us to enqueue actions in the game thread, so we can execute code inside the game thread. Or whatever alternative you want, as long as it lets us execute stuff inside the game thread from another thread.

    And then lastly Threadpools should be fine, or task factories, or whatever thread pooling you guys use should be fine.

    That should sort of cover what most people require threading for.

    EDIT: Also a way to figure out our current thread context. Something similar to Thread.CurrentThread, though that requires access to Thread class. So something similar that tells us which thread we're in.
     
    Last edited by a moderator: Oct 31, 2014
  30. Ravenal Apprentice Engineer

    Messages:
    362
    HELL YES, that would be awesome! Then all i have to do is initiate the update before frame one time and then start the Drone Loops haha!
     
Thread Status:
Not open for further replies.
This last post in this thread was made more than 31 days old.