Page 1 of 1

availability of equipment depending on other equipment?

Posted: Thu May 22, 2008 7:07 am
by Commander McLane
This has probably been asked and answered before, but I don't recall:

Is it possible in equipment.plist, to make the availability of one item dependent on whether the player has installed another item?

Usually an equipment.plist-entry looks like this:

Code: Select all

	<array>
		<integer>0</integer>                              //TechLevel
		<integer>2</integer>                              //price
		<string>Fuel</string>                             //name
		<string>EQ_FUEL</string>                          //identifier
		<string>Fuel for the witchspace engines.</string> //display text
		<dict>                                            //conditions
			<key>available_to_all</key>
			<true/>
		</dict>
	</array>
In the conditions-part there can be some other stuff as well, like

Code: Select all

			<key>portable_between_ships</key>
			<true/>
or

Code: Select all

			<key>requires_empty_pylon</key>
			<true/>
or

Code: Select all

			<key>requires_mounted_pylon</key>
			<true/>
or

Code: Select all

			<key>requires_cargo_space</key>
			<integer>5</integer>
or

Code: Select all

			<key>incompatible_with_equipment</key>
			<string>EQ_NAVAL_ENERGY_UNIT</string>
These are all examples taken from the built-in equipment.plist, because unfortunately there is no documentation in the wiki (a page about equipment.plist is still missing).

What I want to know is whether there is something like

Code: Select all

			<key>requires_equipment</key>
			<string>EQ_GAL_DRIVE</string>
and what the syntax would be (this one doesn't work; have tested it).

Thanks for any enlightenment!

Posted: Thu May 22, 2008 8:52 am
by Kaks
It looks like the dreaded cut & paste bug struck again: at the moment if no 'incompatible_with_equipment' key is set, oolite fills 'incompatible_with_equipment' with what's inside 'requires_equipment'. Then it gets thoroughly confused.
Will fix the bug in trunk now, but there's a workaround for the released version: if you add these lines:

Code: Select all

 <key>incompatible_with_equipment</key>
 <string>EQ_DUMMY_EQUIPMENT</string>
requires_equimpent should start working as intended! :)

There's two more conditions: 'requires_clean' & 'requires_not_clean' that should make equipment available based on the player legal status...

Hope this helps! :D

Posted: Thu May 22, 2008 10:19 am
by Commander McLane
Thanks very much! :D

Also it's good to know that there are these two more keys I didn't know about.

One last request: Would you mind setting up a wiki-page about equipment.plist that contains all this information? It's one of three remaining plists without any documentation (the others being hud.plist and speech_pronunciation_guide.plist, see here).

EDIT: And by the way: It works perfectly! :D My extra equipment appears the very moment I have bought a Galactic Hyperdrive.

Posted: Thu May 22, 2008 11:46 am
by Ramirez
Cool - I might have to use this trick for dealing with the chaff refills in Missiles and Bombs. The use of legal status could be interesting - even after docking manually a player could be denied some essential supplies and be forced to pay over the odds for fuel and repairs.

Posted: Thu May 22, 2008 12:13 pm
by Kaks
Good to know the workaround works! :)
& yes, the legal status conditions do open up a few interesting possibilities. As I was looking at the code, I thought 'people should be told'! :)


I'll try and put a draft equipment.plist page on the wiki tonight, but no firm promises: haven't got tons of free time anymore... now, if I only manage to get sacked.... :mrgreen: