OoliteProject / oolite

The main Oolite repository.
https://www.oolite.space
543 stars 70 forks source link

Expanding ship.canAwardEquipment to allow other contexts #452

Closed phkb closed 9 months ago

phkb commented 9 months ago

For real, this time!

By default, the "canAwardEquipment" checks the equipment with the "scripted" context. This PR allows other contexts to be tested on an equipment item.

For example: player.ship.canAwardEquipment("EQ_NAVAL_ENERGY_UNIT") will return true. This is because, with the "scripted" context, it is allowed to be awarded to the player. However, there are restrictions on whether you can purchase the equipment or not. With this PR, you can do the following: player.ship.canAwardEquipment("EQ_NAVAL_ENERGY_UNIT", "purchase"), which will return false if the player has not yet completed the mission it relates to.