rapid-router 5.4.1__py2.py3-none-any.whl → 7.6.8__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- example_project/rapid_router_test_settings.py +164 -0
- example_project/settings.py +152 -0
- example_project/urls.py +15 -0
- example_project/{example_project/wsgi.py → wsgi.py} +2 -1
- game/__init__.py +1 -1
- game/admin.py +43 -4
- game/app_settings.py +3 -7
- game/character.py +26 -18
- game/decor.py +172 -97
- game/end_to_end_tests/base_game_test.py +44 -33
- game/end_to_end_tests/editor_page.py +17 -2
- game/end_to_end_tests/game_page.py +127 -45
- game/end_to_end_tests/selenium_test_case.py +1 -20
- game/end_to_end_tests/test_cow_crashes.py +3 -5
- game/end_to_end_tests/test_language_dropdown.py +14 -0
- game/end_to_end_tests/test_level_editor.py +290 -0
- game/end_to_end_tests/test_level_failures.py +1 -1
- game/end_to_end_tests/test_level_selection.py +79 -0
- game/end_to_end_tests/test_play_through.py +240 -102
- game/end_to_end_tests/test_python_levels.py +44 -13
- game/end_to_end_tests/test_saving_workspace.py +22 -0
- game/forms.py +9 -2
- game/level_management.py +38 -29
- game/messages.py +1218 -203
- game/migrations/0001_squashed_0025_levels_ordering_pt1.py +19 -1
- game/migrations/0026_levels_pt2.py +13 -2
- game/migrations/0032_cannot_turn_left_level.py +13 -2
- game/migrations/0033_recursion_level.py +13 -2
- game/migrations/0034_joes_level.py +13 -2
- game/migrations/0035_disable_route_score_level_70.py +0 -2
- game/migrations/0036_level_score_73.py +0 -2
- game/migrations/0037_level_score_79.py +0 -2
- game/migrations/0038_level_score_40.py +0 -1
- game/migrations/0042_level_score_73.py +0 -2
- game/migrations/0048_add_cow_field_and_blocks.py +0 -2
- game/migrations/0049_level_score_34.py +0 -2
- game/migrations/0050_level_score_40.py +0 -2
- game/migrations/0051_level_score_49.py +0 -1
- game/migrations/0076_level_locked_for_class.py +19 -0
- game/migrations/0077_alter_level_next_level.py +52 -0
- game/migrations/0078_add_block_types.py +23 -0
- game/migrations/0079_populate_block_type_add_cow_blocks.py +60 -0
- game/migrations/0080_level_disable_algorithm_score.py +18 -0
- game/migrations/0081_first_12_levels_no_algo_score.py +29 -0
- game/migrations/0082_level_43_solution.py +16 -0
- game/migrations/0083_add_cows_to_existing_levels.py +195 -0
- game/migrations/0084_alter_block_block_type.py +18 -0
- game/migrations/0085_add_new_blocks.py +53 -0
- game/migrations/0086_loop_levels.py +482 -0
- game/migrations/0087_workspace_python_view_enabled.py +18 -0
- game/migrations/0088_rename_episodes.py +35 -0
- game/migrations/0089_episodes_in_development.py +30 -0
- game/migrations/0090_add_missing_model_solutions.py +144 -0
- game/migrations/0091_disable_algo_score_if_no_model_solution.py +46 -0
- game/migrations/0092_disable_algo_score_in_custom_levels.py +28 -0
- game/migrations/0093_alter_level_character_name.py +18 -0
- game/migrations/0094_add_hint_lesson_subtitle_to_levels.py +28 -0
- game/migrations/0095_level_commands.py +18 -0
- game/migrations/0096_alter_level_commands.py +18 -0
- game/migrations/0097_add_python_den_levels.py +1515 -0
- game/migrations/0098_add_episode_link_fields.py +44 -0
- game/migrations/0099_python_episodes_links.py +103 -0
- game/migrations/0100_reorder_python_levels.py +179 -0
- game/migrations/0101_rename_episodes.py +45 -0
- game/migrations/0102_reoder_episodes_13_14.py +136 -0
- game/migrations/0103_level_1015_solution.py +26 -0
- game/migrations/0104_remove_level_direct_drive.py +17 -0
- game/migrations/0105_delete_invalid_attempts.py +18 -0
- game/migrations/0106_fields_to_snake_case.py +48 -0
- game/migrations/0107_rename_worksheet_link_episode_student_worksheet_link.py +18 -0
- game/migrations/0108_episode_indy_worksheet_link.py +18 -0
- game/migrations/0109_create_episodes_23_and_24.py +99 -0
- game/migrations/0110_remove_episode_indy_worksheet_link_and_more.py +100 -0
- game/migrations/0111_create_worksheets.py +149 -0
- game/migrations/0112_worksheet_locked_classes.py +21 -0
- game/migrations/0113_level_needs_approval.py +18 -0
- game/migrations/0114_default_and_non_student_levels_no_approval.py +31 -0
- game/migrations/0115_level_level__default_does_not_need_approval.py +22 -0
- game/migrations/0116_update_worksheet_video_links.py +68 -0
- game/migrations/0117_update_solutions_to_if_else.py +61 -0
- game/models.py +157 -16
- game/permissions.py +34 -19
- game/python_den_urls.py +26 -0
- game/random_road.py +43 -127
- game/serializers.py +12 -17
- game/static/django_reverse_js/js/reverse.js +171 -0
- game/static/game/css/LilitaOne-Regular.ttf +0 -0
- game/static/game/css/backgrounds.css +14 -10
- game/static/game/css/dataTables.custom.css +4 -2
- game/static/game/css/dataTables.jqueryui.css +561 -320
- game/static/game/css/editor.css +47 -0
- game/static/game/css/game.css +43 -49
- game/static/game/css/game_screen.css +116 -53
- game/static/game/css/jquery.dataTables.css +455 -251
- game/static/game/css/level_editor.css +10 -1
- game/static/game/css/level_selection.css +32 -3
- game/static/game/css/level_share.css +6 -5
- game/static/game/css/skulpt/codemirror.css +1 -0
- game/static/game/image/Python_Den_hero_student.png +0 -0
- game/static/game/image/Python_levels_page.svg +1954 -0
- game/static/game/image/characters/front_view/Electric_van.svg +448 -0
- game/static/game/image/characters/top_view/Electric_van.svg +448 -0
- game/static/game/image/characters/top_view/Sleigh.svg +436 -0
- game/static/game/image/decor/city/solar_panel.svg +1200 -0
- game/static/game/image/decor/farm/solar_panel.svg +86 -0
- game/static/game/image/decor/grass/solar_panel.svg +86 -0
- game/static/game/image/decor/snow/barn.svg +1788 -0
- game/static/game/image/decor/snow/cfc.svg +1050 -147
- game/static/game/image/decor/snow/crops.svg +7370 -0
- game/static/game/image/decor/snow/hospital.svg +1220 -0
- game/static/game/image/decor/snow/house1.svg +971 -0
- game/static/game/image/decor/snow/house2.svg +1574 -0
- game/static/game/image/decor/snow/school.svg +1071 -0
- game/static/game/image/decor/snow/shop.svg +3211 -0
- game/static/game/image/decor/snow/solar_panel.svg +173 -0
- game/static/game/image/electric_van.svg +448 -0
- game/static/game/image/icons/add_house.svg +26 -0
- game/static/game/image/icons/delete_house.svg +26 -0
- game/static/game/image/icons/description.svg +1 -0
- game/static/game/image/icons/hint.svg +1 -0
- game/static/game/image/icons/if_else.svg +3 -0
- game/static/game/image/icons/python.svg +1 -1
- game/static/game/image/if_else_example.png +0 -0
- game/static/game/image/pigeon.svg +684 -0
- game/static/game/image/python_den_header.svg +19 -0
- game/static/game/js/animation.js +84 -28
- game/static/game/js/blockly/msg/js/bg.js +52 -1
- game/static/game/js/blockly/msg/js/ca.js +52 -1
- game/static/game/js/blockly/msg/js/en-gb.js +52 -1
- game/static/game/js/blockly/msg/js/en.js +52 -1
- game/static/game/js/blockly/msg/js/es.js +52 -1
- game/static/game/js/blockly/msg/js/fr.js +52 -1
- game/static/game/js/blockly/msg/js/hi.js +52 -1
- game/static/game/js/blockly/msg/js/it.js +52 -1
- game/static/game/js/blockly/msg/js/pl.js +52 -1
- game/static/game/js/blockly/msg/js/pt-br.js +52 -1
- game/static/game/js/blockly/msg/js/ru.js +52 -1
- game/static/game/js/blockly/msg/js/ur.js +52 -1
- game/static/game/js/blocklyCompiler.js +550 -392
- game/static/game/js/blocklyControl.js +335 -302
- game/static/game/js/blocklyCustomBlocks.js +691 -458
- game/static/game/js/blocklyCustomisations.js +3 -1
- game/static/game/js/button.js +12 -0
- game/static/game/js/cow.js +15 -130
- game/static/game/js/drawing.js +313 -201
- game/static/game/js/editor.js +23 -0
- game/static/game/js/game.js +148 -139
- game/static/game/js/jquery.dataTables.min.js +3 -159
- game/static/game/js/level_editor.js +823 -448
- game/static/game/js/level_moderation.js +33 -2
- game/static/game/js/level_selection.js +62 -25
- game/static/game/js/loadLanguages.js +21 -0
- game/static/game/js/map.js +106 -36
- game/static/game/js/model.js +55 -107
- game/static/game/js/pathFinder.js +73 -72
- game/static/game/js/program.js +184 -193
- game/static/game/js/pythonControl.js +14 -1
- game/static/game/js/scoreboard.js +0 -37
- game/static/game/js/scoreboardSharedLevels.js +48 -0
- game/static/game/js/sharing.js +22 -10
- game/static/game/js/skulpt/codemirror.js +5 -4
- game/static/game/js/skulpt/skulpt-stdlib.js +1 -1
- game/static/game/js/sound.js +52 -5
- game/static/game/js/van.js +0 -7
- game/static/game/raphael_image/characters/top_view/Electric_van.svg +448 -0
- game/static/game/raphael_image/characters/top_view/Sleigh.svg +436 -0
- game/static/game/raphael_image/decor/city/solar_panel.svg +1200 -0
- game/static/game/raphael_image/decor/farm/solar_panel.svg +86 -0
- game/static/game/raphael_image/decor/grass/solar_panel.svg +86 -0
- game/static/game/raphael_image/decor/snow/barn.svg +1788 -0
- game/static/game/raphael_image/decor/snow/cfc.svg +1050 -147
- game/static/game/raphael_image/decor/snow/crops.svg +7370 -0
- game/static/game/raphael_image/decor/snow/hospital.svg +1220 -0
- game/static/game/raphael_image/decor/snow/house1.svg +971 -0
- game/static/game/raphael_image/decor/snow/house2.svg +1574 -0
- game/static/game/raphael_image/decor/snow/school.svg +1071 -0
- game/static/game/raphael_image/decor/snow/shop.svg +3211 -0
- game/static/game/raphael_image/decor/snow/solar_panel.svg +173 -0
- game/static/game/raphael_image/pigeon.svg +685 -0
- game/static/game/raphael_image/sleigh_wreckage.svg +430 -0
- game/static/game/sass/game.scss +22 -6
- game/static/game/sound/clown_horn.mp3 +0 -0
- game/static/game/sound/clown_horn.ogg +0 -0
- game/static/game/sound/electric_van_starting.mp3 +0 -0
- game/static/game/sound/electric_van_starting.ogg +0 -0
- game/static/game/sound/pigeon.mp3 +0 -0
- game/static/game/sound/pigeon.ogg +0 -0
- game/static/game/sound/sleigh_bells.mp3 +0 -0
- game/static/game/sound/sleigh_bells.ogg +0 -0
- game/static/game/sound/sleigh_crash.mp3 +0 -0
- game/static/game/sound/sleigh_crash.ogg +0 -0
- game/templates/game/base.html +35 -15
- game/templates/game/basenonav.html +23 -17
- game/templates/game/game.html +236 -111
- game/templates/game/level_editor.html +353 -275
- game/templates/game/level_moderation.html +19 -6
- game/templates/game/level_selection.html +75 -62
- game/templates/game/python_den_level_selection.html +291 -0
- game/templates/game/python_den_worksheet.html +101 -0
- game/templates/game/scoreboard.html +88 -65
- game/tests/test_level_editor.py +210 -35
- game/tests/test_level_moderation.py +6 -20
- game/tests/test_level_selection.py +332 -11
- game/tests/test_python_den_worksheet.py +85 -0
- game/tests/test_scoreboard.py +258 -66
- game/tests/utils/level.py +43 -3
- game/tests/utils/teacher.py +2 -2
- game/theme.py +21 -21
- game/urls.py +125 -78
- game/views/language_code_conversions.py +90 -0
- game/views/level.py +201 -63
- game/views/level_editor.py +109 -48
- game/views/level_moderation.py +29 -6
- game/views/level_selection.py +179 -56
- game/views/level_solutions.py +600 -106
- game/views/scoreboard.py +181 -66
- game/views/worksheet.py +25 -0
- rapid_router-7.6.8.dist-info/METADATA +174 -0
- {rapid_router-5.4.1.dist-info → rapid_router-7.6.8.dist-info}/RECORD +222 -242
- {rapid_router-5.4.1.dist-info → rapid_router-7.6.8.dist-info}/WHEEL +1 -1
- rapid_router-7.6.8.dist-info/licenses/LICENSE.md +3 -0
- example_project/example_project/__init__.py +0 -1
- example_project/example_project/settings.py +0 -54
- example_project/example_project/urls.py +0 -16
- example_project/manage.py +0 -10
- game/autoconfig.py +0 -59
- game/csp_config.py +0 -23
- game/locale/ar_SA/LC_MESSAGES/django.mo +0 -0
- game/locale/ar_SA/LC_MESSAGES/django.po +0 -405
- game/locale/ar_SA/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ar_SA/LC_MESSAGES/djangojs.po +0 -743
- game/locale/bg_BG/LC_MESSAGES/django.mo +0 -0
- game/locale/bg_BG/LC_MESSAGES/django.po +0 -405
- game/locale/bg_BG/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/bg_BG/LC_MESSAGES/djangojs.po +0 -739
- game/locale/ca_ES/LC_MESSAGES/django.mo +0 -0
- game/locale/ca_ES/LC_MESSAGES/django.po +0 -405
- game/locale/ca_ES/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ca_ES/LC_MESSAGES/djangojs.po +0 -740
- game/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
- game/locale/cs_CZ/LC_MESSAGES/django.po +0 -405
- game/locale/cs_CZ/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/cs_CZ/LC_MESSAGES/djangojs.po +0 -741
- game/locale/cy_GB/LC_MESSAGES/django.mo +0 -0
- game/locale/cy_GB/LC_MESSAGES/django.po +0 -405
- game/locale/cy_GB/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/cy_GB/LC_MESSAGES/djangojs.po +0 -743
- game/locale/de_DE/LC_MESSAGES/django.mo +0 -0
- game/locale/de_DE/LC_MESSAGES/django.po +0 -405
- game/locale/de_DE/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/de_DE/LC_MESSAGES/djangojs.po +0 -739
- game/locale/el_GR/LC_MESSAGES/django.mo +0 -0
- game/locale/el_GR/LC_MESSAGES/django.po +0 -405
- game/locale/el_GR/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/el_GR/LC_MESSAGES/djangojs.po +0 -739
- game/locale/en_GB/LC_MESSAGES/django.mo +0 -0
- game/locale/en_GB/LC_MESSAGES/django.po +0 -405
- game/locale/en_GB/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/en_GB/LC_MESSAGES/djangojs.po +0 -739
- game/locale/es_ES/LC_MESSAGES/django.mo +0 -0
- game/locale/es_ES/LC_MESSAGES/django.po +0 -405
- game/locale/es_ES/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/es_ES/LC_MESSAGES/djangojs.po +0 -739
- game/locale/fi_FI/LC_MESSAGES/django.mo +0 -0
- game/locale/fi_FI/LC_MESSAGES/django.po +0 -405
- game/locale/fi_FI/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/fi_FI/LC_MESSAGES/djangojs.po +0 -739
- game/locale/fr_FR/LC_MESSAGES/django.mo +0 -0
- game/locale/fr_FR/LC_MESSAGES/django.po +0 -405
- game/locale/fr_FR/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/fr_FR/LC_MESSAGES/djangojs.po +0 -739
- game/locale/gu_IN/LC_MESSAGES/django.mo +0 -0
- game/locale/gu_IN/LC_MESSAGES/django.po +0 -405
- game/locale/gu_IN/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/gu_IN/LC_MESSAGES/djangojs.po +0 -739
- game/locale/hi_IN/LC_MESSAGES/django.mo +0 -0
- game/locale/hi_IN/LC_MESSAGES/django.po +0 -405
- game/locale/hi_IN/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/hi_IN/LC_MESSAGES/djangojs.po +0 -739
- game/locale/id_ID/LC_MESSAGES/django.mo +0 -0
- game/locale/id_ID/LC_MESSAGES/django.po +0 -405
- game/locale/id_ID/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/id_ID/LC_MESSAGES/djangojs.po +0 -738
- game/locale/it_IT/LC_MESSAGES/django.mo +0 -0
- game/locale/it_IT/LC_MESSAGES/django.po +0 -405
- game/locale/it_IT/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/it_IT/LC_MESSAGES/djangojs.po +0 -739
- game/locale/ja_JP/LC_MESSAGES/django.mo +0 -0
- game/locale/ja_JP/LC_MESSAGES/django.po +0 -405
- game/locale/ja_JP/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ja_JP/LC_MESSAGES/djangojs.po +0 -738
- game/locale/lol_US/LC_MESSAGES/django.mo +0 -0
- game/locale/lol_US/LC_MESSAGES/django.po +0 -405
- game/locale/lol_US/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/lol_US/LC_MESSAGES/djangojs.po +0 -739
- game/locale/nb_NO/LC_MESSAGES/django.mo +0 -0
- game/locale/nb_NO/LC_MESSAGES/django.po +0 -405
- game/locale/nb_NO/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/nb_NO/LC_MESSAGES/djangojs.po +0 -739
- game/locale/nl_NL/LC_MESSAGES/django.mo +0 -0
- game/locale/nl_NL/LC_MESSAGES/django.po +0 -405
- game/locale/nl_NL/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/nl_NL/LC_MESSAGES/djangojs.po +0 -739
- game/locale/pl_PL/LC_MESSAGES/django.mo +0 -0
- game/locale/pl_PL/LC_MESSAGES/django.po +0 -405
- game/locale/pl_PL/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/pl_PL/LC_MESSAGES/djangojs.po +0 -741
- game/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
- game/locale/pt_BR/LC_MESSAGES/django.po +0 -405
- game/locale/pt_BR/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/pt_BR/LC_MESSAGES/djangojs.po +0 -739
- game/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
- game/locale/pt_PT/LC_MESSAGES/django.po +0 -405
- game/locale/pt_PT/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/pt_PT/LC_MESSAGES/djangojs.po +0 -739
- game/locale/ro_RO/LC_MESSAGES/django.mo +0 -0
- game/locale/ro_RO/LC_MESSAGES/django.po +0 -405
- game/locale/ro_RO/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ro_RO/LC_MESSAGES/djangojs.po +0 -740
- game/locale/ru_RU/LC_MESSAGES/django.mo +0 -0
- game/locale/ru_RU/LC_MESSAGES/django.po +0 -405
- game/locale/ru_RU/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ru_RU/LC_MESSAGES/djangojs.po +0 -741
- game/locale/sv_SE/LC_MESSAGES/django.mo +0 -0
- game/locale/sv_SE/LC_MESSAGES/django.po +0 -405
- game/locale/sv_SE/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/sv_SE/LC_MESSAGES/djangojs.po +0 -739
- game/locale/tl_PH/LC_MESSAGES/django.mo +0 -0
- game/locale/tl_PH/LC_MESSAGES/django.po +0 -405
- game/locale/tl_PH/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/tl_PH/LC_MESSAGES/djangojs.po +0 -739
- game/locale/tlh_AA/LC_MESSAGES/django.mo +0 -0
- game/locale/tlh_AA/LC_MESSAGES/django.po +0 -405
- game/locale/tlh_AA/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/tlh_AA/LC_MESSAGES/djangojs.po +0 -739
- game/locale/tr_TR/LC_MESSAGES/django.mo +0 -0
- game/locale/tr_TR/LC_MESSAGES/django.po +0 -405
- game/locale/tr_TR/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/tr_TR/LC_MESSAGES/djangojs.po +0 -740
- game/locale/ur_IN/LC_MESSAGES/django.mo +0 -0
- game/locale/ur_IN/LC_MESSAGES/django.po +0 -405
- game/locale/ur_IN/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ur_IN/LC_MESSAGES/djangojs.po +0 -739
- game/locale/ur_PK/LC_MESSAGES/django.mo +0 -0
- game/locale/ur_PK/LC_MESSAGES/django.po +0 -405
- game/locale/ur_PK/LC_MESSAGES/djangojs.mo +0 -0
- game/locale/ur_PK/LC_MESSAGES/djangojs.po +0 -739
- game/static/game/image/actions/go.svg +0 -18
- game/static/game/image/icons/destination.svg +0 -9
- game/static/game/js/pqselect.min.js +0 -9
- game/static/game/js/widget-scroller.js +0 -906
- rapid_router-5.4.1.dist-info/LICENSE.md +0 -577
- rapid_router-5.4.1.dist-info/METADATA +0 -24
- {rapid_router-5.4.1.dist-info → rapid_router-7.6.8.dist-info}/top_level.txt +0 -0
|
@@ -5,6 +5,7 @@ var ocargo = ocargo || {};
|
|
|
5
5
|
ocargo.BlocklyCustomisations = function () {
|
|
6
6
|
|
|
7
7
|
const TOOLBOX_REMAINING_CAPACITY_TEXT_COLUMN_WIDTH = 50;
|
|
8
|
+
const QUANTITY_TEXT_OFFSET = 35;
|
|
8
9
|
|
|
9
10
|
var limitedBlocks = false;
|
|
10
11
|
var blockCount = {};
|
|
@@ -94,6 +95,7 @@ ocargo.BlocklyCustomisations = function () {
|
|
|
94
95
|
flyoutWidth *= this.workspace_.scale;
|
|
95
96
|
flyoutWidth += Blockly.Scrollbar.scrollbarThickness;
|
|
96
97
|
flyoutWidth += TOOLBOX_REMAINING_CAPACITY_TEXT_COLUMN_WIDTH;
|
|
98
|
+
flyoutWidth += 50;
|
|
97
99
|
|
|
98
100
|
if (this.width_ != flyoutWidth) {
|
|
99
101
|
for (var i = 0, block; block = blocks[i]; i++) {
|
|
@@ -173,7 +175,7 @@ ocargo.BlocklyCustomisations = function () {
|
|
|
173
175
|
var attributes = {
|
|
174
176
|
'width': 30,
|
|
175
177
|
'height': 30,
|
|
176
|
-
'x':
|
|
178
|
+
'x': blockHW.width + QUANTITY_TEXT_OFFSET,
|
|
177
179
|
'y': cursorY + 22,
|
|
178
180
|
'class': 'quantity_text',
|
|
179
181
|
'value': block.type
|
game/static/game/js/button.js
CHANGED
|
@@ -14,6 +14,18 @@ ocargo.button.redirectButtonHtml = function(id, location, label){
|
|
|
14
14
|
return Handlebars.templates['button-redirect']({id: id, location: location, label: label});
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
// Returns the html code for a button which redirects to a given episode on the level selection page
|
|
18
|
+
ocargo.button.episodeRedirectButtonHtml = function(id, location, label, next_episode){
|
|
19
|
+
return `<button id="${id}" class="navigation_button long_button"
|
|
20
|
+
onclick="function onClick() {
|
|
21
|
+
window.location.href='${location}';
|
|
22
|
+
localStorage.setItem('currentEpisode', '${next_episode}');
|
|
23
|
+
};
|
|
24
|
+
onClick()">
|
|
25
|
+
<span>${label}</span>
|
|
26
|
+
</button>`
|
|
27
|
+
}
|
|
28
|
+
|
|
17
29
|
// Returns the html code for a button which shows the try again message and closes the popup
|
|
18
30
|
ocargo.button.tryAgainButtonHtml = function(){
|
|
19
31
|
return ocargo.button.dismissButtonHtml('try_again_button', gettext('Try again'));
|
game/static/game/js/cow.js
CHANGED
|
@@ -8,163 +8,48 @@ ocargo.Cow = function(id, data, nodes) {
|
|
|
8
8
|
this.type = data.type;
|
|
9
9
|
this.potentialNodes = []; // Potential nodes at which a cow could appear
|
|
10
10
|
this.activeNodes = {}; // Actual nodes at which cows will appear during a run.
|
|
11
|
+
this.coordinates = []; // coordinates of the cows, some cows may have null nodes that denotes they are outside of road
|
|
12
|
+
|
|
11
13
|
for(var i = 0; i < data.potentialCoordinates.length; i++) {
|
|
12
14
|
var coordinate = new ocargo.Coordinate(data.potentialCoordinates[i].x, data.potentialCoordinates[i].y);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if ('maxCows' in data) {
|
|
21
|
-
this.maxCows = data.maxCows; // Maximum number of cows to appear on the potential nodes during a run
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
this.chooseNewCowPositions(); // init simulation fields
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
ocargo.Cow.prototype.pickRandom = function (count, arr) {
|
|
28
|
-
var out = [], i, pick, clone = arr.slice(0, arr.length);
|
|
29
|
-
for (i = 0; i < count; i ++) {
|
|
30
|
-
pick = Math.floor(Math.random() * clone.length);
|
|
31
|
-
if (clone[pick] !== undefined) {
|
|
32
|
-
out.push(clone[pick]);
|
|
33
|
-
clone.splice(pick, 1);
|
|
34
|
-
}
|
|
15
|
+
var node = ocargo.Node.findNodeByCoordinate(coordinate, nodes);
|
|
16
|
+
this.potentialNodes.push(node);
|
|
17
|
+
var coordinate_str = JSON.stringify(coordinate);
|
|
18
|
+
this.activeNodes[coordinate_str] = ocargo.Cow.ACTIVE;
|
|
19
|
+
this.coordinates.push(coordinate);
|
|
35
20
|
}
|
|
36
|
-
return out;
|
|
37
21
|
};
|
|
38
|
-
|
|
39
22
|
ocargo.Cow.prototype.reset = function() {
|
|
40
|
-
this.activeNodeTimers = {}; // Stores time of appearance of cows on each activeNode.
|
|
41
23
|
|
|
42
24
|
for (var jsonCoordinate in this.activeNodes) {
|
|
43
25
|
this.activeNodes[jsonCoordinate] = ocargo.Cow.READY;
|
|
44
|
-
this.activeNodeTimers[jsonCoordinate] = 0;
|
|
45
26
|
}
|
|
46
27
|
};
|
|
47
28
|
|
|
48
|
-
function arraysIdentical(a, b) {
|
|
49
|
-
var i = a.length;
|
|
50
|
-
if (i != b.length) return false;
|
|
51
|
-
while (i--) {
|
|
52
|
-
if (a[i] !== b[i]) return false;
|
|
53
|
-
}
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
ocargo.Cow.prototype.chooseNewCowPositions = function() {
|
|
58
|
-
var numCows = Math.round(this.minCows+Math.random()*(this.maxCows-this.minCows));
|
|
59
|
-
|
|
60
|
-
var previousActiveNodes = []; // Actual nodes during last run
|
|
61
|
-
for (var jsonCoordinate in this.activeNodes) {
|
|
62
|
-
var node = ocargo.Node.findNodeByCoordinate(JSON.parse(jsonCoordinate), this.nodes);
|
|
63
|
-
previousActiveNodes.push(node);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
this.activeNodes = {};
|
|
67
|
-
|
|
68
|
-
// at least one node in the new active nodes should be a different one from previous run
|
|
69
|
-
// (Unless minCows is equal to the number of potential nodes)
|
|
70
|
-
var activeNodesArray;
|
|
71
|
-
// No previous run
|
|
72
|
-
if(previousActiveNodes.length == 0) {
|
|
73
|
-
activeNodesArray = this.pickRandom(numCows, this.potentialNodes);
|
|
74
|
-
// New run, choose different nodes if possible
|
|
75
|
-
} else {
|
|
76
|
-
activeNodesArray = previousActiveNodes;
|
|
77
|
-
while (this.minCows < this.potentialNodes.length && arraysIdentical(previousActiveNodes, activeNodesArray)) {
|
|
78
|
-
activeNodesArray = this.pickRandom(numCows, this.potentialNodes);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
for (var i = 0; i < activeNodesArray.length; i++) {
|
|
83
|
-
var jsonCoordinate = JSON.stringify(activeNodesArray[i].coordinate);
|
|
84
|
-
this.activeNodes[jsonCoordinate] = ocargo.Cow.READY;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
this.reset();
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
ocargo.Cow.prototype.queueAnimation = function(model, node) {
|
|
91
|
-
ocargo.animation.appendAnimation({
|
|
92
|
-
type: 'cow',
|
|
93
|
-
id: this.id,
|
|
94
|
-
node: node,
|
|
95
|
-
cowType: this.type,
|
|
96
|
-
coordinate: node.coordinate,
|
|
97
|
-
description: 'Cow'
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
|
|
101
29
|
ocargo.Cow.prototype.queueLeaveAnimation = function(model, node) {
|
|
102
30
|
ocargo.animation.appendAnimation({
|
|
103
31
|
type: 'callable',
|
|
104
|
-
functionCall: ocargo.sound.cow,
|
|
105
|
-
description: '
|
|
32
|
+
functionCall: this.type == ocargo.Cow.PIGEON ? ocargo.sound.pigeon : ocargo.sound.cow,
|
|
33
|
+
description: 'animal sound'
|
|
106
34
|
});
|
|
107
35
|
ocargo.animation.appendAnimation({
|
|
108
36
|
type: 'cow_leave',
|
|
109
37
|
id: this.id,
|
|
110
38
|
coordinate: node.coordinate,
|
|
111
|
-
description: '
|
|
39
|
+
description: 'animal leaving'
|
|
112
40
|
});
|
|
113
41
|
};
|
|
114
42
|
|
|
115
|
-
ocargo.Cow.prototype.
|
|
116
|
-
// Do not hide cow(s) if van has crashed
|
|
117
|
-
if(model.van.crashStatus === 'CRASHED') {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
// check if any active cows should be removed (if van has taken any action to scare them away)
|
|
121
|
-
for (var jsonCoordinate in this.activeNodes) {
|
|
122
|
-
if (this.activeNodes[jsonCoordinate] == ocargo.Cow.ACTIVE) {
|
|
123
|
-
var coordinate = JSON.parse(jsonCoordinate);
|
|
124
|
-
var cowTimestamp = this.activeNodeTimers[jsonCoordinate];
|
|
125
|
-
if (this.scaredAwayByHorn(model, cowTimestamp, coordinate) || this.scaredAwayByPuffUp(model, cowTimestamp, coordinate)) {
|
|
126
|
-
// Deactivate and remove cow from map
|
|
127
|
-
this.activeNodes[jsonCoordinate] = ocargo.Cow.INACTIVE;
|
|
128
|
-
this.activeNodeTimers[jsonCoordinate] = 0;
|
|
129
|
-
var node = ocargo.Node.findNodeByCoordinate(coordinate, this.nodes);
|
|
130
|
-
this.queueLeaveAnimation(model, node);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
// White cows are scared away if horn was sounded after the cow appeared and within hearing distance
|
|
137
|
-
ocargo.Cow.prototype.scaredAwayByHorn = function(model, coordinateTime, coordinate){
|
|
138
|
-
if(jQuery.isEmptyObject(model.soundedHorn)){
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
return this.type == ocargo.Cow.WHITE && coordinateTime < model.soundedHorn.timestamp && this.withinRadius(coordinate, model.soundedHorn.coordinates) ;
|
|
142
|
-
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
// Brown cows are scared away if the van was puffed up at the time of checking
|
|
146
|
-
ocargo.Cow.prototype.scaredAwayByPuffUp = function(model, coordinateTime, coordinate){
|
|
147
|
-
if(jQuery.isEmptyObject(model.puffedUp)){
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
return this.type == ocargo.Cow.BROWN && this.withinRadius(coordinate, model.puffedUp.coordinates) ;
|
|
151
|
-
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
ocargo.Cow.prototype.withinRadius = function(coordinate1, coordinate2){
|
|
155
|
-
return Math.abs(coordinate1.x-coordinate2.x)+ Math.abs(coordinate1.y-coordinate2.y) <= 2;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
ocargo.Cow.prototype.setActive = function(model, node) {
|
|
43
|
+
ocargo.Cow.prototype.setInactive = function(model, node) {
|
|
159
44
|
var jsonCoordinate = JSON.stringify(node.coordinate); //get node coordinates
|
|
160
|
-
this.activeNodes[jsonCoordinate] = ocargo.Cow.
|
|
161
|
-
this.activeNodeTimers[jsonCoordinate] = model.movementTimestamp; //initialize cow timer.
|
|
45
|
+
this.activeNodes[jsonCoordinate] = ocargo.Cow.INACTIVE; //set cow state to inactive
|
|
162
46
|
this.triggerEvent = true;
|
|
163
|
-
this.
|
|
47
|
+
this.queueLeaveAnimation(model, node);
|
|
164
48
|
};
|
|
165
49
|
|
|
166
50
|
ocargo.Cow.READY = 'READY';
|
|
167
51
|
ocargo.Cow.ACTIVE = 'ACTIVE';
|
|
168
52
|
ocargo.Cow.INACTIVE = 'INACTIVE';
|
|
169
53
|
ocargo.Cow.WHITE = 'WHITE';
|
|
170
|
-
ocargo.Cow.BROWN = 'BROWN';
|
|
54
|
+
ocargo.Cow.BROWN = 'BROWN';
|
|
55
|
+
ocargo.Cow.PIGEON = 'PIGEON';
|