Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
About the pull request
As described in issue #4777 while vehicle interiors are intended to hear external sounds, it is largely nonfunctional. Sounds are either not heard or are inaudibly quiet. This is due to several smaller issues working together.
First, interiors are not detected as interiors. In commit 0808500 the types stored in the
used_turfs
list were changed to weakrefs, but theis_interior()
function still checked for the old type, causing it to always returnFALSE
:cmss13/code/controllers/subsystem/interior.dm
Lines 54 to 58 in 5fbe143
Fixed by checking for the correct type.
Second, the
get_interior_by_coords()
function returned an object on success, but returnedFALSE
on failure - which still counted as an object. Since shuttles add turfs toused_turfs
but don't have actual interiors, they would passis_interior()
but failget_interior_by_coords()
. The sound code expected any object received at this point to be valid, but usingFALSE
would thrown an error:cmss13/code/game/sound.dm
Lines 82 to 84 in 5fbe143
Fixed by returning
null
on failure.Third, the audio was now playing but in the wrong part of the interior. It was offset to the top-right corner because
get_middle_coords()
got the difference between the bounds, but never actually averaged them:cmss13/code/modules/vehicles/interior/interior.dm
Line 321 in 5fbe143
Fixed by dividing the difference by two.
Fourth, the sound playback zone was oriented incorrectly because the width and height were transposed when creating the zone. Rectangles were defined as width then height, but the sound subsystem was passing height then width:
cmss13/code/controllers/subsystem/sound.dm
Line 44 in 5fbe143
Fixed by passing width then height.
Explain why it's good for the game
Vehicle interiors were intended to hear external sounds. This restores that functionality.
Testing Photographs and Procedure
Screenshots & Videos
Put screenshots and videos here with an empty line between the screenshots and the
<details>
tags.Changelog
🆑
fix: vehicle interiors can hear exterior noises
/:cl: