Equipment conditions scripts.

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

Post Reply
Nyarlatothep
Average
Average
Posts: 12
Joined: Tue Jan 21, 2014 2:58 pm

Equipment conditions scripts.

Post by Nyarlatothep »

I'm slightly uncomfortable with the way conditions scripts completely override the standard ones, and worried that in the future a custom OXP conditions.js might well not be testing all the (new) required conditions.

Adding an extra option to equipment.plist like "apply_standard_conditions" with values like "before_custom_script", "after_custom_script" and "do_not_apply" could improve the situation no end!

Hope this makes sense,

Rob.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Equipment conditions scripts.

Post by cim »

Overriding a built-in equipment entry is always slightly risky: it's not just the condition script that might change. The old Cloak Repair OXP (obsolete since 1.77 when its functionality made it into the core) is going to cause some issues for people who still have it installed when 1.80 comes out, for instance.

If there's particular OXP-initiated conditions people might find it useful to apply to standard equipment, then we can add those to the standard equipment's condition script, though.
Nyarlatothep
Average
Average
Posts: 12
Joined: Tue Jan 21, 2014 2:58 pm

Re: Equipment conditions scripts.

Post by Nyarlatothep »

Ok, I was specifically thinking of the berth control thread (I'll get back to you with the link). If someone wants to use my tweak and to be both 1.77 & 1.79 compatible, with minimal disruption to installed OXPs, there needs to be an extra

Code: Select all

	// OXP hook to allow ships to forbid specific "available to all" equipment
	if (ship.scriptInfo["oolite-barred-equipment"] && ship.scriptInfo["oolite-barred-equipment"].indexOf(equipment) != -1)
	{
		return false;
	}
inside the custom conditions script, enabled for 1.79 and above, but disabled otherwise.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Equipment conditions scripts.

Post by cim »

It probably won't hurt to not disable that line for 1.77, in the OXP: you're just getting the new feature a little in advance for the equipment you modified.
Post Reply