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

playerfactions support #1

Open
int-ua opened this issue Dec 24, 2019 · 4 comments
Open

playerfactions support #1

int-ua opened this issue Dec 24, 2019 · 4 comments
Labels
Enhancement New feature or request
Milestone

Comments

@int-ua
Copy link

int-ua commented Dec 24, 2019

Lacking an ability to send mail to all players who are in the same faction as you.

@thomasrudin thomasrudin added the Enhancement New feature or request label Dec 24, 2019
@S-S-X
Copy link
Member

S-S-X commented Mar 31, 2023

Now that there's mailing list support maybe this can be somehow combined with mailing lists?

Possibly with simple mailing list sync or lookup API that allows registering dynamic mailing list builders, that would allow easily creating mailing lists for any purpose like for example mailing list for players who

  • Has certain privileges
  • Or some amount of XP
  • Or currently exploring caves (or at some other defined area)
  • Or traveling in train
  • Or has home at specific town
  • Or belongs to some faction
  • Or whatever you can imagine without necessarily bringing it into mail mod (like server customizations)

@Emojigit
Copy link
Contributor

Emojigit commented Apr 2, 2023

I suggest allowing mods to register special mailing lists that, when being selected to be the receiver, executes a function provided by the mod which returns a list of player names.

@Athozus
Copy link
Member

Athozus commented Apr 2, 2023

Yes, that would something like in bash : $(command). But now, let see how we implement this...

@S-S-X
Copy link
Member

S-S-X commented Apr 2, 2023

If you like you could also allow mailing lists to handle more complicated situations without increasing complexity of code:
instead of registering named mailing list you could allow registering lookup function that is called for every added name or every added list name.

Doing this would allow fully dynamic lists (no need to know list name beforehand), not sure if this is really useful but good to consider this possibility.

Basically most significant thing is that instead of this logic:

-- mail mod side
if name == "our-vip-recipients" then -- if custom list name is registered
    recipients = get_custom_recipient_list["our-vip-recipients"]() -- then execute specific registered function
end

-- other mod / customization side
get_custom_recipient_list["our-vip-recipients"] = function()
    return {"name1", "name2", "name3"} -- return names
end

would become something like this:

-- mail mod side
recipients = get_custom_recipient_list("our-vip-recipients") -- execute all registered functions

-- other mod / customization side
local original_get_custom_recipient_list = get_custom_recipient_list
function get_custom_recipient_list(name)
    if name == "our-vip-recipients" then -- if asked list name is our list
        return {"name1", "name2", "name3"} -- return names
    end
    return original_get_custom_recipient_list(name) -- not our list, call through rest of the chain
end

Which makes all registered custom lookup functions to run until match is found. This is a lot more useful in some situations but can also cause more complicated issues and conflicts.

@Athozus Athozus modified the milestones: 1.2.0, 1.3.0 Apr 2, 2023
@Athozus Athozus modified the milestones: 1.4.0, 1.5.0 Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants