Skip to content

Commit

Permalink
Fix #1253 - add a cheat menu.
Browse files Browse the repository at this point in the history
When cheating is enabled, a button appears on the global bar which brings up the menu.

The menu allows to spawn most units (can choose type, receiving team and count)
and do some other common cheats (/nocost, /atm, /globallos, /godmode).

There's quite a bit of room for improvement:
 * layout. I suck at designing good-looking interfaces so likely it could be better.
 * commander modules. You can spawn a naked comm and morph him with /nocost but people seem to like insanely powerful units so possibly the UI could allow spawning illegal comms (eg 9001 damage modules).
 * UI polish. The buttons could be disabled when cheating disabled, requires #2555. The /cheat button could be disabled when not the room boss, requires infra changes to mark the boss.
 * robust state detection. No string parsing, requires the engine to expose interfaces (`Spring.GetNocost`, `widget:NocostChanged` etc)
 * possibly the unit roster could be modified. The way I split the "hidden" units into Wacky and Campaign is patterned, yet nebulous. I also didn't include technical stuff like terraunit or the 9001 commander defs (just the former Hub ones), possibly they could be a separate "Uninteresting Crap" category.
  • Loading branch information
sprunk committed Oct 10, 2017
1 parent 868c6c6 commit 04ee88e
Show file tree
Hide file tree
Showing 7 changed files with 744 additions and 2 deletions.
1 change: 1 addition & 0 deletions LuaRules/Configs/customcmds.h.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ CMD_SET_AI_START = 10007
CMD_BUILD = 10010
CMD_NEWTON_FIREZONE = 10283
CMD_STOP_NEWTON_FIREZONE = 10284
CMD_CHEAT_GIVE = 13337
CMD_FACTORY_GUARD = 13921
CMD_AREA_GUARD = 13922
CMD_ORBIT = 13923
Expand Down
1 change: 1 addition & 0 deletions LuaUI/Configs/integral_menu_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ local widgetSpaceHidden = {
[60] = true, -- CMD.PAGES
[CMD_SETHAVEN] = true,
[CMD_SET_AI_START] = true,
[CMD_CHEAT_GIVE] = true,
[CMD_SET_FERRY] = true,
[CMD.MOVE] = true,
}
Expand Down
16 changes: 15 additions & 1 deletion LuaUI/Configs/lang/common.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,19 @@
"go_to" : "Go to",
"x%_done" : "%{x}%% done",
"append_to_current_selection" : "Append to current selection",
"unit_under_attack" : "is under attack"
"unit_under_attack" : "is under attack",
"roster_factorycloak" : "Cloakybots",
"roster_factoryshield" : "Shieldbots",
"roster_factoryveh" : "Vehicles",
"roster_factorytank" : "Tanks",
"roster_factoryamph" : "Amphbots",
"roster_factoryhover" : "Hovercraft",
"roster_factoryjump" : "Jumpybots",
"roster_factoryspider" : "Spiders",
"roster_factorygunship" : "Gunships",
"roster_factoryplane" : "Planes",
"roster_factoryship" : "Ships",
"roster_striderhub" : "Striders",
"roster_staticmissilesilo" : "Missiles",
"neutral" : "Neutral"
}
16 changes: 15 additions & 1 deletion LuaUI/Configs/lang/common.pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,19 @@
"go_to" : "Przejdź do",
"x%_done" : "postęp %{x}%%",
"append_to_current_selection" : "Dodaj do zaznaczenia",
"unit_under_attack" : "jest pod ostrzałem"
"unit_under_attack" : "jest pod ostrzałem",
"roster_factorycloak" : "Cichociemni",
"roster_factoryshield" : "Tarczowniki",
"roster_factoryveh" : "Pojazdy",
"roster_factorytank" : "Czołgi",
"roster_factoryamph" : "Amfibie",
"roster_factoryhover" : "Poduszkowce",
"roster_factoryjump" : "Skoczki",
"roster_factoryspider" : "Pająki",
"roster_factorygunship" : "Statki powietrzne",
"roster_factoryplane" : "Samoloty",
"roster_factoryship" : "Statki",
"roster_striderhub" : "Mechy",
"roster_staticmissilesilo" : "Rakiety taktyczne",
"neutral" : "Neutralny"
}
27 changes: 27 additions & 0 deletions LuaUI/Configs/lang/interface.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"toggle_mission_objectives_desc" : "Shows main and bonus objectives for current mission.",
"toggle_eco_display_name" : "Toggle Economy Display",
"toggle_eco_display_desc" : "Shows metal, geo spots and pylon fields",
"toggle_cheatsheet_name" : "Toggle Cheat Sheet",
"toggle_cheatsheet_desc" : "Shows a menu which contains various handy cheats.",
"place_retreat_zone_name" : "Place Retreat Zone",
"place_retreat_zone_desc" : "Hold shift to place multiple zones. Click on existing zones to remove.",
"place_ferry_route_name" : "Place Ferry Route",
Expand All @@ -56,6 +58,31 @@
"attrition_individual_stats" : "Individual stats",
"attrition_value_killed" : "Value killed",
"attrition_value_lost" : "Value lost",
"cheatsheet_btn_spawn" : "Spawn chosen units at target point.",
"cheatsheet_btn_atm" : "Gain 1000 metal and energy.",
"cheatsheet_lab_spawn" : "Unit spawning",
"cheatsheet_lab_top" : "Cheat Sheet",
"cheatsheet_chb_godmode" : "Global spec control",
"cheatsheet_chb_godmode_desc" : "Allows spectators to control all teams",
"cheatsheet_chb_nocost" : "Quick build",
"cheatsheet_chb_nocost_desc" : "Construction becomes free and completes near instantly.",
"cheatsheet_chb_globallos" : "Global vision",
"cheatsheet_chb_globallos_desc" : "Get line of sight over the entire map.",
"cheatsheet_chb_cheat" : "Enable cheats",
"cheatsheet_chb_cheat_desc" : "Allow toggling cheats. Note that cheats stay enabled even if cheat control is disabled.",
"cheatsheet_count_slider" : "Count: %%.0f",
"cheatsheet_teampick_desc" : "Who receives the units?",
"cheatsheet_pick_category" : "Choose unit category.",
"cheatsheet_pick_unit" : "Choose the specific unit.",
"cheatsheet_no_category" : "<choose category>",
"cheatsheet_cat_eco" : "Economy",
"cheatsheet_cat_defense" : "Defense",
"cheatsheet_cat_intel_super" : "Intel / Superweapon",
"cheatsheet_cat_comms" : "Commanders",
"cheatsheet_cat_chicken" : "Chickens",
"cheatsheet_cat_subunits" : "Sub-units",
"cheatsheet_cat_campaign" : "Campaign",
"cheatsheet_cat_wacky" : "Wacky",
"x_units_in_queue" : {
"one" : "%{count} unit in queue",
"other" : "%{count} units in queue"
Expand Down
27 changes: 27 additions & 0 deletions LuaUI/Configs/lang/interface.pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"toggle_mission_objectives_desc" : "Pokazuje główne i poboczne cele obecnej misji.",
"toggle_eco_display_name" : "Widok ekonomiczny",
"toggle_eco_display_desc" : "Pokazuje złoża metalu i geotermie oraz sieć energetyczną",
"toggle_cheatsheet_name" : "Menu cheatów",
"toggle_cheatsheet_desc" : "Pozwala korzystać z cheatów.",
"place_retreat_zone_name" : "Ustaw miejsce ucieczki",
"place_retreat_zone_desc" : "Shift by ustawić wiele, nałóż drugie by skasować",
"place_ferry_route_name" : "Ustaw trasę transportową",
Expand All @@ -58,6 +60,31 @@
"attrition_individual_stats" : "Indywidualnie",
"attrition_value_killed" : "Zadane straty",
"attrition_value_lost" : "Otrzymane straty",
"cheatsheet_btn_spawn" : "Stwórz wybrane jednostki w docelowym miejscu.",
"cheatsheet_btn_atm" : "Dostajesz 1000 metalu i energii.",
"cheatsheet_lab_spawn" : "Tworzenie jednostek",
"cheatsheet_lab_top" : "Menu Cheatów",
"cheatsheet_chb_godmode" : "Globalna kontrola",
"cheatsheet_chb_godmode_desc" : "Obserwatorzy mogą kontrolować wszystkie drużyny.",
"cheatsheet_chb_nocost" : "Szybka budowa",
"cheatsheet_chb_nocost_desc" : "Budowanie jest darmowe i wykonuje się natychmiast.",
"cheatsheet_chb_globallos" : "Odkrycie mapy",
"cheatsheet_chb_globallos_desc" : "Odkrywa całą mapę.",
"cheatsheet_chb_cheat" : "Pozwól na cheaty",
"cheatsheet_chb_cheat_desc" : "Pozwala włączać pozostałe cheaty. Uwaga: włączone cheaty pozostaną aktywne jeżeli wyłączymy pozwolenie na cheaty.",
"cheatsheet_count_slider" : "Ilość: %%.0f",
"cheatsheet_teampick_desc" : "Kto otrzyma jednostki?",
"cheatsheet_pick_category" : "Wybierz kategorię jednostki.",
"cheatsheet_pick_unit" : "Wybierz konkretną jednostkę.",
"cheatsheet_no_category" : "<wybierz kategorię>",
"cheatsheet_cat_eco" : "Ekonomiczne",
"cheatsheet_cat_defense" : "Obronne",
"cheatsheet_cat_intel_super" : "Zwiad / Superbronie",
"cheatsheet_cat_comms" : "Dowódcy",
"cheatsheet_cat_chicken" : "Kurczaki",
"cheatsheet_cat_subunits" : "Pod-jednostki",
"cheatsheet_cat_campaign" : "Kampania",
"cheatsheet_cat_wacky" : "Dziwolągi",
"x_units_in_queue" : {
"one" : "%{count} jednostka w kolejce",
"few" : "%{count} jednostki w kolejce",
Expand Down

1 comment on commit 04ee88e

@GoogleFrog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add some of the luarules commands too such as '/luarules clear' which destroys all units and features on the map and '/luarules gk' which gently kills all units.

Please sign in to comment.