Tweak tool suppression logic for vehicles

This commit is contained in:
Kae 2023-10-10 19:38:29 +11:00
parent 5ef8aa273e
commit be27a96505
4 changed files with 4 additions and 4 deletions

View File

@ -1440,7 +1440,7 @@ bool Player::canUseTool() const {
bool canUse = !isDead() && !isTeleporting() && !m_techController->toolUsageSuppressed(); bool canUse = !isDead() && !isTeleporting() && !m_techController->toolUsageSuppressed();
if (canUse) { if (canUse) {
if (auto loungeAnchor = as<LoungeAnchor>(m_movementController->entityAnchor())) if (auto loungeAnchor = as<LoungeAnchor>(m_movementController->entityAnchor()))
if (loungeAnchor->suppressTools) if (loungeAnchor->suppressTools.value(loungeAnchor->controllable))
return false; return false;
} }
return canUse; return canUse;

View File

@ -46,7 +46,7 @@ Vehicle::Vehicle(Json baseConfig, String path, Json dynamicConfig)
loungePosition.dance.set(pair.second.optString("dance")); loungePosition.dance.set(pair.second.optString("dance"));
loungePosition.directives.set(pair.second.optString("directives")); loungePosition.directives.set(pair.second.optString("directives"));
loungePosition.statusEffects.set(pair.second.getArray("statusEffects", {}).transformed(jsonToPersistentStatusEffect)); loungePosition.statusEffects.set(pair.second.getArray("statusEffects", {}).transformed(jsonToPersistentStatusEffect));
loungePosition.suppressTools = pair.second.getBool("suppressTools", false); loungePosition.suppressTools = pair.second.optBool("suppressTools");
} }
for (auto const& pair : configValue("physicsCollisions", JsonObject()).iterateObject()) { for (auto const& pair : configValue("physicsCollisions", JsonObject()).iterateObject()) {

View File

@ -96,7 +96,7 @@ private:
Maybe<Vec2F> exitBottomOffset; Maybe<Vec2F> exitBottomOffset;
JsonObject armorCosmeticOverrides; JsonObject armorCosmeticOverrides;
Maybe<String> cursorOverride; Maybe<String> cursorOverride;
bool suppressTools; Maybe<bool> suppressTools;
bool cameraFocus; bool cameraFocus;
NetElementBool enabled; NetElementBool enabled;

View File

@ -31,7 +31,7 @@ struct LoungeAnchor : EntityAnchor {
Maybe<Directives> directives; Maybe<Directives> directives;
JsonObject armorCosmeticOverrides; JsonObject armorCosmeticOverrides;
Maybe<String> cursorOverride; Maybe<String> cursorOverride;
bool suppressTools; Maybe<bool> suppressTools;
bool cameraFocus; bool cameraFocus;
}; };