mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-19 21:37:57 +08:00
tidying and lang updates
This commit is contained in:
parent
3202aa793e
commit
d2b18d99ca
108
.efrocachemap
108
.efrocachemap
@ -420,10 +420,10 @@
|
||||
"assets/build/ba_data/audio/zoeOw.ogg": "https://files.ballistica.net/cache/ba1/dc/d2/160fc27fcaff10793327ac2c70fd",
|
||||
"assets/build/ba_data/audio/zoePickup01.ogg": "https://files.ballistica.net/cache/ba1/11/7a/87d6bca0acfb877fd4fd8fe3a598",
|
||||
"assets/build/ba_data/audio/zoeScream01.ogg": "https://files.ballistica.net/cache/ba1/44/f5/c943c9075abb3e1835d2408a1ef8",
|
||||
"assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/01/df/c8793a0f23e024f44ff5203122f1",
|
||||
"assets/build/ba_data/data/languages/arabic.json": "https://files.ballistica.net/cache/ba1/ca/75/3de74bd6e498113b99bbf9eda645",
|
||||
"assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/d9/7a/82db6c8a2513ebd2a2db9f2b25f7",
|
||||
"assets/build/ba_data/data/languages/arabic.json": "https://files.ballistica.net/cache/ba1/4c/fd/67a9dcdecb85dbaf549a8fbbdc78",
|
||||
"assets/build/ba_data/data/languages/belarussian.json": "https://files.ballistica.net/cache/ba1/61/03/89070ca765e06da3a419a579f503",
|
||||
"assets/build/ba_data/data/languages/chinese.json": "https://files.ballistica.net/cache/ba1/61/ee/f19a0aacec20e49dd16c206b6c69",
|
||||
"assets/build/ba_data/data/languages/chinese.json": "https://files.ballistica.net/cache/ba1/32/a7/b9208ab804dfe2d1c3960256e9f8",
|
||||
"assets/build/ba_data/data/languages/chinesetraditional.json": "https://files.ballistica.net/cache/ba1/61/e6/caf06ce99017fdf5d2da0c038445",
|
||||
"assets/build/ba_data/data/languages/croatian.json": "https://files.ballistica.net/cache/ba1/28/46/3a36628a033da4d4b4ea65b78a28",
|
||||
"assets/build/ba_data/data/languages/czech.json": "https://files.ballistica.net/cache/ba1/87/84/9f3d39610453b3bf350698a23316",
|
||||
@ -431,9 +431,9 @@
|
||||
"assets/build/ba_data/data/languages/dutch.json": "https://files.ballistica.net/cache/ba1/68/93/da8e9874f41a786edf52ba4ccaad",
|
||||
"assets/build/ba_data/data/languages/english.json": "https://files.ballistica.net/cache/ba1/e2/7e/d09eefebb683de87d3845f1f74f4",
|
||||
"assets/build/ba_data/data/languages/esperanto.json": "https://files.ballistica.net/cache/ba1/4c/c7/0184b8178869d1a3827a1bfcd5bb",
|
||||
"assets/build/ba_data/data/languages/filipino.json": "https://files.ballistica.net/cache/ba1/de/5c/631a09d9192e40c99c07c6191b7c",
|
||||
"assets/build/ba_data/data/languages/filipino.json": "https://files.ballistica.net/cache/ba1/4b/f2/6b17381862e41b3be7ddce5d296d",
|
||||
"assets/build/ba_data/data/languages/french.json": "https://files.ballistica.net/cache/ba1/b6/e0/37dd30b686f475733ccc4b3cab49",
|
||||
"assets/build/ba_data/data/languages/german.json": "https://files.ballistica.net/cache/ba1/20/3f/198dcc5cfed5789042e1595bd048",
|
||||
"assets/build/ba_data/data/languages/german.json": "https://files.ballistica.net/cache/ba1/c0/26/04875251b9237f3133c84a910afd",
|
||||
"assets/build/ba_data/data/languages/gibberish.json": "https://files.ballistica.net/cache/ba1/f9/c2/d9889ac09067d7f073f5ee005740",
|
||||
"assets/build/ba_data/data/languages/greek.json": "https://files.ballistica.net/cache/ba1/82/eb/37ff44af76812097f9c98f05c730",
|
||||
"assets/build/ba_data/data/languages/hindi.json": "https://files.ballistica.net/cache/ba1/08/3b/68cea4d16f7020d932829af85323",
|
||||
@ -442,17 +442,17 @@
|
||||
"assets/build/ba_data/data/languages/italian.json": "https://files.ballistica.net/cache/ba1/94/2d/4f17fc4b73260e99453ee3122c0c",
|
||||
"assets/build/ba_data/data/languages/korean.json": "https://files.ballistica.net/cache/ba1/07/37/ab65ccee3a555bd40e9661860c58",
|
||||
"assets/build/ba_data/data/languages/persian.json": "https://files.ballistica.net/cache/ba1/02/ab/e310f81582b6dc2ae93348d45166",
|
||||
"assets/build/ba_data/data/languages/polish.json": "https://files.ballistica.net/cache/ba1/d5/fe/422745cdbe51ccb4f2ced6f5554a",
|
||||
"assets/build/ba_data/data/languages/polish.json": "https://files.ballistica.net/cache/ba1/76/be/84e567de0aabd9f9145b62179c2c",
|
||||
"assets/build/ba_data/data/languages/portuguese.json": "https://files.ballistica.net/cache/ba1/26/41/f1246ab56c6b7853f605c3a95889",
|
||||
"assets/build/ba_data/data/languages/romanian.json": "https://files.ballistica.net/cache/ba1/f4/74/a9e2f85b531061703d08a4118bed",
|
||||
"assets/build/ba_data/data/languages/russian.json": "https://files.ballistica.net/cache/ba1/b2/46/89ae228342f20ca4937ee254197b",
|
||||
"assets/build/ba_data/data/languages/russian.json": "https://files.ballistica.net/cache/ba1/8c/a7/1dea3643720ced9fa40a0b3d1add",
|
||||
"assets/build/ba_data/data/languages/serbian.json": "https://files.ballistica.net/cache/ba1/13/19/828be486951be254445263f36c6e",
|
||||
"assets/build/ba_data/data/languages/slovak.json": "https://files.ballistica.net/cache/ba1/f9/4b/d9f01814224066856695452ef57c",
|
||||
"assets/build/ba_data/data/languages/spanish.json": "https://files.ballistica.net/cache/ba1/87/5d/d36a8a2e9cb0f02731a3fd7af000",
|
||||
"assets/build/ba_data/data/languages/spanish.json": "https://files.ballistica.net/cache/ba1/b3/a3/3e1befdc621a503219fa78ba6d8b",
|
||||
"assets/build/ba_data/data/languages/swedish.json": "https://files.ballistica.net/cache/ba1/91/0a/35c4baf539d5951fc03a794c0e0b",
|
||||
"assets/build/ba_data/data/languages/tamil.json": "https://files.ballistica.net/cache/ba1/fe/f8/0f2b437ae04a7a7126db98d752fe",
|
||||
"assets/build/ba_data/data/languages/tamil.json": "https://files.ballistica.net/cache/ba1/16/8f/30ba7e59d25748b76af1743a5686",
|
||||
"assets/build/ba_data/data/languages/thai.json": "https://files.ballistica.net/cache/ba1/9d/51/f699dbd4beb88bc3cff699a287a7",
|
||||
"assets/build/ba_data/data/languages/turkish.json": "https://files.ballistica.net/cache/ba1/0a/4f/90fcd63bd12a7648b2a1e9b01586",
|
||||
"assets/build/ba_data/data/languages/turkish.json": "https://files.ballistica.net/cache/ba1/6f/2e/20bed8fefb23ca42c18a7b6c75b2",
|
||||
"assets/build/ba_data/data/languages/ukrainian.json": "https://files.ballistica.net/cache/ba1/7f/bb/6239adeb551be5e09f3457d7b411",
|
||||
"assets/build/ba_data/data/languages/venetian.json": "https://files.ballistica.net/cache/ba1/e2/e1/b815d9f2e9b2c3a4daddaf728225",
|
||||
"assets/build/ba_data/data/languages/vietnamese.json": "https://files.ballistica.net/cache/ba1/f2/af/afd1503c7a10cacaa15bc02369b2",
|
||||
@ -3992,50 +3992,50 @@
|
||||
"assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e",
|
||||
"assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/b2/e5/0ee0561e16257a32830645239f34",
|
||||
"ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c7/4f/e8b94b6390cecab9b571d0529f2f",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/ef/e5/c641ee4b953890be38a421c4dc9f",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ed/2e/ab64f102368dce31964cc416404a",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e2/1e/3f4c24afe4ee8f71ff2dfc0ad7f5",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/56/e6/691613ebcddf0c28b13fe468ff6f",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/cb/e3/7ef1979818e8f39e259177bf429a",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/24/27/2c3af3d7bced84c2d368d3b12a3e",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/68/dd/64237dd6203d09443bae46aea724",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/e8/25/0b74945268df9ff672e6458c51ed",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/62/df/3416ab9e48837bf401c16d36f009",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c7/eb/9742ca33ce3dadf4ecaa99af8f3b",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c0/1d/c66a88772a554cbba3e587cdbc81",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/da/ea/4919131850d1574fbbbd3c467115",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/17/6b/75952b2eb13698a1c94450bbf784",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c9/1a/c33805d339a238e03f2e3fb25610",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/97/cb/549865ac23bad6e634bf2480afc4",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/93/c3/859c24fb18f2682e00a4dfb3f705",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/af/df/719d1743258636ebbcd5a042636c",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/0e/81/d26a244e16275e91663c66d24295",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/b7/0f/e4fafe596723f513f33bc3fd121d",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/22/b3/1dbcde06de6e6107f05bc054c63f",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/64/e2/0ed77a64f73a88087b3e59afe068",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f6/4d/a6df77b6554a6d2fcce0da8cd6f9",
|
||||
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/39/15/b5f145e0f448b44488a459437eed",
|
||||
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/36/c4/dd9af330599b72e1de2fe26f591f",
|
||||
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d8/4d/cd07ed88ac012e0a2814ccce55b0",
|
||||
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e8/9c/26d18be4d4f732b30cfaf00839d7",
|
||||
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c6/ed/823544fb91e49f7b00aaee549c1d",
|
||||
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3f/5f/acc2a8b7faeece7d3eb4bd3e85db",
|
||||
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/33/a9/df1834efe475f2b074e0385cf43a",
|
||||
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/66/ab/53203f38e7e00e464a00cd08fd81",
|
||||
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ee/6d/2d5d14ce2fd784ecd9008d635041",
|
||||
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d3/d8/f4c1aa22d06c293afc699eccbfaf",
|
||||
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/96/47/a95bf58c8ee9b1a6cf16c0bce38e",
|
||||
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/65/aa/0b3de0dec8931143e93095030061",
|
||||
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/fe/e9/59f07ea132235d66772728a3f444",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/f2/f6/9375e455fa8ea5ebfd745da986eb",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/a1/0d/6ec5956f134d63097edb47f6b999",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/f1/5f/4a079cab37d3ddeb15e6223d338d",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/44/01/179f72c862b7e13bf0f2353100dd",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/13/9b/863b7052d8e99d53dd4c54b9e72c",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/a9/8d/1d520d9fc7e4284b6f09b5fcc8ff",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/92/16/68afcc43eba0f06b3c804a293437",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/ec/e7/7d92bd291b606cc32058107314ba",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/25/53/6a4e5bf41e72039c2e9505314fc8",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d5/6b/6781774528935242d5f6d19d7576",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/63/08/568b9c8e0fdc44ae10b80506ec9b",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/67/9b/e9d3ca213933b900da272548b99c",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/9d/55/1835bbc7bf7da93cf6b3b2f2829d",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/5f/a5/bfc94a98055c65d21ce0cef290d8",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/48/b1/e78c8b6c5ff9552d423fc58e87d7",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e5/ba/00bbdbe267193e998645b75e0b30",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/04/d9/aca25c3290baa86d3527db214df0",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d7/2d/36b55e57c8911687b34001ae64bf",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/04/c2/66e462754041aa48386da42ea36b",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/19/84/5b1457c336be08ae443563e562cb",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d6/e1/b42b8b4c786cf18bccf545465921",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/e3/5d/67bb3a15c0399b6bcb2a7843e275",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/87/00/9f492f517a5ef8c964bd60a01a8f",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/90/de/ad8ad53c2e67b71809d64d1479c8",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/26/ea/b486ae0f48bf72a0d5e6bcef0dfe",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/7f/df/cddaeaa46f35d87ba3bbdc3a4603",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/61/ba/938a1cd1c456ef81a6210f987470",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/6d/f8/8c1577c4ecc92a715dd70facddbb",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d9/47/82e658f9bd119855a6ad75028603",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c6/63/96f9df7f919f44e6d4566eba5ae0",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7a/dc/36b1839661638396bf17b7af90e4",
|
||||
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/71/82/4679ec67236513a61a8260035d3a",
|
||||
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/26/c0/610acfd8b1eebea05169e78af27d",
|
||||
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ee/e5/46b03f0ee43affd5a800581941b2",
|
||||
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c7/f7/e01f4702338f9b09d996a2a7f445",
|
||||
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7d/a5/04080ea482994ce0135683fa5340",
|
||||
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/db/fe/6fb2d9e508ede8f5679fb258c520",
|
||||
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/20/ce/34c62328d5afb90d2848f1628d42",
|
||||
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/51/e2/870956a5cdb0f216d4386f0417ad",
|
||||
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/22/64/a8be5f32f808f536266857256162",
|
||||
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b4/0b/48637a34a9b5b8727c73a6261c6d",
|
||||
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/94/15/1d8e7e30526b3182064ec6afa904",
|
||||
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/62/b1/a3cbed9e6a5f96b433ad657f0c36",
|
||||
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6f/bc/63aa452a2ae2f747f4a2e68da687",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/32/39/8618f51e38e8043cf2f3a20ac03b",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/c8/19/7c0eebd3b60065e62655b59c786b",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/ea/59/03b3db146092f14719782d1d017e",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/e8/3a/c2a9a2c00e230c0ed181dcf2df76",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/be/02/e7c834e3dd661881e968bcc1cc9b",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/e5/f4/7592825467eca48b95437f4d4fc3",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/d8/3a/b43c8a2fb8778d2f33cb2d3ccb94",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/7e/67/b6f493081e8b4c158fe7f3b38004",
|
||||
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/6e/6f/004b696e9a13b083069374e4bb6a",
|
||||
"src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/d3/db/e73d4dcf1280d5f677c3cf8b47c3"
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
### 1.7.2 (20612, 2022-06-22)
|
||||
### 1.7.2 (20615, 2022-06-23)
|
||||
- Minor fixes in some minigames (Thanks Droopy!)
|
||||
- Fixed a bug preventing 'clients' arg from working in _ba.chatmessage (Thanks imayushsaini!)
|
||||
- Fixed a bug where ba.Player.getdelegate(doraise=True) could return None instead of raising a ba.DelegateNotFoundError (thanks Dliwk!)
|
||||
|
||||
@ -1 +1 @@
|
||||
109029534501022699603510994431677623146
|
||||
189669784378787860418944488756518386723
|
||||
@ -675,7 +675,7 @@ class Node:
|
||||
@overload
|
||||
def getdelegate(self,
|
||||
type: type[_T],
|
||||
doraise: Literal[False] = False) -> Optional[_T]:
|
||||
doraise: Literal[False] = False) -> _T | None:
|
||||
...
|
||||
|
||||
@overload
|
||||
@ -1604,7 +1604,7 @@ def get_chat_messages() -> list[str]:
|
||||
return ['blah', 'blah2']
|
||||
|
||||
|
||||
def get_client_public_device_uuid(client_id: int) -> Optional[str]:
|
||||
def get_client_public_device_uuid(client_id: int) -> str | None:
|
||||
"""(internal)
|
||||
|
||||
Category: General Utility Functions
|
||||
@ -1941,11 +1941,11 @@ def getactivity(doraise: Literal[True] = True) -> ba.Activity:
|
||||
|
||||
|
||||
@overload
|
||||
def getactivity(doraise: Literal[False]) -> Optional[ba.Activity]:
|
||||
def getactivity(doraise: Literal[False]) -> ba.Activity | None:
|
||||
...
|
||||
|
||||
|
||||
def getactivity(doraise: bool = True) -> Optional[ba.Activity]:
|
||||
def getactivity(doraise: bool = True) -> ba.Activity | None:
|
||||
"""Return the current ba.Activity instance.
|
||||
|
||||
Category: **Gameplay Functions**
|
||||
@ -2000,7 +2000,7 @@ def getinputdevice(name: str,
|
||||
|
||||
@overload
|
||||
def getinputdevice(name: str, unique_id: str,
|
||||
doraise: Literal[False]) -> Optional[ba.InputDevice]:
|
||||
doraise: Literal[False]) -> ba.InputDevice | None:
|
||||
...
|
||||
|
||||
|
||||
@ -2048,11 +2048,11 @@ def getsession(doraise: Literal[True] = True) -> ba.Session:
|
||||
|
||||
|
||||
@overload
|
||||
def getsession(doraise: Literal[False]) -> Optional[ba.Session]:
|
||||
def getsession(doraise: Literal[False]) -> ba.Session | None:
|
||||
...
|
||||
|
||||
|
||||
def getsession(doraise: bool = True) -> Optional[ba.Session]:
|
||||
def getsession(doraise: bool = True) -> ba.Session | None:
|
||||
"""Category: **Gameplay Functions**
|
||||
|
||||
Returns the current ba.Session instance.
|
||||
@ -2871,7 +2871,7 @@ def set_public_party_name(name: str) -> None:
|
||||
return None
|
||||
|
||||
|
||||
def set_public_party_stats_url(url: Optional[str]) -> None:
|
||||
def set_public_party_stats_url(url: str | None) -> None:
|
||||
"""(internal)"""
|
||||
return None
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import _ba
|
||||
from ba._error import print_exception
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Union, Optional
|
||||
from typing import Any, Sequence
|
||||
import ba
|
||||
|
||||
# This could use some cleanup.
|
||||
@ -73,7 +73,7 @@ class AchievementSubsystem:
|
||||
def __init__(self) -> None:
|
||||
self.achievements: list[Achievement] = []
|
||||
self.achievements_to_display: (list[tuple[ba.Achievement, bool]]) = []
|
||||
self.achievement_display_timer: Optional[_ba.Timer] = None
|
||||
self.achievement_display_timer: _ba.Timer | None = None
|
||||
self.last_achievement_display_time: float = 0.0
|
||||
self.achievement_completion_banner_slots: set[int] = set()
|
||||
self._init_achievements()
|
||||
@ -450,7 +450,7 @@ class Achievement:
|
||||
self._icon_name = icon_name
|
||||
self._icon_color: Sequence[float] = list(icon_color) + [1]
|
||||
self._level_name = level_name
|
||||
self._completion_banner_slot: Optional[int] = None
|
||||
self._completion_banner_slot: int | None = None
|
||||
self._award = award
|
||||
self._hard_mode_only = hard_mode_only
|
||||
|
||||
@ -534,7 +534,7 @@ class Achievement:
|
||||
def display_name(self) -> ba.Lstr:
|
||||
"""Return a ba.Lstr for this Achievement's name."""
|
||||
from ba._language import Lstr
|
||||
name: Union[ba.Lstr, str]
|
||||
name: ba.Lstr | str
|
||||
try:
|
||||
if self._level_name != '':
|
||||
from ba._campaign import getcampaign
|
||||
|
||||
@ -16,7 +16,7 @@ from ba._general import Call, verify_object_death
|
||||
from ba._messages import UNHANDLED
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, Any
|
||||
from typing import Any
|
||||
import ba
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
@ -139,7 +139,7 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]):
|
||||
assert isinstance(settings, dict)
|
||||
assert _ba.getactivity() is self
|
||||
|
||||
self._globalsnode: Optional[ba.Node] = None
|
||||
self._globalsnode: ba.Node | None = None
|
||||
|
||||
# Player/Team types should have been specified as type args;
|
||||
# grab those.
|
||||
@ -148,7 +148,7 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]):
|
||||
self._setup_player_and_team_types()
|
||||
|
||||
# FIXME: Relocate or remove the need for this stuff.
|
||||
self.paused_text: Optional[ba.Actor] = None
|
||||
self.paused_text: ba.Actor | None = None
|
||||
|
||||
self._session = weakref.ref(_ba.getsession())
|
||||
|
||||
@ -163,7 +163,7 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]):
|
||||
self._has_transitioned_in = False
|
||||
self._has_begun = False
|
||||
self._has_ended = False
|
||||
self._activity_death_check_timer: Optional[ba.Timer] = None
|
||||
self._activity_death_check_timer: ba.Timer | None = None
|
||||
self._expired = False
|
||||
self._delay_delete_players: list[PlayerType] = []
|
||||
self._delay_delete_teams: list[TeamType] = []
|
||||
@ -177,14 +177,14 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]):
|
||||
self._actor_refs: list[ba.Actor] = []
|
||||
self._actor_weak_refs: list[weakref.ref[ba.Actor]] = []
|
||||
self._last_prune_dead_actors_time = _ba.time()
|
||||
self._prune_dead_actors_timer: Optional[ba.Timer] = None
|
||||
self._prune_dead_actors_timer: ba.Timer | None = None
|
||||
|
||||
self.teams = []
|
||||
self.players = []
|
||||
|
||||
self.lobby = None
|
||||
self._stats: Optional[ba.Stats] = None
|
||||
self._customdata: Optional[dict] = {}
|
||||
self._stats: ba.Stats | None = None
|
||||
self._customdata: dict | None = {}
|
||||
|
||||
def __del__(self) -> None:
|
||||
|
||||
@ -396,7 +396,7 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]):
|
||||
"""Return whether ba.Activity.on_transition_out() has been called."""
|
||||
return self._transitioning_out
|
||||
|
||||
def transition_in(self, prev_globals: Optional[ba.Node]) -> None:
|
||||
def transition_in(self, prev_globals: ba.Node | None) -> None:
|
||||
"""Called by Session to kick off transition-in.
|
||||
|
||||
(internal)
|
||||
|
||||
@ -12,7 +12,7 @@ from ba._messages import DieMessage, DeathType, OutOfBoundsMessage, UNHANDLED
|
||||
from ba._error import print_exception, ActivityNotFoundError
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Literal
|
||||
from typing import Any, Literal
|
||||
import ba
|
||||
|
||||
TA = TypeVar('TA', bound='Actor')
|
||||
@ -187,10 +187,10 @@ class Actor:
|
||||
...
|
||||
|
||||
@overload
|
||||
def getactivity(self, doraise: Literal[False]) -> Optional[ba.Activity]:
|
||||
def getactivity(self, doraise: Literal[False]) -> ba.Activity | None:
|
||||
...
|
||||
|
||||
def getactivity(self, doraise: bool = True) -> Optional[ba.Activity]:
|
||||
def getactivity(self, doraise: bool = True) -> ba.Activity | None:
|
||||
"""Return the ba.Activity this Actor is associated with.
|
||||
|
||||
If the Activity no longer exists, raises a ba.ActivityNotFoundError
|
||||
|
||||
@ -9,7 +9,7 @@ from typing import TYPE_CHECKING
|
||||
import _ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, Callable, Any
|
||||
from typing import Callable, Any
|
||||
|
||||
|
||||
class AdsSubsystem:
|
||||
@ -23,11 +23,11 @@ class AdsSubsystem:
|
||||
def __init__(self) -> None:
|
||||
self.last_ad_network = 'unknown'
|
||||
self.last_ad_network_set_time = time.time()
|
||||
self.ad_amt: Optional[float] = None
|
||||
self.ad_amt: float | None = None
|
||||
self.last_ad_purpose = 'invalid'
|
||||
self.attempted_first_ad = False
|
||||
self.last_in_game_ad_remove_message_show_time: Optional[float] = None
|
||||
self.last_ad_completion_time: Optional[float] = None
|
||||
self.last_in_game_ad_remove_message_show_time: float | None = None
|
||||
self.last_ad_completion_time: float | None = None
|
||||
self.last_ad_was_short = False
|
||||
|
||||
def do_remove_in_game_ads_message(self) -> None:
|
||||
@ -89,7 +89,7 @@ class AdsSubsystem:
|
||||
show = False # Never show ads during tournaments.
|
||||
|
||||
if show:
|
||||
interval: Optional[float]
|
||||
interval: float | None
|
||||
launch_count = app.config.get('launchCount', 0)
|
||||
|
||||
# If we're seeing short ads we may want to space them differently.
|
||||
|
||||
@ -10,7 +10,7 @@ from typing import (Generic, TypeVar, TYPE_CHECKING)
|
||||
import _ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, Any
|
||||
from typing import Any
|
||||
import ba
|
||||
|
||||
T = TypeVar('T', bound='DependencyComponent')
|
||||
@ -39,7 +39,7 @@ class Dependency(Generic[T]):
|
||||
"""
|
||||
self.cls: type[T] = cls
|
||||
self.config = config
|
||||
self._hash: Optional[int] = None
|
||||
self._hash: int | None = None
|
||||
|
||||
def get_hash(self) -> int:
|
||||
"""Return the dependency's hash, calculating it if necessary."""
|
||||
@ -133,7 +133,7 @@ class DependencyEntry:
|
||||
|
||||
# Arbitrary data for use by dependencies in the resolved set
|
||||
# (the static instance for static-deps, etc).
|
||||
self.component: Optional[DependencyComponent] = None
|
||||
self.component: DependencyComponent | None = None
|
||||
|
||||
# Weakref to the depset that includes us (to avoid ref loop).
|
||||
self.depset = weakref.ref(depset)
|
||||
|
||||
@ -12,14 +12,14 @@ from efro.util import asserttype
|
||||
from ba._team import Team, SessionTeam
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Sequence, Optional
|
||||
from typing import Sequence
|
||||
import ba
|
||||
|
||||
|
||||
@dataclass
|
||||
class WinnerGroup:
|
||||
"""Entry for a winning team or teams calculated by game-results."""
|
||||
score: Optional[int]
|
||||
score: int | None
|
||||
teams: Sequence[ba.SessionTeam]
|
||||
|
||||
|
||||
@ -36,13 +36,13 @@ class GameResults:
|
||||
def __init__(self) -> None:
|
||||
self._game_set = False
|
||||
self._scores: dict[int, tuple[weakref.ref[ba.SessionTeam],
|
||||
Optional[int]]] = {}
|
||||
self._sessionteams: Optional[list[weakref.ref[ba.SessionTeam]]] = None
|
||||
self._playerinfos: Optional[list[ba.PlayerInfo]] = None
|
||||
self._lower_is_better: Optional[bool] = None
|
||||
self._score_label: Optional[str] = None
|
||||
self._none_is_winner: Optional[bool] = None
|
||||
self._scoretype: Optional[ba.ScoreType] = None
|
||||
int | None]] = {}
|
||||
self._sessionteams: list[weakref.ref[ba.SessionTeam]] | None = None
|
||||
self._playerinfos: list[ba.PlayerInfo] | None = None
|
||||
self._lower_is_better: bool | None = None
|
||||
self._score_label: str | None = None
|
||||
self._none_is_winner: bool | None = None
|
||||
self._scoretype: ba.ScoreType | None = None
|
||||
|
||||
def set_game(self, game: ba.GameActivity) -> None:
|
||||
"""Set the game instance these results are applying to."""
|
||||
@ -59,7 +59,7 @@ class GameResults:
|
||||
self._none_is_winner = scoreconfig.none_is_winner
|
||||
self._scoretype = scoreconfig.scoretype
|
||||
|
||||
def set_team_score(self, team: ba.Team, score: Optional[int]) -> None:
|
||||
def set_team_score(self, team: ba.Team, score: int | None) -> None:
|
||||
"""Set the score for a given team.
|
||||
|
||||
This can be a number or None.
|
||||
@ -69,8 +69,7 @@ class GameResults:
|
||||
sessionteam = team.sessionteam
|
||||
self._scores[sessionteam.id] = (weakref.ref(sessionteam), score)
|
||||
|
||||
def get_sessionteam_score(self,
|
||||
sessionteam: ba.SessionTeam) -> Optional[int]:
|
||||
def get_sessionteam_score(self, sessionteam: ba.SessionTeam) -> int | None:
|
||||
"""Return the score for a given ba.SessionTeam."""
|
||||
assert isinstance(sessionteam, SessionTeam)
|
||||
for score in list(self._scores.values()):
|
||||
@ -157,7 +156,7 @@ class GameResults:
|
||||
return self._lower_is_better
|
||||
|
||||
@property
|
||||
def winning_sessionteam(self) -> Optional[ba.SessionTeam]:
|
||||
def winning_sessionteam(self) -> ba.SessionTeam | None:
|
||||
"""The winning ba.SessionTeam if there is exactly one, or else None."""
|
||||
if not self._game_set:
|
||||
raise RuntimeError("Can't get winners until game is set.")
|
||||
@ -184,7 +183,7 @@ class GameResults:
|
||||
team = score[0]()
|
||||
assert team is not None
|
||||
sval.append(team)
|
||||
results: list[tuple[Optional[int],
|
||||
results: list[tuple[int | None,
|
||||
list[ba.SessionTeam]]] = list(winners.items())
|
||||
results.sort(reverse=not self._lower_is_better,
|
||||
key=lambda x: asserttype(x[0], int))
|
||||
@ -199,7 +198,7 @@ class GameResults:
|
||||
# Add the Nones to the list (either as winners or losers
|
||||
# depending on the rules).
|
||||
if none_sessionteams:
|
||||
nones: list[tuple[Optional[int], list[ba.SessionTeam]]] = [
|
||||
nones: list[tuple[int | None, list[ba.SessionTeam]]] = [
|
||||
(None, none_sessionteams)
|
||||
]
|
||||
if self._none_is_winner:
|
||||
|
||||
@ -12,7 +12,7 @@ from ba._generated.enums import TimeType, TimeFormat, SpecialChar, UIScale
|
||||
from ba._error import ActivityNotFoundError
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Sequence, Optional
|
||||
from typing import Sequence
|
||||
import ba
|
||||
|
||||
TROPHY_CHARS = {
|
||||
@ -32,8 +32,8 @@ class GameTip:
|
||||
Category: **Gameplay Classes**
|
||||
"""
|
||||
text: str
|
||||
icon: Optional[ba.Texture] = None
|
||||
sound: Optional[ba.Sound] = None
|
||||
icon: ba.Texture | None = None
|
||||
sound: ba.Sound | None = None
|
||||
|
||||
|
||||
def get_trophy_string(trophy_id: str) -> str:
|
||||
|
||||
@ -17,7 +17,7 @@ from ba._generated.enums import TimeType
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from types import FrameType
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
from efro.call import Call as Call # 'as Call' so we re-export.
|
||||
|
||||
|
||||
@ -37,15 +37,15 @@ ExistableType = TypeVar('ExistableType', bound=Existable)
|
||||
T = TypeVar('T')
|
||||
|
||||
|
||||
def existing(obj: Optional[ExistableType]) -> Optional[ExistableType]:
|
||||
def existing(obj: ExistableType | None) -> ExistableType | None:
|
||||
"""Convert invalid references to None for any ba.Existable object.
|
||||
|
||||
Category: **Gameplay Functions**
|
||||
|
||||
To best support type checking, it is important that invalid references
|
||||
not be passed around and instead get converted to values of None.
|
||||
That way the type checker can properly flag attempts to pass dead
|
||||
objects (Optional[FooType]) into functions expecting only live ones
|
||||
That way the type checker can properly flag attempts to pass possibly-dead
|
||||
objects (FooType | None) into functions expecting only live ones
|
||||
(FooType), etc. This call can be used on any 'existable' object
|
||||
(one with an exists() method) and will convert it to a None value
|
||||
if it does not exist.
|
||||
|
||||
@ -18,7 +18,7 @@ from typing import TYPE_CHECKING
|
||||
import _ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Sequence, Optional, Any
|
||||
from typing import Sequence, Any
|
||||
import ba
|
||||
|
||||
|
||||
@ -325,7 +325,7 @@ def party_invite_revoke(invite_id: str) -> None:
|
||||
transition='out_right')
|
||||
|
||||
|
||||
def filter_chat_message(msg: str, client_id: int) -> Optional[str]:
|
||||
def filter_chat_message(msg: str, client_id: int) -> str | None:
|
||||
"""Intercept/filter chat messages.
|
||||
|
||||
Called for all chat messages while hosting.
|
||||
|
||||
@ -11,7 +11,7 @@ import _ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import ba
|
||||
from typing import Any, Optional, Union, Sequence
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class LanguageSubsystem:
|
||||
@ -23,8 +23,8 @@ class LanguageSubsystem:
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.language_target: Optional[AttrDict] = None
|
||||
self.language_merged: Optional[AttrDict] = None
|
||||
self.language_target: AttrDict | None = None
|
||||
self.language_merged: AttrDict | None = None
|
||||
self.default_language = self._get_default_language()
|
||||
|
||||
def _can_display_language(self, language: str) -> bool:
|
||||
@ -139,7 +139,7 @@ class LanguageSubsystem:
|
||||
if self._can_display_language(name))
|
||||
|
||||
def setlanguage(self,
|
||||
language: Optional[str],
|
||||
language: str | None,
|
||||
print_change: bool = True,
|
||||
store_to_config: bool = True) -> None:
|
||||
"""Set the active language used for the game.
|
||||
@ -408,7 +408,7 @@ class Lstr:
|
||||
resource: str,
|
||||
fallback_resource: str = '',
|
||||
fallback_value: str = '',
|
||||
subs: Sequence[tuple[str, Union[str, Lstr]]] = []) -> None:
|
||||
subs: Sequence[tuple[str, str | Lstr]] = []) -> None:
|
||||
"""Create an Lstr from a string resource."""
|
||||
|
||||
# noinspection PyShadowingNames,PyDefaultArgument
|
||||
@ -416,7 +416,7 @@ class Lstr:
|
||||
def __init__(self,
|
||||
*,
|
||||
translate: tuple[str, str],
|
||||
subs: Sequence[tuple[str, Union[str, Lstr]]] = []) -> None:
|
||||
subs: Sequence[tuple[str, str | Lstr]] = []) -> None:
|
||||
"""Create an Lstr by translating a string in a category."""
|
||||
|
||||
# noinspection PyDefaultArgument
|
||||
@ -424,7 +424,7 @@ class Lstr:
|
||||
def __init__(self,
|
||||
*,
|
||||
value: str,
|
||||
subs: Sequence[tuple[str, Union[str, Lstr]]] = []) -> None:
|
||||
subs: Sequence[tuple[str, str | Lstr]] = []) -> None:
|
||||
"""Create an Lstr from a raw string value."""
|
||||
|
||||
# pylint: enable=redefined-outer-name, dangerous-default-value
|
||||
|
||||
@ -10,7 +10,7 @@ from typing import TYPE_CHECKING
|
||||
import _ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
import ba
|
||||
|
||||
|
||||
@ -31,9 +31,9 @@ class Level:
|
||||
self._settings = settings
|
||||
self._preview_texture_name = preview_texture_name
|
||||
self._displayname = displayname
|
||||
self._campaign: Optional[weakref.ref[ba.Campaign]] = None
|
||||
self._index: Optional[int] = None
|
||||
self._score_version_string: Optional[str] = None
|
||||
self._campaign: weakref.ref[ba.Campaign] | None = None
|
||||
self._index: int | None = None
|
||||
self._score_version_string: str | None = None
|
||||
|
||||
def __repr__(self) -> str:
|
||||
cls = type(self)
|
||||
@ -78,7 +78,7 @@ class Level:
|
||||
return self._gametype
|
||||
|
||||
@property
|
||||
def campaign(self) -> Optional[ba.Campaign]:
|
||||
def campaign(self) -> ba.Campaign | None:
|
||||
"""The ba.Campaign this Level is associated with, or None."""
|
||||
return None if self._campaign is None else self._campaign()
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ from ba._generated.enums import SpecialChar, InputType
|
||||
from ba._profile import get_player_profile_colors
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, Any, Sequence, Union
|
||||
from typing import Any, Sequence
|
||||
import ba
|
||||
|
||||
MAX_QUICK_CHANGE_COUNT = 30
|
||||
@ -32,14 +32,12 @@ class JoinInfo:
|
||||
from ba._nodeactor import NodeActor
|
||||
from ba._general import WeakCall
|
||||
self._state = 0
|
||||
self._press_to_punch: Union[str,
|
||||
ba.Lstr] = ('C' if _ba.app.iircade_mode
|
||||
else _ba.charstr(
|
||||
SpecialChar.LEFT_BUTTON))
|
||||
self._press_to_bomb: Union[str,
|
||||
ba.Lstr] = ('B' if _ba.app.iircade_mode else
|
||||
self._press_to_punch: str | ba.Lstr = ('C' if _ba.app.iircade_mode else
|
||||
_ba.charstr(
|
||||
SpecialChar.RIGHT_BUTTON))
|
||||
SpecialChar.LEFT_BUTTON))
|
||||
self._press_to_bomb: str | ba.Lstr = ('B' if _ba.app.iircade_mode else
|
||||
_ba.charstr(
|
||||
SpecialChar.RIGHT_BUTTON))
|
||||
self._joinmsg = Lstr(resource='pressAnyButtonToJoinText')
|
||||
can_switch_teams = (len(lobby.sessionteams) > 1)
|
||||
|
||||
@ -150,12 +148,12 @@ class Chooser:
|
||||
self._sessionplayer = sessionplayer
|
||||
self._inited = False
|
||||
self._dead = False
|
||||
self._text_node: Optional[ba.Node] = None
|
||||
self._text_node: ba.Node | None = None
|
||||
self._profilename = ''
|
||||
self._profilenames: list[str] = []
|
||||
self._ready: bool = False
|
||||
self._character_names: list[str] = []
|
||||
self._last_change: Sequence[Union[float, int]] = (0, 0)
|
||||
self._last_change: Sequence[float | int] = (0, 0)
|
||||
self._profiles: dict[str, dict[str, Any]] = {}
|
||||
|
||||
app = _ba.app
|
||||
@ -318,7 +316,7 @@ class Chooser:
|
||||
raise NotFoundError('Lobby does not exist.')
|
||||
return lobby
|
||||
|
||||
def get_lobby(self) -> Optional[ba.Lobby]:
|
||||
def get_lobby(self) -> ba.Lobby | None:
|
||||
"""Return this chooser's lobby if it still exists; otherwise None."""
|
||||
return self._lobby()
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ from enum import Enum
|
||||
import _ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Sequence, Optional, Any
|
||||
from typing import Sequence, Any
|
||||
import ba
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ class PlayerDiedMessage:
|
||||
"""The particular type of death."""
|
||||
|
||||
def __init__(self, player: ba.Player, was_killed: bool,
|
||||
killerplayer: Optional[ba.Player], how: ba.DeathType):
|
||||
killerplayer: ba.Player | None, how: ba.DeathType):
|
||||
"""Instantiate a message with the given values."""
|
||||
|
||||
# Invalid refs should never be passed as args.
|
||||
@ -98,7 +98,7 @@ class PlayerDiedMessage:
|
||||
self.how = how
|
||||
|
||||
def getkillerplayer(self,
|
||||
playertype: type[PlayerType]) -> Optional[PlayerType]:
|
||||
playertype: type[PlayerType]) -> PlayerType | None:
|
||||
"""Return the ba.Player responsible for the killing, if any.
|
||||
|
||||
Pass the Player type being used by the current game.
|
||||
@ -267,8 +267,8 @@ class HitMessage:
|
||||
self.force_direction = (force_direction
|
||||
if force_direction is not None else velocity)
|
||||
|
||||
def get_source_player(
|
||||
self, playertype: type[PlayerType]) -> Optional[PlayerType]:
|
||||
def get_source_player(self,
|
||||
playertype: type[PlayerType]) -> PlayerType | None:
|
||||
"""Return the source-player if one exists and is the provided type."""
|
||||
player: Any = self._source_player
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ from ba._session import Session
|
||||
from ba._error import NotFoundError, print_error
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, Any, Sequence
|
||||
from typing import Any, Sequence
|
||||
import ba
|
||||
|
||||
DEFAULT_TEAM_COLORS = ((0.1, 0.25, 1.0), (1.0, 0.25, 0.2))
|
||||
@ -62,7 +62,7 @@ class MultiTeamSession(Session):
|
||||
|
||||
show_tutorial = cfg.get('Show Tutorial', True)
|
||||
|
||||
self._tutorial_activity_instance: Optional[ba.Activity]
|
||||
self._tutorial_activity_instance: ba.Activity | None
|
||||
if show_tutorial:
|
||||
from bastd.tutorial import TutorialActivity
|
||||
|
||||
@ -105,7 +105,7 @@ class MultiTeamSession(Session):
|
||||
shuffle=self._playlist_randomize)
|
||||
|
||||
# Get a game on deck ready to go.
|
||||
self._current_game_spec: Optional[dict[str, Any]] = None
|
||||
self._current_game_spec: dict[str, Any] | None = None
|
||||
self._next_game_spec: dict[str, Any] = self._playlist.pull_next()
|
||||
self._next_game: type[ba.GameActivity] = (
|
||||
self._next_game_spec['resolved_type'])
|
||||
@ -278,7 +278,7 @@ class ShuffleList:
|
||||
self.source_list = items
|
||||
self.shuffle = shuffle
|
||||
self.shuffle_list: list[dict[str, Any]] = []
|
||||
self.last_gotten: Optional[dict[str, Any]] = None
|
||||
self.last_gotten: dict[str, Any] | None = None
|
||||
|
||||
def pull_next(self) -> dict[str, Any]:
|
||||
"""Pull and return the next item on the shuffle-list."""
|
||||
|
||||
@ -11,7 +11,7 @@ from enum import Enum
|
||||
import _ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable, Any, Optional, Union
|
||||
from typing import Callable, Any
|
||||
import ba
|
||||
|
||||
|
||||
@ -127,11 +127,11 @@ class MusicSubsystem:
|
||||
|
||||
def __init__(self) -> None:
|
||||
# pylint: disable=cyclic-import
|
||||
self._music_node: Optional[_ba.Node] = None
|
||||
self._music_node: _ba.Node | None = None
|
||||
self._music_mode: MusicPlayMode = MusicPlayMode.REGULAR
|
||||
self._music_player: Optional[MusicPlayer] = None
|
||||
self._music_player_type: Optional[type[MusicPlayer]] = None
|
||||
self.music_types: dict[MusicPlayMode, Optional[MusicType]] = {
|
||||
self._music_player: MusicPlayer | None = None
|
||||
self._music_player_type: type[MusicPlayer] | None = None
|
||||
self.music_types: dict[MusicPlayMode, MusicType | None] = {
|
||||
MusicPlayMode.REGULAR: None,
|
||||
MusicPlayMode.TEST: None
|
||||
}
|
||||
@ -270,7 +270,7 @@ class MusicSubsystem:
|
||||
self.do_play_music(None)
|
||||
|
||||
def do_play_music(self,
|
||||
musictype: Union[MusicType, str, None],
|
||||
musictype: MusicType | str | None,
|
||||
continuous: bool = False,
|
||||
mode: MusicPlayMode = MusicPlayMode.REGULAR,
|
||||
testsoundtrack: dict[str, Any] = None) -> None:
|
||||
@ -352,7 +352,7 @@ class MusicSubsystem:
|
||||
# Do the thing.
|
||||
self.get_music_player().play(entry)
|
||||
|
||||
def _play_internal_music(self, musictype: Optional[MusicType]) -> None:
|
||||
def _play_internal_music(self, musictype: MusicType | None) -> None:
|
||||
|
||||
# Stop any existing music-player playback.
|
||||
if self._music_player is not None:
|
||||
@ -393,7 +393,7 @@ class MusicPlayer:
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._have_set_initial_volume = False
|
||||
self._entry_to_play: Optional[Any] = None
|
||||
self._entry_to_play: Any = None
|
||||
self._volume = 1.0
|
||||
self._actually_playing = False
|
||||
|
||||
@ -470,8 +470,7 @@ class MusicPlayer:
|
||||
self._actually_playing = False
|
||||
|
||||
|
||||
def setmusic(musictype: Optional[ba.MusicType],
|
||||
continuous: bool = False) -> None:
|
||||
def setmusic(musictype: ba.MusicType | None, continuous: bool = False) -> None:
|
||||
"""Set the app to play (or stop playing) a certain type of music.
|
||||
|
||||
category: **Gameplay Functions**
|
||||
|
||||
@ -12,9 +12,9 @@ from typing import TYPE_CHECKING
|
||||
import _ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Union, Callable, Optional
|
||||
from typing import Any, Callable
|
||||
import socket
|
||||
MasterServerCallback = Callable[[Union[None, dict[str, Any]]], None]
|
||||
MasterServerCallback = Callable[[None | dict[str, Any]], None]
|
||||
|
||||
# Timeout for standard functions talking to the master-server/etc.
|
||||
DEFAULT_REQUEST_TIMEOUT_SECONDS = 60
|
||||
@ -72,8 +72,8 @@ class MasterServerCallThread(threading.Thread):
|
||||
"""Thread to communicate with the master-server."""
|
||||
|
||||
def __init__(self, request: str, request_type: str,
|
||||
data: Optional[dict[str, Any]],
|
||||
callback: Optional[MasterServerCallback],
|
||||
data: dict[str, Any] | None,
|
||||
callback: MasterServerCallback | None,
|
||||
response_type: MasterServerResponseType):
|
||||
super().__init__()
|
||||
self._request = request
|
||||
@ -82,7 +82,7 @@ class MasterServerCallThread(threading.Thread):
|
||||
raise TypeError(f'Invalid response type: {response_type}')
|
||||
self._response_type = response_type
|
||||
self._data = {} if data is None else copy.deepcopy(data)
|
||||
self._callback: Optional[MasterServerCallback] = callback
|
||||
self._callback: MasterServerCallback | None = callback
|
||||
self._context = _ba.Context('current')
|
||||
|
||||
# Save and restore the context we were created from.
|
||||
@ -90,7 +90,7 @@ class MasterServerCallThread(threading.Thread):
|
||||
self._activity = weakref.ref(
|
||||
activity) if activity is not None else None
|
||||
|
||||
def _run_callback(self, arg: Union[None, dict[str, Any]]) -> None:
|
||||
def _run_callback(self, arg: None | dict[str, Any]) -> None:
|
||||
# If we were created in an activity context and that activity has
|
||||
# since died, do nothing.
|
||||
# FIXME: Should we just be using a ContextCall instead of doing
|
||||
@ -182,7 +182,7 @@ class MasterServerCallThread(threading.Thread):
|
||||
def master_server_get(
|
||||
request: str,
|
||||
data: dict[str, Any],
|
||||
callback: Optional[MasterServerCallback] = None,
|
||||
callback: MasterServerCallback | None = None,
|
||||
response_type: MasterServerResponseType = MasterServerResponseType.JSON
|
||||
) -> None:
|
||||
"""Make a call to the master server via a http GET."""
|
||||
@ -193,7 +193,7 @@ def master_server_get(
|
||||
def master_server_post(
|
||||
request: str,
|
||||
data: dict[str, Any],
|
||||
callback: Optional[MasterServerCallback] = None,
|
||||
callback: MasterServerCallback | None = None,
|
||||
response_type: MasterServerResponseType = MasterServerResponseType.JSON
|
||||
) -> None:
|
||||
"""Make a call to the master server via a http POST."""
|
||||
|
||||
@ -8,7 +8,7 @@ from typing import TYPE_CHECKING
|
||||
from dataclasses import dataclass
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Sequence, Optional
|
||||
from typing import Sequence
|
||||
import ba
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ class PowerupMessage:
|
||||
"""The type of powerup to be granted (a string).
|
||||
See ba.Powerup.poweruptype for available type values."""
|
||||
|
||||
sourcenode: Optional[ba.Node] = None
|
||||
sourcenode: ba.Node | None = None
|
||||
"""The node the powerup game from, or None otherwise.
|
||||
If a powerup is accepted, a ba.PowerupAcceptMessage should be sent
|
||||
back to the sourcenode to inform it of the fact. This will generally
|
||||
|
||||
@ -12,7 +12,7 @@ from ba._language import Lstr
|
||||
from ba._player import Player
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Sequence, Any, Optional
|
||||
from typing import Sequence, Any
|
||||
import ba
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ class Session:
|
||||
self._sessiondata = _ba.register_session(self)
|
||||
|
||||
# Should remove this if possible.
|
||||
self.tournament_id: Optional[str] = None
|
||||
self.tournament_id: str | None = None
|
||||
|
||||
self.sessionteams = []
|
||||
self.sessionplayers = []
|
||||
@ -144,16 +144,16 @@ class Session:
|
||||
self.customdata = {}
|
||||
self._in_set_activity = False
|
||||
self._next_team_id = 0
|
||||
self._activity_retained: Optional[ba.Activity] = None
|
||||
self._launch_end_session_activity_time: Optional[float] = None
|
||||
self._activity_end_timer: Optional[ba.Timer] = None
|
||||
self._activity_retained: ba.Activity | None = None
|
||||
self._launch_end_session_activity_time: float | None = None
|
||||
self._activity_end_timer: ba.Timer | None = None
|
||||
self._activity_weak = empty_weakref(Activity)
|
||||
self._next_activity: Optional[ba.Activity] = None
|
||||
self._next_activity: ba.Activity | None = None
|
||||
self._wants_to_end = False
|
||||
self._ending = False
|
||||
self._activity_should_end_immediately = False
|
||||
self._activity_should_end_immediately_results: (
|
||||
Optional[ba.GameResults]) = None
|
||||
self._activity_should_end_immediately_results: (ba.GameResults
|
||||
| None) = None
|
||||
self._activity_should_end_immediately_delay = 0.0
|
||||
|
||||
# Create static teams if we're using them.
|
||||
@ -285,7 +285,7 @@ class Session:
|
||||
self.sessionplayers.remove(sessionplayer)
|
||||
|
||||
def _remove_player_team(self, sessionteam: ba.SessionTeam,
|
||||
activity: Optional[ba.Activity]) -> None:
|
||||
activity: ba.Activity | None) -> None:
|
||||
"""Remove the player-specific team in non-teams mode."""
|
||||
|
||||
# They should have been the only one on their team.
|
||||
@ -481,7 +481,7 @@ class Session:
|
||||
timetype=TimeType.REAL)
|
||||
self._in_set_activity = False
|
||||
|
||||
def getactivity(self) -> Optional[ba.Activity]:
|
||||
def getactivity(self) -> ba.Activity | None:
|
||||
"""Return the current foreground activity for this session."""
|
||||
return self._activity_weak()
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ from ba._error import (print_exception, print_error, SessionTeamNotFoundError,
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import ba
|
||||
from typing import Any, Optional, Sequence, Union
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
@dataclass
|
||||
@ -49,12 +49,12 @@ class PlayerRecord:
|
||||
self.accum_kill_count = 0
|
||||
self.killed_count = 0
|
||||
self.accum_killed_count = 0
|
||||
self._multi_kill_timer: Optional[ba.Timer] = None
|
||||
self._multi_kill_timer: ba.Timer | None = None
|
||||
self._multi_kill_count = 0
|
||||
self._stats = weakref.ref(stats)
|
||||
self._last_sessionplayer: Optional[ba.SessionPlayer] = None
|
||||
self._sessionplayer: Optional[ba.SessionPlayer] = None
|
||||
self._sessionteam: Optional[weakref.ref[ba.SessionTeam]] = None
|
||||
self._last_sessionplayer: ba.SessionPlayer | None = None
|
||||
self._sessionplayer: ba.SessionPlayer | None = None
|
||||
self._sessionteam: weakref.ref[ba.SessionTeam] | None = None
|
||||
self.streak = 0
|
||||
self.associate_with_sessionplayer(sessionplayer)
|
||||
|
||||
@ -96,7 +96,7 @@ class PlayerRecord:
|
||||
"""Cancel any multi-kill timer for this player entry."""
|
||||
self._multi_kill_timer = None
|
||||
|
||||
def getactivity(self) -> Optional[ba.Activity]:
|
||||
def getactivity(self) -> ba.Activity | None:
|
||||
"""Return the ba.Activity this instance is currently associated with.
|
||||
|
||||
Returns None if the activity no longer exists."""
|
||||
@ -178,12 +178,12 @@ class PlayerRecord:
|
||||
|
||||
def _apply(name2: Lstr, score2: int, showpoints2: bool,
|
||||
color2: tuple[float, float, float, float], scale2: float,
|
||||
sound2: Optional[ba.Sound]) -> None:
|
||||
sound2: ba.Sound | None) -> None:
|
||||
from bastd.actor.popuptext import PopupText
|
||||
|
||||
# Only award this if they're still alive and we can get
|
||||
# a current position for them.
|
||||
our_pos: Optional[ba.Vec3] = None
|
||||
our_pos: ba.Vec3 | None = None
|
||||
if self._sessionplayer:
|
||||
if self._sessionplayer.activityplayer is not None:
|
||||
try:
|
||||
@ -233,14 +233,14 @@ class Stats:
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._activity: Optional[weakref.ref[ba.Activity]] = None
|
||||
self._activity: weakref.ref[ba.Activity] | None = None
|
||||
self._player_records: dict[str, PlayerRecord] = {}
|
||||
self.orchestrahitsound1: Optional[ba.Sound] = None
|
||||
self.orchestrahitsound2: Optional[ba.Sound] = None
|
||||
self.orchestrahitsound3: Optional[ba.Sound] = None
|
||||
self.orchestrahitsound4: Optional[ba.Sound] = None
|
||||
self.orchestrahitsound1: ba.Sound | None = None
|
||||
self.orchestrahitsound2: ba.Sound | None = None
|
||||
self.orchestrahitsound3: ba.Sound | None = None
|
||||
self.orchestrahitsound4: ba.Sound | None = None
|
||||
|
||||
def setactivity(self, activity: Optional[ba.Activity]) -> None:
|
||||
def setactivity(self, activity: ba.Activity | None) -> None:
|
||||
"""Set the current activity for this instance."""
|
||||
|
||||
self._activity = None if activity is None else weakref.ref(activity)
|
||||
@ -253,7 +253,7 @@ class Stats:
|
||||
with _ba.Context(activity):
|
||||
self._load_activity_media()
|
||||
|
||||
def getactivity(self) -> Optional[ba.Activity]:
|
||||
def getactivity(self) -> ba.Activity | None:
|
||||
"""Get the activity associated with this instance.
|
||||
|
||||
May return None.
|
||||
@ -319,7 +319,7 @@ class Stats:
|
||||
victim_player: ba.Player = None,
|
||||
scale: float = 1.0,
|
||||
color: Sequence[float] = None,
|
||||
title: Union[str, ba.Lstr] = None,
|
||||
title: str | ba.Lstr | None = None,
|
||||
screenmessage: bool = True,
|
||||
display: bool = True,
|
||||
importance: int = 1,
|
||||
|
||||
@ -9,7 +9,7 @@ from typing import TYPE_CHECKING
|
||||
import _ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, Any
|
||||
from typing import Any
|
||||
import ba
|
||||
|
||||
|
||||
@ -434,7 +434,7 @@ def _calc_count_for_tab(tabval: list[dict[str, Any]], our_tickets: int,
|
||||
return count
|
||||
|
||||
|
||||
def get_available_sale_time(tab: str) -> Optional[int]:
|
||||
def get_available_sale_time(tab: str) -> int | None:
|
||||
"""(internal)"""
|
||||
# pylint: disable=too-many-branches
|
||||
# pylint: disable=too-many-nested-blocks
|
||||
@ -443,7 +443,7 @@ def get_available_sale_time(tab: str) -> Optional[int]:
|
||||
import datetime
|
||||
from ba._generated.enums import TimeType, TimeFormat
|
||||
app = _ba.app
|
||||
sale_times: list[Optional[int]] = []
|
||||
sale_times: list[int | None] = []
|
||||
|
||||
# Calc time for our pro sale (old special case).
|
||||
if tab == 'extras':
|
||||
@ -475,7 +475,7 @@ def get_available_sale_time(tab: str) -> Optional[int]:
|
||||
return None
|
||||
|
||||
assert app.pro_sale_start_val is not None
|
||||
val: Optional[int] = max(
|
||||
val: int | None = max(
|
||||
0, app.pro_sale_start_val -
|
||||
(_ba.time(TimeType.REAL, TimeFormat.MILLISECONDS) -
|
||||
app.pro_sale_start_time))
|
||||
|
||||
@ -10,7 +10,7 @@ from typing import TYPE_CHECKING, TypeVar, Generic
|
||||
from ba._error import print_exception
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Sequence, Union, Optional
|
||||
from typing import Sequence
|
||||
import ba
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ class SessionTeam:
|
||||
|
||||
# Annotate our attr types at the class level so they're introspectable.
|
||||
|
||||
name: Union[ba.Lstr, str]
|
||||
name: ba.Lstr | str
|
||||
"""The team's name."""
|
||||
|
||||
color: tuple[float, ...] # FIXME: can't we make this fixed len?
|
||||
@ -46,7 +46,7 @@ class SessionTeam:
|
||||
|
||||
def __init__(self,
|
||||
team_id: int = 0,
|
||||
name: Union[ba.Lstr, str] = '',
|
||||
name: ba.Lstr | str = '',
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0)):
|
||||
"""Instantiate a ba.SessionTeam.
|
||||
|
||||
@ -59,7 +59,7 @@ class SessionTeam:
|
||||
self.color = tuple(color)
|
||||
self.players = []
|
||||
self.customdata = {}
|
||||
self.activityteam: Optional[Team] = None
|
||||
self.activityteam: Team | None = None
|
||||
|
||||
def leave(self) -> None:
|
||||
"""(internal)"""
|
||||
@ -84,7 +84,7 @@ class Team(Generic[PlayerType]):
|
||||
# that types are introspectable (these are still instance attrs).
|
||||
players: list[PlayerType]
|
||||
id: int
|
||||
name: Union[ba.Lstr, str]
|
||||
name: ba.Lstr | str
|
||||
color: tuple[float, ...] # FIXME: can't we make this fixed length?
|
||||
_sessionteam: weakref.ref[SessionTeam]
|
||||
_expired: bool
|
||||
@ -120,7 +120,7 @@ class Team(Generic[PlayerType]):
|
||||
self._expired = False
|
||||
self._postinited = True
|
||||
|
||||
def manual_init(self, team_id: int, name: Union[ba.Lstr, str],
|
||||
def manual_init(self, team_id: int, name: ba.Lstr | str,
|
||||
color: tuple[float, ...]) -> None:
|
||||
"""Manually init a team for uses such as bots."""
|
||||
self.id = team_id
|
||||
|
||||
@ -9,7 +9,7 @@ import os
|
||||
import _ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, Sequence
|
||||
from typing import Sequence
|
||||
|
||||
|
||||
def get_human_readable_user_scripts_path() -> str:
|
||||
@ -19,7 +19,7 @@ def get_human_readable_user_scripts_path() -> str:
|
||||
"""
|
||||
from ba import _language
|
||||
app = _ba.app
|
||||
path: Optional[str] = app.python_directory_user
|
||||
path: str | None = app.python_directory_user
|
||||
if path is None:
|
||||
return '<Not Available>'
|
||||
|
||||
@ -27,7 +27,7 @@ def get_human_readable_user_scripts_path() -> str:
|
||||
# only visible to the user's processes and thus not really useful printed
|
||||
# in its entirety; lets print it as <External Storage>/myfilepath.
|
||||
if app.platform == 'android':
|
||||
ext_storage_path: Optional[str] = (
|
||||
ext_storage_path: str | None = (
|
||||
_ba.android_get_external_storage_path())
|
||||
if (ext_storage_path is not None
|
||||
and app.python_directory_user.startswith(ext_storage_path)):
|
||||
@ -70,7 +70,7 @@ def show_user_scripts() -> None:
|
||||
# they can see it.
|
||||
if app.platform == 'android':
|
||||
try:
|
||||
usd: Optional[str] = app.python_directory_user
|
||||
usd: str | None = app.python_directory_user
|
||||
if usd is not None and os.path.isdir(usd):
|
||||
file_name = usd + '/about_this_folder.txt'
|
||||
with open(file_name, 'w', encoding='utf-8') as outfile:
|
||||
|
||||
@ -12,7 +12,7 @@ import _ba
|
||||
from ba._music import MusicPlayer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable, Any, Union, Optional
|
||||
from typing import Callable, Any
|
||||
|
||||
|
||||
class OSMusicPlayer(MusicPlayer):
|
||||
@ -60,8 +60,8 @@ class OSMusicPlayer(MusicPlayer):
|
||||
self._on_play_folder_cb).start()
|
||||
|
||||
def _on_play_folder_cb(self,
|
||||
result: Union[str, list[str]],
|
||||
error: Optional[str] = None) -> None:
|
||||
result: str | list[str],
|
||||
error: str | None = None) -> None:
|
||||
from ba import _language
|
||||
if error is not None:
|
||||
rstr = (_language.Lstr(
|
||||
@ -95,8 +95,7 @@ class OSMusicPlayer(MusicPlayer):
|
||||
class _PickFolderSongThread(threading.Thread):
|
||||
|
||||
def __init__(self, path: str, valid_extensions: list[str],
|
||||
callback: Callable[[Union[str, list[str]], Optional[str]],
|
||||
None]):
|
||||
callback: Callable[[str | list[str], str | None], None]):
|
||||
super().__init__()
|
||||
self._valid_extensions = valid_extensions
|
||||
self._callback = callback
|
||||
|
||||
@ -11,7 +11,7 @@ import ba
|
||||
from ba.internal import JoinActivity
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Sequence, Union
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class CoopJoinActivity(JoinActivity):
|
||||
@ -54,7 +54,7 @@ class CoopJoinActivity(JoinActivity):
|
||||
ControlsGuide(delay=1.0).autoretain()
|
||||
|
||||
def _on_got_scores_to_beat(self,
|
||||
scores: Optional[list[dict[str, Any]]]) -> None:
|
||||
scores: list[dict[str, Any]] | None) -> None:
|
||||
# pylint: disable=too-many-locals
|
||||
# pylint: disable=too-many-statements
|
||||
from efro.util import asserttype
|
||||
@ -87,7 +87,7 @@ class CoopJoinActivity(JoinActivity):
|
||||
delay_inc = 0.1
|
||||
|
||||
def _add_t(
|
||||
text: Union[str, ba.Lstr],
|
||||
text: str | ba.Lstr,
|
||||
h_offs: float = 0.0,
|
||||
scale: float = 1.0,
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0, 0.46)
|
||||
|
||||
@ -14,7 +14,7 @@ from bastd.actor.text import Text
|
||||
from bastd.actor.zoomtext import ZoomText
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, Any, Sequence
|
||||
from typing import Any, Sequence
|
||||
from bastd.ui.store.button import StoreButton
|
||||
from bastd.ui.league.rankbutton import LeagueRankButton
|
||||
|
||||
@ -56,9 +56,9 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
|
||||
if _ba.get_v1_account_state() == 'signed_in' else
|
||||
None)
|
||||
|
||||
self._game_service_icon_color: Optional[Sequence[float]]
|
||||
self._game_service_achievements_texture: Optional[ba.Texture]
|
||||
self._game_service_leaderboards_texture: Optional[ba.Texture]
|
||||
self._game_service_icon_color: Sequence[float] | None
|
||||
self._game_service_achievements_texture: ba.Texture | None
|
||||
self._game_service_leaderboards_texture: ba.Texture | None
|
||||
|
||||
with ba.Context('ui'):
|
||||
if self._account_type == 'Game Center':
|
||||
@ -89,53 +89,53 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
|
||||
self._cashregistersound = ba.getsound('cashRegister')
|
||||
self._gun_cocking_sound = ba.getsound('gunCocking')
|
||||
self._dingsound = ba.getsound('ding')
|
||||
self._score_link: Optional[str] = None
|
||||
self._root_ui: Optional[ba.Widget] = None
|
||||
self._background: Optional[ba.Actor] = None
|
||||
self._score_link: str | None = None
|
||||
self._root_ui: ba.Widget | None = None
|
||||
self._background: ba.Actor | None = None
|
||||
self._old_best_rank = 0.0
|
||||
self._game_name_str: Optional[str] = None
|
||||
self._game_config_str: Optional[str] = None
|
||||
self._game_name_str: str | None = None
|
||||
self._game_config_str: str | None = None
|
||||
|
||||
# Ui bits.
|
||||
self._corner_button_offs: Optional[tuple[float, float]] = None
|
||||
self._league_rank_button: Optional[LeagueRankButton] = None
|
||||
self._store_button_instance: Optional[StoreButton] = None
|
||||
self._restart_button: Optional[ba.Widget] = None
|
||||
self._update_corner_button_positions_timer: Optional[ba.Timer] = None
|
||||
self._next_level_error: Optional[ba.Actor] = None
|
||||
self._corner_button_offs: tuple[float, float] | None = None
|
||||
self._league_rank_button: LeagueRankButton | None = None
|
||||
self._store_button_instance: StoreButton | None = None
|
||||
self._restart_button: ba.Widget | None = None
|
||||
self._update_corner_button_positions_timer: ba.Timer | None = None
|
||||
self._next_level_error: ba.Actor | None = None
|
||||
|
||||
# Score/gameplay bits.
|
||||
self._was_complete: Optional[bool] = None
|
||||
self._is_complete: Optional[bool] = None
|
||||
self._newly_complete: Optional[bool] = None
|
||||
self._is_more_levels: Optional[bool] = None
|
||||
self._next_level_name: Optional[str] = None
|
||||
self._show_friend_scores: Optional[bool] = None
|
||||
self._show_info: Optional[dict[str, Any]] = None
|
||||
self._name_str: Optional[str] = None
|
||||
self._friends_loading_status: Optional[ba.Actor] = None
|
||||
self._score_loading_status: Optional[ba.Actor] = None
|
||||
self._tournament_time_remaining: Optional[float] = None
|
||||
self._tournament_time_remaining_text: Optional[Text] = None
|
||||
self._tournament_time_remaining_text_timer: Optional[ba.Timer] = None
|
||||
self._was_complete: bool | None = None
|
||||
self._is_complete: bool | None = None
|
||||
self._newly_complete: bool | None = None
|
||||
self._is_more_levels: bool | None = None
|
||||
self._next_level_name: str | None = None
|
||||
self._show_friend_scores: bool | None = None
|
||||
self._show_info: dict[str, Any] | None = None
|
||||
self._name_str: str | None = None
|
||||
self._friends_loading_status: ba.Actor | None = None
|
||||
self._score_loading_status: ba.Actor | None = None
|
||||
self._tournament_time_remaining: float | None = None
|
||||
self._tournament_time_remaining_text: Text | None = None
|
||||
self._tournament_time_remaining_text_timer: ba.Timer | None = None
|
||||
|
||||
# Stuff for activity skip by pressing button
|
||||
self._birth_time = ba.time()
|
||||
self._min_view_time = 5.0
|
||||
self._allow_server_transition = False
|
||||
self._server_transitioning: Optional[bool] = None
|
||||
self._server_transitioning: bool | None = None
|
||||
|
||||
self._playerinfos: list[ba.PlayerInfo] = settings['playerinfos']
|
||||
assert isinstance(self._playerinfos, list)
|
||||
assert (isinstance(i, ba.PlayerInfo) for i in self._playerinfos)
|
||||
|
||||
self._score: Optional[int] = settings['score']
|
||||
self._score: int | None = settings['score']
|
||||
assert isinstance(self._score, (int, type(None)))
|
||||
|
||||
self._fail_message: Optional[ba.Lstr] = settings['fail_message']
|
||||
self._fail_message: ba.Lstr | None = settings['fail_message']
|
||||
assert isinstance(self._fail_message, (ba.Lstr, type(None)))
|
||||
|
||||
self._begin_time: Optional[float] = None
|
||||
self._begin_time: float | None = None
|
||||
|
||||
self._score_order: str
|
||||
if 'score_order' in settings:
|
||||
@ -410,7 +410,7 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
|
||||
texture=self._replay_icon_texture,
|
||||
opacity=0.8)
|
||||
|
||||
next_button: Optional[ba.Widget] = None
|
||||
next_button: ba.Widget | None = None
|
||||
|
||||
# Our 'next' button is disabled if we haven't unlocked the next
|
||||
# level yet and invisible if there is none.
|
||||
@ -702,7 +702,7 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
|
||||
str(len(self._playerinfos)) + ' Player', [])
|
||||
|
||||
if self._score is not None:
|
||||
our_score: Optional[list] = [
|
||||
our_score: list | None = [
|
||||
self._score, {
|
||||
'players': [{
|
||||
'name': p.name,
|
||||
@ -931,7 +931,7 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
|
||||
'loop': False
|
||||
})).autoretain()
|
||||
|
||||
def _got_friend_score_results(self, results: Optional[list[Any]]) -> None:
|
||||
def _got_friend_score_results(self, results: list[Any] | None) -> None:
|
||||
|
||||
# FIXME: tidy this up
|
||||
# pylint: disable=too-many-locals
|
||||
@ -1046,7 +1046,7 @@ class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
|
||||
transition=Text.Transition.IN_RIGHT,
|
||||
transition_delay=tdelay2).autoretain()
|
||||
|
||||
def _got_score_results(self, results: Optional[dict[str, Any]]) -> None:
|
||||
def _got_score_results(self, results: dict[str, Any] | None) -> None:
|
||||
|
||||
# FIXME: tidy this up
|
||||
# pylint: disable=too-many-locals
|
||||
|
||||
@ -10,7 +10,7 @@ import ba
|
||||
from bastd.activity.multiteamscore import MultiTeamScoreScreenActivity
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
|
||||
class FreeForAllVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
||||
@ -236,7 +236,7 @@ class FreeForAllVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
||||
transtime2: ts_h_offs + (xval - slide_amt) * scale
|
||||
}))
|
||||
|
||||
def _safesetattr(node: Optional[ba.Node], attr: str,
|
||||
def _safesetattr(node: ba.Node | None, attr: str,
|
||||
value: Any) -> None:
|
||||
if node:
|
||||
setattr(node, attr, value)
|
||||
@ -259,7 +259,7 @@ class FreeForAllVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
||||
self._score_display_sound_small))
|
||||
v_offs -= spacing
|
||||
|
||||
def _safe_animate(self, node: Optional[ba.Node], attr: str,
|
||||
def _safe_animate(self, node: ba.Node | None, attr: str,
|
||||
keys: dict[float, float]) -> None:
|
||||
"""Run an animation on a node if the node still exists."""
|
||||
if node:
|
||||
|
||||
@ -11,7 +11,7 @@ from ba.internal import JoinActivity
|
||||
from bastd.actor.text import Text
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional
|
||||
pass
|
||||
|
||||
|
||||
class MultiTeamJoinActivity(JoinActivity):
|
||||
@ -19,7 +19,7 @@ class MultiTeamJoinActivity(JoinActivity):
|
||||
|
||||
def __init__(self, settings: dict):
|
||||
super().__init__(settings)
|
||||
self._next_up_text: Optional[Text] = None
|
||||
self._next_up_text: Text | None = None
|
||||
|
||||
def on_transition_in(self) -> None:
|
||||
from bastd.actor.controlsguide import ControlsGuide
|
||||
|
||||
@ -11,7 +11,7 @@ from bastd.actor.text import Text
|
||||
from bastd.actor.image import Image
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, Union
|
||||
pass
|
||||
|
||||
|
||||
class MultiTeamScoreScreenActivity(ScoreScreenActivity):
|
||||
@ -52,7 +52,7 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
|
||||
|
||||
def show_player_scores(self,
|
||||
delay: float = 2.5,
|
||||
results: Optional[ba.GameResults] = None,
|
||||
results: ba.GameResults | None = None,
|
||||
scale: float = 1.0,
|
||||
x_offset: float = 0.0,
|
||||
y_offset: float = 0.0) -> None:
|
||||
@ -67,7 +67,7 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
|
||||
|
||||
is_free_for_all = isinstance(self.session, ba.FreeForAllSession)
|
||||
|
||||
def _get_prec_score(p_rec: ba.PlayerRecord) -> Optional[int]:
|
||||
def _get_prec_score(p_rec: ba.PlayerRecord) -> int | None:
|
||||
if is_free_for_all and results is not None:
|
||||
assert isinstance(results, ba.GameResults)
|
||||
assert p_rec.team.activityteam is not None
|
||||
@ -75,7 +75,7 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
|
||||
return val
|
||||
return p_rec.accumscore
|
||||
|
||||
def _get_prec_score_str(p_rec: ba.PlayerRecord) -> Union[str, ba.Lstr]:
|
||||
def _get_prec_score_str(p_rec: ba.PlayerRecord) -> str | ba.Lstr:
|
||||
if is_free_for_all and results is not None:
|
||||
assert isinstance(results, ba.GameResults)
|
||||
assert p_rec.team.activityteam is not None
|
||||
@ -96,7 +96,7 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
def _get_player_score_set_entry(
|
||||
player: ba.SessionPlayer) -> Optional[ba.PlayerRecord]:
|
||||
player: ba.SessionPlayer) -> ba.PlayerRecord | None:
|
||||
for p_rec in valid_players:
|
||||
if p_rec[1].player is player:
|
||||
return p_rec[1]
|
||||
@ -129,7 +129,7 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
|
||||
text: ba.Lstr,
|
||||
h_align: Text.HAlign = Text.HAlign.RIGHT,
|
||||
extrascale: float = 1.0,
|
||||
maxwidth: Optional[float] = 120.0) -> None:
|
||||
maxwidth: float | None = 120.0) -> None:
|
||||
Text(text,
|
||||
color=(0.5, 0.5, 0.6, 0.5),
|
||||
position=(ts_h_offs + xoffs * scale,
|
||||
@ -169,7 +169,7 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
|
||||
topkillcount = max(topkillcount, prec.accum_kill_count)
|
||||
topkilledcount = min(topkilledcount, prec.accum_killed_count)
|
||||
|
||||
def _scoretxt(text: Union[str, ba.Lstr],
|
||||
def _scoretxt(text: str | ba.Lstr,
|
||||
x_offs: float,
|
||||
highlight: bool,
|
||||
delay2: float,
|
||||
|
||||
@ -10,7 +10,7 @@ import ba
|
||||
from bastd.activity.multiteamscore import MultiTeamScoreScreenActivity
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional
|
||||
pass
|
||||
|
||||
|
||||
class TeamSeriesVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
||||
@ -146,8 +146,8 @@ class TeamSeriesVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
||||
else:
|
||||
v_extra = 0
|
||||
|
||||
mvp: Optional[ba.PlayerRecord] = None
|
||||
mvp_name: Optional[str] = None
|
||||
mvp: ba.PlayerRecord | None = None
|
||||
mvp_name: str | None = None
|
||||
|
||||
# Show game MVP.
|
||||
if not self._is_ffa:
|
||||
|
||||
@ -14,7 +14,7 @@ import ba
|
||||
from bastd.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Optional, Callable
|
||||
from typing import Any, Sequence, Callable
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
PlayerType = TypeVar('PlayerType', bound='ba.Player')
|
||||
@ -678,7 +678,7 @@ class Bomb(ba.Actor):
|
||||
self._exploded = False
|
||||
self.scale = bomb_scale
|
||||
|
||||
self.texture_sequence: Optional[ba.Node] = None
|
||||
self.texture_sequence: ba.Node | None = None
|
||||
|
||||
if self.bomb_type == 'sticky':
|
||||
self._last_sticky_sound_time = 0.0
|
||||
@ -846,8 +846,8 @@ class Bomb(ba.Actor):
|
||||
0.26: self.scale
|
||||
})
|
||||
|
||||
def get_source_player(
|
||||
self, playertype: type[PlayerType]) -> Optional[PlayerType]:
|
||||
def get_source_player(self,
|
||||
playertype: type[PlayerType]) -> PlayerType | None:
|
||||
"""Return the source-player if one exists and is the provided type."""
|
||||
player: Any = self._source_player
|
||||
return (player if isinstance(player, playertype) and player.exists()
|
||||
@ -1071,7 +1071,7 @@ class TNTSpawner:
|
||||
def __init__(self, position: Sequence[float], respawn_time: float = 20.0):
|
||||
"""Instantiate with given position and respawn_time (in seconds)."""
|
||||
self._position = position
|
||||
self._tnt: Optional[Bomb] = None
|
||||
self._tnt: Bomb | None = None
|
||||
self._respawn_time = random.uniform(0.8, 1.2) * respawn_time
|
||||
self._wait_time = 0.0
|
||||
self._update()
|
||||
|
||||
@ -10,7 +10,7 @@ import _ba
|
||||
import ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Sequence, Union
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class ControlsGuide(ba.Actor):
|
||||
@ -52,13 +52,13 @@ class ControlsGuide(ba.Actor):
|
||||
self._lifespan = lifespan
|
||||
self._dead = False
|
||||
self._bright = bright
|
||||
self._cancel_timer: Optional[ba.Timer] = None
|
||||
self._fade_in_timer: Optional[ba.Timer] = None
|
||||
self._update_timer: Optional[ba.Timer] = None
|
||||
self._title_text: Optional[ba.Node]
|
||||
self._cancel_timer: ba.Timer | None = None
|
||||
self._fade_in_timer: ba.Timer | None = None
|
||||
self._update_timer: ba.Timer | None = None
|
||||
self._title_text: ba.Node | None
|
||||
clr: Sequence[float]
|
||||
extra_pos_1: Optional[tuple[float, float]]
|
||||
extra_pos_2: Optional[tuple[float, float]]
|
||||
extra_pos_1: tuple[float, float] | None
|
||||
extra_pos_2: tuple[float, float] | None
|
||||
if ba.app.iircade_mode:
|
||||
xtweak = 0.2
|
||||
ytweak = 0.2
|
||||
@ -238,7 +238,7 @@ class ControlsGuide(ba.Actor):
|
||||
})
|
||||
|
||||
if extra_pos_1 is not None:
|
||||
self._extra_image_1: Optional[ba.Node] = ba.newnode(
|
||||
self._extra_image_1: ba.Node | None = ba.newnode(
|
||||
'image',
|
||||
attrs={
|
||||
'texture': ba.gettexture('nub'),
|
||||
@ -252,7 +252,7 @@ class ControlsGuide(ba.Actor):
|
||||
else:
|
||||
self._extra_image_1 = None
|
||||
if extra_pos_2 is not None:
|
||||
self._extra_image_2: Optional[ba.Node] = ba.newnode(
|
||||
self._extra_image_2: ba.Node | None = ba.newnode(
|
||||
'image',
|
||||
attrs={
|
||||
'texture': ba.gettexture('nub'),
|
||||
@ -317,8 +317,9 @@ class ControlsGuide(ba.Actor):
|
||||
# an input device that is *not* the touchscreen.
|
||||
# (otherwise it is confusing to see the touchscreen buttons right
|
||||
# next to our display buttons)
|
||||
touchscreen: Optional[ba.InputDevice] = _ba.getinputdevice(
|
||||
'TouchScreen', '#1', doraise=False)
|
||||
touchscreen: ba.InputDevice | None = _ba.getinputdevice('TouchScreen',
|
||||
'#1',
|
||||
doraise=False)
|
||||
|
||||
if touchscreen is not None:
|
||||
# We look at the session's players; not the activity's.
|
||||
@ -477,7 +478,7 @@ class ControlsGuide(ba.Actor):
|
||||
pickup_button_names.clear()
|
||||
|
||||
self._run_text.text = run_text
|
||||
w_text: Union[ba.Lstr, str]
|
||||
w_text: ba.Lstr | str
|
||||
if only_remote and self._lifespan is None:
|
||||
w_text = ba.Lstr(resource='fireTVRemoteWarningText',
|
||||
subs=[('${REMOTE_APP_NAME}',
|
||||
|
||||
@ -11,7 +11,7 @@ import ba
|
||||
from bastd.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Optional
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class FlagFactory:
|
||||
@ -185,7 +185,7 @@ class Flag(ba.Actor):
|
||||
|
||||
super().__init__()
|
||||
|
||||
self._initial_position: Optional[Sequence[float]] = None
|
||||
self._initial_position: Sequence[float] | None = None
|
||||
self._has_moved = False
|
||||
shared = SharedObjects.get()
|
||||
factory = FlagFactory.get()
|
||||
@ -214,7 +214,7 @@ class Flag(ba.Actor):
|
||||
if dropped_timeout is not None:
|
||||
dropped_timeout = int(dropped_timeout)
|
||||
self._dropped_timeout = dropped_timeout
|
||||
self._counter: Optional[ba.Node]
|
||||
self._counter: ba.Node | None
|
||||
if self._dropped_timeout is not None:
|
||||
self._count = self._dropped_timeout
|
||||
self._tick_timer = ba.Timer(1.0,
|
||||
@ -234,8 +234,8 @@ class Flag(ba.Actor):
|
||||
self._counter = None
|
||||
|
||||
self._held_count = 0
|
||||
self._score_text: Optional[ba.Node] = None
|
||||
self._score_text_hide_timer: Optional[ba.Timer] = None
|
||||
self._score_text: ba.Node | None = None
|
||||
self._score_text_hide_timer: ba.Timer | None = None
|
||||
|
||||
def _tick(self) -> None:
|
||||
if self.node:
|
||||
|
||||
@ -10,7 +10,7 @@ from typing import TYPE_CHECKING
|
||||
import ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Union, Optional
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class Image(ba.Actor):
|
||||
@ -33,9 +33,9 @@ class Image(ba.Actor):
|
||||
BOTTOM_CENTER = 'bottomCenter'
|
||||
|
||||
def __init__(self,
|
||||
texture: Union[ba.Texture, dict[str, Any]],
|
||||
texture: ba.Texture | dict[str, Any],
|
||||
position: tuple[float, float] = (0, 0),
|
||||
transition: Optional[Transition] = None,
|
||||
transition: Transition | None = None,
|
||||
transition_delay: float = 0.0,
|
||||
attach: Attach = Attach.CENTER,
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0, 1.0),
|
||||
@ -53,7 +53,7 @@ class Image(ba.Actor):
|
||||
|
||||
# If they provided a dict as texture, assume its an icon.
|
||||
# otherwise its just a texture value itself.
|
||||
mask_texture: Optional[ba.Texture]
|
||||
mask_texture: ba.Texture | None
|
||||
if isinstance(texture, dict):
|
||||
tint_color = texture['tint_color']
|
||||
tint2_color = texture['tint2_color']
|
||||
|
||||
@ -9,7 +9,7 @@ from typing import TYPE_CHECKING
|
||||
import ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Callable, Optional
|
||||
from typing import Any, Callable
|
||||
|
||||
|
||||
class OnScreenCountdown(ba.Actor):
|
||||
@ -57,7 +57,7 @@ class OnScreenCountdown(ba.Actor):
|
||||
2: ba.getsound('announceTwo'),
|
||||
1: ba.getsound('announceOne')
|
||||
}
|
||||
self._timer: Optional[ba.Timer] = None
|
||||
self._timer: ba.Timer | None = None
|
||||
|
||||
def start(self) -> None:
|
||||
"""Start the timer."""
|
||||
|
||||
@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, overload
|
||||
import ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, Union, Any, Literal
|
||||
from typing import Any, Literal
|
||||
|
||||
|
||||
class OnScreenTimer(ba.Actor):
|
||||
@ -21,7 +21,7 @@ class OnScreenTimer(ba.Actor):
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self._starttime_ms: Optional[int] = None
|
||||
self._starttime_ms: int | None = None
|
||||
self.node = ba.newnode('text',
|
||||
attrs={
|
||||
'v_attach': 'top',
|
||||
@ -55,7 +55,7 @@ class OnScreenTimer(ba.Actor):
|
||||
return self._starttime_ms is not None
|
||||
|
||||
def stop(self,
|
||||
endtime: Union[int, float] = None,
|
||||
endtime: int | float | None = None,
|
||||
timeformat: ba.TimeFormat = ba.TimeFormat.SECONDS) -> None:
|
||||
"""End the timer.
|
||||
|
||||
@ -96,9 +96,8 @@ class OnScreenTimer(ba.Actor):
|
||||
...
|
||||
|
||||
def getstarttime(
|
||||
self,
|
||||
timeformat: ba.TimeFormat = ba.TimeFormat.SECONDS
|
||||
) -> Union[int, float]:
|
||||
self,
|
||||
timeformat: ba.TimeFormat = ba.TimeFormat.SECONDS) -> int | float:
|
||||
"""Return the sim-time when start() was called.
|
||||
|
||||
Time will be returned in seconds if timeformat is SECONDS or
|
||||
|
||||
@ -10,7 +10,7 @@ import ba
|
||||
from bastd.actor.spaz import Spaz
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Optional, Literal
|
||||
from typing import Any, Sequence, Literal
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
PlayerType = TypeVar('PlayerType', bound=ba.Player)
|
||||
@ -63,11 +63,11 @@ class PlayerSpaz(Spaz):
|
||||
source_player=player,
|
||||
start_invincible=True,
|
||||
powerups_expire=powerups_expire)
|
||||
self.last_player_attacked_by: Optional[ba.Player] = None
|
||||
self.last_player_attacked_by: ba.Player | None = None
|
||||
self.last_attacked_time = 0.0
|
||||
self.last_attacked_type: Optional[tuple[str, str]] = None
|
||||
self.last_attacked_type: tuple[str, str] | None = None
|
||||
self.held_count = 0
|
||||
self.last_player_held_by: Optional[ba.Player] = None
|
||||
self.last_player_held_by: ba.Player | None = None
|
||||
self._player = player
|
||||
self._drive_player_position()
|
||||
|
||||
@ -76,7 +76,7 @@ class PlayerSpaz(Spaz):
|
||||
@overload
|
||||
def getplayer(self,
|
||||
playertype: type[PlayerType],
|
||||
doraise: Literal[False] = False) -> Optional[PlayerType]:
|
||||
doraise: Literal[False] = False) -> PlayerType | None:
|
||||
...
|
||||
|
||||
@overload
|
||||
@ -86,7 +86,7 @@ class PlayerSpaz(Spaz):
|
||||
|
||||
def getplayer(self,
|
||||
playertype: type[PlayerType],
|
||||
doraise: bool = False) -> Optional[PlayerType]:
|
||||
doraise: bool = False) -> PlayerType | None:
|
||||
"""Get the ba.Player associated with this Spaz.
|
||||
|
||||
By default this will return None if the Player no longer exists.
|
||||
|
||||
@ -11,7 +11,7 @@ import ba
|
||||
from bastd.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Sequence
|
||||
from typing import Any, Sequence
|
||||
|
||||
DEFAULT_POWERUP_INTERVAL = 8.0
|
||||
|
||||
@ -88,7 +88,7 @@ class PowerupBoxFactory:
|
||||
"""
|
||||
from ba.internal import get_default_powerup_distribution
|
||||
shared = SharedObjects.get()
|
||||
self._lastpoweruptype: Optional[str] = None
|
||||
self._lastpoweruptype: str | None = None
|
||||
self.model = ba.getmodel('powerup')
|
||||
self.model_simple = ba.getmodel('powerupSimple')
|
||||
self.tex_bomb = ba.gettexture('powerupBomb')
|
||||
|
||||
@ -10,7 +10,7 @@ from typing import TYPE_CHECKING
|
||||
import ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional
|
||||
pass
|
||||
|
||||
|
||||
class RespawnIcon:
|
||||
@ -49,7 +49,7 @@ class RespawnIcon:
|
||||
texture = icon['texture']
|
||||
h_offs = -10
|
||||
ipos = (-40 - h_offs if on_right else 40 + h_offs, -180 + offs)
|
||||
self._image: Optional[ba.NodeActor] = ba.NodeActor(
|
||||
self._image: ba.NodeActor | None = ba.NodeActor(
|
||||
ba.newnode('image',
|
||||
attrs={
|
||||
'texture': texture,
|
||||
@ -68,7 +68,7 @@ class RespawnIcon:
|
||||
ba.animate(self._image.node, 'opacity', {0.0: 0, 0.2: 0.7})
|
||||
|
||||
npos = (-40 - h_offs if on_right else 40 + h_offs, -205 + 49 + offs)
|
||||
self._name: Optional[ba.NodeActor] = ba.NodeActor(
|
||||
self._name: ba.NodeActor | None = ba.NodeActor(
|
||||
ba.newnode('text',
|
||||
attrs={
|
||||
'v_attach': 'top',
|
||||
@ -88,7 +88,7 @@ class RespawnIcon:
|
||||
ba.animate(self._name.node, 'scale', {0: 0, 0.1: 0.5})
|
||||
|
||||
tpos = (-60 - h_offs if on_right else 60 + h_offs, -192 + offs)
|
||||
self._text: Optional[ba.NodeActor] = ba.NodeActor(
|
||||
self._text: ba.NodeActor | None = ba.NodeActor(
|
||||
ba.newnode('text',
|
||||
attrs={
|
||||
'position': tpos,
|
||||
@ -107,9 +107,9 @@ class RespawnIcon:
|
||||
|
||||
self._respawn_time = ba.time() + respawn_time
|
||||
self._update()
|
||||
self._timer: Optional[ba.Timer] = ba.Timer(1.0,
|
||||
ba.WeakCall(self._update),
|
||||
repeat=True)
|
||||
self._timer: ba.Timer | None = ba.Timer(1.0,
|
||||
ba.WeakCall(self._update),
|
||||
repeat=True)
|
||||
|
||||
@property
|
||||
def visible(self) -> bool:
|
||||
|
||||
@ -10,13 +10,13 @@ from typing import TYPE_CHECKING
|
||||
import ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Sequence, Union
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class _Entry:
|
||||
|
||||
def __init__(self, scoreboard: Scoreboard, team: ba.Team, do_cover: bool,
|
||||
scale: float, label: Optional[ba.Lstr], flash_length: float):
|
||||
scale: float, label: ba.Lstr | None, flash_length: float):
|
||||
# pylint: disable=too-many-statements
|
||||
self._scoreboard = weakref.ref(scoreboard)
|
||||
self._do_cover = do_cover
|
||||
@ -29,11 +29,11 @@ class _Entry:
|
||||
self._bar_tex = self._backing_tex = ba.gettexture('bar')
|
||||
self._cover_tex = ba.gettexture('uiAtlas')
|
||||
self._model = ba.getmodel('meterTransparent')
|
||||
self._pos: Optional[Sequence[float]] = None
|
||||
self._flash_timer: Optional[ba.Timer] = None
|
||||
self._flash_counter: Optional[int] = None
|
||||
self._flash_colors: Optional[bool] = None
|
||||
self._score: Optional[float] = None
|
||||
self._pos: Sequence[float] | None = None
|
||||
self._flash_timer: ba.Timer | None = None
|
||||
self._flash_counter: int | None = None
|
||||
self._flash_colors: bool | None = None
|
||||
self._score: float | None = None
|
||||
|
||||
safe_team_color = ba.safecolor(team.color, target_intensity=1.0)
|
||||
|
||||
@ -126,7 +126,7 @@ class _Entry:
|
||||
|
||||
clr = safe_team_color
|
||||
|
||||
team_name_label: Union[str, ba.Lstr]
|
||||
team_name_label: str | ba.Lstr
|
||||
if label is not None:
|
||||
team_name_label = label
|
||||
else:
|
||||
@ -207,7 +207,7 @@ class _Entry:
|
||||
def _set_flash_colors(self, flash: bool) -> None:
|
||||
self._flash_colors = flash
|
||||
|
||||
def _safesetcolor(node: Optional[ba.Node], val: Any) -> None:
|
||||
def _safesetcolor(node: ba.Node | None, val: Any) -> None:
|
||||
if node:
|
||||
node.color = val
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ from bastd.actor.spazfactory import SpazFactory
|
||||
from bastd.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Optional, Union, Callable
|
||||
from typing import Any, Sequence, Callable
|
||||
|
||||
POWERUP_WEAR_OFF_TIME = 20000
|
||||
BASE_PUNCH_COOLDOWN = 400
|
||||
@ -57,7 +57,7 @@ class Spaz(ba.Actor):
|
||||
"""The 'spaz' ba.Node."""
|
||||
|
||||
points_mult = 1
|
||||
curse_time: Optional[float] = 5.0
|
||||
curse_time: float | None = 5.0
|
||||
default_bomb_count = 1
|
||||
default_bomb_type = 'normal'
|
||||
default_boxing_gloves = False
|
||||
@ -102,7 +102,7 @@ class Spaz(ba.Actor):
|
||||
self._hockey = False
|
||||
self._punched_nodes: set[ba.Node] = set()
|
||||
self._cursed = False
|
||||
self._connected_to_player: Optional[ba.Player] = None
|
||||
self._connected_to_player: ba.Player | None = None
|
||||
materials = [
|
||||
factory.spaz_material, shared.object_material,
|
||||
shared.player_material
|
||||
@ -155,11 +155,11 @@ class Spaz(ba.Actor):
|
||||
'invincible': start_invincible,
|
||||
'source_player': source_player
|
||||
})
|
||||
self.shield: Optional[ba.Node] = None
|
||||
self.shield: ba.Node | None = None
|
||||
|
||||
if start_invincible:
|
||||
|
||||
def _safesetattr(node: Optional[ba.Node], attr: str,
|
||||
def _safesetattr(node: ba.Node | None, attr: str,
|
||||
val: Any) -> None:
|
||||
if node:
|
||||
setattr(node, attr, val)
|
||||
@ -168,15 +168,15 @@ class Spaz(ba.Actor):
|
||||
False))
|
||||
self.hitpoints = 1000
|
||||
self.hitpoints_max = 1000
|
||||
self.shield_hitpoints: Optional[int] = None
|
||||
self.shield_hitpoints: int | None = None
|
||||
self.shield_hitpoints_max = 650
|
||||
self.shield_decay_rate = 0
|
||||
self.shield_decay_timer: Optional[ba.Timer] = None
|
||||
self._boxing_gloves_wear_off_timer: Optional[ba.Timer] = None
|
||||
self._boxing_gloves_wear_off_flash_timer: Optional[ba.Timer] = None
|
||||
self._bomb_wear_off_timer: Optional[ba.Timer] = None
|
||||
self._bomb_wear_off_flash_timer: Optional[ba.Timer] = None
|
||||
self._multi_bomb_wear_off_timer: Optional[ba.Timer] = None
|
||||
self.shield_decay_timer: ba.Timer | None = None
|
||||
self._boxing_gloves_wear_off_timer: ba.Timer | None = None
|
||||
self._boxing_gloves_wear_off_flash_timer: ba.Timer | None = None
|
||||
self._bomb_wear_off_timer: ba.Timer | None = None
|
||||
self._bomb_wear_off_flash_timer: ba.Timer | None = None
|
||||
self._multi_bomb_wear_off_timer: ba.Timer | None = None
|
||||
self.bomb_count = self.default_bomb_count
|
||||
self._max_bomb_count = self.default_bomb_count
|
||||
self.bomb_type_default = self.default_bomb_type
|
||||
@ -205,7 +205,7 @@ class Spaz(ba.Actor):
|
||||
self._turbo_filter_counts: dict[str, int] = {}
|
||||
self.frozen = False
|
||||
self.shattered = False
|
||||
self._last_hit_time: Optional[int] = None
|
||||
self._last_hit_time: int | None = None
|
||||
self._num_times_hit = 0
|
||||
self._bomb_held = False
|
||||
if self.default_shields:
|
||||
@ -213,13 +213,13 @@ class Spaz(ba.Actor):
|
||||
self._dropped_bomb_callbacks: list[Callable[[Spaz, ba.Actor],
|
||||
Any]] = []
|
||||
|
||||
self._score_text: Optional[ba.Node] = None
|
||||
self._score_text_hide_timer: Optional[ba.Timer] = None
|
||||
self._last_stand_pos: Optional[Sequence[float]] = None
|
||||
self._score_text: ba.Node | None = None
|
||||
self._score_text_hide_timer: ba.Timer | None = None
|
||||
self._last_stand_pos: Sequence[float] | None = None
|
||||
|
||||
# Deprecated stuff.. should make these into lists.
|
||||
self.punch_callback: Optional[Callable[[Spaz], Any]] = None
|
||||
self.pick_up_powerup_callback: Optional[Callable[[Spaz], Any]] = None
|
||||
self.punch_callback: Callable[[Spaz], Any] | None = None
|
||||
self.pick_up_powerup_callback: Callable[[Spaz], Any] | None = None
|
||||
|
||||
def exists(self) -> bool:
|
||||
return bool(self.node)
|
||||
@ -297,7 +297,7 @@ class Spaz(ba.Actor):
|
||||
self._turbo_filter_counts = {source: 1}
|
||||
|
||||
def set_score_text(self,
|
||||
text: Union[str, ba.Lstr],
|
||||
text: str | ba.Lstr,
|
||||
color: Sequence[float] = (1.0, 1.0, 0.4),
|
||||
flash: bool = False) -> None:
|
||||
"""
|
||||
@ -1208,7 +1208,7 @@ class Spaz(ba.Actor):
|
||||
return super().handlemessage(msg)
|
||||
return None
|
||||
|
||||
def drop_bomb(self) -> Optional[stdbomb.Bomb]:
|
||||
def drop_bomb(self) -> stdbomb.Bomb | None:
|
||||
"""
|
||||
Tell the spaz to drop one of his bombs, and returns
|
||||
the resulting bomb object.
|
||||
|
||||
@ -9,7 +9,7 @@ import _ba
|
||||
import ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional
|
||||
pass
|
||||
|
||||
|
||||
def get_appearances(include_locked: bool = False) -> list[str]:
|
||||
@ -111,8 +111,8 @@ class Appearance:
|
||||
self.pickup_sounds: list[str] = []
|
||||
self.fall_sounds: list[str] = []
|
||||
self.style = 'spaz'
|
||||
self.default_color: Optional[tuple[float, float, float]] = None
|
||||
self.default_highlight: Optional[tuple[float, float, float]] = None
|
||||
self.default_color: tuple[float, float, float] | None = None
|
||||
self.default_highlight: tuple[float, float, float] | None = None
|
||||
|
||||
|
||||
def register_appearances() -> None:
|
||||
|
||||
@ -13,7 +13,7 @@ import ba
|
||||
from bastd.actor.spaz import Spaz
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Sequence, Callable
|
||||
from typing import Any, Sequence, Callable
|
||||
from bastd.actor.flag import Flag
|
||||
|
||||
LITE_BOT_COLOR = (1.2, 0.9, 0.2)
|
||||
@ -51,13 +51,13 @@ class SpazBotDiedMessage:
|
||||
spazbot: SpazBot
|
||||
"""The SpazBot that was killed."""
|
||||
|
||||
killerplayer: Optional[ba.Player]
|
||||
killerplayer: ba.Player | None
|
||||
"""The ba.Player that killed it (or None)."""
|
||||
|
||||
how: ba.DeathType
|
||||
"""The particular type of death."""
|
||||
|
||||
def __init__(self, spazbot: SpazBot, killerplayer: Optional[ba.Player],
|
||||
def __init__(self, spazbot: SpazBot, killerplayer: ba.Player | None,
|
||||
how: ba.DeathType):
|
||||
"""Instantiate with given values."""
|
||||
self.spazbot = spazbot
|
||||
@ -115,17 +115,17 @@ class SpazBot(Spaz):
|
||||
# If you need to add custom behavior to a bot, set this to a callable
|
||||
# which takes one arg (the bot) and returns False if the bot's normal
|
||||
# update should be run and True if not.
|
||||
self.update_callback: Optional[Callable[[SpazBot], Any]] = None
|
||||
self.update_callback: Callable[[SpazBot], Any] | None = None
|
||||
activity = self.activity
|
||||
assert isinstance(activity, ba.GameActivity)
|
||||
self._map = weakref.ref(activity.map)
|
||||
self.last_player_attacked_by: Optional[ba.Player] = None
|
||||
self.last_player_attacked_by: ba.Player | None = None
|
||||
self.last_attacked_time = 0.0
|
||||
self.last_attacked_type: Optional[tuple[str, str]] = None
|
||||
self.target_point_default: Optional[ba.Vec3] = None
|
||||
self.last_attacked_type: tuple[str, str] | None = None
|
||||
self.target_point_default: ba.Vec3 | None = None
|
||||
self.held_count = 0
|
||||
self.last_player_held_by: Optional[ba.Player] = None
|
||||
self.target_flag: Optional[Flag] = None
|
||||
self.last_player_held_by: ba.Player | None = None
|
||||
self.target_flag: Flag | None = None
|
||||
self._charge_speed = 0.5 * (self.charge_speed_min +
|
||||
self.charge_speed_max)
|
||||
self._lead_amount = 0.5
|
||||
@ -135,9 +135,9 @@ class SpazBot(Spaz):
|
||||
self._running = False
|
||||
self._last_jump_time = 0.0
|
||||
|
||||
self._throw_release_time: Optional[float] = None
|
||||
self._have_dropped_throw_bomb: Optional[bool] = None
|
||||
self._player_pts: Optional[list[tuple[ba.Vec3, ba.Vec3]]] = None
|
||||
self._throw_release_time: float | None = None
|
||||
self._have_dropped_throw_bomb: bool | None = None
|
||||
self._player_pts: list[tuple[ba.Vec3, ba.Vec3]] | None = None
|
||||
|
||||
# These cooldowns didn't exist when these bots were calibrated,
|
||||
# so take them out of the equation.
|
||||
@ -156,17 +156,16 @@ class SpazBot(Spaz):
|
||||
assert mval is not None
|
||||
return mval
|
||||
|
||||
def _get_target_player_pt(
|
||||
self) -> tuple[Optional[ba.Vec3], Optional[ba.Vec3]]:
|
||||
def _get_target_player_pt(self) -> tuple[ba.Vec3 | None, ba.Vec3 | None]:
|
||||
"""Returns the position and velocity of our target.
|
||||
|
||||
Both values will be None in the case of no target.
|
||||
"""
|
||||
assert self.node
|
||||
botpt = ba.Vec3(self.node.position)
|
||||
closest_dist: Optional[float] = None
|
||||
closest_vel: Optional[ba.Vec3] = None
|
||||
closest: Optional[ba.Vec3] = None
|
||||
closest_dist: float | None = None
|
||||
closest_vel: ba.Vec3 | None = None
|
||||
closest: ba.Vec3 | None = None
|
||||
assert self._player_pts is not None
|
||||
for plpt, plvel in self._player_pts:
|
||||
dist = (plpt - botpt).length()
|
||||
@ -206,8 +205,8 @@ class SpazBot(Spaz):
|
||||
our_pos = ba.Vec3(pos[0], 0, pos[2])
|
||||
can_attack = True
|
||||
|
||||
target_pt_raw: Optional[ba.Vec3]
|
||||
target_vel: Optional[ba.Vec3]
|
||||
target_pt_raw: ba.Vec3 | None
|
||||
target_vel: ba.Vec3 | None
|
||||
|
||||
# If we're a flag-bearer, we're pretty simple-minded - just walk
|
||||
# towards the flag and try to pick it up.
|
||||
@ -517,7 +516,7 @@ class SpazBot(Spaz):
|
||||
# Report normal deaths for scoring purposes.
|
||||
if not self._dead and not msg.immediate:
|
||||
|
||||
killerplayer: Optional[ba.Player]
|
||||
killerplayer: ba.Player | None
|
||||
|
||||
# If this guy was being held at the time of death, the
|
||||
# holder is the killer.
|
||||
@ -883,7 +882,7 @@ class SpazBotSet:
|
||||
]
|
||||
self._spawn_sound = ba.getsound('spawn')
|
||||
self._spawning_count = 0
|
||||
self._bot_update_timer: Optional[ba.Timer] = None
|
||||
self._bot_update_timer: ba.Timer | None = None
|
||||
self.start_moving()
|
||||
|
||||
def __del__(self) -> None:
|
||||
@ -904,7 +903,7 @@ class SpazBotSet:
|
||||
self._spawning_count += 1
|
||||
|
||||
def _spawn_bot(self, bot_type: type[SpazBot], pos: Sequence[float],
|
||||
on_spawn_call: Optional[Callable[[SpazBot], Any]]) -> None:
|
||||
on_spawn_call: Callable[[SpazBot], Any] | None) -> None:
|
||||
spaz = bot_type()
|
||||
ba.playsound(self._spawn_sound, position=pos)
|
||||
assert spaz.node
|
||||
|
||||
@ -10,7 +10,7 @@ from typing import TYPE_CHECKING
|
||||
import ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Union, Sequence, Optional
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class Text(ba.Actor):
|
||||
@ -49,12 +49,12 @@ class Text(ba.Actor):
|
||||
TOP = 'top'
|
||||
|
||||
def __init__(self,
|
||||
text: Union[str, ba.Lstr],
|
||||
text: str | ba.Lstr,
|
||||
position: tuple[float, float] = (0.0, 0.0),
|
||||
h_align: HAlign = HAlign.LEFT,
|
||||
v_align: VAlign = VAlign.NONE,
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0, 1.0),
|
||||
transition: Optional[Transition] = None,
|
||||
transition: Transition | None = None,
|
||||
transition_delay: float = 0.0,
|
||||
flash: bool = False,
|
||||
v_attach: VAttach = VAttach.CENTER,
|
||||
|
||||
@ -8,7 +8,7 @@ from typing import TYPE_CHECKING
|
||||
import ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Callable, Optional
|
||||
from typing import Any, Callable
|
||||
|
||||
|
||||
class AppDelegate(ba.AppDelegate):
|
||||
@ -16,8 +16,8 @@ class AppDelegate(ba.AppDelegate):
|
||||
|
||||
def create_default_game_settings_ui(
|
||||
self, gameclass: type[ba.GameActivity],
|
||||
sessiontype: type[ba.Session], settings: Optional[dict],
|
||||
completion_call: Callable[[Optional[dict]], Any]) -> None:
|
||||
sessiontype: type[ba.Session], settings: dict | None,
|
||||
completion_call: Callable[[dict | None], Any]) -> None:
|
||||
"""(internal)"""
|
||||
|
||||
# Replace the main window once we come up successfully.
|
||||
|
||||
@ -16,7 +16,7 @@ from bastd.actor.flag import (FlagFactory, Flag, FlagPickedUpMessage,
|
||||
FlagDroppedMessage, FlagDiedMessage)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Union, Optional
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class CTFFlag(Flag):
|
||||
@ -39,9 +39,9 @@ class CTFFlag(Flag):
|
||||
'h_align': 'center'
|
||||
})
|
||||
self.reset_return_times()
|
||||
self.last_player_to_hold: Optional[Player] = None
|
||||
self.time_out_respawn_time: Optional[int] = None
|
||||
self.touch_return_time: Optional[float] = None
|
||||
self.last_player_to_hold: Player | None = None
|
||||
self.time_out_respawn_time: int | None = None
|
||||
self.touch_return_time: float | None = None
|
||||
|
||||
def reset_return_times(self) -> None:
|
||||
"""Clear flag related times in the activity."""
|
||||
@ -78,11 +78,11 @@ class Team(ba.Team[Player]):
|
||||
self.score = 0
|
||||
self.flag_return_touches = 0
|
||||
self.home_flag_at_base = True
|
||||
self.touch_return_timer: Optional[ba.Timer] = None
|
||||
self.touch_return_timer: ba.Timer | None = None
|
||||
self.enemy_flag_at_base = False
|
||||
self.flag: Optional[CTFFlag] = None
|
||||
self.last_flag_leave_time: Optional[float] = None
|
||||
self.touch_return_timer_ticking: Optional[ba.NodeActor] = None
|
||||
self.flag: CTFFlag | None = None
|
||||
self.last_flag_leave_time: float | None = None
|
||||
self.touch_return_timer_ticking: ba.NodeActor | None = None
|
||||
|
||||
|
||||
# ba_meta export game
|
||||
@ -161,12 +161,12 @@ class CaptureTheFlagGame(ba.TeamGameActivity[Player, Team]):
|
||||
self.default_music = (ba.MusicType.EPIC if self._epic_mode else
|
||||
ba.MusicType.FLAG_CATCHER)
|
||||
|
||||
def get_instance_description(self) -> Union[str, Sequence]:
|
||||
def get_instance_description(self) -> str | Sequence:
|
||||
if self._score_to_win == 1:
|
||||
return 'Steal the enemy flag.'
|
||||
return 'Steal the enemy flag ${ARG1} times.', self._score_to_win
|
||||
|
||||
def get_instance_description_short(self) -> Union[str, Sequence]:
|
||||
def get_instance_description_short(self) -> str | Sequence:
|
||||
if self._score_to_win == 1:
|
||||
return 'return 1 flag'
|
||||
return 'return ${ARG1} flags', self._score_to_win
|
||||
@ -438,7 +438,7 @@ class CaptureTheFlagGame(ba.TeamGameActivity[Player, Team]):
|
||||
We keep track of when each player is touching their own flag so we
|
||||
can award points when returned.
|
||||
"""
|
||||
player: Optional[Player]
|
||||
player: Player | None
|
||||
try:
|
||||
spaz = ba.getcollision().sourcenode.getdelegate(PlayerSpaz, True)
|
||||
except ba.NotFoundError:
|
||||
|
||||
@ -16,14 +16,14 @@ from bastd.actor.scoreboard import Scoreboard
|
||||
from bastd.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Sequence, Union
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class Player(ba.Player['Team']):
|
||||
"""Our player type for this game."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.chosen_light: Optional[ba.NodeActor] = None
|
||||
self.chosen_light: ba.NodeActor | None = None
|
||||
|
||||
|
||||
class Team(ba.Team[Player]):
|
||||
@ -87,7 +87,7 @@ class ChosenOneGame(ba.TeamGameActivity[Player, Team]):
|
||||
def __init__(self, settings: dict):
|
||||
super().__init__(settings)
|
||||
self._scoreboard = Scoreboard()
|
||||
self._chosen_one_player: Optional[Player] = None
|
||||
self._chosen_one_player: Player | None = None
|
||||
self._swipsound = ba.getsound('swip')
|
||||
self._countdownsounds: dict[int, ba.Sound] = {
|
||||
10: ba.getsound('announceTen'),
|
||||
@ -101,10 +101,10 @@ class ChosenOneGame(ba.TeamGameActivity[Player, Team]):
|
||||
2: ba.getsound('announceTwo'),
|
||||
1: ba.getsound('announceOne')
|
||||
}
|
||||
self._flag_spawn_pos: Optional[Sequence[float]] = None
|
||||
self._reset_region_material: Optional[ba.Material] = None
|
||||
self._flag: Optional[Flag] = None
|
||||
self._reset_region: Optional[ba.Node] = None
|
||||
self._flag_spawn_pos: Sequence[float] | None = None
|
||||
self._reset_region_material: ba.Material | None = None
|
||||
self._flag: Flag | None = None
|
||||
self._reset_region: ba.Node | None = None
|
||||
self._epic_mode = bool(settings['Epic Mode'])
|
||||
self._chosen_one_time = int(settings['Chosen One Time'])
|
||||
self._time_limit = float(settings['Time Limit'])
|
||||
@ -116,7 +116,7 @@ class ChosenOneGame(ba.TeamGameActivity[Player, Team]):
|
||||
self.default_music = (ba.MusicType.EPIC
|
||||
if self._epic_mode else ba.MusicType.CHOSEN_ONE)
|
||||
|
||||
def get_instance_description(self) -> Union[str, Sequence]:
|
||||
def get_instance_description(self) -> str | Sequence:
|
||||
return 'There can be only one.'
|
||||
|
||||
def create_team(self, sessionteam: ba.SessionTeam) -> Team:
|
||||
@ -165,7 +165,7 @@ class ChosenOneGame(ba.TeamGameActivity[Player, Team]):
|
||||
'materials': [mat]
|
||||
})
|
||||
|
||||
def _get_chosen_one_player(self) -> Optional[Player]:
|
||||
def _get_chosen_one_player(self) -> Player | None:
|
||||
# Should never return invalid references; return None in that case.
|
||||
if self._chosen_one_player:
|
||||
return self._chosen_one_player
|
||||
@ -251,7 +251,7 @@ class ChosenOneGame(ba.TeamGameActivity[Player, Team]):
|
||||
self._chosen_one_time - team.time_remaining)
|
||||
self.end(results=results, announce_delay=0)
|
||||
|
||||
def _set_chosen_one_player(self, player: Optional[Player]) -> None:
|
||||
def _set_chosen_one_player(self, player: Player | None) -> None:
|
||||
existing = self._get_chosen_one_player()
|
||||
if existing:
|
||||
existing.chosen_light = None
|
||||
|
||||
@ -17,7 +17,7 @@ from bastd.actor.playerspaz import PlayerSpaz
|
||||
from bastd.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Sequence, Union
|
||||
from typing import Any, Sequence
|
||||
from bastd.actor.respawnicon import RespawnIcon
|
||||
|
||||
|
||||
@ -26,11 +26,11 @@ class ConquestFlag(Flag):
|
||||
|
||||
def __init__(self, *args: Any, **keywds: Any):
|
||||
super().__init__(*args, **keywds)
|
||||
self._team: Optional[Team] = None
|
||||
self.light: Optional[ba.Node] = None
|
||||
self._team: Team | None = None
|
||||
self.light: ba.Node | None = None
|
||||
|
||||
@property
|
||||
def team(self) -> Optional[Team]:
|
||||
def team(self) -> Team | None:
|
||||
"""The team that owns this flag."""
|
||||
return self._team
|
||||
|
||||
@ -46,21 +46,21 @@ class Player(ba.Player['Team']):
|
||||
# FIXME: We shouldn't be using customdata here
|
||||
# (but need to update respawn funcs accordingly first).
|
||||
@property
|
||||
def respawn_timer(self) -> Optional[ba.Timer]:
|
||||
def respawn_timer(self) -> ba.Timer | None:
|
||||
"""Type safe access to standard respawn timer."""
|
||||
return self.customdata.get('respawn_timer', None)
|
||||
|
||||
@respawn_timer.setter
|
||||
def respawn_timer(self, value: Optional[ba.Timer]) -> None:
|
||||
def respawn_timer(self, value: ba.Timer | None) -> None:
|
||||
self.customdata['respawn_timer'] = value
|
||||
|
||||
@property
|
||||
def respawn_icon(self) -> Optional[RespawnIcon]:
|
||||
def respawn_icon(self) -> RespawnIcon | None:
|
||||
"""Type safe access to standard respawn icon."""
|
||||
return self.customdata.get('respawn_icon', None)
|
||||
|
||||
@respawn_icon.setter
|
||||
def respawn_icon(self, value: Optional[RespawnIcon]) -> None:
|
||||
def respawn_icon(self, value: RespawnIcon | None) -> None:
|
||||
self.customdata['respawn_icon'] = value
|
||||
|
||||
|
||||
@ -136,10 +136,10 @@ class ConquestGame(ba.TeamGameActivity[Player, Team]):
|
||||
('call', 'at_connect', self._handle_flag_player_collide),
|
||||
))
|
||||
|
||||
def get_instance_description(self) -> Union[str, Sequence]:
|
||||
def get_instance_description(self) -> str | Sequence:
|
||||
return 'Secure all ${ARG1} flags.', len(self.map.flag_points)
|
||||
|
||||
def get_instance_description_short(self) -> Union[str, Sequence]:
|
||||
def get_instance_description_short(self) -> str | Sequence:
|
||||
return 'secure all ${ARG1} flags', len(self.map.flag_points)
|
||||
|
||||
def on_team_join(self, team: Team) -> None:
|
||||
|
||||
@ -14,7 +14,7 @@ from bastd.actor.playerspaz import PlayerSpaz
|
||||
from bastd.actor.scoreboard import Scoreboard
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Union, Sequence, Optional
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class Player(ba.Player['Team']):
|
||||
@ -97,7 +97,7 @@ class DeathMatchGame(ba.TeamGameActivity[Player, Team]):
|
||||
def __init__(self, settings: dict):
|
||||
super().__init__(settings)
|
||||
self._scoreboard = Scoreboard()
|
||||
self._score_to_win: Optional[int] = None
|
||||
self._score_to_win: int | None = None
|
||||
self._dingsound = ba.getsound('dingSmall')
|
||||
self._epic_mode = bool(settings['Epic Mode'])
|
||||
self._kills_to_win_per_player = int(
|
||||
@ -111,10 +111,10 @@ class DeathMatchGame(ba.TeamGameActivity[Player, Team]):
|
||||
self.default_music = (ba.MusicType.EPIC if self._epic_mode else
|
||||
ba.MusicType.TO_THE_DEATH)
|
||||
|
||||
def get_instance_description(self) -> Union[str, Sequence]:
|
||||
def get_instance_description(self) -> str | Sequence:
|
||||
return 'Crush ${ARG1} of your enemies.', self._score_to_win
|
||||
|
||||
def get_instance_description_short(self) -> Union[str, Sequence]:
|
||||
def get_instance_description_short(self) -> str | Sequence:
|
||||
return 'kill ${ARG1} enemies', self._score_to_win
|
||||
|
||||
def on_team_join(self, team: Team) -> None:
|
||||
|
||||
@ -20,15 +20,15 @@ from bastd.actor.respawnicon import RespawnIcon
|
||||
from bastd.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
|
||||
class Player(ba.Player['Team']):
|
||||
"""Our player type for this game."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.respawn_timer: Optional[ba.Timer] = None
|
||||
self.respawn_icon: Optional[RespawnIcon] = None
|
||||
self.respawn_timer: ba.Timer | None = None
|
||||
self.respawn_icon: RespawnIcon | None = None
|
||||
|
||||
|
||||
class Team(ba.Team[Player]):
|
||||
@ -76,9 +76,9 @@ class EasterEggHuntGame(ba.TeamGameActivity[Player, Team]):
|
||||
conditions=('they_have_material', shared.player_material),
|
||||
actions=(('call', 'at_connect', self._on_egg_player_collide), ))
|
||||
self._eggs: list[Egg] = []
|
||||
self._update_timer: Optional[ba.Timer] = None
|
||||
self._countdown: Optional[OnScreenCountdown] = None
|
||||
self._bots: Optional[SpazBotSet] = None
|
||||
self._update_timer: ba.Timer | None = None
|
||||
self._countdown: OnScreenCountdown | None = None
|
||||
self._bots: SpazBotSet | None = None
|
||||
|
||||
# Base class overrides
|
||||
self.default_music = ba.MusicType.FORWARD_MARCH
|
||||
|
||||
@ -14,7 +14,7 @@ from bastd.actor.spazfactory import SpazFactory
|
||||
from bastd.actor.scoreboard import Scoreboard
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Optional, Union
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class Icon(ba.Actor):
|
||||
@ -162,7 +162,7 @@ class Team(ba.Team[Player]):
|
||||
"""Our team type for this game."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.survival_seconds: Optional[int] = None
|
||||
self.survival_seconds: int | None = None
|
||||
self.spawn_order: list[Player] = []
|
||||
|
||||
|
||||
@ -234,9 +234,9 @@ class EliminationGame(ba.TeamGameActivity[Player, Team]):
|
||||
def __init__(self, settings: dict):
|
||||
super().__init__(settings)
|
||||
self._scoreboard = Scoreboard()
|
||||
self._start_time: Optional[float] = None
|
||||
self._vs_text: Optional[ba.Actor] = None
|
||||
self._round_end_timer: Optional[ba.Timer] = None
|
||||
self._start_time: float | None = None
|
||||
self._vs_text: ba.Actor | None = None
|
||||
self._round_end_timer: ba.Timer | None = None
|
||||
self._epic_mode = bool(settings['Epic Mode'])
|
||||
self._lives_per_player = int(settings['Lives Per Player'])
|
||||
self._time_limit = float(settings['Time Limit'])
|
||||
@ -249,11 +249,11 @@ class EliminationGame(ba.TeamGameActivity[Player, Team]):
|
||||
self.default_music = (ba.MusicType.EPIC
|
||||
if self._epic_mode else ba.MusicType.SURVIVAL)
|
||||
|
||||
def get_instance_description(self) -> Union[str, Sequence]:
|
||||
def get_instance_description(self) -> str | Sequence:
|
||||
return 'Last team standing wins.' if isinstance(
|
||||
self.session, ba.DualTeamSession) else 'Last one standing wins.'
|
||||
|
||||
def get_instance_description_short(self) -> Union[str, Sequence]:
|
||||
def get_instance_description_short(self) -> str | Sequence:
|
||||
return 'last team standing wins' if isinstance(
|
||||
self.session, ba.DualTeamSession) else 'last one standing wins'
|
||||
|
||||
@ -401,7 +401,7 @@ class EliminationGame(ba.TeamGameActivity[Player, Team]):
|
||||
icon.update_for_lives()
|
||||
xval += x_offs
|
||||
|
||||
def _get_spawn_point(self, player: Player) -> Optional[ba.Vec3]:
|
||||
def _get_spawn_point(self, player: Player) -> ba.Vec3 | None:
|
||||
del player # Unused.
|
||||
|
||||
# In solo-mode, if there's an existing live player on the map, spawn at
|
||||
|
||||
@ -26,7 +26,7 @@ from bastd.actor.spazbot import (SpazBotDiedMessage, SpazBotPunchedMessage,
|
||||
StickyBot, ExplodeyBot)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Optional, Union
|
||||
from typing import Any, Sequence
|
||||
from bastd.actor.spaz import Spaz
|
||||
from bastd.actor.spazbot import SpazBot
|
||||
|
||||
@ -39,9 +39,9 @@ class FootballFlag(Flag):
|
||||
dropped_timeout=20,
|
||||
color=(1.0, 1.0, 0.3))
|
||||
assert self.node
|
||||
self.last_holding_player: Optional[ba.Player] = None
|
||||
self.last_holding_player: ba.Player | None = None
|
||||
self.node.is_area_of_interest = True
|
||||
self.respawn_timer: Optional[ba.Timer] = None
|
||||
self.respawn_timer: ba.Timer | None = None
|
||||
self.scored = False
|
||||
self.held_count = 0
|
||||
self.light = ba.newnode('light',
|
||||
@ -59,8 +59,8 @@ class Player(ba.Player['Team']):
|
||||
"""Our player type for this game."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.respawn_timer: Optional[ba.Timer] = None
|
||||
self.respawn_icon: Optional[RespawnIcon] = None
|
||||
self.respawn_timer: ba.Timer | None = None
|
||||
self.respawn_icon: RespawnIcon | None = None
|
||||
|
||||
|
||||
class Team(ba.Team[Player]):
|
||||
@ -120,7 +120,7 @@ class FootballTeamGame(ba.TeamGameActivity[Player, Team]):
|
||||
|
||||
def __init__(self, settings: dict):
|
||||
super().__init__(settings)
|
||||
self._scoreboard: Optional[Scoreboard] = Scoreboard()
|
||||
self._scoreboard: Scoreboard | None = Scoreboard()
|
||||
|
||||
# Load some media we need.
|
||||
self._cheer_sound = ba.getsound('cheer')
|
||||
@ -136,15 +136,15 @@ class FootballTeamGame(ba.TeamGameActivity[Player, Team]):
|
||||
('modify_part_collision', 'physical', False),
|
||||
('call', 'at_connect', self._handle_score),
|
||||
))
|
||||
self._flag_spawn_pos: Optional[Sequence[float]] = None
|
||||
self._flag_spawn_pos: Sequence[float] | None = None
|
||||
self._score_regions: list[ba.NodeActor] = []
|
||||
self._flag: Optional[FootballFlag] = None
|
||||
self._flag_respawn_timer: Optional[ba.Timer] = None
|
||||
self._flag_respawn_light: Optional[ba.NodeActor] = None
|
||||
self._flag: FootballFlag | None = None
|
||||
self._flag_respawn_timer: ba.Timer | None = None
|
||||
self._flag_respawn_light: ba.NodeActor | None = None
|
||||
self._score_to_win = int(settings['Score to Win'])
|
||||
self._time_limit = float(settings['Time Limit'])
|
||||
|
||||
def get_instance_description(self) -> Union[str, Sequence]:
|
||||
def get_instance_description(self) -> str | Sequence:
|
||||
touchdowns = self._score_to_win / 7
|
||||
|
||||
# NOTE: if use just touchdowns = self._score_to_win // 7
|
||||
@ -155,7 +155,7 @@ class FootballTeamGame(ba.TeamGameActivity[Player, Team]):
|
||||
return 'Score ${ARG1} touchdowns.', touchdowns
|
||||
return 'Score a touchdown.'
|
||||
|
||||
def get_instance_description_short(self) -> Union[str, Sequence]:
|
||||
def get_instance_description_short(self) -> str | Sequence:
|
||||
touchdowns = self._score_to_win / 7
|
||||
touchdowns = math.ceil(touchdowns)
|
||||
if touchdowns > 1:
|
||||
@ -336,14 +336,14 @@ class FootballCoopGame(ba.CoopGameActivity[Player, Team]):
|
||||
def get_score_type(self) -> str:
|
||||
return 'time'
|
||||
|
||||
def get_instance_description(self) -> Union[str, Sequence]:
|
||||
def get_instance_description(self) -> str | Sequence:
|
||||
touchdowns = self._score_to_win / 7
|
||||
touchdowns = math.ceil(touchdowns)
|
||||
if touchdowns > 1:
|
||||
return 'Score ${ARG1} touchdowns.', touchdowns
|
||||
return 'Score a touchdown.'
|
||||
|
||||
def get_instance_description_short(self) -> Union[str, Sequence]:
|
||||
def get_instance_description_short(self) -> str | Sequence:
|
||||
touchdowns = self._score_to_win / 7
|
||||
touchdowns = math.ceil(touchdowns)
|
||||
if touchdowns > 1:
|
||||
@ -375,27 +375,27 @@ class FootballCoopGame(ba.CoopGameActivity[Player, Team]):
|
||||
self._powerup_spread = (10, 5.5)
|
||||
self._player_has_dropped_bomb = False
|
||||
self._player_has_punched = False
|
||||
self._scoreboard: Optional[Scoreboard] = None
|
||||
self._flag_spawn_pos: Optional[Sequence[float]] = None
|
||||
self._scoreboard: Scoreboard | None = None
|
||||
self._flag_spawn_pos: Sequence[float] | None = None
|
||||
self._score_regions: list[ba.NodeActor] = []
|
||||
self._exclude_powerups: list[str] = []
|
||||
self._have_tnt = False
|
||||
self._bot_types_initial: Optional[list[type[SpazBot]]] = None
|
||||
self._bot_types_7: Optional[list[type[SpazBot]]] = None
|
||||
self._bot_types_14: Optional[list[type[SpazBot]]] = None
|
||||
self._bot_team: Optional[Team] = None
|
||||
self._starttime_ms: Optional[int] = None
|
||||
self._time_text: Optional[ba.NodeActor] = None
|
||||
self._time_text_input: Optional[ba.NodeActor] = None
|
||||
self._tntspawner: Optional[TNTSpawner] = None
|
||||
self._bot_types_initial: list[type[SpazBot]] | None = None
|
||||
self._bot_types_7: list[type[SpazBot]] | None = None
|
||||
self._bot_types_14: list[type[SpazBot]] | None = None
|
||||
self._bot_team: Team | None = None
|
||||
self._starttime_ms: int | None = None
|
||||
self._time_text: ba.NodeActor | None = None
|
||||
self._time_text_input: ba.NodeActor | None = None
|
||||
self._tntspawner: TNTSpawner | None = None
|
||||
self._bots = SpazBotSet()
|
||||
self._bot_spawn_timer: Optional[ba.Timer] = None
|
||||
self._powerup_drop_timer: Optional[ba.Timer] = None
|
||||
self._scoring_team: Optional[Team] = None
|
||||
self._final_time_ms: Optional[int] = None
|
||||
self._time_text_timer: Optional[ba.Timer] = None
|
||||
self._flag_respawn_light: Optional[ba.Actor] = None
|
||||
self._flag: Optional[FootballFlag] = None
|
||||
self._bot_spawn_timer: ba.Timer | None = None
|
||||
self._powerup_drop_timer: ba.Timer | None = None
|
||||
self._scoring_team: Team | None = None
|
||||
self._final_time_ms: int | None = None
|
||||
self._time_text_timer: ba.Timer | None = None
|
||||
self._flag_respawn_light: ba.Actor | None = None
|
||||
self._flag: FootballFlag | None = None
|
||||
|
||||
def on_transition_in(self) -> None:
|
||||
super().on_transition_in()
|
||||
@ -581,7 +581,7 @@ class FootballCoopGame(ba.CoopGameActivity[Player, Team]):
|
||||
return
|
||||
|
||||
flagpos = ba.Vec3(self._flag.node.position)
|
||||
closest_bot: Optional[SpazBot] = None
|
||||
closest_bot: SpazBot | None = None
|
||||
closest_dist = 0.0 # Always gets assigned first time through.
|
||||
for bot in bots:
|
||||
# If a bot is picked up, he should forget about the flag.
|
||||
|
||||
@ -16,7 +16,7 @@ from bastd.actor.powerupbox import PowerupBoxFactory
|
||||
from bastd.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Optional, Union
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class PuckDiedMessage:
|
||||
@ -198,18 +198,18 @@ class HockeyGame(ba.TeamGameActivity[Player, Team]):
|
||||
actions=(('modify_part_collision', 'collide',
|
||||
True), ('modify_part_collision', 'physical', False),
|
||||
('call', 'at_connect', self._handle_score)))
|
||||
self._puck_spawn_pos: Optional[Sequence[float]] = None
|
||||
self._score_regions: Optional[list[ba.NodeActor]] = None
|
||||
self._puck: Optional[Puck] = None
|
||||
self._puck_spawn_pos: Sequence[float] | None = None
|
||||
self._score_regions: list[ba.NodeActor] | None = None
|
||||
self._puck: Puck | None = None
|
||||
self._score_to_win = int(settings['Score to Win'])
|
||||
self._time_limit = float(settings['Time Limit'])
|
||||
|
||||
def get_instance_description(self) -> Union[str, Sequence]:
|
||||
def get_instance_description(self) -> str | Sequence:
|
||||
if self._score_to_win == 1:
|
||||
return 'Score a goal.'
|
||||
return 'Score ${ARG1} goals.', self._score_to_win
|
||||
|
||||
def get_instance_description_short(self) -> Union[str, Sequence]:
|
||||
def get_instance_description_short(self) -> str | Sequence:
|
||||
if self._score_to_win == 1:
|
||||
return 'score a goal'
|
||||
return 'score ${ARG1} goals', self._score_to_win
|
||||
|
||||
@ -17,7 +17,7 @@ from bastd.actor.flag import (Flag, FlagDroppedMessage, FlagDiedMessage,
|
||||
FlagPickedUpMessage)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Sequence, Union
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class FlagState(Enum):
|
||||
@ -106,20 +106,20 @@ class KeepAwayGame(ba.TeamGameActivity[Player, Team]):
|
||||
2: ba.getsound('announceTwo'),
|
||||
1: ba.getsound('announceOne')
|
||||
}
|
||||
self._flag_spawn_pos: Optional[Sequence[float]] = None
|
||||
self._update_timer: Optional[ba.Timer] = None
|
||||
self._flag_spawn_pos: Sequence[float] | None = None
|
||||
self._update_timer: ba.Timer | None = None
|
||||
self._holding_players: list[Player] = []
|
||||
self._flag_state: Optional[FlagState] = None
|
||||
self._flag_light: Optional[ba.Node] = None
|
||||
self._scoring_team: Optional[Team] = None
|
||||
self._flag: Optional[Flag] = None
|
||||
self._flag_state: FlagState | None = None
|
||||
self._flag_light: ba.Node | None = None
|
||||
self._scoring_team: Team | None = None
|
||||
self._flag: Flag | None = None
|
||||
self._hold_time = int(settings['Hold Time'])
|
||||
self._time_limit = float(settings['Time Limit'])
|
||||
|
||||
def get_instance_description(self) -> Union[str, Sequence]:
|
||||
def get_instance_description(self) -> str | Sequence:
|
||||
return 'Carry the flag for ${ARG1} seconds.', self._hold_time
|
||||
|
||||
def get_instance_description_short(self) -> Union[str, Sequence]:
|
||||
def get_instance_description_short(self) -> str | Sequence:
|
||||
return 'carry the flag for ${ARG1} seconds', self._hold_time
|
||||
|
||||
def create_team(self, sessionteam: ba.SessionTeam) -> Team:
|
||||
|
||||
@ -18,7 +18,7 @@ from bastd.actor.scoreboard import Scoreboard
|
||||
from bastd.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Sequence, Union
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class FlagState(Enum):
|
||||
@ -108,11 +108,11 @@ class KingOfTheHillGame(ba.TeamGameActivity[Player, Team]):
|
||||
2: ba.getsound('announceTwo'),
|
||||
1: ba.getsound('announceOne')
|
||||
}
|
||||
self._flag_pos: Optional[Sequence[float]] = None
|
||||
self._flag_state: Optional[FlagState] = None
|
||||
self._flag: Optional[Flag] = None
|
||||
self._flag_light: Optional[ba.Node] = None
|
||||
self._scoring_team: Optional[weakref.ref[Team]] = None
|
||||
self._flag_pos: Sequence[float] | None = None
|
||||
self._flag_state: FlagState | None = None
|
||||
self._flag: Flag | None = None
|
||||
self._flag_light: ba.Node | None = None
|
||||
self._scoring_team: weakref.ref[Team] | None = None
|
||||
self._hold_time = int(settings['Hold Time'])
|
||||
self._time_limit = float(settings['Time Limit'])
|
||||
self._flag_region_material = ba.Material()
|
||||
@ -130,10 +130,10 @@ class KingOfTheHillGame(ba.TeamGameActivity[Player, Team]):
|
||||
# Base class overrides.
|
||||
self.default_music = ba.MusicType.SCARY
|
||||
|
||||
def get_instance_description(self) -> Union[str, Sequence]:
|
||||
def get_instance_description(self) -> str | Sequence:
|
||||
return 'Secure the flag for ${ARG1} seconds.', self._hold_time
|
||||
|
||||
def get_instance_description_short(self) -> Union[str, Sequence]:
|
||||
def get_instance_description_short(self) -> str | Sequence:
|
||||
return 'secure the flag for ${ARG1} seconds', self._hold_time
|
||||
|
||||
def create_team(self, sessionteam: ba.SessionTeam) -> Team:
|
||||
|
||||
@ -15,7 +15,7 @@ from bastd.actor.bomb import Bomb
|
||||
from bastd.actor.onscreentimer import OnScreenTimer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Optional
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class Player(ba.Player['Team']):
|
||||
@ -23,7 +23,7 @@ class Player(ba.Player['Team']):
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.death_time: Optional[float] = None
|
||||
self.death_time: float | None = None
|
||||
|
||||
|
||||
class Team(ba.Team[Player]):
|
||||
@ -64,9 +64,9 @@ class MeteorShowerGame(ba.TeamGameActivity[Player, Team]):
|
||||
super().__init__(settings)
|
||||
|
||||
self._epic_mode = settings.get('Epic Mode', False)
|
||||
self._last_player_death_time: Optional[float] = None
|
||||
self._last_player_death_time: float | None = None
|
||||
self._meteor_time = 2.0
|
||||
self._timer: Optional[OnScreenTimer] = None
|
||||
self._timer: OnScreenTimer | None = None
|
||||
|
||||
# Some base class overrides:
|
||||
self.default_music = (ba.MusicType.EPIC
|
||||
|
||||
@ -15,7 +15,7 @@ from bastd.actor.spazbot import SpazBotSet, ChargerBot, SpazBotDiedMessage
|
||||
from bastd.actor.onscreentimer import OnScreenTimer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
|
||||
class Player(ba.Player['Team']):
|
||||
@ -58,7 +58,7 @@ class NinjaFightGame(ba.TeamGameActivity[Player, Team]):
|
||||
super().__init__(settings)
|
||||
self._winsound = ba.getsound('score')
|
||||
self._won = False
|
||||
self._timer: Optional[OnScreenTimer] = None
|
||||
self._timer: OnScreenTimer | None = None
|
||||
self._bots = SpazBotSet()
|
||||
self._preset = str(settings['preset'])
|
||||
|
||||
|
||||
@ -28,22 +28,22 @@ from bastd.actor.spazbot import (
|
||||
TriggerBotProShielded, BrawlerBotPro, BomberBotProShielded)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Union, Sequence
|
||||
from typing import Any, Sequence
|
||||
from bastd.actor.spazbot import SpazBot
|
||||
|
||||
|
||||
@dataclass
|
||||
class Wave:
|
||||
"""A wave of enemies."""
|
||||
entries: list[Union[Spawn, Spacing, Delay, None]]
|
||||
entries: list[Spawn | Spacing | Delay | None]
|
||||
base_angle: float = 0.0
|
||||
|
||||
|
||||
@dataclass
|
||||
class Spawn:
|
||||
"""A bot spawn event in a wave."""
|
||||
bottype: Union[type[SpazBot], str]
|
||||
point: Optional[Point] = None
|
||||
bottype: type[SpazBot] | str
|
||||
point: Point | None = None
|
||||
spacing: float = 5.0
|
||||
|
||||
|
||||
@ -123,7 +123,7 @@ class OnslaughtGame(ba.CoopGameActivity[Player, Team]):
|
||||
name = 'Onslaught'
|
||||
description = 'Defeat all enemies.'
|
||||
|
||||
tips: list[Union[str, ba.GameTip]] = [
|
||||
tips: list[str | ba.GameTip] = [
|
||||
'Hold any button to run.'
|
||||
' (Trigger buttons work well if you have them)',
|
||||
'Try tricking enemies into killing eachother or running off cliffs.',
|
||||
@ -169,26 +169,26 @@ class OnslaughtGame(ba.CoopGameActivity[Player, Team]):
|
||||
self._powerup_spread = (4.6, 2.7)
|
||||
else:
|
||||
raise Exception('Unsupported map: ' + str(settings['map']))
|
||||
self._scoreboard: Optional[Scoreboard] = None
|
||||
self._scoreboard: Scoreboard | None = None
|
||||
self._game_over = False
|
||||
self._wavenum = 0
|
||||
self._can_end_wave = True
|
||||
self._score = 0
|
||||
self._time_bonus = 0
|
||||
self._spawn_info_text: Optional[ba.NodeActor] = None
|
||||
self._spawn_info_text: ba.NodeActor | None = None
|
||||
self._dingsound = ba.getsound('dingSmall')
|
||||
self._dingsoundhigh = ba.getsound('dingSmallHigh')
|
||||
self._have_tnt = False
|
||||
self._excluded_powerups: Optional[list[str]] = None
|
||||
self._excluded_powerups: list[str] | None = None
|
||||
self._waves: list[Wave] = []
|
||||
self._tntspawner: Optional[TNTSpawner] = None
|
||||
self._bots: Optional[SpazBotSet] = None
|
||||
self._powerup_drop_timer: Optional[ba.Timer] = None
|
||||
self._time_bonus_timer: Optional[ba.Timer] = None
|
||||
self._time_bonus_text: Optional[ba.NodeActor] = None
|
||||
self._flawless_bonus: Optional[int] = None
|
||||
self._wave_text: Optional[ba.NodeActor] = None
|
||||
self._wave_update_timer: Optional[ba.Timer] = None
|
||||
self._tntspawner: TNTSpawner | None = None
|
||||
self._bots: SpazBotSet | None = None
|
||||
self._powerup_drop_timer: ba.Timer | None = None
|
||||
self._time_bonus_timer: ba.Timer | None = None
|
||||
self._time_bonus_text: ba.NodeActor | None = None
|
||||
self._flawless_bonus: int | None = None
|
||||
self._wave_text: ba.NodeActor | None = None
|
||||
self._wave_update_timer: ba.Timer | None = None
|
||||
self._throw_off_kills = 0
|
||||
self._land_mine_kills = 0
|
||||
self._tnt_kills = 0
|
||||
@ -729,7 +729,7 @@ class OnslaughtGame(ba.CoopGameActivity[Player, Team]):
|
||||
"""End the game with the specified outcome."""
|
||||
if outcome == 'defeat':
|
||||
self.fade_to_red()
|
||||
score: Optional[int]
|
||||
score: int | None
|
||||
if self._wavenum >= 2:
|
||||
score = self._score
|
||||
fail_message = None
|
||||
@ -878,7 +878,7 @@ class OnslaughtGame(ba.CoopGameActivity[Player, Team]):
|
||||
if not any(player.is_alive() for player in self.teams[0].players):
|
||||
self._spawn_info_text.node.text = ''
|
||||
else:
|
||||
text: Union[str, ba.Lstr] = ''
|
||||
text: str | ba.Lstr = ''
|
||||
for player in self.players:
|
||||
if (not player.is_alive()
|
||||
and (self._preset
|
||||
@ -1070,8 +1070,8 @@ class OnslaughtGame(ba.CoopGameActivity[Player, Team]):
|
||||
def _add_entries_for_distribution_group(
|
||||
self, group: list[tuple[int, int]],
|
||||
bot_levels: list[list[type[SpazBot]]],
|
||||
all_entries: list[Union[Spawn, Spacing, Delay, None]]) -> None:
|
||||
entries: list[Union[Spawn, Spacing, Delay, None]] = []
|
||||
all_entries: list[Spawn | Spacing | Delay | None]) -> None:
|
||||
entries: list[Spawn | Spacing | Delay | None] = []
|
||||
for entry in group:
|
||||
bot_level = bot_levels[entry[0] - 1]
|
||||
bot_type = bot_level[random.randrange(len(bot_level))]
|
||||
@ -1106,7 +1106,7 @@ class OnslaughtGame(ba.CoopGameActivity[Player, Team]):
|
||||
distribution = self._get_distribution(target_points, min_dudes,
|
||||
max_dudes, group_count,
|
||||
max_level)
|
||||
all_entries: list[Union[Spawn, Spacing, Delay, None]] = []
|
||||
all_entries: list[Spawn | Spacing | Delay | None] = []
|
||||
for group in distribution:
|
||||
self._add_entries_for_distribution_group(group, bot_levels,
|
||||
all_entries)
|
||||
@ -1206,7 +1206,7 @@ class OnslaughtGame(ba.CoopGameActivity[Player, Team]):
|
||||
pts, importance = msg.spazbot.get_death_points(msg.how)
|
||||
if msg.killerplayer is not None:
|
||||
self._handle_kill_achievements(msg)
|
||||
target: Optional[Sequence[float]]
|
||||
target: Sequence[float] | None
|
||||
if msg.spazbot.node:
|
||||
target = msg.spazbot.node.position
|
||||
else:
|
||||
|
||||
@ -18,7 +18,7 @@ from bastd.actor.scoreboard import Scoreboard
|
||||
from bastd.gameutils import SharedObjects
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Optional, Union
|
||||
from typing import Any, Sequence
|
||||
from bastd.actor.onscreentimer import OnScreenTimer
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ if TYPE_CHECKING:
|
||||
class RaceMine:
|
||||
"""Holds info about a mine on the track."""
|
||||
point: Sequence[float]
|
||||
mine: Optional[Bomb]
|
||||
mine: Bomb | None
|
||||
|
||||
|
||||
class RaceRegion(ba.Actor):
|
||||
@ -53,19 +53,19 @@ class Player(ba.Player['Team']):
|
||||
"""Our player type for this game."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.distance_txt: Optional[ba.Node] = None
|
||||
self.distance_txt: ba.Node | None = None
|
||||
self.last_region = 0
|
||||
self.lap = 0
|
||||
self.distance = 0.0
|
||||
self.finished = False
|
||||
self.rank: Optional[int] = None
|
||||
self.rank: int | None = None
|
||||
|
||||
|
||||
class Team(ba.Team[Player]):
|
||||
"""Our team type for this game."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.time: Optional[float] = None
|
||||
self.time: float | None = None
|
||||
self.lap = 0
|
||||
self.finished = False
|
||||
|
||||
@ -141,22 +141,22 @@ class RaceGame(ba.TeamGameActivity[Player, Team]):
|
||||
self._scoreboard = Scoreboard()
|
||||
self._score_sound = ba.getsound('score')
|
||||
self._swipsound = ba.getsound('swip')
|
||||
self._last_team_time: Optional[float] = None
|
||||
self._front_race_region: Optional[int] = None
|
||||
self._last_team_time: float | None = None
|
||||
self._front_race_region: int | None = None
|
||||
self._nub_tex = ba.gettexture('nub')
|
||||
self._beep_1_sound = ba.getsound('raceBeep1')
|
||||
self._beep_2_sound = ba.getsound('raceBeep2')
|
||||
self.race_region_material: Optional[ba.Material] = None
|
||||
self.race_region_material: ba.Material | None = None
|
||||
self._regions: list[RaceRegion] = []
|
||||
self._team_finish_pts: Optional[int] = None
|
||||
self._time_text: Optional[ba.Actor] = None
|
||||
self._timer: Optional[OnScreenTimer] = None
|
||||
self._race_mines: Optional[list[RaceMine]] = None
|
||||
self._race_mine_timer: Optional[ba.Timer] = None
|
||||
self._scoreboard_timer: Optional[ba.Timer] = None
|
||||
self._player_order_update_timer: Optional[ba.Timer] = None
|
||||
self._start_lights: Optional[list[ba.Node]] = None
|
||||
self._bomb_spawn_timer: Optional[ba.Timer] = None
|
||||
self._team_finish_pts: int | None = None
|
||||
self._time_text: ba.Actor | None = None
|
||||
self._timer: OnScreenTimer | None = None
|
||||
self._race_mines: list[RaceMine] | None = None
|
||||
self._race_mine_timer: ba.Timer | None = None
|
||||
self._scoreboard_timer: ba.Timer | None = None
|
||||
self._player_order_update_timer: ba.Timer | None = None
|
||||
self._start_lights: list[ba.Node] | None = None
|
||||
self._bomb_spawn_timer: ba.Timer | None = None
|
||||
self._laps = int(settings['Laps'])
|
||||
self._entire_team_must_finish = bool(
|
||||
settings.get('Entire Team Must Finish', False))
|
||||
@ -170,7 +170,7 @@ class RaceGame(ba.TeamGameActivity[Player, Team]):
|
||||
self.default_music = (ba.MusicType.EPIC_RACE
|
||||
if self._epic_mode else ba.MusicType.RACE)
|
||||
|
||||
def get_instance_description(self) -> Union[str, Sequence]:
|
||||
def get_instance_description(self) -> str | Sequence:
|
||||
if (isinstance(self.session, ba.DualTeamSession)
|
||||
and self._entire_team_must_finish):
|
||||
t_str = ' Your entire team has to finish.'
|
||||
@ -181,7 +181,7 @@ class RaceGame(ba.TeamGameActivity[Player, Team]):
|
||||
return 'Run ${ARG1} laps.' + t_str, self._laps
|
||||
return 'Run 1 lap.' + t_str
|
||||
|
||||
def get_instance_description_short(self) -> Union[str, Sequence]:
|
||||
def get_instance_description_short(self) -> str | Sequence:
|
||||
if self._laps > 1:
|
||||
return 'run ${ARG1} laps', self._laps
|
||||
return 'run 1 lap'
|
||||
@ -522,7 +522,7 @@ class RaceGame(ba.TeamGameActivity[Player, Team]):
|
||||
|
||||
# Calc all player distances.
|
||||
for player in self.players:
|
||||
pos: Optional[ba.Vec3]
|
||||
pos: ba.Vec3 | None
|
||||
try:
|
||||
pos = player.position
|
||||
except ba.NotFoundError:
|
||||
|
||||
@ -26,7 +26,7 @@ from bastd.actor.spazbot import (
|
||||
BomberBotPro, BrawlerBotPro)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Optional, Union
|
||||
from typing import Any, Sequence
|
||||
|
||||
|
||||
class Preset(Enum):
|
||||
@ -54,7 +54,7 @@ class Spawn:
|
||||
# noinspection PyUnresolvedReferences
|
||||
type: type[SpazBot]
|
||||
path: int = 0
|
||||
point: Optional[Point] = None
|
||||
point: Point | None = None
|
||||
|
||||
|
||||
@dataclass
|
||||
@ -66,15 +66,15 @@ class Spacing:
|
||||
@dataclass
|
||||
class Wave:
|
||||
"""Defines a wave of enemies."""
|
||||
entries: list[Union[Spawn, Spacing, None]]
|
||||
entries: list[Spawn | Spacing | None]
|
||||
|
||||
|
||||
class Player(ba.Player['Team']):
|
||||
"""Our player type for this game."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.respawn_timer: Optional[ba.Timer] = None
|
||||
self.respawn_icon: Optional[RespawnIcon] = None
|
||||
self.respawn_timer: ba.Timer | None = None
|
||||
self.respawn_icon: RespawnIcon | None = None
|
||||
|
||||
|
||||
class Team(ba.Team[Player]):
|
||||
@ -144,31 +144,31 @@ class RunaroundGame(ba.CoopGameActivity[Player, Team]):
|
||||
|
||||
self._last_wave_end_time = ba.time()
|
||||
self._player_has_picked_up_powerup = False
|
||||
self._scoreboard: Optional[Scoreboard] = None
|
||||
self._scoreboard: Scoreboard | None = None
|
||||
self._game_over = False
|
||||
self._wavenum = 0
|
||||
self._can_end_wave = True
|
||||
self._score = 0
|
||||
self._time_bonus = 0
|
||||
self._score_region: Optional[ba.Actor] = None
|
||||
self._score_region: ba.Actor | None = None
|
||||
self._dingsound = ba.getsound('dingSmall')
|
||||
self._dingsoundhigh = ba.getsound('dingSmallHigh')
|
||||
self._exclude_powerups: Optional[list[str]] = None
|
||||
self._have_tnt: Optional[bool] = None
|
||||
self._waves: Optional[list[Wave]] = None
|
||||
self._exclude_powerups: list[str] | None = None
|
||||
self._have_tnt: bool | None = None
|
||||
self._waves: list[Wave] | None = None
|
||||
self._bots = SpazBotSet()
|
||||
self._tntspawner: Optional[TNTSpawner] = None
|
||||
self._lives_bg: Optional[ba.NodeActor] = None
|
||||
self._tntspawner: TNTSpawner | None = None
|
||||
self._lives_bg: ba.NodeActor | None = None
|
||||
self._start_lives = 10
|
||||
self._lives = self._start_lives
|
||||
self._lives_text: Optional[ba.NodeActor] = None
|
||||
self._lives_text: ba.NodeActor | None = None
|
||||
self._flawless = True
|
||||
self._time_bonus_timer: Optional[ba.Timer] = None
|
||||
self._time_bonus_text: Optional[ba.NodeActor] = None
|
||||
self._time_bonus_mult: Optional[float] = None
|
||||
self._wave_text: Optional[ba.NodeActor] = None
|
||||
self._flawless_bonus: Optional[int] = None
|
||||
self._wave_update_timer: Optional[ba.Timer] = None
|
||||
self._time_bonus_timer: ba.Timer | None = None
|
||||
self._time_bonus_text: ba.NodeActor | None = None
|
||||
self._time_bonus_mult: float | None = None
|
||||
self._wave_text: ba.NodeActor | None = None
|
||||
self._flawless_bonus: int | None = None
|
||||
self._wave_update_timer: ba.Timer | None = None
|
||||
|
||||
def on_transition_in(self) -> None:
|
||||
super().on_transition_in()
|
||||
@ -556,7 +556,7 @@ class RunaroundGame(ba.CoopGameActivity[Player, Team]):
|
||||
else:
|
||||
delay = 0
|
||||
|
||||
score: Optional[int]
|
||||
score: int | None
|
||||
if self._wavenum >= 2:
|
||||
score = self._score
|
||||
fail_message = None
|
||||
@ -723,13 +723,13 @@ class RunaroundGame(ba.CoopGameActivity[Player, Team]):
|
||||
t_sec = 0.0
|
||||
base_delay = 0.5
|
||||
delay = 0.0
|
||||
bot_types: list[Union[Spawn, Spacing, None]] = []
|
||||
bot_types: list[Spawn | Spacing | None] = []
|
||||
|
||||
if self._preset in {Preset.ENDLESS, Preset.ENDLESS_TOURNAMENT}:
|
||||
level = self._wavenum
|
||||
target_points = (level + 1) * 8.0
|
||||
group_count = random.randint(1, 3)
|
||||
entries: list[Union[Spawn, Spacing, None]] = []
|
||||
entries: list[Spawn | Spacing | None] = []
|
||||
spaz_types: list[tuple[type[SpazBot], float]] = []
|
||||
if level < 6:
|
||||
spaz_types += [(BomberBot, 5.0)]
|
||||
@ -1121,7 +1121,7 @@ class RunaroundGame(ba.CoopGameActivity[Player, Team]):
|
||||
return None
|
||||
pts, importance = msg.spazbot.get_death_points(msg.how)
|
||||
if msg.killerplayer is not None:
|
||||
target: Optional[Sequence[float]]
|
||||
target: Sequence[float] | None
|
||||
try:
|
||||
assert msg.spazbot is not None
|
||||
assert msg.spazbot.node
|
||||
|
||||
@ -17,7 +17,7 @@ from bastd.actor.bomb import Bomb
|
||||
from bastd.actor.popuptext import PopupText
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Sequence
|
||||
from typing import Any, Sequence
|
||||
from bastd.actor.bomb import Blast
|
||||
|
||||
|
||||
@ -62,8 +62,8 @@ class TargetPracticeGame(ba.TeamGameActivity[Player, Team]):
|
||||
super().__init__(settings)
|
||||
self._scoreboard = Scoreboard()
|
||||
self._targets: list[Target] = []
|
||||
self._update_timer: Optional[ba.Timer] = None
|
||||
self._countdown: Optional[OnScreenCountdown] = None
|
||||
self._update_timer: ba.Timer | None = None
|
||||
self._countdown: OnScreenCountdown | None = None
|
||||
self._target_count = int(settings['Target Count'])
|
||||
self._enable_impact_bombs = bool(settings['Enable Impact Bombs'])
|
||||
self._enable_triple_bombs = bool(settings['Enable Triple Bombs'])
|
||||
|
||||
@ -21,7 +21,7 @@ from bastd.actor.spazbot import (SpazBotSet, SpazBotDiedMessage, BomberBot,
|
||||
ChargerBot, StickyBot, ExplodeyBot)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Sequence
|
||||
from typing import Any, Sequence
|
||||
from bastd.actor.spazbot import SpazBot
|
||||
|
||||
|
||||
@ -71,14 +71,14 @@ class TheLastStandGame(ba.CoopGameActivity[Player, Team]):
|
||||
self._powerup_spread = (7, 2)
|
||||
self._preset = str(settings.get('preset', 'default'))
|
||||
self._excludepowerups: list[str] = []
|
||||
self._scoreboard: Optional[Scoreboard] = None
|
||||
self._scoreboard: Scoreboard | None = None
|
||||
self._score = 0
|
||||
self._bots = SpazBotSet()
|
||||
self._dingsound = ba.getsound('dingSmall')
|
||||
self._dingsoundhigh = ba.getsound('dingSmallHigh')
|
||||
self._tntspawner: Optional[TNTSpawner] = None
|
||||
self._bot_update_interval: Optional[float] = None
|
||||
self._bot_update_timer: Optional[ba.Timer] = None
|
||||
self._tntspawner: TNTSpawner | None = None
|
||||
self._bot_update_interval: float | None = None
|
||||
self._bot_update_timer: ba.Timer | None = None
|
||||
self._powerup_drop_timer = None
|
||||
|
||||
# For each bot type: [spawnrate, increase, d_increase]
|
||||
@ -220,7 +220,7 @@ class TheLastStandGame(ba.CoopGameActivity[Player, Team]):
|
||||
|
||||
# Now go back through and see where this value falls.
|
||||
total = 0
|
||||
bottype: Optional[type[SpazBot]] = None
|
||||
bottype: type[SpazBot] | None = None
|
||||
for spawntype, spawninfo in self._bot_spawn_types.items():
|
||||
total += spawninfo.spawnrate
|
||||
if randval <= total:
|
||||
@ -262,7 +262,7 @@ class TheLastStandGame(ba.CoopGameActivity[Player, Team]):
|
||||
|
||||
elif isinstance(msg, SpazBotDiedMessage):
|
||||
pts, importance = msg.spazbot.get_death_points(msg.how)
|
||||
target: Optional[Sequence[float]]
|
||||
target: Sequence[float] | None
|
||||
if msg.killerplayer:
|
||||
assert msg.spazbot.node
|
||||
target = msg.spazbot.node.position
|
||||
|
||||
@ -9,7 +9,7 @@ from typing import TYPE_CHECKING
|
||||
import ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional
|
||||
pass
|
||||
|
||||
|
||||
class SharedObjects:
|
||||
@ -29,14 +29,14 @@ class SharedObjects:
|
||||
if self._STORENAME in activity.customdata:
|
||||
raise RuntimeError('Use SharedObjects.get() to fetch the'
|
||||
' shared instance for this activity.')
|
||||
self._object_material: Optional[ba.Material] = None
|
||||
self._player_material: Optional[ba.Material] = None
|
||||
self._pickup_material: Optional[ba.Material] = None
|
||||
self._footing_material: Optional[ba.Material] = None
|
||||
self._attack_material: Optional[ba.Material] = None
|
||||
self._death_material: Optional[ba.Material] = None
|
||||
self._region_material: Optional[ba.Material] = None
|
||||
self._railing_material: Optional[ba.Material] = None
|
||||
self._object_material: ba.Material | None = None
|
||||
self._player_material: ba.Material | None = None
|
||||
self._pickup_material: ba.Material | None = None
|
||||
self._footing_material: ba.Material | None = None
|
||||
self._attack_material: ba.Material | None = None
|
||||
self._death_material: ba.Material | None = None
|
||||
self._region_material: ba.Material | None = None
|
||||
self._railing_material: ba.Material | None = None
|
||||
|
||||
@classmethod
|
||||
def get(cls) -> SharedObjects:
|
||||
|
||||
@ -13,7 +13,7 @@ import ba
|
||||
import _ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
# FIXME: Clean this up if I ever revisit it.
|
||||
# pylint: disable=attribute-defined-outside-init
|
||||
@ -32,8 +32,8 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
|
||||
def on_transition_in(self) -> None:
|
||||
super().on_transition_in()
|
||||
random.seed(123)
|
||||
self._logo_node: Optional[ba.Node] = None
|
||||
self._custom_logo_tex_name: Optional[str] = None
|
||||
self._logo_node: ba.Node | None = None
|
||||
self._custom_logo_tex_name: str | None = None
|
||||
self._word_actors: list[ba.Actor] = []
|
||||
app = ba.app
|
||||
|
||||
@ -246,7 +246,7 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
|
||||
|
||||
self._ts = 0.86
|
||||
|
||||
self._language: Optional[str] = None
|
||||
self._language: str | None = None
|
||||
self._update_timer = ba.Timer(1.0, self._update, repeat=True)
|
||||
self._update()
|
||||
|
||||
@ -263,12 +263,12 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
|
||||
self._valid = True
|
||||
self._message_duration = 10.0
|
||||
self._message_spacing = 2.0
|
||||
self._text: Optional[ba.NodeActor] = None
|
||||
self._text: ba.NodeActor | None = None
|
||||
self._activity = weakref.ref(activity)
|
||||
|
||||
# If we're signed in, fetch news immediately.
|
||||
# Otherwise wait until we are signed in.
|
||||
self._fetch_timer: Optional[ba.Timer] = ba.Timer(
|
||||
self._fetch_timer: ba.Timer | None = ba.Timer(
|
||||
1.0, ba.WeakCall(self._try_fetching_news), repeat=True)
|
||||
self._try_fetching_news()
|
||||
|
||||
@ -694,8 +694,8 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
|
||||
# (unless we're in VR mode in which case its best to
|
||||
# leave things still).
|
||||
if not ba.app.vr_mode:
|
||||
cmb: Optional[ba.Node]
|
||||
cmb2: Optional[ba.Node]
|
||||
cmb: ba.Node | None
|
||||
cmb2: ba.Node | None
|
||||
if not shadow:
|
||||
cmb = ba.newnode('combine',
|
||||
owner=word_obj.node,
|
||||
@ -756,7 +756,7 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
|
||||
delay + 0.2: scale
|
||||
})
|
||||
|
||||
def _get_custom_logo_tex_name(self) -> Optional[str]:
|
||||
def _get_custom_logo_tex_name(self) -> str | None:
|
||||
if _ba.get_v1_account_misc_read_val('easter', False):
|
||||
return 'logoEaster'
|
||||
return None
|
||||
|
||||
@ -9,7 +9,7 @@ from typing import TYPE_CHECKING
|
||||
import ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
|
||||
def _get_map_data(name: str) -> dict[str, Any]:
|
||||
@ -26,7 +26,7 @@ class StdMap(ba.Map):
|
||||
"""A map completely defined by asset data.
|
||||
|
||||
"""
|
||||
_data: Optional[dict[str, Any]] = None
|
||||
_data: dict[str, Any] | None = None
|
||||
|
||||
@classmethod
|
||||
def _getdata(cls) -> dict[str, Any]:
|
||||
|
||||
@ -23,10 +23,10 @@ import ba
|
||||
from bastd.actor import spaz as basespaz
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, Callable, Sequence, Union
|
||||
from typing import Any, Callable, Sequence
|
||||
|
||||
|
||||
def _safesetattr(node: Optional[ba.Node], attr: str, value: Any) -> None:
|
||||
def _safesetattr(node: ba.Node | None, attr: str, value: Any) -> None:
|
||||
if node:
|
||||
setattr(node, attr, value)
|
||||
|
||||
@ -46,9 +46,9 @@ class ButtonPress:
|
||||
def run(self, a: TutorialActivity) -> None:
|
||||
s = a.current_spaz
|
||||
assert s is not None
|
||||
img: Optional[ba.Node]
|
||||
release_call: Optional[Callable]
|
||||
color: Optional[Sequence[float]]
|
||||
img: ba.Node | None
|
||||
release_call: Callable[[], None] | None
|
||||
color: Sequence[float] | None
|
||||
if self._button == 'punch':
|
||||
call = s.on_punch_press
|
||||
release_call = s.on_punch_release
|
||||
@ -124,9 +124,9 @@ class ButtonRelease:
|
||||
def run(self, a: TutorialActivity) -> None:
|
||||
s = a.current_spaz
|
||||
assert s is not None
|
||||
call: Optional[Callable]
|
||||
img: Optional[ba.Node]
|
||||
color: Optional[Sequence[float]]
|
||||
call: Callable[[], None] | None
|
||||
img: ba.Node | None
|
||||
color: Sequence[float] | None
|
||||
if self._button == 'punch':
|
||||
call = s.on_punch_release
|
||||
img = a.punch_image
|
||||
@ -183,9 +183,9 @@ class TutorialActivity(ba.Activity[Player, Team]):
|
||||
if settings is None:
|
||||
settings = {}
|
||||
super().__init__(settings)
|
||||
self.current_spaz: Optional[basespaz.Spaz] = None
|
||||
self.current_spaz: basespaz.Spaz | None = None
|
||||
self._benchmark_type = getattr(ba.getsession(), 'benchmark_type', None)
|
||||
self.last_start_time: Optional[int] = None
|
||||
self.last_start_time: int | None = None
|
||||
self.cycle_times: list[int] = []
|
||||
self.allow_pausing = True
|
||||
self.allow_kick_idle_players = False
|
||||
@ -200,31 +200,31 @@ class TutorialActivity(ba.Activity[Player, Team]):
|
||||
self._have_skipped = False
|
||||
self.stick_image_position_x = self.stick_image_position_y = 0.0
|
||||
self.spawn_sound = ba.getsound('spawn')
|
||||
self.map: Optional[ba.Map] = None
|
||||
self.text: Optional[ba.Node] = None
|
||||
self._skip_text: Optional[ba.Node] = None
|
||||
self._skip_count_text: Optional[ba.Node] = None
|
||||
self._scale: Optional[float] = None
|
||||
self.map: ba.Map | None = None
|
||||
self.text: ba.Node | None = None
|
||||
self._skip_text: ba.Node | None = None
|
||||
self._skip_count_text: ba.Node | None = None
|
||||
self._scale: float | None = None
|
||||
self._stick_base_position: tuple[float, float] = (0.0, 0.0)
|
||||
self._stick_nub_position: tuple[float, float] = (0.0, 0.0)
|
||||
self._stick_base_image_color: Sequence[float] = (1.0, 1.0, 1.0, 1.0)
|
||||
self._stick_nub_image_color: Sequence[float] = (1.0, 1.0, 1.0, 1.0)
|
||||
self._time: int = -1
|
||||
self.punch_image_color = (1.0, 1.0, 1.0)
|
||||
self.punch_image: Optional[ba.Node] = None
|
||||
self.bomb_image: Optional[ba.Node] = None
|
||||
self.jump_image: Optional[ba.Node] = None
|
||||
self.pickup_image: Optional[ba.Node] = None
|
||||
self._stick_base_image: Optional[ba.Node] = None
|
||||
self._stick_nub_image: Optional[ba.Node] = None
|
||||
self.punch_image: ba.Node | None = None
|
||||
self.bomb_image: ba.Node | None = None
|
||||
self.jump_image: ba.Node | None = None
|
||||
self.pickup_image: ba.Node | None = None
|
||||
self._stick_base_image: ba.Node | None = None
|
||||
self._stick_nub_image: ba.Node | None = None
|
||||
self.bomb_image_color = (1.0, 1.0, 1.0)
|
||||
self.pickup_image_color = (1.0, 1.0, 1.0)
|
||||
self.control_ui_nodes: list[ba.Node] = []
|
||||
self.spazzes: dict[int, basespaz.Spaz] = {}
|
||||
self.jump_image_color = (1.0, 1.0, 1.0)
|
||||
self._entries: list[Any] = []
|
||||
self._read_entries_timer: Optional[ba.Timer] = None
|
||||
self._entry_timer: Optional[ba.Timer] = None
|
||||
self._read_entries_timer: ba.Timer | None = None
|
||||
self._entry_timer: ba.Timer | None = None
|
||||
|
||||
def on_transition_in(self) -> None:
|
||||
super().on_transition_in()
|
||||
@ -493,7 +493,7 @@ class TutorialActivity(ba.Activity[Player, Team]):
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
make_current: bool = False,
|
||||
relative_to: int = None,
|
||||
name: Union[str, ba.Lstr] = '',
|
||||
name: str | ba.Lstr = '',
|
||||
flash: bool = True,
|
||||
angle: float = 0.0):
|
||||
self._num = num
|
||||
@ -752,7 +752,7 @@ class TutorialActivity(ba.Activity[Player, Team]):
|
||||
|
||||
class Text:
|
||||
|
||||
def __init__(self, text: Union[str, ba.Lstr]):
|
||||
def __init__(self, text: str | ba.Lstr):
|
||||
self.text = text
|
||||
|
||||
def run(self, a: TutorialActivity) -> None:
|
||||
|
||||
@ -10,7 +10,7 @@ import _ba
|
||||
import ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Union, Callable, Optional
|
||||
from typing import Any, Union, Callable
|
||||
|
||||
|
||||
class ConfirmWindow:
|
||||
@ -38,8 +38,8 @@ class ConfirmWindow:
|
||||
self._action = action
|
||||
|
||||
# if they provided an origin-widget, scale up from that
|
||||
self._transition_out: Optional[str]
|
||||
scale_origin: Optional[tuple[float, float]]
|
||||
self._transition_out: str | None
|
||||
scale_origin: tuple[float, float] | None
|
||||
if origin_widget is not None:
|
||||
self._transition_out = 'out_scale'
|
||||
scale_origin = origin_widget.get_screen_space_center()
|
||||
@ -70,7 +70,7 @@ class ConfirmWindow:
|
||||
maxwidth=width * 0.9,
|
||||
max_height=height - 75)
|
||||
|
||||
cbtn: Optional[ba.Widget]
|
||||
cbtn: ba.Widget | None
|
||||
if cancel_button:
|
||||
cbtn = btn = ba.buttonwidget(parent=self.root_widget,
|
||||
autoselect=True,
|
||||
|
||||
@ -12,7 +12,7 @@ import ba
|
||||
from bastd.ui import popup
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Sequence, Optional, Any
|
||||
from typing import Sequence, Any
|
||||
|
||||
|
||||
class PartyWindow(ba.Window):
|
||||
@ -24,9 +24,9 @@ class PartyWindow(ba.Window):
|
||||
def __init__(self, origin: Sequence[float] = (0, 0)):
|
||||
_ba.set_party_window_open(True)
|
||||
self._r = 'partyWindow'
|
||||
self._popup_type: Optional[str] = None
|
||||
self._popup_party_member_client_id: Optional[int] = None
|
||||
self._popup_party_member_is_host: Optional[bool] = None
|
||||
self._popup_type: str | None = None
|
||||
self._popup_party_member_client_id: int | None = None
|
||||
self._popup_party_member_is_host: bool | None = None
|
||||
self._width = 500
|
||||
uiscale = ba.app.ui.uiscale
|
||||
self._height = (365 if uiscale is ba.UIScale.SMALL else
|
||||
@ -153,7 +153,7 @@ class PartyWindow(ba.Window):
|
||||
on_activate_call=self._send_chat_message)
|
||||
ba.textwidget(edit=txt, on_return_press_call=btn.activate)
|
||||
self._name_widgets: list[ba.Widget] = []
|
||||
self._roster: Optional[list[dict[str, Any]]] = None
|
||||
self._roster: list[dict[str, Any]] | None = None
|
||||
self._update_timer = ba.Timer(1.0,
|
||||
ba.WeakCall(self._update),
|
||||
repeat=True,
|
||||
|
||||
@ -9,7 +9,7 @@ import _ba
|
||||
import ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Callable, Optional
|
||||
from typing import Any, Sequence, Callable
|
||||
|
||||
|
||||
class StoreButton:
|
||||
@ -46,8 +46,8 @@ class StoreButton:
|
||||
color=color,
|
||||
button_type=button_type)
|
||||
|
||||
self._title_text: Optional[ba.Widget]
|
||||
self._ticket_text: Optional[ba.Widget]
|
||||
self._title_text: ba.Widget | None
|
||||
self._ticket_text: ba.Widget | None
|
||||
|
||||
if show_tickets:
|
||||
self._title_text = ba.textwidget(
|
||||
|
||||
@ -11,7 +11,7 @@ import ba
|
||||
from bastd.ui import popup as popup_ui
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence, Callable, Optional
|
||||
from typing import Any, Sequence, Callable
|
||||
|
||||
|
||||
class TournamentScoresWindow(popup_ui.PopupWindow):
|
||||
@ -33,7 +33,7 @@ class TournamentScoresWindow(popup_ui.PopupWindow):
|
||||
del tint2_color # unused arg
|
||||
del selected_character # unused arg
|
||||
self._tournament_id = tournament_id
|
||||
self._subcontainer: Optional[ba.Widget] = None
|
||||
self._subcontainer: ba.Widget | None = None
|
||||
self._on_close_call = on_close_call
|
||||
uiscale = ba.app.ui.uiscale
|
||||
if scale is None:
|
||||
@ -107,8 +107,8 @@ class TournamentScoresWindow(popup_ui.PopupWindow):
|
||||
callback=ba.WeakCall(
|
||||
self._on_tournament_query_response))
|
||||
|
||||
def _on_tournament_query_response(self, data: Optional[dict[str,
|
||||
Any]]) -> None:
|
||||
def _on_tournament_query_response(self,
|
||||
data: dict[str, Any] | None) -> None:
|
||||
if data is not None:
|
||||
# this used to be the whole payload
|
||||
data_t: list[dict[str, Any]] = data['t']
|
||||
|
||||
@ -28,7 +28,6 @@ from efro.error import CleanError
|
||||
from efro.terminal import Clr
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, Union
|
||||
from types import FrameType
|
||||
from bacommon.servermanager import ServerCommand
|
||||
|
||||
@ -81,23 +80,23 @@ class ServerManagerApp:
|
||||
self._interactive = sys.stdin.isatty()
|
||||
self._wrapper_shutdown_desired = False
|
||||
self._done = False
|
||||
self._subprocess_commands: list[Union[str, ServerCommand]] = []
|
||||
self._subprocess_commands: list[str | ServerCommand] = []
|
||||
self._subprocess_commands_lock = Lock()
|
||||
self._subprocess_force_kill_time: Optional[float] = None
|
||||
self._subprocess_force_kill_time: float | None = None
|
||||
self._auto_restart = True
|
||||
self._config_auto_restart = True
|
||||
self._config_mtime: Optional[float] = None
|
||||
self._last_config_mtime_check_time: Optional[float] = None
|
||||
self._config_mtime: float | None = None
|
||||
self._last_config_mtime_check_time: float | None = None
|
||||
self._should_report_subprocess_error = False
|
||||
self._running = False
|
||||
self._interpreter_start_time: Optional[float] = None
|
||||
self._subprocess: Optional[subprocess.Popen[bytes]] = None
|
||||
self._subprocess_launch_time: Optional[float] = None
|
||||
self._interpreter_start_time: float | None = None
|
||||
self._subprocess: subprocess.Popen[bytes] | None = None
|
||||
self._subprocess_launch_time: float | None = None
|
||||
self._subprocess_sent_config_auto_restart = False
|
||||
self._subprocess_sent_clean_exit = False
|
||||
self._subprocess_sent_unclean_exit = False
|
||||
self._subprocess_thread: Optional[Thread] = None
|
||||
self._subprocess_exited_cleanly: Optional[bool] = None
|
||||
self._subprocess_thread: Thread | None = None
|
||||
self._subprocess_exited_cleanly: bool | None = None
|
||||
|
||||
# This may override the above defaults.
|
||||
self._parse_command_line_args()
|
||||
@ -251,8 +250,8 @@ class ServerManagerApp:
|
||||
|
||||
def screenmessage(self,
|
||||
message: str,
|
||||
color: Optional[tuple[float, float, float]] = None,
|
||||
clients: Optional[list[int]] = None) -> None:
|
||||
color: tuple[float, float, float] | None = None,
|
||||
clients: list[int] | None = None) -> None:
|
||||
"""Display a screen-message.
|
||||
|
||||
This will have no name attached and not show up in chat history.
|
||||
@ -265,7 +264,7 @@ class ServerManagerApp:
|
||||
|
||||
def chatmessage(self,
|
||||
message: str,
|
||||
clients: Optional[list[int]] = None) -> None:
|
||||
clients: list[int] | None = None) -> None:
|
||||
"""Send a chat message from the server.
|
||||
|
||||
This will have the server's name attached and will be logged
|
||||
@ -281,7 +280,7 @@ class ServerManagerApp:
|
||||
self._enqueue_server_command(ClientListCommand())
|
||||
self._block_for_command_completion()
|
||||
|
||||
def kick(self, client_id: int, ban_time: Optional[int] = None) -> None:
|
||||
def kick(self, client_id: int, ban_time: int | None = None) -> None:
|
||||
"""Kick the client with the provided id.
|
||||
|
||||
If ban_time is provided, the client will be banned for that
|
||||
@ -489,7 +488,7 @@ class ServerManagerApp:
|
||||
|
||||
def _load_config_from_file(self, print_confirmation: bool) -> ServerConfig:
|
||||
|
||||
out: Optional[ServerConfig] = None
|
||||
out: ServerConfig | None = None
|
||||
|
||||
if not os.path.exists(self._config_path):
|
||||
|
||||
@ -549,8 +548,7 @@ class ServerManagerApp:
|
||||
while not self._done:
|
||||
self._run_server_cycle()
|
||||
|
||||
def _handle_term_signal(self, sig: int,
|
||||
frame: Optional[FrameType]) -> None:
|
||||
def _handle_term_signal(self, sig: int, frame: FrameType | None) -> None:
|
||||
"""Handle signals (will always run in the main thread)."""
|
||||
del sig, frame # Unused.
|
||||
sys.exit(1 if self._should_report_subprocess_error else 0)
|
||||
@ -742,7 +740,7 @@ class ServerManagerApp:
|
||||
break
|
||||
|
||||
# Watch for the server process exiting..
|
||||
code: Optional[int] = self._subprocess.poll()
|
||||
code: int | None = self._subprocess.poll()
|
||||
if code is not None:
|
||||
|
||||
clr = Clr.CYN if code == 0 else Clr.RED
|
||||
@ -768,7 +766,7 @@ class ServerManagerApp:
|
||||
if (self._last_config_mtime_check_time is None
|
||||
or (now - self._last_config_mtime_check_time) > 3.123):
|
||||
self._last_config_mtime_check_time = now
|
||||
mtime: Optional[float]
|
||||
mtime: float | None
|
||||
if os.path.isfile(self._config_path):
|
||||
mtime = Path(self._config_path).stat().st_mtime
|
||||
else:
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
namespace ballistica {
|
||||
|
||||
// These are set automatically via script; don't modify them here.
|
||||
const int kAppBuildNumber = 20612;
|
||||
const int kAppBuildNumber = 20615;
|
||||
const char* kAppVersion = "1.7.2";
|
||||
|
||||
// Our standalone globals.
|
||||
|
||||
@ -467,7 +467,7 @@ auto PythonMethodsNetworking::GetMethods() -> std::vector<PyMethodDef> {
|
||||
|
||||
{"get_client_public_device_uuid",
|
||||
(PyCFunction)PyGetClientPublicDeviceUUID, METH_VARARGS | METH_KEYWORDS,
|
||||
"get_client_public_device_uuid(client_id: int) -> Optional[str]\n"
|
||||
"get_client_public_device_uuid(client_id: int) -> str | None\n"
|
||||
"\n"
|
||||
"(internal)\n"
|
||||
"\n"
|
||||
@ -529,7 +529,7 @@ auto PythonMethodsNetworking::GetMethods() -> std::vector<PyMethodDef> {
|
||||
|
||||
{"set_public_party_stats_url", (PyCFunction)PySetPublicPartyStatsURL,
|
||||
METH_VARARGS | METH_KEYWORDS,
|
||||
"set_public_party_stats_url(url: Optional[str]) -> None\n"
|
||||
"set_public_party_stats_url(url: str | None) -> None\n"
|
||||
"\n"
|
||||
"(internal)"},
|
||||
|
||||
|
||||
@ -17,16 +17,16 @@ from efro.terminal import Clr
|
||||
from efrotools.build import Lazybuild
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Sequence, Optional, Any
|
||||
from typing import Sequence, Any
|
||||
|
||||
|
||||
# Python pip packages we require for this project.
|
||||
@dataclass
|
||||
class PipRequirement:
|
||||
"""A pip package required by our project."""
|
||||
modulename: Optional[str] = None
|
||||
minversion: Optional[list[int]] = None # None implies no min version.
|
||||
pipname: Optional[str] = None # None implies same as modulename.
|
||||
modulename: str | None = None
|
||||
minversion: list[int] | None = None # None implies no min version.
|
||||
pipname: str | None = None # None implies same as modulename.
|
||||
|
||||
|
||||
# Note: we look directly for modules when possible instead of just pip
|
||||
|
||||
@ -33,7 +33,7 @@ def _get_varying_func_info(sig_in: str) -> tuple[str, str]:
|
||||
sig = ('# Show that ur return type varies based on "doraise" value:\n'
|
||||
'@overload\n'
|
||||
'def getdelegate(self, type: type[_T],'
|
||||
' doraise: Literal[False] = False) -> Optional[_T]:\n'
|
||||
' doraise: Literal[False] = False) -> _T | None:\n'
|
||||
' ...\n'
|
||||
'\n'
|
||||
'@overload\n'
|
||||
@ -53,7 +53,7 @@ def _get_varying_func_info(sig_in: str) -> tuple[str, str]:
|
||||
'\n'
|
||||
'@overload\n'
|
||||
'def getinputdevice(name: str, unique_id: str,'
|
||||
' doraise: Literal[False]) -> Optional[ba.InputDevice]:\n'
|
||||
' doraise: Literal[False]) -> ba.InputDevice | None:\n'
|
||||
' ...\n'
|
||||
'\n'
|
||||
'def getinputdevice(name: str, unique_id: str,'
|
||||
@ -97,11 +97,11 @@ def _get_varying_func_info(sig_in: str) -> tuple[str, str]:
|
||||
'\n'
|
||||
'@overload\n'
|
||||
'def getactivity(doraise: Literal[False])'
|
||||
' -> Optional[ba.Activity]:\n'
|
||||
' -> ba.Activity | None:\n'
|
||||
' ...\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'def getactivity(doraise: bool = True) -> Optional[ba.Activity]:')
|
||||
'def getactivity(doraise: bool = True) -> ba.Activity | None:')
|
||||
elif sig_in == 'getsession(doraise: bool = True) -> <varies>':
|
||||
sig = ('# Show that our return type varies based on "doraise" value:\n'
|
||||
'@overload\n'
|
||||
@ -111,11 +111,11 @@ def _get_varying_func_info(sig_in: str) -> tuple[str, str]:
|
||||
'\n'
|
||||
'@overload\n'
|
||||
'def getsession(doraise: Literal[False])'
|
||||
' -> Optional[ba.Session]:\n'
|
||||
' -> ba.Session | None:\n'
|
||||
' ...\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'def getsession(doraise: bool = True) -> Optional[ba.Session]:')
|
||||
'def getsession(doraise: bool = True) -> ba.Session | None:')
|
||||
|
||||
else:
|
||||
raise RuntimeError(
|
||||
@ -179,18 +179,21 @@ def _writefuncs(parent: Any, funcnames: Sequence[str], indent: int,
|
||||
elif returns == 'ba.Lstr':
|
||||
returnstr = ('import ba # pylint: disable=cyclic-import\n'
|
||||
"return ba.Lstr(value='')")
|
||||
elif returns in ('ba.Activity', 'Optional[ba.Activity]'):
|
||||
elif returns in ('ba.Activity', 'Optional[ba.Activity]',
|
||||
'ba.Activity | None'):
|
||||
returnstr = (
|
||||
'import ba # pylint: disable=cyclic-import\nreturn ' +
|
||||
'ba.Activity(settings={})')
|
||||
elif returns in ('ba.Session', 'Optional[ba.Session]'):
|
||||
elif returns in ('ba.Session', 'Optional[ba.Session]',
|
||||
'ba.Session | None'):
|
||||
returnstr = (
|
||||
'import ba # pylint: disable=cyclic-import\nreturn ' +
|
||||
'ba.Session([])')
|
||||
elif returns == 'Optional[ba.SessionPlayer]':
|
||||
elif returns in ('Optional[ba.SessionPlayer]',
|
||||
'ba.SessionPlayer | None'):
|
||||
returnstr = ('import ba # pylint: disable=cyclic-import\n'
|
||||
'return ba.SessionPlayer()')
|
||||
elif returns == 'Optional[ba.Player]':
|
||||
elif returns in ('Optional[ba.Player]', 'ba.Player | None'):
|
||||
returnstr = ('import ba # pylint: disable=cyclic-import\n'
|
||||
'return ba.Player()')
|
||||
elif returns.startswith('ba.'):
|
||||
@ -212,13 +215,14 @@ def _writefuncs(parent: Any, funcnames: Sequence[str], indent: int,
|
||||
returnstr = 'return _uninferrable()'
|
||||
elif returns == 'tuple[float, float]':
|
||||
returnstr = 'return (0.0, 0.0)'
|
||||
elif returns == 'Optional[str]':
|
||||
elif returns in ('Optional[str]', 'str | None'):
|
||||
returnstr = "return ''"
|
||||
elif returns == 'tuple[float, float, float, float]':
|
||||
returnstr = 'return (0.0, 0.0, 0.0, 0.0)'
|
||||
elif returns == 'Optional[ba.Widget]':
|
||||
elif returns in ('Optional[ba.Widget]', 'ba.Widget | None'):
|
||||
returnstr = 'return Widget()'
|
||||
elif returns == 'Optional[ba.InputDevice]':
|
||||
elif returns in ('Optional[ba.InputDevice]',
|
||||
'ba.InputDevice | None'):
|
||||
returnstr = 'return InputDevice()'
|
||||
elif returns == 'list[ba.Widget]':
|
||||
returnstr = 'return [Widget()]'
|
||||
@ -230,7 +234,8 @@ def _writefuncs(parent: Any, funcnames: Sequence[str], indent: int,
|
||||
returnstr = 'return 0.0'
|
||||
elif returns == 'dict[str, Any]':
|
||||
returnstr = "return {'foo': 'bar'}"
|
||||
elif returns in ('Optional[tuple[int, int]]', 'tuple[int, int]'):
|
||||
elif returns in ('Optional[tuple[int, int]]',
|
||||
'tuple[int, int] | None', 'tuple[int, int]'):
|
||||
returnstr = 'return (0, 0)'
|
||||
elif returns == 'list[dict[str, Any]]':
|
||||
returnstr = "return [{'foo': 'bar'}]"
|
||||
|
||||
@ -10,7 +10,7 @@ from typing import TYPE_CHECKING
|
||||
from efro.terminal import Clr
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional
|
||||
pass
|
||||
|
||||
|
||||
def gen_flat_data_code(projroot: str, in_path: str, out_path: str,
|
||||
@ -33,7 +33,7 @@ def gen_flat_data_code(projroot: str, in_path: str, out_path: str,
|
||||
# slightly slow down hackers.
|
||||
sval = svalin
|
||||
|
||||
sval1: Optional[bytes]
|
||||
sval1: bytes | None
|
||||
sval1 = sval
|
||||
while sval1:
|
||||
sval_out += ' ' + json.dumps(sval1[:1000].decode())
|
||||
|
||||
@ -15,7 +15,7 @@ from efro.error import CleanError
|
||||
from efro.terminal import Clr
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional
|
||||
pass
|
||||
|
||||
|
||||
def project_centric_path(projroot: str, path: str) -> str:
|
||||
@ -67,8 +67,8 @@ class Updater:
|
||||
self._license_line_checks = bool(
|
||||
getlocalconfig(Path('.')).get('license_line_checks', True))
|
||||
|
||||
self._internal_source_dirs: Optional[set[str]] = None
|
||||
self._internal_source_files: Optional[set[str]] = None
|
||||
self._internal_source_dirs: set[str] | None = None
|
||||
self._internal_source_files: set[str] | None = None
|
||||
|
||||
def run(self) -> None:
|
||||
"""Do the thing."""
|
||||
@ -153,7 +153,7 @@ class Updater:
|
||||
# (or error if we're in check mode).
|
||||
unchanged_project_count = 0
|
||||
for fname, fcode in self._file_changes.items():
|
||||
f_orig: Optional[str]
|
||||
f_orig: str | None
|
||||
if os.path.exists(fname):
|
||||
with open(fname, 'r', encoding='utf-8') as infile:
|
||||
f_orig = infile.read()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user