88 lines
No EOL
2.1 KiB
Python
88 lines
No EOL
2.1 KiB
Python
import os
|
|
import sys
|
|
import time
|
|
from datetime import datetime
|
|
from xml.etree import ElementTree
|
|
|
|
steampaths = ['C:\\games_ssd\\steam', 'D:\\games\\steam', 'C:\\games\steam', 'C:\\program files (x86)\\steam', 'C:\\program files\\steam']
|
|
steamcommon = '\\steamapps\\common\\7 Days To Die\\Data\\Config'
|
|
|
|
found_steam = None
|
|
|
|
for sp in steampaths:
|
|
if os.path.exists(sp + steamcommon):
|
|
found_steam = sp
|
|
break
|
|
|
|
if not found_steam:
|
|
print "Failed to find 7DTD on steam..."
|
|
sys.exit(1)
|
|
|
|
gamepath = found_steam + steamcommon + "\\"
|
|
|
|
ents = ElementTree.parse(gamepath + 'entityclasses.xml')
|
|
eroot = ents.getroot()
|
|
for entity in eroot.iter('entity_class'):
|
|
ename = entity.get('name')
|
|
for prp in entity.iter('property'):
|
|
pname = prp.get('name')
|
|
if pname == 'ApproachSpeed':
|
|
pv = float(prp.get('value'))
|
|
if pv <= 0.2:
|
|
""" No modifications to speeds already set to 0.2 or less """
|
|
continue
|
|
|
|
ptv = prp.get('pretweak_value')
|
|
if ptv != None:
|
|
pv = float(ptv)
|
|
else:
|
|
prp.set('pretweak_value', str(pv))
|
|
|
|
|
|
if pv > 0.9:
|
|
prp.set('value', str('0.4'))
|
|
else:
|
|
prp.set('value', str('0.2'))
|
|
|
|
elif pname == 'NightApproachSpeed':
|
|
pv = float(prp.get('value'))
|
|
if pv <= 0.2:
|
|
""" No modifications to speeds already set to 0.2 or less """
|
|
continue
|
|
|
|
ptv = prp.get('pretweak_value')
|
|
if ptv != None:
|
|
pv = float(ptv)
|
|
else:
|
|
prp.set('pretweak_value', str(pv))
|
|
|
|
|
|
if pv > 0.9:
|
|
prp.set('value', str('0.6'))
|
|
else:
|
|
prp.set('value', str('0.4'))
|
|
|
|
elif pname == 'PanicSpeed':
|
|
pv = float(prp.get('value'))
|
|
if pv <= 0.2:
|
|
""" No modifications to speeds already set to 0.2 or less """
|
|
continue
|
|
|
|
if ename[:6] == 'animal' and ename != 'animalBear':
|
|
""" Animals are pretty ok as-is, except bears which are assholes """
|
|
continue
|
|
|
|
ptv = prp.get('pretweak_value')
|
|
if ptv != None:
|
|
pv = float(ptv)
|
|
else:
|
|
prp.set('pretweak_value', str(pv))
|
|
|
|
if pv > 0.9:
|
|
prp.set('value', str('0.6'))
|
|
else:
|
|
prp.set('value', str('0.3'))
|
|
|
|
|
|
|
|
ents.write(gamepath + "entityclasses.xml") |