ignore unknown stuff

This commit is contained in:
Bill Currie 2004-05-09 00:57:57 +00:00
parent e9f19be2bb
commit 2ccff86089

View file

@ -80,26 +80,29 @@ while 1:
else: else:
entity.spawnflags = 0 entity.spawnflags = 0
for ent in entity_list: for ent in entity_list:
if ent.classname[:5] == "item_": try:
item = ent.classname[5:] if ent.classname[:5] == "item_":
if item == "weapon": item = ent.classname[5:]
# officially depricated but some maps use it if item == "weapon":
big = (ent.spawnflags & 8) != 0 # officially depricated but some maps use it
if ent.spawnflags & 4: big = (ent.spawnflags & 8) != 0
items["rockets"][big] += 1 if ent.spawnflags & 4:
elif ent.spawnflags & 2: items["rockets"][big] += 1
items["spikes"][big] += 1 elif ent.spawnflags & 2:
elif ent.spawnflags & 1: items["spikes"][big] += 1
items["shells"][big] += 1 elif ent.spawnflags & 1:
elif item[:9] == "artifact_": items["shells"][big] += 1
artifact = item[9:] elif item[:9] == "artifact_":
artifacts[artifact] += 1 artifact = item[9:]
else: artifacts[artifact] += 1
big = ent.spawnflags & 3 else:
items[item][big] += 1 big = ent.spawnflags & 3
elif ent.classname[:7] == "weapon_": items[item][big] += 1
weapon = ent.classname[7:] elif ent.classname[:7] == "weapon_":
weapons[weapon] += 1 weapon = ent.classname[7:]
weapons[weapon] += 1
except KeyError:
pass # ignore unknown items/weapons
print "Lightning Gun :", weapons["lightning"] print "Lightning Gun :", weapons["lightning"]
print "6 cells :", items["cells"][0] print "6 cells :", items["cells"][0]