Jump to content

Message code refactor request


SabreML

Recommended Posts


PR Details:

  • Files Changed: 91
  • Line insertions: 330
  • Line deletions: 333
  • Potential labels: Refactor, Tweak
  • Type: Draft until fully self-reviewed.

PR Contents:

  • Converts the magic numbers used by show_message() into bitflag defines for readability. (MSG_VISIBLE and MSG_AUDIBLE)
    M.show_message("<span class='warning'>BANG</span>", 2)
    >>>>>>
    M.show_message("<span class='warning'>BANG</span>", MSG_AUDIBLE)
  • Converts many instances of show_message() into visible_message(), audible_message(), or to_chat() where applicable.
    for(var/mob/O in viewers(src, null))
    	O.show_message(text("<span class='alertalien'>[src] has planted some alien weeds!</span>"), 1)
    >>>>>>
    visible_message("<span class='alertalien'>[src] has planted some alien weeds!</span>")
  • Adds a vision_distance argument to visible_message(), to make the message range customisable.
  • Adds an ignored_mobs argument to visible_message() and audible_message(), to exclude a mob from being able to see the message. Useful for situations where the user, target, and observers all need separate messages.
  • Adds autodoc documentation to the show_message()visible_message(), and audible_message() procs.
  • Fixes some incorrectly called visible_message() procs.
    visible_message("<span class='warning'>[user] disassembles [src].</span>", \
    	"<span class='notice'>You start to disassemble [src]...</span>",\
    	"<span class='warning'>You hear welding.</span>")
    >>>>>>
    user.visible_message("<span class='warning'>[user] disassembles [src].</span>", \
    	"<span class='notice'>You start to disassemble [src]...</span>",\
    	"<span class='warning'>You hear welding.</span>")

The code for this is already finished, working, and mostly tested (I'll do more if it's approved). The vast majority of the file changes are very small, mostly just similar to the examples above, but as it affects 91 files in total I'm making a forum post for this anyway.


Edited by SabreML
  • Like 2
Link to comment
Share on other sites

This looks solid to me, code improvement is always welcome

Link to comment
Share on other sites

3 hours ago, S34N said:

This looks solid to me, code improvement is always welcome

You dont dictate how the repo operates, please stop acting like it. 


Now onto the question itself at hand.

 

This one I think is fine since its just a big cleanup of existing stuff, not an actual big change in how the underlying code works. I also asked another maintainer how they feel about this, and they agree its fine to put up the PR, so feel free to open it whenever. 

  • Thanks 1
  • bap 1
Link to comment
Share on other sites

1 hour ago, AffectedArc07 said:

You dont dictate how the repo operates, please stop acting like it.

This is a suggestion thread, open to the public to input their opinions on. I gave my opinion on it. Kindly stop being so hostile to me.

  • Like 5
Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use