Поиск по STEAMB

Игры и программы по онлайну, скины по объёму продаж

Ничего не найдено

Попробуйте другое название или переключите категорию.

Меню

Скрипты

EasyAPI

Положительные голоса97%175 голосов игроков
Подписчики17,1 тыс.17 080 в Steam Workshop
Размер файла33,29 КБЗагрузка через Steam
Обновление автора7 нояб. 2018 г.Дата обновления материала

Фото и видео: 1 из 8. Материалы автора из Steam Workshop.

Фото и видео: 1 из 8
Установить через Steam

О материале

«EasyAPI» — материал мастерской Space Engineers. Моды, чертежи кораблей, скрипты и миры для Space Engineers. Данные Steam, описание автора и ссылка для установки через подписку. Совместимость редакцией не проверена.

Описание автора

EasyAPI makes writing powerful scripts a breeze by providing a simple query API to find and manipulate blocks, inventories, properties, and actions. It also allows you to schedule events so that a function gets called when the event occurs. Below is an overview of how easy things are in EasyAPI. There are many more examples in the documentation.

See the EasyAPI Documentation guide for a tutorial and the full documentation of the API.

I have created a GitHub repository for EasyAPI. You can find it at https://github.com/rockyjvec/EasyAPI

The Change Notes tab lists what was added in the latest updates.

Easy Commands

The Easy Commands feature provides a way for people to quickly do things to their ship just using arguments to a PB without doing any programming.

To use this feature, just add EasyAPI to a PB (Programmable Block), and then run the pb with an argument that starts with EasyCommand followed by the command you want to run.

For example, you could put the following as the argument when the PB is run on a button panel:


EasyCommand Blocks.OfTypeLike("Door").ApplyAction("Open_Off");

That command will close all the doors on your ship when the button is pressed. There are tons of block filters and actions built in to easyapi. You can find a (mostly) complete list in the documentation. Just search for "filters" or "actions". Leave a comment below if you need help.

Easy Arguments

Want to toggle all your lights when a button is pressed? It only takes the code below. Just put the PB Run action on any button or cockpit action key you want and use "ToggleLights" for the argument.

Code for toggling lights when button panel button or cockpit key pressed.


public class Example : EasyAPI 
{ 
    public void toggleLights()
    {
        Blocks.OfTypeLike("Light").ApplyAction("OnOff");
    }

    public Example(IMyGridTerminalSystem grid, IMyProgrammableBlock me, Action<string> echo, TimeSpan elapsedTime) : base(grid, me, echo, elapsedTime) 
    { 
        On("ToggleLights", toggleLights);
    } 
} 

Easy Inventory Management

Want to clean all your assembler input inventories by moving all stone to your cargo containers?


Blocks.OfType("Assembler").Items().InInventory(0).OfType("Stone").MoveTo(Blocks.OfTypeLike("Cargo Container"));

Get the number of construction components in all your large cargo containers:


int NumConstructs = Blocks.OfType("Large Cargo Container").Items().OfType("Construct").Count();

Easy Block Actions

To turn off all the Spotlights on your ship that have "Front" in their names:


Blocks.OfType("Spotlight").NamedLike("Front").Off();

Actions specific to a block are also supported. Let's say you want to make all the sound blocks on your ship play at once:


Blocks.OfType("Sound Block").ApplyAction("PlaySound");

Easy Setting/Getting Block Properties

This example syncs the gravity field width, height, and depth of all the gravity generators on your ship. If you change one of those properties in "Gravity Generator 1" the new value will automatically get copied to the rest of them:


public class Example : EasyAPI  
{ 
    public void UpdateGravGens()
    {
        EasyBlocks AllGravGens = Blocks.OfType("Gravity Generator"); 
        EasyBlocks SourceGravGen = AllGravGens.Named("Gravity Generator 1"); 
 
        Single Height = SourceGravGen.GetProperty<Single>("Height"); 
        Single Width = SourceGravGen.GetProperty<Single>("Width"); 
        Single Depth = SourceGravGen.GetProperty<Single>("Depth"); 
 
        AllGravGens.SetProperty<Single>("Height", Height); 
        AllGravGens.SetProperty<Single>("Width", Width); 
        AllGravGens.SetProperty<Single>("Depth", Depth); 
    }

    public Example(IMyGridTerminalSystem grid, IMyProgrammableBlock me, Action<string> echo, TimeSpan elapsedTime) : base(grid, me, echo, elapsedTime)  
    { 
        Every(1 * Seconds, UpdateGravGens); 
   }  
} 

Easy to Learn

A tutorial, lots of examples, and the full documentation are available in my EasyAPI Documentation guide. I keep adding new features and examples.

Add-On Modules

These are extra features that are designed to work with EasyAPI

  • EasyMenu - Design menus to control your ship's systems.

  • EasyLCD - This is currently included in the EasyAPI script.

If you have designed an add-on module, let me know in the comments below and I'll add it to this list.

Make your own scripts and mods

Please feel free to use and include this script in your own Steam Workshop scripts/mods.

Collaborate to make it better!

I have created a GitHub repository for EasyAPI. You can find it at https://github.com/rockyjvec/EasyAPI

Have an idea that you would like to see implemented in EasyAPI? Feel free to fork EasyAPI and implement your feature or make a suggestion in the comments or discussions below.

Thanks!

I would like to thank the following people for their contributions to EasyAPI:

  • Bush Tucker Man

  • LukeStrike

Видео автораОткрыть в YouTube ↗
Видео автораОткрыть в YouTube ↗
Видео автораОткрыть в YouTube ↗
Видео автораОткрыть в YouTube ↗
Оригинал в Steam Workshop

Как установить и запустить

Откройте оригинальную страницу в Steam Workshop, проверьте версию игры, зависимости и порядок загрузки в описании автора. Нажмите «Подписаться» и дождитесь загрузки Steam. Включите материал в меню модификаций или контента игры, если это требуется. Совместимость и запуск редакцией не проверены.

Настройки cookies

Вы можете изменить выбор в любой момент. Отказ от аналитики не ограничивает доступ к сайту.

Технологии, провайдеры и сроки хранения