Page 1 of 1

Destroying equipment

Posted: Sat Apr 11, 2009 12:32 pm
by Eric Walch
Yesterday I was in a severe fight with my shields down. In a rapid succession I lost three pieces of equipment before I could kill my attackers. After the fight I examined the damage and saw that two pieces of equipment were damages and one was destroyed (not in the inventory anymore). I have a private oxp running that logs all the damages equipment:

Code: Select all

Oolite [Eric's test] OOJSGlobal.m:165: Damaged: EQ_UPS_UNIVERSAL_SCANNER With name: Universal Scanner
Oolite [Eric's test] OOJSGlobal.m:165: Damaged: EQ_ENERGY_BOMB With name: Energy Bomb
Oolite [Eric's test] OOJSGlobal.m:165: Damaged: EQ_FUEL_INJECTION With name: Witchdrive Fuel Injectors
This destruction of any equipment I had never seen before. Universal Scanner is a piece of equipment from ups that was often damaged before in the usual way but never completely destroyed.

Looking in the code I cant see how total equipment destruction is possible. Playing Oolite in strict mode destroys equipment, otherwise it only damages when I read the code well. I don't know what caused this complete deletion of the equipment but somehow I liked this bug. It gives more variation in destruction. Why not make it a feature that equipment can be damaged AND destroyed by changing the code in playerEntity.m into:
[self removeEquipmentItem:system_key];
if (![UNIVERSE strict] && ranrot_rand() & 255 < 200)
{
[self addEquipmentItem:[NSString stringWithFormat:@"%@_DAMAGED", system_key]]; // for possible future repair
[self doScriptEvent:@"equipmentDamaged" withArgument:system_key];
if (![self hasEquipmentItem:system_name]) // Because script may have undestroyed it
{
[UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-damaged"), system_name] forCount:4.5];
}
}
else
{
[self doScriptEvent:@"equipmentDestroyed" withArgument:system_key];
if (![self hasEquipmentItem:system_name]) // Because script may have undestroyed it
{
[UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-destroyed"), system_name] forCount:4.5];
}
}

Posted: Sat Apr 11, 2009 3:46 pm
by _ds_
ITYM "[code]" there… anyway, 1 in 16 (at most) chance of destruction of undamaged equipment – or should this be settable in equipment definitions? – and letting damaged equipment be destroyed both seem reasonable.