Page 1 of 2

various equipment questions

Posted: Wed Mar 11, 2015 2:20 pm
by Smivs
NPC-only equipment has traditionally been given a TL of 99 in the equipment.plist. Now that TL99 is deprecated and a condition_script is used to prevent these becoming available to players, what TL should we state in the equipment.plist?

Re: TL for NPC-only equipment

Posted: Wed Mar 11, 2015 3:06 pm
by spara
Smivs wrote:
NPC-only equipment has traditionally been given a TL of 99 in the equipment.plist. Now that TL99 is deprecated and a condition_script is used to prevent these becoming available to players, what TL should we state in the equipment.plist?
I haven't got the slightest what's the "correct" way, but I'm using TL0 and this

Code: Select all

this.allowAwardEquipment = function(eqKey, ship, context) {
	//only allow via scripting
	if (context === "scripted") return true;
	return false;
}
in conditions to make equipment scripted only.

Re: TL for NPC-only equipment

Posted: Wed Mar 11, 2015 3:35 pm
by Smivs
spara wrote:
I haven't got the slightest what's the "correct" way...
Same here :) hence the question.
I'm currently looking at Aliens and want to update the 'Photon Torpedo' which is a special Scorpax weapon which is not available to anybody else.
The equipment.plist is

Code: Select all

(
      (
        99, 
        1, 
        "Photon Torpedo",
        "EQ_PHOTONTORP_MISSILE",
        "Scorpax photon missile",
        {
          condition_script = "oolite-conditions.js";
          available_to_all = false;
        }
      )
)
and I have

Code: Select all

 script_info = {"oolite-barred-equipment" = "EQ_PHOTONTORP_MISSILE"};
in the missile's shipdata.
It works fine with no log errors in 1.81, but I did wonder about that TL, just out of interest really.

Re: TL for NPC-only equipment

Posted: Wed Mar 11, 2015 3:47 pm
by Ngalo
Sorry if I've read this (or the documentation) wrong, but isn't there an 'available_to_player' key which you can set 'false' or 'no' in equipment.plist?
I do use and quite like Aliens OXP, btw.

Re: TL for NPC-only equipment

Posted: Wed Mar 11, 2015 4:06 pm
by spara
Ngalo wrote:
Sorry if I've read this (or the documentation) wrong, but isn't there an 'available_to_player' key which you can set 'false' or 'no' in equipment.plist?
Sure, but there are cases were finer control is needed. You for example want some mission related equipment to be added to NPC ships only from javascript or you want an NPC equipment to be available only to certain NPC ships.
Smivs wrote:
...but I did wonder about that TL, just out of interest really.
Thinking about the context, it's probably just a placeholder.

My money's on the placeholder :mrgreen: .

Re: TL for NPC-only equipment

Posted: Wed Mar 11, 2015 4:11 pm
by Smivs
Ngalo wrote:
Sorry if I've read this (or the documentation) wrong, but isn't there an 'available_to_player' key which you can set 'false' or 'no' in equipment.plist?
I do use and quite like Aliens OXP, btw.
Hi Ngalo :)
Yes, it's 'available_to_all' and it is set to false (see above). This whole area is a bit confusing because there are several ways to approach it, and most seem to work.
I'm glad you like the OXP - have you been photon torpedoed yet? They are a bit lethal (as they were developed by the Scorpax as anti-Thargoid weapons) which is why I didn't think they should be on general sale :wink:

Re: TL for NPC-only equipment

Posted: Wed Mar 11, 2015 4:16 pm
by spara
Smivs wrote:
...and I have

Code: Select all

 script_info = {"oolite-barred-equipment" = "EQ_PHOTONTORP_MISSILE"};
in the missile's shipdata.
This is quite interesting. One would assume that it prevents "EQ_PHOTONTORP_MISSILE" from the missile itself. :?:

Re: TL for NPC-only equipment

Posted: Wed Mar 11, 2015 4:21 pm
by Smivs
Again, I'm assuming this is right - it certainly works, but could be redundant. I think 'oolite_barred_equipment' only prevents player access, but clarification would be nice. The Scorpax has these specified in its shipdata

Code: Select all

missile_role = "EQ_PHOTONTORP_MISSILE";
and certainly has them in-game.

Re: TL for NPC-only equipment

Posted: Wed Mar 11, 2015 4:35 pm
by spara
Smivs wrote:
Again, I'm assuming this is right - it certainly works, but could be redundant. I think 'oolite_barred_equipment' only prevents player access, but clarification would be nice. The Scorpax has these specified in its shipdata

Code: Select all

missile_role = "EQ_PHOTONTORP_MISSILE";
and certainly has them in-game.
Yup. I've been reading the equipment.plist page for about million times and still have some trouble grasping it. "Available_to_all" seems to mean "this item can be installed on all ships". So setting it to "no" effectively removes the equipment from shop. I assume that "available_to_NPCs" means that the equipment can be added by the game to NPC ships. So setting that to "no" would stop that. On the other hand, does "available_to_all" already bar it from all ships? After that the only way to add the equipment to a ship would be via script or missile_role assuming of course that my assumptions are correct. Correct, I'm confused with these :lol: .

Re: TL for NPC-only equipment

Posted: Wed Mar 11, 2015 6:06 pm
by cim
So, a few separate issues here:

available_to_all = false; means that the equipment can only be fitted to player ships which have the item in either the Standard or Optional Equipment section of their shipyard.plist definition. Unlikely, for a random piece of OXP equipment, but not impossible. This is what's actually doing the purchase blocking in this case. (Generally I wouldn't recommend using this on OXP equipment unless you want to tie it to a playable ship in the same OXP). Exactly when this is applied to the player ship has varied between Oolite versions [1] ... you should assume that it always applies and situations where it doesn't are bugs to be reported, I think.

available_to_player = false; means that the equipment can't be fitted to a player ship. If you don't want to use a condition script, Ngalo is right that this is the correct property.

script_info = {"oolite-barred-equipment" = "EQ_PHOTONTORP_MISSILE"}; when combined with oolite-conditions.js as the condition script means that the equipment can't be fitted to the ship with that script_info in its shipdata.plist, and works on player and NPC ships. In this case, this means that the missile can't mount copies of itself on its pylons as additional ammunition, which will no doubt relieve anyone it's fired at.

While you can stick oolite-conditions.js on OXP equipment (and perhaps you may as well if you don't need any other condition support), obviously the chance of any core or OXP ship specifically barring it is very low - you're probably better off giving the item its own OXP-specific condition script. In general, condition scripts are the solution to the problem of there being lots of equipment availability properties with overlapping and unclear effects, and in this case a custom one could be used to ensure that not only could the player not fit it, but neither could any non-Scorpax NPC.

TL for NPC equipment is irrelevant in the core game; set it to some reasonable value just in case some OXP is introduced which has persistent NPCs, tracks their equipment purchasing, and supports OXP equipment. TL:99 is an old magic value which allowed the TL to be changed by script (including legacy scripts) - it was never particularly appropriate for items which should never be player-accessible, for which 100 or 98 (or one of the many more specific properties) is better.

Re: TL for NPC-only equipment

Posted: Wed Mar 11, 2015 6:50 pm
by Smivs
Thanks cim. That's certainly clarified things a bit.
From what you've said, it seems I certainly covered all the bases, but somewhat redundantly. 'available_to_player = false;' sounds like what I really want for this, so I can go tidy things up now.

Re: TL for NPC-only equipment

Posted: Thu Mar 12, 2015 12:42 pm
by Ngalo
smivs wrote:
I'm glad you like the OXP - have you been photon torpedoed yet?
Haven't been hit by one yet. But I have outrun one on injectors. Didn't fancy going back to finish off the Scorpax though.

Re: TL for NPC-only equipment

Posted: Thu Mar 12, 2015 3:05 pm
by spara
One more question. How dominant these settings are in relation to adding equipment with awardEquipment or missile_role?

Re: TL for NPC-only equipment

Posted: Thu Mar 12, 2015 5:46 pm
by cim
They should override those, too (condition scripts have a mechanism to say in which situations they apply; the rest should be universal)

Re: various equipment questions

Posted: Thu Mar 12, 2015 6:44 pm
by Smivs
Back again with another question (and a change of title for this thread as I suspect this won't be the last one).
"installation_time" and "repair_time" are now writable (in 1.81) but how do they work? I notice in another post that they are measured in seconds, but I have a piece of equipment that requires a zero installation time - I've moved on to looking at the Tea Maker, and this concerns the refills, which shouldn't take 11 minutes and 40 seconds to install - that's seems silly to me :)
Back to the point, having

Code: Select all

"installation_time" = 0;
in the equipment.pist doesn't do anything. Is there not a zero-option or have I mis-understood something?