Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-20 15:27:28 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-20 15:27:28 +1000
commitb964668a38a69a3dcec58fece9bdf97b693d6e22 (patch)
treeaf8834fa258863567d99bbf3a3f63794db690197
parentc1ae23808677028ef6ac1b7f0b19b298d78affc2 (diff)
Let players use tools in lounges
-rw-r--r--source/game/StarPlayer.cpp16
-rw-r--r--source/game/StarVehicle.cpp2
-rw-r--r--source/game/StarVehicle.hpp1
-rw-r--r--source/game/interfaces/StarLoungingEntities.hpp1
-rw-r--r--source/game/objects/StarLoungeableObject.cpp1
5 files changed, 17 insertions, 4 deletions
diff --git a/source/game/StarPlayer.cpp b/source/game/StarPlayer.cpp
index d790d1c..2fa98df 100644
--- a/source/game/StarPlayer.cpp
+++ b/source/game/StarPlayer.cpp
@@ -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() {
diff --git a/source/game/StarVehicle.cpp b/source/game/StarVehicle.cpp
index e60e6e6..5747507 100644
--- a/source/game/StarVehicle.cpp
+++ b/source/game/StarVehicle.cpp
@@ -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;
}
diff --git a/source/game/StarVehicle.hpp b/source/game/StarVehicle.hpp
index 381e207..f5bc2b5 100644
--- a/source/game/StarVehicle.hpp
+++ b/source/game/StarVehicle.hpp
@@ -96,6 +96,7 @@ private:
Maybe<Vec2F> exitBottomOffset;
JsonObject armorCosmeticOverrides;
Maybe<String> cursorOverride;
+ bool suppressTools;
bool cameraFocus;
NetElementBool enabled;
diff --git a/source/game/interfaces/StarLoungingEntities.hpp b/source/game/interfaces/StarLoungingEntities.hpp
index 282fe2c..e654269 100644
--- a/source/game/interfaces/StarLoungingEntities.hpp
+++ b/source/game/interfaces/StarLoungingEntities.hpp
@@ -31,6 +31,7 @@ struct LoungeAnchor : EntityAnchor {
Maybe<Directives> directives;
JsonObject armorCosmeticOverrides;
Maybe<String> cursorOverride;
+ bool suppressTools;
bool cameraFocus;
};
diff --git a/source/game/objects/StarLoungeableObject.cpp b/source/game/objects/StarLoungeableObject.cpp
index eeeadb2..7a3fbea 100644
--- a/source/game/objects/StarLoungeableObject.cpp
+++ b/source/game/objects/StarLoungeableObject.cpp
@@ -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();