.. default-domain:: js .. highlight:: js .. module:: SpaceCenter :no-index: Contracts ========= .. class:: ContractManager Contracts manager. Obtained by calling :func:`SpaceCenter.getContractManager`. .. method:: getTypes() A list of all contract types. :Property: Read-only, cannot be set :rtype: ``Set`` of ``string`` .. method:: getAllContracts() A list of all contracts. :Property: Read-only, cannot be set :rtype: ``Array`` of :class:`SpaceCenter.Contract` .. method:: getActiveContracts() A list of all active contracts. :Property: Read-only, cannot be set :rtype: ``Array`` of :class:`SpaceCenter.Contract` .. method:: getOfferedContracts() A list of all offered, but unaccepted, contracts. :Property: Read-only, cannot be set :rtype: ``Array`` of :class:`SpaceCenter.Contract` .. method:: getCompletedContracts() A list of all completed contracts. :Property: Read-only, cannot be set :rtype: ``Array`` of :class:`SpaceCenter.Contract` .. method:: getFailedContracts() A list of all failed contracts. :Property: Read-only, cannot be set :rtype: ``Array`` of :class:`SpaceCenter.Contract` .. class:: Contract A contract. Can be accessed using :func:`SpaceCenter.getContractManager`. .. method:: getType() Type of the contract. :Property: Read-only, cannot be set :rtype: ``string`` .. method:: getTitle() Title of the contract. :Property: Read-only, cannot be set :rtype: ``string`` .. method:: getDescription() Description of the contract. :Property: Read-only, cannot be set :rtype: ``string`` .. method:: getNotes() Notes for the contract. :Property: Read-only, cannot be set :rtype: ``string`` .. method:: getSynopsis() Synopsis for the contract. :Property: Read-only, cannot be set :rtype: ``string`` .. method:: getKeywords() Keywords for the contract. :Property: Read-only, cannot be set :rtype: ``Array`` of ``string`` .. method:: getState() State of the contract. :Property: Read-only, cannot be set :rtype: :class:`SpaceCenter.ContractState` .. method:: getSeen() Whether the contract has been seen. :Property: Read-only, cannot be set :rtype: ``boolean`` .. method:: getRead() Whether the contract has been read. :Property: Read-only, cannot be set :rtype: ``boolean`` .. method:: getActive() Whether the contract is active. :Property: Read-only, cannot be set :rtype: ``boolean`` .. method:: getFailed() Whether the contract has been failed. :Property: Read-only, cannot be set :rtype: ``boolean`` .. method:: getCanBeCanceled() Whether the contract can be canceled. :Property: Read-only, cannot be set :rtype: ``boolean`` .. method:: getCanBeDeclined() Whether the contract can be declined. :Property: Read-only, cannot be set :rtype: ``boolean`` .. method:: getCanBeFailed() Whether the contract can be failed. :Property: Read-only, cannot be set :rtype: ``boolean`` .. method:: accept() Accept an offered contract. .. method:: cancel() Cancel an active contract. .. method:: decline() Decline an offered contract. .. method:: getFundsAdvance() Funds received when accepting the contract. :Property: Read-only, cannot be set :rtype: ``number`` .. method:: getFundsCompletion() Funds received on completion of the contract. :Property: Read-only, cannot be set :rtype: ``number`` .. method:: getFundsFailure() Funds lost if the contract is failed. :Property: Read-only, cannot be set :rtype: ``number`` .. method:: getReputationCompletion() Reputation gained on completion of the contract. :Property: Read-only, cannot be set :rtype: ``number`` .. method:: getReputationFailure() Reputation lost if the contract is failed. :Property: Read-only, cannot be set :rtype: ``number`` .. method:: getScienceCompletion() Science gained on completion of the contract. :Property: Read-only, cannot be set :rtype: ``number`` .. method:: getParameters() Parameters for the contract. :Property: Read-only, cannot be set :rtype: ``Array`` of :class:`SpaceCenter.ContractParameter` .. method:: getDateAccepted() Universal time at which the contract was accepted, in seconds. Zero if the contract has not been accepted. :Property: Read-only, cannot be set :rtype: ``number`` .. method:: getDateDeadline() Universal time by which the contract must be completed, in seconds. Zero if the contract has no deadline. :Property: Read-only, cannot be set :rtype: ``number`` .. method:: getDateExpire() Universal time at which the contract offer expires, in seconds. Zero if the contract has no expiry date. :Property: Read-only, cannot be set :rtype: ``number`` .. method:: getDateFinished() Universal time at which the contract was completed or failed, in seconds. Zero if the contract has not finished or KSP did not record a finish time. :Property: Read-only, cannot be set :rtype: ``number`` .. class:: ContractState The state of a contract. See :meth:`SpaceCenter.Contract.getState`. .. attribute:: active The contract is active. .. attribute:: canceled The contract has been canceled. .. attribute:: completed The contract has been completed. .. attribute:: deadlineExpired The deadline for the contract has expired. .. attribute:: declined The contract has been declined. .. attribute:: failed The contract has been failed. .. attribute:: generated The contract has been generated. .. attribute:: offered The contract has been offered to the player. .. attribute:: offerExpired The contract was offered to the player, but the offer expired. .. attribute:: withdrawn The contract has been withdrawn. .. class:: ContractParameter A contract parameter. See :meth:`SpaceCenter.Contract.getParameters`. .. method:: getTitle() Title of the parameter. :Property: Read-only, cannot be set :rtype: ``string`` .. method:: getNotes() Notes for the parameter. :Property: Read-only, cannot be set :rtype: ``string`` .. method:: getChildren() Child contract parameters. :Property: Read-only, cannot be set :rtype: ``Array`` of :class:`SpaceCenter.ContractParameter` .. method:: getCompleted() Whether the parameter has been completed. :Property: Read-only, cannot be set :rtype: ``boolean`` .. method:: getFailed() Whether the parameter has been failed. :Property: Read-only, cannot be set :rtype: ``boolean`` .. method:: getOptional() Whether the contract parameter is optional. :Property: Read-only, cannot be set :rtype: ``boolean`` .. method:: getFundsCompletion() Funds received on completion of the contract parameter. :Property: Read-only, cannot be set :rtype: ``number`` .. method:: getFundsFailure() Funds lost if the contract parameter is failed. :Property: Read-only, cannot be set :rtype: ``number`` .. method:: getReputationCompletion() Reputation gained on completion of the contract parameter. :Property: Read-only, cannot be set :rtype: ``number`` .. method:: getReputationFailure() Reputation lost if the contract parameter is failed. :Property: Read-only, cannot be set :rtype: ``number`` .. method:: getScienceCompletion() Science gained on completion of the contract parameter. :Property: Read-only, cannot be set :rtype: ``number``