MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / getFootstepSound

Method getFootstepSound

source/game/StarPlayer.cpp:1912–1927  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1910}
1911
1912String Player::getFootstepSound(Vec2I const& sensor) const {
1913 auto materialDatabase = Root::singleton().materialDatabase();
1914
1915 String fallback = materialDatabase->defaultFootstepSound();
1916 List<Vec2I> scanOrder{{0, 0}, {0, -1}, {-1, 0}, {1, 0}, {-1, -1}, {1, -1}};
1917 for (auto subSensor : scanOrder) {
1918 String footstepSound = materialDatabase->footstepSound(world()->material(sensor + subSensor, TileLayer::Foreground),
1919 world()->mod(sensor + subSensor, TileLayer::Foreground));
1920 if (!footstepSound.empty()) {
1921 if (footstepSound != fallback) {
1922 return footstepSound;
1923 }
1924 }
1925 }
1926 return fallback;
1927}
1928
1929bool Player::inInteractionRange() const {
1930 return inInteractionRange(centerOfTile(aimPosition()));

Callers

nothing calls this directly

Calls 7

singletonClass · 0.85
materialDatabaseMethod · 0.80
defaultFootstepSoundMethod · 0.80
footstepSoundMethod · 0.80
materialMethod · 0.45
modMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected