Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Missing equipment after combat

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Missing equipment after combat

Post by Eric Walch »

I sometimes have a problem that equipment does not get damaged, but is fully removed instead. It was already happening with 1.74, but I never could track down the source. And as far as I know, I don't have any fancy oxp installed that removes stuff.

Yesterday it happened again. While busy with a trident down mission I was ambushed by police and got in a heavy fight:

Code: Select all

Player leaves station eagis: Torus Station - Space Rickshaw Co.
Player is sustaining 15.463841438293457 units of energy damage from: ATU Viper MkII
Player is sustaining 20.397254943847656 units of energy damage from: ATU Viper MkII
Player is sustaining 22.399099349975586 units of energy damage from: ATU Viper MkII
Player is sustaining 22.349374771118164 units of energy damage from: ATU Viper MkII
Player is sustaining 18.89563751220703 units of energy damage from: ATU Viper MkII
Player is sustaining 18.945655822753906 units of energy damage from: ATU Viper MkII
Player is sustaining 4.6300201416015625 units of energy damage from: ATU Viper MkII
Player is sustaining 20.548084259033203 units of energy damage from: ATU Viper MkII
Damaged: EQ_ESCORTCONTRACTS With name: I.T.H.A Independent Escort License  <--------
Player is sustaining 21.948278427124023 units of energy damage from: ATU Viper MkII
Player is sustaining 15.942626953125 units of energy damage from: ATU Viper MkII
Player is sustaining 22.39990997314453 units of energy damage from: ATU Viper MkII
Damaged: EQ_TARGET_MEMORY With name: Target System Memory Expansion
Player is sustaining 21.048059463500977 units of energy damage from: ATU Viper MkII
Player is sustaining 19.845901489257812 units of energy damage from: ATU Viper MkII
Player is sustaining 8.060550689697266 units of energy damage from: ATU Viper MkII
Player is sustaining 22.39963150024414 units of energy damage from: ATU Viper MkII
Player is sustaining 22.3985595703125 units of energy damage from: ATU Viper MkII
Player is sustaining 22.39937973022461 units of energy damage from: ATU Viper MkII
Damaged: EQ_SCANNER_SHOW_MISSILE_TARGET With name: Scanner Targeting Enhancement
Player is sustaining 22.04900360107422 units of energy damage from: ATU Viper MkII
Damaged: EQ_UPS_UNIVERSAL_SCANNER With name: Universal Scanner <------
Player is sustaining 12.6651029586792 units of energy damage from: ATU Viper MkII
Player is sustaining 2.753755569458008 units of energy damage from: ATU Viper MkII
Player is sustaining 15.085862159729004 units of energy damage from: ATU Viper MkII
Player is sustaining 22.3558349609375 units of energy damage from: ATU Viper MkII
Player is sustaining 22.349353790283203 units of energy damage from: ATU Viper MkII
Player is sustaining 17.84465789794922 units of energy damage from: ATU Viper MkII
Damaged: EQ_WORMHOLE_SCANNER With name: Wormhole Scanner
Player is sustaining 20.59740447998047 units of energy damage from: ATU Viper MkII
Player is sustaining 22.398649215698242 units of energy damage from: ATU Viper MkII
Player is sustaining 2.9287548065185547 units of energy damage from: ATU Viper MkII
Boa Class Cruiser received message: Fool!  No-one crosses us and lives! from ship: ATU Viper MkII
Boa Class Cruiser received message: Fool!  No-one crosses us and lives! from ship: ATU Viper MkII
Player will enter witchspace with a standard jump
Upon the next docking, I made inventory and noticed three items were marked as damaged. The other two indicated in the above log were just gone.

NB the damaged message in above log is triggered by a "equipmentDamaged()" handler and should be there as damaged.
User avatar
Gimi
---- E L I T E ----
---- E L I T E ----
Posts: 2073
Joined: Tue Aug 29, 2006 5:02 pm
Location: Norway

Re: Missing equipment after combat

Post by Gimi »

I have seen this, and for me it seems to especially affect "planetary landing capability". I have never seen those log-lines though, but you seem to have excessive logging turned on.
"A brilliant game of blasting and trading... Truly a mega-game... The game of a lifetime."
(Gold Medal Award, Zzap!64 May 1985).
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Missing equipment after combat

Post by Eric Walch »

Gimi wrote:
I have never seen those log-lines though, but you seem to have excessive logging turned on.
Something like that. I have a custom script containing:

Code: Select all

this.equipmentDamaged  = function(equipment)
{
 log(this.name, "Damaged: "+ equipment + " With name: " + EquipmentInfo.infoForKey(equipment).name)
}

this.shipTakingDamage = function (amount, whom, type)
{
    if (amount> 0) log(this.name, "Player is sustaining " + amount + " units of " + type + " from: " + (whom?whom.name:"unknown"));
}
Useful for figuring out what happened while debugging. :P

And I have also the feeling that only certain oxp equipment is affected. I only can remember occasions with the EQ_UPS_UNIVERSAL_SCANNER and the EQ_ORE_PROCESSOR. Maybe they were the last in an array at that time?
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: Missing equipment after combat

Post by Capt. Murphy »

This is in the escort contracts script to reset the license to EQUIPMENT_OK in the event it is damaged so it shouldn't be gone entirely. Odd.

Code: Select all

this.equipmentDamaged = function(equipment)
{
if(equipment == "EQ_ESCORTCONTRACTS")
	{
		player.ship.setEquipmentStatus(equipment,"EQUIPMENT_OK");
	}
}
Edit - if my attempt to read the source code is correct for this bit it looks pretty straightforward. Selected equipment is removed, if not in strict mode then add equipment with _DAMAGED appended, then send equipmentDamaged event handler.
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Re: Missing equipment after combat

Post by Thargoid »

I think it may be related to the conditions/requirements for the equipment. I've been wondering about this having seen something similar occasionally with repairing equipment.

Can you confirm the tech level and especially any other required conditions for the equipment involved (other equipment required, incompatabilities, max/min system specs etc)? I think I've seen equipment that should have been repaired vanishing if the repair happens in a system where you could not normally purchase the equipment (e.g. if you try and repair an item that needs govt > multi-govt when you are flying in an anarchy system, I think the setting of the equipment status back to OK sometimes seems to fail.

Is it something along those lines?
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: Missing equipment after combat

Post by Capt. Murphy »

Good thinking that man.Insectoid Alien.

EQ_ESCORTCONTRACTS - tech lvl 4

Code: Select all

"available_to_all" = 1;
conditions = ("systemGovernment_number morethan 2");
"requires_clean" = 1;
EQ_UPS_UNIVERSAL_SCANNER - tech lvl 99

Code: Select all

"available_to_all" = 1;
"requires_clean" = 1;
"script" = "upsUniversalScanner.js";
I can see one thing in common.....

Results of a little test seem to indicate that the requires_clean is an issue.
Debug console shows EQ_ESCORTCONTRACTS has gone entirely when player bounty is 1, and can't be awarded. If bounty is 0, it is fixed as per the script.
> player.bounty = 1
> player.bounty = 1
1
> player.ship.setEquipmentStatus("EQ_ESCORTCONTRACTS","EQUIPMENT_DAMAGED")
> player.ship.setEquipmentStatus("EQ_ESCORTCONTRACTS","EQUIPMENT_DAMAGED")
true
> player.ship.equipment
> player.ship.equipment
[[EquipmentInfo EQ_CARGO_BAY "Large Cargo Bay"], [EquipmentInfo EQ_ECM "E.C.M. System"], [EquipmentInfo EQ_FUEL_SCOOPS "Fuel Scoops"], [EquipmentInfo EQ_ENERGY_UNIT "Extra Energy Unit"], [EquipmentInfo EQ_DOCK_COMP "Docking Computers"], [EquipmentInfo EQ_FUEL_INJECTION "Witchdrive Fuel Injectors"], [EquipmentInfo EQ_SCANNER_SHOW_MISSILE_TARGET "Scanner Targeting Enhancement"], [EquipmentInfo EQ_MULTI_TARGET "Multi-Targeting System"], [EquipmentInfo EQ_ADVANCED_COMPASS "Advanced Space Compass"], [EquipmentInfo EQ_ADVANCED_NAVIGATIONAL_ARRAY "Advanced Navigational Array"], [EquipmentInfo EQ_TARGET_MEMORY "Target System Memory Expansion"], [EquipmentInfo EQ_SHIELD_BOOSTER "Shield Boosters"], [EquipmentInfo EQ_NAVAL_SHIELD_BOOSTER "Military Shield Enhancement"], [EquipmentInfo EQ_HEAT_SHIELD "External Heat Shielding"], [EquipmentInfo EQ_WORMHOLE_SCANNER "Wormhole Scanner"], [EquipmentInfo EQ_FRAME_BOUNTY_SCANNER "Bounty Scanner"], [EquipmentInfo EQ_BREAKABLE_HUD_IFF_SCANNER "Standard HUD/IFF Scanner"], [EquipmentInfo EQ_BREAKABLE_SHIELD_FORE "Primary Shield Generator - Fore"], [EquipmentInfo EQ_BREAKABLE_SHIELD_AFT "Primary Shield Generator - Aft"], [EquipmentInfo EQ_BREAKABLE_TORUSDRIVE "Torus Jump Drive"], [EquipmentInfo EQ_BREAKABLE_WITCHDRIVE "Thruspace HyperDrive"], [EquipmentInfo EQ_ESCAPE_CAPSULE_LOCATOR_DISABLED "Escape Pod Locator - Disabled due to pilot legal status"], [EquipmentInfo EQ_HYPERCARGO "HyperCargo System"], [EquipmentInfo EQ_POLICE_SCANNER_UPGRADE "Police IFF Scanner Upgrade"], [EquipmentInfo EQ_RAILGUN_2 "Medium Railgun"], [EquipmentInfo EQ_REPAIRBOTS_CONTROLLER "Self-Repair System"], [EquipmentInfo EQ_RETROROCKETS "Retro Rockets"], [EquipmentInfo EQ_ROCKHERMIT_SCANNER "Rock Hermit Locator"]]
> player.ship.awardEquipment("EQ_ESCORTCONTRACTS")
> player.ship.awardEquipment("EQ_ESCORTCONTRACTS")
false
> player.ship.bounty = 0
> player.ship.bounty = 0
0
> player.ship.awardEquipment("EQ_ESCORTCONTRACTS")
> player.ship.awardEquipment("EQ_ESCORTCONTRACTS")
true
> player.ship.setEquipmentStatus("EQ_ESCORTCONTRACTS","EQUIPMENT_DAMAGED")
> player.ship.setEquipmentStatus("EQ_ESCORTCONTRACTS","EQUIPMENT_DAMAGED")
true
> player.ship.equipment
> player.ship.equipment
[[EquipmentInfo EQ_CARGO_BAY "Large Cargo Bay"], [EquipmentInfo EQ_ECM "E.C.M. System"], [EquipmentInfo EQ_FUEL_SCOOPS "Fuel Scoops"], [EquipmentInfo EQ_ENERGY_UNIT "Extra Energy Unit"], [EquipmentInfo EQ_DOCK_COMP "Docking Computers"], [EquipmentInfo EQ_FUEL_INJECTION "Witchdrive Fuel Injectors"], [EquipmentInfo EQ_SCANNER_SHOW_MISSILE_TARGET "Scanner Targeting Enhancement"], [EquipmentInfo EQ_MULTI_TARGET "Multi-Targeting System"], [EquipmentInfo EQ_ADVANCED_COMPASS "Advanced Space Compass"], [EquipmentInfo EQ_ADVANCED_NAVIGATIONAL_ARRAY "Advanced Navigational Array"], [EquipmentInfo EQ_TARGET_MEMORY "Target System Memory Expansion"], [EquipmentInfo EQ_SHIELD_BOOSTER "Shield Boosters"], [EquipmentInfo EQ_NAVAL_SHIELD_BOOSTER "Military Shield Enhancement"], [EquipmentInfo EQ_HEAT_SHIELD "External Heat Shielding"], [EquipmentInfo EQ_WORMHOLE_SCANNER "Wormhole Scanner"], [EquipmentInfo EQ_FRAME_BOUNTY_SCANNER "Bounty Scanner"], [EquipmentInfo EQ_BREAKABLE_HUD_IFF_SCANNER "Standard HUD/IFF Scanner"], [EquipmentInfo EQ_BREAKABLE_SHIELD_FORE "Primary Shield Generator - Fore"], [EquipmentInfo EQ_BREAKABLE_SHIELD_AFT "Primary Shield Generator - Aft"], [EquipmentInfo EQ_BREAKABLE_TORUSDRIVE "Torus Jump Drive"], [EquipmentInfo EQ_BREAKABLE_WITCHDRIVE "Thruspace HyperDrive"], [EquipmentInfo EQ_ESCAPE_CAPSULE_LOCATOR_DISABLED "Escape Pod Locator - Disabled due to pilot legal status"], [EquipmentInfo EQ_ESCORTCONTRACTS "I.T.H.A Independent Escort License"], [EquipmentInfo EQ_HYPERCARGO "HyperCargo System"], [EquipmentInfo EQ_POLICE_SCANNER_UPGRADE "Police IFF Scanner Upgrade"], [EquipmentInfo EQ_RAILGUN_2 "Medium Railgun"], [EquipmentInfo EQ_REPAIRBOTS_CONTROLLER "Self-Repair System"], [EquipmentInfo EQ_RETROROCKETS "Retro Rockets"], [EquipmentInfo EQ_ROCKHERMIT_SCANNER "Rock Hermit Locator"]]
Same test for EQ_UPS_UNIVERSAL_SCANNER produces similar result.
> player.ship.awardEquipment("EQ_UPS_UNIVERSAL_SCANNER")
> player.ship.awardEquipment("EQ_UPS_UNIVERSAL_SCANNER")
true
> player.ship.setEquipmentStatus("EQ_UPS_UNIVERSAL_SCANNER","EQUIPMENT_DAMAGED")
> player.ship.setEquipmentStatus("EQ_UPS_UNIVERSAL_SCANNER","EQUIPMENT_DAMAGED")
true
> player.ship.equipment
> player.ship.equipment
[[EquipmentInfo EQ_CARGO_BAY "Large Cargo Bay"], [EquipmentInfo EQ_ECM "E.C.M. System"], [EquipmentInfo EQ_FUEL_SCOOPS "Fuel Scoops"], [EquipmentInfo EQ_ENERGY_UNIT "Extra Energy Unit"], [EquipmentInfo EQ_DOCK_COMP "Docking Computers"], [EquipmentInfo EQ_FUEL_INJECTION "Witchdrive Fuel Injectors"], [EquipmentInfo EQ_SCANNER_SHOW_MISSILE_TARGET "Scanner Targeting Enhancement"], [EquipmentInfo EQ_MULTI_TARGET "Multi-Targeting System"], [EquipmentInfo EQ_ADVANCED_COMPASS "Advanced Space Compass"], [EquipmentInfo EQ_ADVANCED_NAVIGATIONAL_ARRAY "Advanced Navigational Array"], [EquipmentInfo EQ_TARGET_MEMORY "Target System Memory Expansion"], [EquipmentInfo EQ_SHIELD_BOOSTER "Shield Boosters"], [EquipmentInfo EQ_NAVAL_SHIELD_BOOSTER "Military Shield Enhancement"], [EquipmentInfo EQ_HEAT_SHIELD "External Heat Shielding"], [EquipmentInfo EQ_WORMHOLE_SCANNER "Wormhole Scanner"], [EquipmentInfo EQ_FRAME_BOUNTY_SCANNER "Bounty Scanner"], [EquipmentInfo EQ_BREAKABLE_HUD_IFF_SCANNER "Standard HUD/IFF Scanner"], [EquipmentInfo EQ_BREAKABLE_SHIELD_FORE "Primary Shield Generator - Fore"], [EquipmentInfo EQ_BREAKABLE_SHIELD_AFT "Primary Shield Generator - Aft"], [EquipmentInfo EQ_BREAKABLE_TORUSDRIVE "Torus Jump Drive"], [EquipmentInfo EQ_BREAKABLE_WITCHDRIVE "Thruspace HyperDrive"], [EquipmentInfo EQ_ESCAPE_CAPSULE_LOCATOR_DISABLED "Escape Pod Locator - Disabled due to pilot legal status"], [EquipmentInfo EQ_ESCORTCONTRACTS "I.T.H.A Independent Escort License"], [EquipmentInfo EQ_HYPERCARGO "HyperCargo System"], [EquipmentInfo EQ_POLICE_SCANNER_UPGRADE "Police IFF Scanner Upgrade"], [EquipmentInfo EQ_RAILGUN_2 "Medium Railgun"], [EquipmentInfo EQ_REPAIRBOTS_CONTROLLER "Self-Repair System"], [EquipmentInfo EQ_RETROROCKETS "Retro Rockets"], [EquipmentInfo EQ_ROCKHERMIT_SCANNER "Rock Hermit Locator"], [EquipmentInfo EQ_UPS_UNIVERSAL_SCANNER "Universal Scanner"]]
> player.ship.setEquipmentStatus("EQ_UPS_UNIVERSAL_SCANNER","EQUIPMENT_OK")
> player.ship.setEquipmentStatus("EQ_UPS_UNIVERSAL_SCANNER","EQUIPMENT_OK")
true
> player.ship.bounty = 1
> player.ship.bounty = 1
1
> player.ship.setEquipmentStatus("EQ_UPS_UNIVERSAL_SCANNER","EQUIPMENT_DAMAGED")
> player.ship.setEquipmentStatus("EQ_UPS_UNIVERSAL_SCANNER","EQUIPMENT_DAMAGED")
true
> player.ship.equipment
> player.ship.equipment
[[EquipmentInfo EQ_CARGO_BAY "Large Cargo Bay"], [EquipmentInfo EQ_ECM "E.C.M. System"], [EquipmentInfo EQ_FUEL_SCOOPS "Fuel Scoops"], [EquipmentInfo EQ_ENERGY_UNIT "Extra Energy Unit"], [EquipmentInfo EQ_DOCK_COMP "Docking Computers"], [EquipmentInfo EQ_FUEL_INJECTION "Witchdrive Fuel Injectors"], [EquipmentInfo EQ_SCANNER_SHOW_MISSILE_TARGET "Scanner Targeting Enhancement"], [EquipmentInfo EQ_MULTI_TARGET "Multi-Targeting System"], [EquipmentInfo EQ_ADVANCED_COMPASS "Advanced Space Compass"], [EquipmentInfo EQ_ADVANCED_NAVIGATIONAL_ARRAY "Advanced Navigational Array"], [EquipmentInfo EQ_TARGET_MEMORY "Target System Memory Expansion"], [EquipmentInfo EQ_SHIELD_BOOSTER "Shield Boosters"], [EquipmentInfo EQ_NAVAL_SHIELD_BOOSTER "Military Shield Enhancement"], [EquipmentInfo EQ_HEAT_SHIELD "External Heat Shielding"], [EquipmentInfo EQ_WORMHOLE_SCANNER "Wormhole Scanner"], [EquipmentInfo EQ_FRAME_BOUNTY_SCANNER "Bounty Scanner"], [EquipmentInfo EQ_BREAKABLE_HUD_IFF_SCANNER "Standard HUD/IFF Scanner"], [EquipmentInfo EQ_BREAKABLE_SHIELD_FORE "Primary Shield Generator - Fore"], [EquipmentInfo EQ_BREAKABLE_SHIELD_AFT "Primary Shield Generator - Aft"], [EquipmentInfo EQ_BREAKABLE_TORUSDRIVE "Torus Jump Drive"], [EquipmentInfo EQ_BREAKABLE_WITCHDRIVE "Thruspace HyperDrive"], [EquipmentInfo EQ_ESCAPE_CAPSULE_LOCATOR_DISABLED "Escape Pod Locator - Disabled due to pilot legal status"], [EquipmentInfo EQ_ESCORTCONTRACTS "I.T.H.A Independent Escort License"], [EquipmentInfo EQ_HYPERCARGO "HyperCargo System"], [EquipmentInfo EQ_POLICE_SCANNER_UPGRADE "Police IFF Scanner Upgrade"], [EquipmentInfo EQ_RAILGUN_2 "Medium Railgun"], [EquipmentInfo EQ_REPAIRBOTS_CONTROLLER "Self-Repair System"], [EquipmentInfo EQ_RETROROCKETS "Retro Rockets"], [EquipmentInfo EQ_ROCKHERMIT_SCANNER "Rock Hermit Locator"]]
And finally repeated the test for the EQ_ESCORTCONTRACTS in an Anarchy but with no bounty. Once again it disappears when set to DAMAGED.

Conclusion - the addEquipmentItem routine in the source code needs looking at so it doesn't check conditions when replacing equipment with the _DAMAGED version or alternatively removing _DAMAGED version and replacing it with working version.
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Missing equipment after combat

Post by Eric Walch »

Thargoid wrote:
I think it may be related to the conditions/requirements for the equipment. I've been wondering about this having seen something similar occasionally with repairing equipment.
I think you both hit the nail there. :!:

Both equipments from my example have a condition that requires clean and the police were after me because I was a fugitive. I remember that also an ship.awardEquipment0 does not work when conditions don't match.
So, awarding the damaged equipment should ignore conditions in this part of the code. I wonder how easy such a change would be. :evil:

EDIT: Probably easier than I thought as it seems there is already a check possible:

Code: Select all

- (BOOL) addEquipmentItem:(NSString *)equipmentKey withValidation:(BOOL)validateAddition
{
	OOEquipmentType			*eqType = nil;
	NSString				*lcEquipmentKey = [equipmentKey lowercaseString];
	BOOL					isEqThargon = [lcEquipmentKey hasSuffix:@"thargon"] || [lcEquipmentKey hasPrefix:@"thargon"];
	
	// canAddEquipment always checks if the undamaged version is equipped.
	if (validateAddition == YES && ![self canAddEquipment:equipmentKey])  return NO;
	
Currently the code it called with 'validateAddition= true' but I think calling it with 'validateAddition = false' should do the trick.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Re: Missing equipment after combat

Post by Thargoid »

This will have a big impact on repair bots/equipment as well - it makes items only repairable when the conditions at the time are correct to be able to buy the item from the station too. So either the conditions should only be checked for the purchase of equipment (and not when it breaks or gets its status changed back to OK from damaged) or possibly a new JS command variant of awardEquipment and/or setEquipmentStatus that explicitly ignored conditions and forces the change.
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: Missing equipment after combat

Post by Mauiby de Fug »

Sounds about right. I think I've had a couple of issues with the Bounty Scanner and the Target Auto-Lock when my Scanner Targeting Enhancer has been damaged, on which they are both dependent...
Makara
Dangerous
Dangerous
Posts: 122
Joined: Sat Oct 17, 2009 6:34 pm

Re: Missing equipment after combat

Post by Makara »

Mauiby de Fug wrote:
Sounds about right. I think I've had a couple of issues with the Bounty Scanner and the Target Auto-Lock when my Scanner Targeting Enhancer has been damaged, on which they are both dependent...
I recognise the issue, but don't think it is quite the same situation as Eric has highlighted. In Eric's case the issue seems to be concerning the handling of an equipment status change when the original issuing conditions are no longer satisfied. It requires damage to the equipment which subsequently, and mysteriously, disappears.

In the case of Target Autolock (I can't remember with Bounty Scanner, although it does also apply to Target Reticle Sensitive), damage to the "parent" of these dependent equipments causes these equipments to disappear, rather than just stop functioning. Damage to the disappearing equipment is not required (especially aggravating when the damage is caused by an override missile - only one piece of equipment damaged but three to fix & replace). Not sure if this is a bug or feature :?
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: Missing equipment after combat

Post by Mauiby de Fug »

Well, on the few occasions that I suffer damage, the damage tends to be quite extensive, and multiple pieces of equipment get damaged. The Scanner Targeting Enhancement is a requirement for the two pieces of equipment I mentioned. So when they all get damaged, their original conditions are not met. On docking I found they disappeared. That is why I assumed it was related. But I can see what you mean, in that it might just be damage to the parent item, which then destroys the others. Personally, I think that this should damage the others, rather than remove them...
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: Missing equipment after combat

Post by Capt. Murphy »

There are two different things going on there.

I've just damaged Scanner Targeting Enhancement by debug console and Bounty Scanner remains visible and listed. But if Bounty Scanner is damaged whilst Scanner Targeting Enhancement is already damaged Bounty Scanner disappears entirely. So this is the same behaviour observed by Eric, the condition check is stopping the game engine adding the damaged version of the equipment. Also confirmed that if the Bounty Scanner is damaged first, and then Scanner Targeting Enhancement damaged, an attempt to set the Bounty Scanner back to EQUIPMENT_OK will report as true, but the equipment disappears. Again the game engine is removing the damaged version, but then the condition check is stopping the game engine adding the working version.

On the other hand both Target Autolock and Target Reticle Sensitive appear to have been deliberately scripted by their authors (Thargoid and Eric respectively) to be removed when Scanner Targeting Enhancement is damaged.

Both scripts remove the equipment item and set a missionVariable instead when bought, so neither items are ever visible on the Equipment manifest or can be damaged in their own right. The functionality is based on presence of the missionVariable.

But both scripts clear the missionVariable (and so effectively remove the equipment) if Scanner Targeting Enhancement is damaged.
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Re: Missing equipment after combat

Post by Thargoid »

At the time both were written that was the only way to do it. In both cases the equipment are by concept "software upgrades" (at least TAP is), and it makes no sense for a software upgrade to get physically damaged and to need repair. It's just designed to switch off the additional functionality when the base function (scanner targeting enhancement) is no longer functioning due to damage.

Plus it isn't possible to script-award a damaged piece of equipment directly these days (the _DAMAGED version can't be script-awarded since about 1.73 or 1.74), only the status changed to damaged. However if we try to do that I think we're again going to trip over the condition/requirements problem.

Having thought about this a little more the simplest solution could be for awardEquipment to take the conditions/requirements into consideration, but for setEquipmentStatus to explicitly ignore them. Indeed if setEquipmentStatus could be tweaked to allow setting of items not currently installed (status EQUIPMENT_UNKNOWN) to be EQUIPMENT_OK to act as a "back door install" without the checks that would allow all functionality.
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: Missing equipment after combat

Post by Capt. Murphy »

Thargoid wrote:

Having thought about this a little more the simplest solution could be for awardEquipment to take the conditions/requirements into consideration, but for setEquipmentStatus to explicitly ignore them. Indeed if setEquipmentStatus could be tweaked to allow setting of items not currently installed (status EQUIPMENT_UNKNOWN) to be EQUIPMENT_OK to act as a "back door install" without the checks that would allow all functionality.
Maybe worth going a bit further than that and the condition check should only be used to determine if equipment is available to purchase/repair via the GUI when docked.

No condition check for the engine's internal routines for dealing with equipment that is damaged (which is the current bug), and no condition checks when manipulating equipment inventory via script. It would then be up to the scripter to decide if it is appropriate to manually apply condition checks depending on the context of the script.

edit 2 add- on 2nd thoughts that might break some existing OXPs who rely on the current condition checking when using awardEquipment. So Thargoid's suggestion is maybe better.
Last edited by Capt. Murphy on Wed Aug 17, 2011 7:00 am, edited 1 time in total.
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
User avatar
Gimi
---- E L I T E ----
---- E L I T E ----
Posts: 2073
Joined: Tue Aug 29, 2006 5:02 pm
Location: Norway

Re: Missing equipment after combat

Post by Gimi »

I suspect there may be similar problems related to "planetary landing capability" from Planetfall.oxp, docking computer and heat shielding. Planetary landing capability requires the two latter pieces of equipment and, as I have posted earlier, I have seen planetary landing capability disappear completely after being damaged on more than one occasion. In this case, one is OXP and the others are native.
"A brilliant game of blasting and trading... Truly a mega-game... The game of a lifetime."
(Gold Medal Award, Zzap!64 May 1985).
Post Reply