Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ground Zero map and improvements #332

Merged
merged 23 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5753d63
Added Ground Zero map
Shebuka Jan 3, 2024
3f56e54
Update color style of Interchange
Shebuka Jan 3, 2024
e7ef6ad
Update color style of Reserve
Shebuka Jan 3, 2024
00effdd
Update color style of Woods
Shebuka Jan 3, 2024
26a8d88
Update color style of Customs;
Shebuka Jan 3, 2024
e2335e9
Merge branch 'master' into separate_floors
Shebuka Jan 4, 2024
8cb6e6c
Moved BigRed 2nd floor to 3rd floor
Shebuka Jan 4, 2024
8b3dc7e
Reserve prettified;
Shebuka Jan 4, 2024
bd98bbc
Update color style of Shoreline
Shebuka Jan 4, 2024
2aba2ff
Update color style of StreetsOfTarkov
Shebuka Jan 4, 2024
5ffcfff
Readded data-keep-with-group="Ground_Level" to Customs
Shebuka Jan 4, 2024
d227048
Removed xml version definition
Shebuka Jan 4, 2024
b79e104
Fixed ground id for the border on Ground Zero
Shebuka Jan 4, 2024
0a85b6b
Switch ground and limit group on Customs
Shebuka Jan 4, 2024
e0f5ea0
Updated Shoreline with map expansion changes
Shebuka Jan 4, 2024
d077c8b
Revert "Moved BigRed 2nd floor to 3rd floor"
Shebuka Jan 4, 2024
e13bedf
Update color style of Lighthouse
Shebuka Jan 4, 2024
f053c23
Adding style_common css and python script to replace it in all svgs
Shebuka Jan 10, 2024
dc8747a
Added overwrite or new file output write to the script
Shebuka Jan 10, 2024
ee03ec5
Better formatting of css
Shebuka Jan 10, 2024
2025f61
Supressing namespace prefixes in writing new files
Shebuka Jan 10, 2024
bf40c64
Applied new common_style all maps
Shebuka Jan 10, 2024
90f027b
Removed dedicated style for streets shadow
Shebuka Jan 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,169 changes: 609 additions & 560 deletions maps/Customs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
336 changes: 336 additions & 0 deletions maps/GroundZero.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
485 changes: 245 additions & 240 deletions maps/Interchange.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
863 changes: 435 additions & 428 deletions maps/Lighthouse.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
974 changes: 262 additions & 712 deletions maps/Reserve.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
913 changes: 474 additions & 439 deletions maps/Shoreline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,304 changes: 1,155 additions & 1,149 deletions maps/StreetsOfTarkov.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
894 changes: 450 additions & 444 deletions maps/Woods.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions maps/replace_style_common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import os
import xml.etree.ElementTree as ET


def replace_style(svg_path, new_style_path, output_path, overwrite):
# Parse the SVG file
tree = ET.parse(svg_path)
root = tree.getroot()

# Find the style element with id="style_common"
style_common = root.find(".//*[@id='style_common']")

if style_common is not None:
# Read the content of the new style file
with open(new_style_path, 'r') as new_style_file:
new_style_content = new_style_file.read()

# Update the content of style_common with the new style content
style_common.text = new_style_content

if overwrite:
# Save the modified SVG to the original file
tree.write(svg_path)
print(f'Successfully replaced style in {svg_path}.')
else:
# Save the modified SVG to a new file
tree.write(output_path)
print(f'Successfully replaced style in {svg_path} and saved to {output_path}')
else:
print(f'Style with id="style_common" not found in {svg_path}.')


def process_svg_files(overwrite):
# Get the directory of the script
script_directory = os.path.dirname(os.path.realpath(__file__))

ET.register_namespace("", "http://www.w3.org/2000/svg")
ET.register_namespace("xlink", "http://www.w3.org/1999/xlink")

# Loop over all files in the script directory
for filename in os.listdir(script_directory):
if filename.endswith(".svg"):
svg_path = os.path.join(script_directory, filename)

# Assume new_style.css is in the same directory as the script
new_style_path = os.path.join(script_directory, 'style_common.css')

if overwrite:
# Process the SVG file and overwrite the original
replace_style(svg_path, new_style_path, None, True)
else:
# Assume output files should have "_modified" appended to the original name
output_path = os.path.join(script_directory, f'{os.path.splitext(filename)[0]}_modified.svg')

# Process the SVG file and save to a new file
replace_style(svg_path, new_style_path, output_path, False)


if __name__ == "__main__":
# Ask the user whether to overwrite original files
user_input = input("Do you want to overwrite the original files? (yes/no): ").lower()
overwrite = user_input == 'yes'

# Process SVG files based on user choice
process_svg_files(overwrite)
26 changes: 26 additions & 0 deletions maps/style_common.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

.trees { fill:#144043 }
.cement { fill:#c6c2c2 }
.land { fill:#1f5054 }
.rock { fill:#dcd5b6 }
.water { fill:#4a6b96 }
.wood { fill:#593700 }
.tarmac { fill:#768089 }
.gravel { fill:#946d3e }
.building { fill:#1a2632 }
.floor { fill:#70777f }
.locked { fill:#37414c }
.map_border { fill:none;stroke:#000;stroke-width:2 }
.fence { fill:none;stroke:#c4e3c3;stroke-width:1 }
.road_tarmac { fill:none;stroke:#888 }
.road_gravel { fill:none;stroke:#946d3e }
.road_small { stroke-width:5 }
.road_medium { stroke-width:8 }
.road_large { stroke-width:12 }
.railroad { fill:none;stroke:#914833;stroke-dasharray:6;stroke-width:3 }
.powerline { fill:none;stroke:#ffce00;stroke-width:2;stroke-miterlimit:10;stroke-dasharray:6,6 }
.danger { fill:red;fill-opacity:.4;stroke:red;stroke-dasharray:4,2;stroke-width:2 }
.task { fill:#000 }
.stairs { fill:#FFD700 }
.shadow { filter:drop-shadow(0 0 2px #000) }