After various changes to existing OXPs I was wondering about making an own one.
I would like to have an MFD that displays all of that equipment that is primable and which equipment currently is primed and how many times you need to press key_prime_equipment in order to prime that equipment that you want to prime previously to doing it.
However, after browsing the documentation I get the impression that there is at least not an easy way to determine whether some equipment is primable. An array of all equipment can be iterated upon, but then I would have to add manual support for all equipment that is known to be primable. And as there doesn't seem to be a general event handler for some equipment being primed, all primable equipment would need support for such an MFD by notifying it in their "activated" function.
I also noticed that the order of primable equipments that is iterated through by key_prime_equipment is not stable between saveloads (it changes each time) and there also doesn't seem to be a way of getting this array or set directly. So knowing which equipment is the next to prime seems impossible.
What determines if some equipment is primable ? The presence of a "script" entry in its equipment.plist entry ? At some point I also managed it by removing a this.activated() function.
MFD - primable equipment ?
Moderators: winston, another_commander
-
- ---- E L I T E ----
- Posts: 299
- Joined: Mon Apr 27, 2015 9:03 pm
MFD - primable equipment ?
warning sound if a missile is inbound: Missile warning
- Norby
- ---- E L I T E ----
- Posts: 2577
- Joined: Mon May 20, 2013 9:53 pm
- Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
- Contact:
Re: MFD - primable equipment ?
An easy solution: increase the number of items in the primed equipment selector of your HUD. Here is an example with 3 lines from the hud.plist of SOTL.
The main obstacle in your attempt is equipment scripts are not accessible from js like worldScripts so there is not a sure way to detect if an equipment is primable by checking the existence of the activate function. We have an
Code: Select all
{ // primed equipment, x and y give the location, the size defines the character size, n_bars is the number of items to show (default 1)
selector = "drawPrimedEquipment:";
y_origin = -1;
x_origin = 1;
x = -180;
y = 130;
width = 10;
height = 10;
n_bars = 3;
},
[url=http://wiki.alioth.net/index.php/Oolite_JavaScript_Reference:_EquipmentInfo#scriptName]EquipmentInfo.infoForKey("EQ_SOMEEQUIPMENT").scriptName[/url]
parameter only, if this is filled then probably the equipment is primable.-
- ---- E L I T E ----
- Posts: 299
- Joined: Mon Apr 27, 2015 9:03 pm
Re: MFD - primable equipment ?
Thanks. Almost as good, though "hardcoded"; makes the HUD dependant on the number of primable equipments.
Now I have this in hudselector-extralarge.plist to replace MFD #7 by the list of primable equipments, takes about the same space:
Now I have this in hudselector-extralarge.plist to replace MFD #7 by the list of primable equipments, takes about the same space:
Code: Select all
{ // primed equipment, x and y give the location, the size defines the character size, n_bars is the number of items to show (default 1)
selector = "drawPrimedEquipment:";
//y_origin = -1;
//x = 216;
//y = -2;
width = 10;
height = 10;
n_bars = 11;
y_origin = 1;
x_origin = 1;
x = -106;
y = -99;
//{ width = 100; height = 90; x = -53; y = -144; y_origin = 1; x_origin = 1; }, //7
},
warning sound if a missile is inbound: Missile warning