Skip to content

Commit

Permalink
fix: add snow and city solar panel graphics (#1716)
Browse files Browse the repository at this point in the history
* add snowy solar panel

* add solar panel house, adjust test

* add solar panel images to other folders

* delete holding_assets folder
  • Loading branch information
evemartin authored Sep 4, 2024
1 parent b84ae7d commit 53beace
Show file tree
Hide file tree
Showing 179 changed files with 2,752 additions and 170,228 deletions.
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 @@ -2389,13 +2389,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

0 comments on commit 53beace

Please sign in to comment.