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

fix: add snow and city solar panel graphics #1716

Merged
merged 6 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
8 changes: 4 additions & 4 deletions game/decor.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ def __init__(self, pk, name, url, xmas_url, width, height, theme, z_index):
("solar_panel", "snow"): Decor(
z_index=4,
name="solar_panel",
url="decor/snow/tree1.svg",
xmas_url="decor/snow/tree1.svg",
url="decor/snow/solar_panel.svg",
xmas_url="decor/snow/solar_panel.svg",
height=100,
width=100,
theme=get_theme("snow"),
Expand All @@ -378,8 +378,8 @@ def __init__(self, pk, name, url, xmas_url, width, height, theme, z_index):
("solar_panel", "city"): Decor(
z_index=4,
name="solar_panel",
url="decor/city/school.svg",
xmas_url="decor/snow/school.svg",
url="decor/city/solar_panel.svg",
xmas_url="decor/snow/solar_panel.svg",
height=100,
width=100,
theme=get_theme("city"),
Expand Down
13 changes: 2 additions & 11 deletions game/end_to_end_tests/test_level_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,23 +241,14 @@ def test_custom_description_and_hint(self):

def test_solar_panels(self):
"""test that the solar panels appear as a scenery option when clicking on the scenery tab
and that they disappear as a scenery option when switching to an incompatible theme, i.e. snow
"""
page = self.go_to_level_editor()
page.go_to_scenery_tab()

solar_panel_style = self.selenium.find_element(
solar_panel = self.selenium.find_element(
By.ID, "solar_panel"
).get_attribute("style")
assert "inline" in solar_panel_style

Select(self.selenium.find_element(By.ID, "theme_select")).select_by_value(
"snow"
)
solar_panel_snow_style = self.selenium.find_element(
By.ID, "solar_panel"
).get_attribute("style")
assert "none" in solar_panel_snow_style
assert solar_panel.is_displayed()

def test_electric_fuel_gauge(self):
self.login_once()
Expand Down
1,200 changes: 1,200 additions & 0 deletions game/static/game/image/decor/city/solar_panel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
173 changes: 173 additions & 0 deletions game/static/game/image/decor/snow/solar_panel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 0 additions & 7 deletions game/static/game/js/level_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2387,13 +2387,6 @@ ocargo.LevelEditor = function(levelId) {

$('.decor_button').each(function(index, element) {
element.src = theme.decor[element.id].url;
if (element.id === "solar_panel") {
if (currentTheme === THEMES.grass || currentTheme === THEMES.farm) {
element.style = "display: inline;"
} else {
element.style = "display: none;"
}
}
});

$('#paper').css({'background-color': theme.background});
Expand Down
Loading