Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak: Prevent send multiple messages to same radio channel #24508

Closed
wants to merge 2 commits into from
Closed

Tweak: Prevent send multiple messages to same radio channel #24508

wants to merge 2 commits into from

Conversation

dj-34
Copy link
Contributor

@dj-34 dj-34 commented Mar 8, 2024

What Does This PR Do

Prevents sending multiple messages to same radio channel
Ported from here: ss220-space/Paradise#3337

Why It's Good For The Game

No laging and spam

Images of changes

Testing

Tested in-game

Changelog

NPFC?

@ParadiseSS13-Bot ParadiseSS13-Bot added -Status: Awaiting type assignment This PR is waiting for its type to be assigned internally -Status: Awaiting approval This PR is waiting for approval internally and removed -Status: Awaiting type assignment This PR is waiting for its type to be assigned internally labels Mar 8, 2024
@Contrabang Contrabang added the Tweak This PR tweaks something ingame label Mar 12, 2024
@ParadiseSS13-Bot ParadiseSS13-Bot added -Status: Awaiting review This PR is awaiting review from the review team and removed -Status: Awaiting approval This PR is waiting for approval internally labels Mar 20, 2024
@dj-34 dj-34 requested a review from DGamerL March 25, 2024 01:54
Comment on lines +303 to +309
for(var/obj/O in listening_obj)
spawn(0) // KILL THIS
if(O) // It's possible that it could be deleted in the meantime.
if(isradio(O))
var/obj/item/radio/radio = O
if(radio.broadcasting && get_dist(radio, M) <= radio.canhear_range && !(radio.frequency in transmited_channels))
if(radio.talk_into(M, message_pieces, null, verbage))
transmited_channels += radio.frequency
else
O.hear_talk(M, message_pieces, verbage)
Copy link
Member

@S34NW S34NW Mar 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for(var/obj/O in listening_obj)
spawn(0) // KILL THIS
if(O) // It's possible that it could be deleted in the meantime.
if(isradio(O))
var/obj/item/radio/radio = O
if(radio.broadcasting && get_dist(radio, M) <= radio.canhear_range && !(radio.frequency in transmited_channels))
if(radio.talk_into(M, message_pieces, null, verbage))
transmited_channels += radio.frequency
else
O.hear_talk(M, message_pieces, verbage)
for(var/obj/O in listening_obj)
spawn(0) // KILL THIS
if(!istype(O)) // It's possible that it could be deleted in the meantime.
return
if(!isradio(O))
O.hear_talk(M, message_pieces, verbage)
return
var/obj/item/radio/radio = O
if(!radio.broadcasting || get_dist(radio, M) > radio.canhear_range || (radio.frequency in transmited_channels))
return
if(radio.talk_into(M, message_pieces, null, verbage))
transmited_channels += radio.frequency

Tried to tidy this up, please test to make sure I've not made any mistakes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@S34NW it doesn't work, unfortunately. Message isn't sent to radio channels

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue seems to be that the code returns, while it should continue instead, could you try that?

@github-actions github-actions bot added the Merge Conflict This PR is merge conflicted label Apr 3, 2024
dj-34 and others added 2 commits April 6, 2024 02:24
@dj-34 dj-34 requested a review from S34NW April 5, 2024 21:24
@github-actions github-actions bot removed the Merge Conflict This PR is merge conflicted label Apr 6, 2024
Copy link
Contributor

This pull request seems to be stale as there have been no changes in 14 days, please make changes within 7 days or the PR will be closed. If you believe this is a mistake, please inform a development team member on Discord.

@github-actions github-actions bot added Stale This PR has been left inactive and requires an update. and removed Stale This PR has been left inactive and requires an update. labels Apr 22, 2024
@DGamerL
Copy link
Member

DGamerL commented May 2, 2024

This pull request seems to be stale as there have been no changes in 14 days, please make changes within 7 days or the PR will be closed. If you believe this is a mistake, please inform a development team member on Discord.

Not stale

Copy link
Contributor

This pull request seems to be stale as there have been no changes in 14 days, please make changes within 7 days or the PR will be closed. If you believe this is a mistake, please inform a development team member on Discord.

@github-actions github-actions bot added the Stale This PR has been left inactive and requires an update. label May 16, 2024
@dj-34
Copy link
Contributor Author

dj-34 commented May 21, 2024

Gotta close this, can't get onto this PR right now. You can have it, maybe I'll reopen it later.

@dj-34 dj-34 closed this May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Status: Awaiting review This PR is awaiting review from the review team Stale This PR has been left inactive and requires an update. Tweak This PR tweaks something ingame
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants