This object is in archive! 
[ModAPI] Add Missing Contract APIs and Interfaces
Under Consideration
While working on custom contracts I've noticed some missing interfaces, so starting this ticket to collect all of them in hopes this might get added in a patch at some point :)
bits that seem to have been missed in the implementation:
- there's no IMyContractBlock interface (leading to some weird workarounds like `block?.FatBlock?.BlockDefinition.SubtypeId.Contains("ContractBlock")` for looking them up e.g.). This also leads to there being no way to clean up contracts if a mod adding them looses the reference for some reason (or even to delete existing/vanilla contracts if you want custom behaviour e.g.) because there's no access to 'getAvailableContracts' (even having it in `MyAPIGateway.ContractSystem` would be nice). In general i was expecting something akin to the IMyStoreBlock to be available.
- Contract Type names are not read at all, even when a `.resx` file is created and show up as `LocalizationKey_..`, the current workaround being forcing a load in the mods session component's Load method (`VRage.MyTexts.LoadTexts(modContext.ModPath);`)
- Icons and Header Images are also not loaded when defining an MyObjectBuilder_ContractTypeDefinition in sbc, the current workaround being creating an sbc with dummy `MyObjectBuilder_PhysicalItemDefinition`s that contain an Icon for Header and Contract Icon each so that they get loaded (consequently the Icon and Header in the contracts.sbc are respected and rendered). e.g.
<PhysicalItem xsi:type="MyObjectBuilder_PhysicalItemDefinition"> <Id> <TypeId>PhysicalObject</TypeId> <SubtypeId>IconBuffer_Bounty</SubtypeId> </Id> <DisplayName>IconBuffer_Bounty</DisplayName> <Description>IconBuffer_Bounty</Description> <Icon>Textures\GUI\Icons\Contracts\NPCBountyContract.dds</Icon> <Public>false</Public> <CanPlayerOrder>false</CanPlayerOrder> <CanSpawnFromScreen>false</CanSpawnFromScreen> </PhysicalItem> <PhysicalItem xsi:type="MyObjectBuilder_PhysicalItemDefinition"> <Id> <TypeId>PhysicalObject</TypeId> <SubtypeId>HeaderBuffer_Bounty</SubtypeId> </Id> <DisplayName>HeaderBuffer_Bounty</DisplayName> <Description>HeaderBuffer_Bounty</Description> <Icon>Textures\GUI\Icons\Contracts\NPCBountyContractHeader.dds</Icon> <Public>false</Public> <CanPlayerOrder>false</CanPlayerOrder> <CanSpawnFromScreen>false</CanSpawnFromScreen> </PhysicalItem>
additionally it would be nice to have:
- an IMyStation interface (to use existing or even use the vanilla interface for mods using the concept of MyStation)
- a way to access `Stations`, seeing as they get spawned based on player vicinity (and iirc despawn in certain situations?), so keeping track of them in a mod can be unreliable/and or lead to crashes (currently I turn vanilla economy off when i have custom contracts on and have no way to interact properly with the vanilla system)
- the contract block's type filter loads all definitions. would be really nice to be able to have certain stations only show certain contracts, but at least to have an 'enabled' property/respect the 'enabled' flag from MyDefinitionManager.Static definitions and have certain types disabled in a save. Currently this just creates dead categories for types that are not being used.
This should be unarchived and reconsidered.
This should be unarchived and reconsidered.
Please fix this issue so we can have custom contracts. It would be really awesome if you would allow custom contracts to also have different rewards not just credits(example tier 4 tools or high end components like super conductors or thruster components or maybe top tier ore and ingots or even custom ships.
Please fix this issue so we can have custom contracts. It would be really awesome if you would allow custom contracts to also have different rewards not just credits(example tier 4 tools or high end components like super conductors or thruster components or maybe top tier ore and ingots or even custom ships.
Please allow us to retrieve contracts as Patrick has suggested. Trying to create your own XML based tracking files and keep track of contracts is a major headache and not very reliable :(
Please allow us to retrieve contracts as Patrick has suggested. Trying to create your own XML based tracking files and keep track of contracts is a major headache and not very reliable :(
Replies have been locked on this page!