Let players use tools in lounges
This commit is contained in:
parent
c1ae238086
commit
b964668a38
@ -879,11 +879,13 @@ void Player::update(uint64_t) {
|
||||
p.second->update(WorldTimestep * p.second->updateDelta());
|
||||
|
||||
if (edgeTriggeredUse) {
|
||||
if (canUseTool()) {
|
||||
auto anchor = as<LoungeAnchor>(m_movementController->entityAnchor());
|
||||
bool useTool = canUseTool();
|
||||
if (anchor && (!useTool || anchor->controllable))
|
||||
m_movementController->resetAnchorState();
|
||||
else if (useTool) {
|
||||
if (auto ie = bestInteractionEntity(true))
|
||||
interactWithEntity(ie);
|
||||
} else if (loungingIn()) {
|
||||
m_movementController->resetAnchorState();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1393,7 +1395,13 @@ void Player::playEmote(HumanoidEmote emote) {
|
||||
}
|
||||
|
||||
bool Player::canUseTool() const {
|
||||
return !isDead() && !isTeleporting() && !m_techController->toolUsageSuppressed() && m_state != State::Lounge;
|
||||
bool canUse = !isDead() && !isTeleporting() && !m_techController->toolUsageSuppressed();
|
||||
if (canUse) {
|
||||
if (auto loungeAnchor = as<LoungeAnchor>(m_movementController->entityAnchor()))
|
||||
if (loungeAnchor->suppressTools)
|
||||
return false;
|
||||
}
|
||||
return canUse;
|
||||
}
|
||||
|
||||
void Player::beginPrimaryFire() {
|
||||
|
@ -46,6 +46,7 @@ Vehicle::Vehicle(Json baseConfig, String path, Json dynamicConfig)
|
||||
loungePosition.dance.set(pair.second.optString("dance"));
|
||||
loungePosition.directives.set(pair.second.optString("directives"));
|
||||
loungePosition.statusEffects.set(pair.second.getArray("statusEffects", {}).transformed(jsonToPersistentStatusEffect));
|
||||
loungePosition.suppressTools = pair.second.getBool("suppressTools", false);
|
||||
}
|
||||
|
||||
for (auto const& pair : configValue("physicsCollisions", JsonObject()).iterateObject()) {
|
||||
@ -465,6 +466,7 @@ LoungeAnchorConstPtr Vehicle::loungeAnchor(size_t positionIndex) const {
|
||||
loungePosition->armorCosmeticOverrides = positionConfig.armorCosmeticOverrides;
|
||||
loungePosition->cursorOverride = positionConfig.cursorOverride;
|
||||
loungePosition->cameraFocus = positionConfig.cameraFocus;
|
||||
loungePosition->suppressTools = positionConfig.suppressTools;
|
||||
return loungePosition;
|
||||
}
|
||||
|
||||
|
@ -96,6 +96,7 @@ private:
|
||||
Maybe<Vec2F> exitBottomOffset;
|
||||
JsonObject armorCosmeticOverrides;
|
||||
Maybe<String> cursorOverride;
|
||||
bool suppressTools;
|
||||
bool cameraFocus;
|
||||
|
||||
NetElementBool enabled;
|
||||
|
@ -31,6 +31,7 @@ struct LoungeAnchor : EntityAnchor {
|
||||
Maybe<Directives> directives;
|
||||
JsonObject armorCosmeticOverrides;
|
||||
Maybe<String> cursorOverride;
|
||||
bool suppressTools;
|
||||
bool cameraFocus;
|
||||
};
|
||||
|
||||
|
@ -51,6 +51,7 @@ LoungeAnchorConstPtr LoungeableObject::loungeAnchor(size_t positionIndex) const
|
||||
|
||||
auto loungeAnchor = make_shared<LoungeAnchor>();
|
||||
|
||||
loungeAnchor->suppressTools = false;
|
||||
loungeAnchor->controllable = false;
|
||||
loungeAnchor->direction = m_sitFlipDirection ? -direction() : direction();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user