Skip to content

Commit

Permalink
fixed duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
higps committed Oct 4, 2023
1 parent 44603ec commit b7d0c64
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 26 deletions.
2 changes: 1 addition & 1 deletion free_damage_flames_pyro_agro.sp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ MakeGiantPyro(client)
CreateTimer(0.0, Timer_Switch, client);
SetModel(client, GPYRO);

RoboSetHealth(client,TFClass_PyroPyro, 3000, 1.5);
RoboSetHealth(client,TFClass_Pyro, 3000, 1.5);

// PrintToChatAll("iHealth %i", iHealth);

Expand Down
2 changes: 1 addition & 1 deletion free_damage_melee_heavy_boxing_champ.sp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ MakeGDeflectorH(client)
CreateTimer(0.0, Timer_Switch, client);
SetModel(client, GDEFLECTORH);

RoboSetHealth(client,TFClass_HeavyHeavy, 3000, 1.5);
RoboSetHealth(client,TFClass_Heavy, 3000, 1.5);

SetEntPropFloat(client, Prop_Send, "m_flModelScale", 1.5);
SetEntProp(client, Prop_Send, "m_bIsMiniBoss", _:true);
Expand Down
34 changes: 11 additions & 23 deletions import os2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,21 @@
# Directory path
search_directory = 'D:/Github/robogithub' # <-- Modify this to the path where you want to search

## Function to clean up and standardize whitespace in a line
def standardize_whitespace(line):
return ' '.join(line.split())
# List of class names
class_names = ["Scout", "Soldier", "Pyro", "DemoMan", "Heavy", "Engineer", "Medic", "Sniper", "Spy"]

# Search specified directory for .sp files
for filename in os.listdir(search_directory):
if filename.endswith(".sp") and (filename.startswith("boss_") or filename.startswith("free_") or filename.startswith("paid_")):
with open(os.path.join(search_directory, filename), 'r') as file:
lines = file.readlines()

# Standardize the whitespace for each line
cleaned_lines = [standardize_whitespace(line) for line in lines]

# Define the block start and end for easier identification
block_start = "stock TF2_SetHealth(client, NewHealth)"
block_end = "SetEntProp(client, Prop_Data, \"m_iMaxHealth\", NewHealth, 1);"

# Identify the start and end indices of the block
try:
start_index = cleaned_lines.index(block_start)
end_index = cleaned_lines.index(block_end)
except ValueError:
continue # Block not found in this file

# Remove the block
del lines[start_index:end_index+2] # +2 to remove the block end line and the closing brace

content = file.read()

# Check for duplicates and replace them
for class_name in class_names:
duplicate_str = f"TFClass_{class_name}{class_name}"
correct_str = f"TFClass_{class_name}"
content = content.replace(duplicate_str, correct_str)

# Write back the modified content
with open(os.path.join(search_directory, filename), 'w') as file:
file.writelines(lines)
file.write(content)
2 changes: 1 addition & 1 deletion paid_tank_heavy_sensor_armstrong.sp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ MakePanCop(client)
CreateTimer(0.0, Timer_Switch, client);
SetModel(client, GDEFLECTORH);

RoboSetHealth(client,TFClass_HeavyHeavy, 10500, 1.5);
RoboSetHealth(client,TFClass_Heavy, 10500, 1.5);

// int iHealth = 10500;

Expand Down

0 comments on commit b7d0c64

Please sign in to comment.