From 94e2155a8911efb17ad59e6fb5114e48c0a5b97f Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Mon, 15 Feb 2021 12:47:02 -0600 Subject: [PATCH] Misc tidying and common lib updates --- .efrocachemap | 72 +++++++++---------- .idea/dictionaries/ericf.xml | 2 + .../.idea/dictionaries/ericf.xml | 1 + docs/ba_module.md | 2 +- src/ballistica/ballistica.cc | 2 +- src/ballistica/ballistica.h | 4 +- src/ballistica/game/game.cc | 8 --- src/ballistica/game/game.h | 2 - tools/efro/entity/_support.py | 12 +++- tools/efro/util.py | 19 +++++ 10 files changed, 73 insertions(+), 51 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 5e50d92c..579e71fc 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3932,40 +3932,40 @@ "assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450", "assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e", "assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f", - "build/prefab/full/linux_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/b5/9c/4ed33ca668735a73940f0f34bba5", - "build/prefab/full/linux_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/fd/44/ddb130657627ecd2601304a58fc2", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a9/ef/33d214794fcd5bd12f1bedf8b473", - "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/78/fc/7fc9b5a1476b16729e276c0a4149", - "build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/7b/a8/9890f10c94576c95314f8af13691", - "build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/c1/5b/6f127d8dab6ee7926970fc6a608a", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/48/23/07790e69616cb6b4cc363d6387f3", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/97/45/3b791f71346eaa3336ce6d272710", - "build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/81/92/432abd7736711dfe9d3246197b34", - "build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/0f/00/100c03c2890ea8b0ebc0a9fc3148", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4d/8a/70142a48207549acf806375f7e29", - "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/32/96/a70288e1c3ef9b2526b6465ea813", - "build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/54/6f/d226aa9c2a264379370f771fd6e2", - "build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/21/1a/6a2574c7b7567e7fd3ffba14c867", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ca/af/c555373380ed30d3307f1f72980f", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/98/d0/b6cf47b24b7f3b1e371de3c23b12", - "build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/44/67/b57a5df7975d4f33362281f68928", - "build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/44/af/203a0d2870be0978f0e1ce9cef25", - "build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/ed/68/95d4496ed757cd3a4a69ab9b8bb2", - "build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/4c/ce/f55164dd7ddc92efda6f9933ff71", - "build/prefab/lib/linux_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/34/21/016123d9ec8293ce92ba910dd00a", - "build/prefab/lib/linux_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6f/f8/cf46e7c33a0a237e2c6f19ef4f92", - "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/10/67/5a3d6131d1b1fdf9f629301b68db", - "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6b/bc/72d32c36d51acb255b2667c4d386", - "build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7c/9b/af5e799cb4d296074598f11a063f", - "build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/35/7c/b5f26ca01907df6ea80ff3ae5861", - "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8c/76/9ea770a68773fd4a08fb78855fbb", - "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1d/b3/329956f15f5cb76a63bd4fd3e0cc", - "build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3f/9f/364a5a80335d48c6ad7e82037e35", - "build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/61/80/48a03104b7dd1662caf414c89027", - "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/76/44/772d6659c84af2c27d72825fe014", - "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/fe/1e/343bfea0b8ad9801b3c2c521d84f", - "build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c1/0c/f191201437b205048516d1a6bbaa", - "build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/77/04/5b95837741d1f3fccf17a812ba2d", - "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/57/a0/1d2ddef1ce03fca30125c65a9569", - "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/34/da/e9d2065a1e9fc41e7f84e8d7c7b0" + "build/prefab/full/linux_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ea/05/68b74f30e981933bbae03755e4de", + "build/prefab/full/linux_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/31/a6/b3ddf128be7d13840e069f827044", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d9/1e/850d020b72dacf7183db2235eae6", + "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/af/e0/c1e1eef9db322ac19764a1c3c064", + "build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/81/c7/93bdab4190e62d6a362dda017bbd", + "build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/be/26/8b6a414b673401e6e4e3fdb7c8c7", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2a/68/72899e9f3026dae42206415dd28a", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e4/bc/c5ac53cdc69c2d289ee96a017ead", + "build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/33/44/526fc5ce4e143d870e3036e7810e", + "build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/aa/60/af50b46a92dfcd4d99450f0ea90a", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/52/b9/419f3cff40380d5c9de94b9cd5bc", + "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/77/cc/27f3e0187c85a966a53d8846b773", + "build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/67/d1/bf1a09c11b5d395eca2480091d82", + "build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/7b/20/c7ba7aff67a80900985869160266", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/83/34/4792d67ee44693f8a79d0e45b693", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/86/be/8b9603cbee7660f861ac099075cf", + "build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/8e/b6/d1a042ebce63ac649fbc71faeeb4", + "build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ba/02/e4d54f002ee5a741e87c9e31a353", + "build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/db/01/88065479393a44de2f4203c849b4", + "build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/bc/83/e79ec5372197af6c23bf80060480", + "build/prefab/lib/linux_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4c/bf/393694ea67f3d590dd2706c9955e", + "build/prefab/lib/linux_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/78/cb/bb9ae4f896f862074057c8e36e1d", + "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ae/bd/39d7b885f7f01e81d0e96f0f85ce", + "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/30/da/709e6b36f4f3158843d3a39032c6", + "build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c0/9b/5d60f10dbe2e6f670b9e177bce16", + "build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/52/d9/563a6949d2c4db5a915c54460fbc", + "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d0/6a/42fe8d2e34f95e1b3282e8422344", + "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/50/cf/bad44b07a4022aee3001002086b5", + "build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5a/42/aa563542dce1ac737ffeb7876ee0", + "build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e5/31/a045a08a8db23dfe4e9da0b5b1fa", + "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f3/a5/741584cb2f6897d9f11b1a60ab62", + "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/58/90/07fd566cc337337e3e622d86c613", + "build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c6/cb/ed41a99350ec3c21184688eacdfa", + "build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2f/dc/4761b6be13320fdf8ba733b10570", + "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/71/88/46aa34701da4196d5e53083bf1bb", + "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e0/c4/cbcc32a20a5cdb038c33d6f992c0" } \ No newline at end of file diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index 62e0334c..5034db82 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -1172,6 +1172,7 @@ linbeast lindex lindexorig + linearstep linebits lineheight lineno @@ -1938,6 +1939,7 @@ smag smallscale smlh + smoothstep smoothy smtpd smtplib diff --git a/ballisticacore-cmake/.idea/dictionaries/ericf.xml b/ballisticacore-cmake/.idea/dictionaries/ericf.xml index a872c19e..f337f6d1 100644 --- a/ballisticacore-cmake/.idea/dictionaries/ericf.xml +++ b/ballisticacore-cmake/.idea/dictionaries/ericf.xml @@ -499,6 +499,7 @@ libutf lightshad linearsize + linearstep listobj llock lockpath diff --git a/docs/ba_module.md b/docs/ba_module.md index a78595e7..5964a1da 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2021-01-26 for Ballistica version 1.6.0 build 20279

+

last updated on 2021-02-15 for Ballistica version 1.6.0 build 20279

This page documents the Python classes and functions in the 'ba' module, which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please let me know. Happy modding!


diff --git a/src/ballistica/ballistica.cc b/src/ballistica/ballistica.cc index 064ce01a..452569ff 100644 --- a/src/ballistica/ballistica.cc +++ b/src/ballistica/ballistica.cc @@ -21,7 +21,7 @@ namespace ballistica { // These are set automatically via script; don't change here. -const int kAppBuildNumber = 20279; +const int kAppBuildNumber = 20280; const char* kAppVersion = "1.6.0"; // Our standalone globals. diff --git a/src/ballistica/ballistica.h b/src/ballistica/ballistica.h index dfad7e31..f50b5521 100644 --- a/src/ballistica/ballistica.h +++ b/src/ballistica/ballistica.h @@ -158,8 +158,8 @@ auto AppInternalInitPythonModule() -> void; auto AppInternalPythonPostInit() -> void; auto AppInternalHasBlessingHash() -> bool; auto AppInternalPutLog(bool fatal) -> bool; -auto AppInternalAwardAdTickets() -> void; -auto AppInternalAwardAdTournamentEntry() -> void; +auto AppInternalAAT() -> void; +auto AppInternalAATE() -> void; auto AppInternalSetAdCompletionCall(PyObject* obj, bool pass_actually_showed) -> void; auto AppInternalPushAdViewComplete(const std::string& purpose, diff --git a/src/ballistica/game/game.cc b/src/ballistica/game/game.cc index fd48273e..0200f692 100644 --- a/src/ballistica/game/game.cc +++ b/src/ballistica/game/game.cc @@ -315,14 +315,6 @@ void Game::InitialScreenCreated() { void Game::Prune() { g_media->Prune(); } -void Game::PushAwardAdTicketsCall() { - PushCall([] { AppInternalAwardAdTickets(); }); -} - -void Game::PushAwardAdTournamentEntryCall() { - PushCall([] { AppInternalAwardAdTournamentEntry(); }); -} - // Launch into main menu or whatever else. void Game::RunAppLaunchCommands() { assert(!ran_app_launch_commands_); diff --git a/src/ballistica/game/game.h b/src/ballistica/game/game.h index 4acd8ba5..c70df4e8 100644 --- a/src/ballistica/game/game.h +++ b/src/ballistica/game/game.h @@ -37,8 +37,6 @@ class Game : public Module { const std::string& account_id) -> void; auto PushSetAccountTokenCall(const std::string& account_id, const std::string& token) -> void; - auto PushAwardAdTicketsCall() -> void; - auto PushAwardAdTournamentEntryCall() -> void; auto PushPartyInviteCall(const std::string& name, const std::string& invite_id) -> void; auto PushPartyInviteRevokeCall(const std::string& invite_id) -> void; diff --git a/tools/efro/entity/_support.py b/tools/efro/entity/_support.py index 6d32ae39..43c034e5 100644 --- a/tools/efro/entity/_support.py +++ b/tools/efro/entity/_support.py @@ -392,8 +392,11 @@ class BoundCompoundDictField(Generic[TKey, TCompound]): # would not be able to make sense of) if TYPE_CHECKING: + def get(self, key: TKey) -> Optional[TCompound]: + """Return a value if present; otherwise None.""" + def __getitem__(self, key: TKey) -> TCompound: - pass + ... def values(self) -> List[TCompound]: """Return a list of our values.""" @@ -408,6 +411,13 @@ class BoundCompoundDictField(Generic[TKey, TCompound]): else: + def get(self, key): + """return a value if present; otherwise None.""" + data = self.d_data.get(key) + if data is not None: + return BoundCompoundValue(self.d_field.d_value, data) + return None + def __getitem__(self, key): return BoundCompoundValue(self.d_field.d_value, self.d_data[key]) diff --git a/tools/efro/util.py b/tools/efro/util.py index 4c45db64..d4bf0440 100644 --- a/tools/efro/util.py +++ b/tools/efro/util.py @@ -449,3 +449,22 @@ def check_non_optional(obj: Optional[T]) -> T: if obj is None: raise TypeError('Got None value in check_non_optional.') return obj + + +def smoothstep(edge0: float, edge1: float, x: float) -> float: + """A smooth transition function. + + Returns a value that smoothly moves from 0 to 1 as we go between edges. + Values outside of the range return 0 or 1. + """ + y = min(1.0, max(0.0, (x - edge0) / (edge1 - edge0))) + return y * y * (3.0 - 2.0 * y) + + +def linearstep(edge0: float, edge1: float, x: float) -> float: + """A linear transition function. + + Returns a value that linearly moves from 0 to 1 as we go between edges. + Values outside of the range return 0 or 1. + """ + return max(0.0, min(1.0, (x - edge0) / (edge1 - edge0)))