Space Engineers

Space Engineers

EasyAPI
Aaron Tigan 7 ABR 2015 a las 0:02
Alert status system
Perhaps a system that is four fold... Green, Yellow, Red, and Blue alerts.

Green: All systems nominal, everything running smooth. (Default status)

Yellow: Intruder Alert, triggered by sensors set to "detect enemy player." Upon trigger, change internal lights color to yellow and blinking, activate internal turrets and output name of triggered sensor or sensors to LCD display (and update list if more continue to be triggered so as to track the target). Close and turn off doors between rooms that have detections in them (like in Emergency Bulheads)Yellow alert also can be activated by turning on a light with a special name. Upon deactivation, doors are turned on but NOT opened, turrents are turned off and LCD's are reset to display normal operations.

Red: Battle Stations, triggered by damage to a block on the ship, or sensor set to "detect enemy small ship/large ship/station." Upon trigger, change internal lights color to red and blinking, activate external defense systems (turrets and launchers), toggle closed a group of blocks predefined as "Blast shutters" (in case of protection over windows), and output to LCD name of sensor or sensors that triggered alarm. Red alert also can be activated by turning on a light with a special name. Upon deactivation, turn off defense systems, open blast shutters,

Blue: Low power mode, triggered by low percentage of power from reactors (include arc reactors if possible). Upon trigger change color of internal lights to blue and blinking.Turns on a group of batteries labeled EmergencyPower. Turns off assemblers, refineries, arc furnaces, and oxygen generators. Blue alert can also be activated by turning on a light with a special name. Upon deactivation, assemblers, refineries, arc furnaces, and oxygen generators are turned back on.

Just like the other script this one should only be run on the ship or station it is on maybe based on a prefix, not ones docked via connectors and ect.
Última edición por Aaron Tigan; 7 ABR 2015 a las 0:13
< >
Mostrando 1-8 de 8 comentarios
rockyjvec  [desarrollador] 7 ABR 2015 a las 8:34 
@Hype365, another good idea. This one will be easy to implement in EasyAPI. The only issue is that I don't think we can currently detect damage on armor blocks. Only on functional blocks. I'll have to investigate again to see if that has changed.
Aaron Tigan 7 ABR 2015 a las 15:47 
@rockyjvec This script https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=412005083 is what the idea is based off of if that helps :) You are correct though that armor block damage is currently undetectable using scripts as the creator of the linked script states in it's description. The sensor blocks should compensate for that by detecting enemy players and ships.

As an addition, having a group of sound blocks play when an alert level is activated would be great too. Maybe also like the other idea have the sound blocks turn off automatically after so many seconds. This script should also like the other one only operate on the ship or station it is run on, so [Prefix] based as well.
Última edición por Aaron Tigan; 7 ABR 2015 a las 16:05
Aaron Tigan 7 ABR 2015 a las 20:04 
Just reread my OP, the script should turn on a "group of internal lights," doesn't have to be all of them since I'd hope that there would already be lights on for seeing to get around lol
Última edición por Aaron Tigan; 7 ABR 2015 a las 20:05
rockyjvec  [desarrollador] 8 ABR 2015 a las 1:14 
Yeah, it could could use all lights in a "group" or it could use only lights with a tag (like [alert] in the name). Groups might be easier since you could easly show them all on hud to find them when you are setting them up on your ship.

As I said on your other thread I'm happy to help in any way I can. I don't have time right now to just write this script as I am working on a major new feature in EasyAPI (Menus). But feel free to ask questions and I'll answer when I can. For this one I may be able to write up a quick script for one alert as an example so you can copy it to make the others.
Aaron Tigan 8 ABR 2015 a las 7:23 
@rockyjvec Thank you so much. If you could do one of the alert levels as an example that would be great. It may help me in understanding more how scripting works (i'm more a visual learner than a reading learner). I believe doing each level seperately, like the Life Support system, and then putting it together would be best for this one as well. I will of course be more than happy to credit you when the scripts are complete. It's the least I can do for your help :) The EasyAPI Menus may help in this script in the long run as well once you get it up and running (checking status of systems, i.e. Production systems, weapons systems, power systems, engine systems, and maybe even be able to set alert statuses through the menu. :)
Aaron Tigan 8 ABR 2015 a las 9:45 
Additional idea to add here, broadcast distress signal using antenna, or beacon if antenna is not available, turning on a special light. Script would set range for either block to maximum and change the name of the block to a player set value in the script (likely the ship/station/faction name and the word Distress Call). Maybe have a way for it to choose range setting based on available power on the ship or station so as to not overload power and thus not be able to send distress call. Turning off the special light would revert settings back to previous values either based on "Default" settings written into the script or if it's able to remember previous values.
Última edición por Aaron Tigan; 8 ABR 2015 a las 11:43
rockyjvec  [desarrollador] 8 ABR 2015 a las 23:07 
@Hype365, here is some example code that implements the green state and part of the yellow. It mainly just doesn't close / open doors and doesn't output status to an lcd yet. For it to work you need all your blocks on your ship in a "Ship" group, and you will need other groups for the other types of blocks as named in the script. You will need to load up the easyapi script and then replace the example class at the top with the code below. I recommend using Notepad++ (a free text editor) if you plan on writing scripts since it highlights the code to make it easier to read.

public class Example : EasyAPI { EasyBlocks shipBlocks; // This will store all the blocks in the "Ship" group so that we deal only with blocks that are on the ship and not connected ones. EasyBlocks alertLights; // This will store all the alert lights on the ship. EasyBlocks intruderSensors; // This will store all the sensors that detect enemy players EasyBlocks internalTurrets; // This will store all the internal turrents string currentState; // This function only runs the first time the programming block gets run after getting compiled. public Example(IMyGridTerminalSystem grid) : base(grid) { shipBlocks = Blocks.InGroupsNamed("Ship"); // Save off all of the blocks in the Ship group into the ship variable for use later in the script. alertLights = shipBlocks.InGroupsNamed("Alert Lights"); // Save off all the blocks in the ship that are in the Alert Lights group. intruderSensors = shipBlocks.InGroupsNamed("Intruder Sensors"); // Save off all the blocks in the ship that are in the Intruder Sensors group internalTurrets = shipBlocks.InGroupsNamed("Internal Turrets"); // Save off all the internal turrets Every(500 * Milliseconds, detectState); } public void detectState() { var intruders = intruderSensors.SensorsActive(); if(intruders.Count() > 0) // There are intruders { yellowMode(intruders); } else { greenMode(); } } public void greenMode() { if(currentState != "Green") // this means the state just changed to green { currentState = "Green"; alertLights.SetProperty<Color>("Color", new Color(0, 255, 0)); // color green alertLights.On(); internalTurrets.Off(); } } public void yellowMode(EasyBlocks intruders) { if(currentState != "Yellow") // this means the state just changed to yellow { currentState = "Yellow"; alertLights.SetProperty<Color>("Color", new Color(255, 255, 0)); // color yellow internalTurrets.On(); } alertLights.Toggle(); // toggle lights on and off to blink them. There are bugs with the lights using the in-game blinking } }
LukeStrike 12 JUN 2016 a las 19:53 
Very nice example of how to use EasyAPI and why it is so powerful :) Simply said: yes I embark at least one EasyAPI script in all of my ships :)

LKS
< >
Mostrando 1-8 de 8 comentarios
Por página: 1530 50