Jump to content

Minor language bug: smugglerletter.lua - header and sender localization


Rinart73

Recommended Posts

Player sends localized letter text to the server. Server sends a letter with received text to player.

But server uses it's own localization for sender and letter header.

...

local mailText = [[
Hello,

It looks like you have been betrayed by Bottan and his smugglers, too, and I think we might have a common enemy now.
I'd like to work with you. Meet me at (${x}:${y}).

- A Friend
]]%_t

if onServer() then

...

else -- if not on server

    function getUpdateInterval()
        return 12
    end

    function updateClient()
        invokeServerFunction("sendMail", mailText)
    end

end

function sendMail(text)
    local player = Player()

    if player:hasScript("story/smugglerretaliation") then return end

    local specs = SectorSpecifics()
    local center = directionalDistance(280)
    local location = specs:findFreeSector(random(), center.x, center.y, 0, 5, Server().seed)

    local mail = Mail()
    mail.sender = "A Friend"%_t
    mail.header = "The Enemy of my Enemy is my Friend"%_t
    mail.text = text % location

    player:addMail(mail)
    player:addScriptOnce("story/smugglerretaliation", location.x, location.y)

    terminate()
end

 

So basically this should look like this (added or for compatibility):

...

local mailSender = "A Friend"%_t
local mailHeader = "The Enemy of my Enemy is my Friend"%_t
local mailText = [[
Hello,

It looks like you have been betrayed by Bottan and his smugglers, too, and I think we might have a common enemy now.
I'd like to work with you. Meet me at (${x}:${y}).

- A Friend
]]%_t

if onServer() then

...

else -- if not on server

    function getUpdateInterval()
        return 12
    end

    function updateClient()
        invokeServerFunction("sendMail", mailText, mailSender, mailHeader)
    end

end

function sendMail(text, sender, header)
    local player = Player()

    if player:hasScript("story/smugglerretaliation") then return end

    local specs = SectorSpecifics()
    local center = directionalDistance(280)
    local location = specs:findFreeSector(random(), center.x, center.y, 0, 5, Server().seed)

    local mail = Mail()
    mail.sender = sender or mailSender
    mail.header = header or mailHeader
    mail.text = text % location

    player:addMail(mail)
    player:addScriptOnce("story/smugglerretaliation", location.x, location.y)

    terminate()
end

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...