36@implementation NSObject (OOInspectorExtensions)
40 NSString *desc = [
self shortDescriptionComponents];
41 if (desc ==
nil)
return [
self className];
42 else return [NSString stringWithFormat:@"%@ %@", [
self className], desc];
48 return [
self inspDescription];
78 if ([
self conformsToProtocol:
@protocol(OOWeakReferenceSupport)])
87@implementation Entity (OOEntityInspectorExtensions)
89- (NSString *) inspDescription
91 return [NSString stringWithFormat:@"%@ ID %u", [
self class], [
self universalID]];
95- (NSString *) inspBasicIdentityLine
101 return [NSString stringWithFormat:@"%@ ID %u", [
self class], myID];
105 return [
self className];
110- (NSString *) inspScanClassLine
116- (NSString *) inspStatusLine
122- (NSString *) inspRetainCountLine
124 return [NSString stringWithFormat:@"%lu", [
self retainCount]];
128- (NSString *) inspPositionLine
130 HPVector v = [
self position];
131 return [NSString stringWithFormat:@"%.0f, %.0f, %.0f", v.x, v.y, v.z];
135- (NSString *) inspVelocityLine
137 Vector v = [
self velocity];
138 return [NSString stringWithFormat:@"%.1f, %.1f, %.1f (%.1f)", v.x, v.y, v.z, magnitude(v)];
142- (NSString *) inspOrientationLine
144 Quaternion q = [
self orientation];
145 return [NSString stringWithFormat:@"%.3f (%.3f, %.3f, %.3f)", q.w, q.x, q.y, q.z];
149- (NSString *) inspEnergyLine
151 return [NSString stringWithFormat:@"%i/%i", (int)[
self energy], (int)[
self maxEnergy]];
155- (NSString *) inspOwnerLine
157 if ([
self owner] ==
self)
return @"Self";
158 return [[
self owner] inspDescription];
162- (NSString *) inspTargetLine
170@implementation ShipEntity (OOEntityInspectorExtensions)
172- (BOOL) inspHasSecondaryIdentityLine
178- (NSString *) inspSecondaryIdentityLine
180 return [
self displayName];
184- (NSString *) inspDescription
186 return [NSString stringWithFormat:@"%@ ID %u", [
self displayName], [
self universalID]];
190- (NSString *) inspTargetLine
192 return [[
self primaryTarget] inspDescription];
196- (BOOL) inspCanBecomeTarget
198 return ![
self isSubEntity];
202- (void) inspBecomeTarget
210@implementation PlayerEntity (OOEntityInspectorExtensions)
212- (NSString *) inspSecondaryIdentityLine
214 return [NSString stringWithFormat:NSLocalizedStringFromTableInBundle(@"\"%@\", %@", nil, [NSBundle bundleForClass:[
self class]], @""), [
self commanderName], [
self displayName]];
218- (BOOL) inspCanBecomeTarget
224- (NSString *) inspDescription
NSString * OOStringFromScanClass(OOScanClass scanClass) CONST_FUNC
NSString * OOStringFromEntityStatus(OOEntityStatus status) CONST_FUNC
NSString * inspBasicIdentityLine()
BOOL inspHasSecondaryIdentityLine()
NSString * inspDescription()
BOOL inspCanBecomeTarget()
NSString * inspSecondaryIdentityLine()
id inspectorForObject:(id< OOWeakReferenceSupport > object)
NSString * commanderName()
void addTarget:(Entity *targetEntity)
PlayerEntity * sharedPlayer()