Dedicated Server API

stickmenzstickmenz Posts: 12 Seed
Hello everyone,

We have a dedicated server live (www.TUGCRAFT.com) and are currently working through testing server loads and reporting back to the dev team. We would like to create some simple mods and push the limits, even though the API is in its early stages, it's great practice.

My mod team (from Minecraft) had some general questions, mostly: What event system can we hook into as we don't see any event listeners in the api? API version alpha 0.8.5.

Cheers,
Stickmenz

Comments

  • stickmenzstickmenz Posts: 12 Seed
    Linking @Ghost
  • johnycilohoklajohnycilohokla Posts: 283 Developer
    Hello Stickmenz,

    We have a CallbackManager that allows callbacks/hooks to be exposed for modders to hook into, currently it only exposes few callbacks related to placement, but we are adding new hooks to it when needed.
    A lot of stuff can be achieved already by using the ModScriptClass.
    For example we are exposing LocalPlayerReady(player) on ModScriptClass, this will allow you to interact with players from mod files.
    You can also override files and functions for specific classes.

    We have used lua to create all of the game content, which means you can change almost anything.

    It really depends on what you want to achieve, will the modification be server side only or are you planning to have a client side mod for the server? Do you want to add new things to the game or modify what's currently there?

    Server side only mods are doable, but it will require tinkering with the systems.
    Server&Client mods will give you access to everything we have access to.

    Regards,
    Johny
    My Blog
    jc.png
      yt.png  t.png  
  • sergeantmajormesergeantmajorme Posts: 1 Podling
    What we're trying to make is some server side plugins, mainly permissions/block protection. I have an entire password and permissions system built up, but need to be able to have a command run. I've tried following the testmodscript, but due to many issues it doesn't seem to be working. Even when I set it up properly I can't get it to send text to players for updates.



    The above command ends up printing no information. It seems like there is no way for me to add a server-side command via the modding API.

    Relevant code sections:

    --------------------------------------------------------------------------------
    Shows that rjcmd does in fact load as a valid permission
    --------------------------------------------------------------------------------
    [01:04:51] Precaching objects...
    [01:05:03] Initializing World
    [01:05:03] debugger.lua loaded for Lua 5.1
    [01:05:03] Command rjcmd registered to RJPermissions
    [01:05:03] Command login registered to RJPermissions
    [01:05:03] Command logout registered to RJPermissions

    ----------------------------------------------------------------------------------
    Where the registration happens
    -----------------------------------------------------------------------------------
    function RJPermissions:Initialize()
    failed = 0
    commands = {'rjcmd','login','logout','chgpwd','chgpwdadm','addperm','clearperm'}
    for count=1,#commands do
    if Eternus.CommandService:NKRegisterChatCommand(commands[count],commands[count]) then
    NKPrint("Command "..commands[count].." registered to RJPermissions")
    else
    NKError("FAILED - Command "..commands[count].." NOT registered to RJPermissions")
    end
    end
    --INitialize the default playe
    loadPermFile("default")
    rjpermtable["default"]["active"] = 1
    end

    --------------------------------------------------------------------------------------
    rjcmd function itself
    --------------------------------------------------------------------------------------
    function RJPermissions:rjcmd(userCmd, args)
    rjdebug("RJPermissions has loaded properly")
    if table.getn(args) < 1 then return end
    if args[1] == "d" then displayTable() end
    rjdebug(tostring(args[1]).." "..tostring(args[2]).." "..tostring(args[3]))
    if args[1] == "h" then rjdebug(tostring(RJPermissions:HasPermssion(args[2],args[3]))) end
    end

    --------------------------------------------------------------------------------------
    rjdebug function
    ---------------------------------------------------------------------------------------
    function rjdebug(args)
    NKWarn(args)
    Eternus.CommandService:NKSendNetworkText(args) --This seems to NEVER send text to players...
    end
  • johnycilohoklajohnycilohokla Posts: 283 Developer
    OK, now I see what you need.
    Currently the commands are executed on the client side, which means unfortunately it would have to be a client side mod.
    I will definitely add server side commands to the modding improvements list, I can see a lot of servers wanting those.
    My Blog
    jc.png
      yt.png  t.png  
  • StilleVandeStilleVande Posts: 81 Seed
    This is great work guys. Hats off to your team. :)

    Please keep it up! :)
    Seriously, it's Faroese for Calm Water. - StilleVande
    regular-banner-3.png
    regular-banner-1.png
    regular-banner-3.png
    regular-banner-2.png
  • PH4N20MPH4N20M Posts: 1 Podling
    Sorry to necro but this is very relevant to this post

    Has this server side issue been solved with the new 0.8.6 update?

    Thanks
    PH4N20M
    Thanks,
    PH4N20M

    play.tugcraft.com port: 6600
  • johnycilohoklajohnycilohokla Posts: 283 Developer
    Yes, this issue has been resolved.
    All unhandled commands are passed to TUGGameMode:ExecuteSlashCommand.
    If the command doesn't exist on the client it is sent to the server.

    TestModScript contains an example of server side command.
    function TestModScript:Initialize()
    -- ...
    if Eternus.IsServer then
    -- Register server side command
    Eternus.GameState:RegisterSlashCommand("TestServerCommand", self, "TestServerCommandFunction")
    end
    -- ...
    end

    function TestModScript:TestServerCommandFunction(userInput, args, commandName, player)
    player:SendChatMessage("Executed Command: " .. commandName)
    player:SendChatMessage("Now printing args:")
    for key,value in pairs(args) do
    player:SendChatMessage(value)
    end
    player:SendChatMessage("Finished printing.")
    return true
    end
    My Blog
    jc.png
      yt.png  t.png  
Sign In or Register to comment.