Mod loading after 0.8.1 / 0.8.2 update?

CragrimCragrim REGISTERED Posts: 44
edited February 2015 in Code
Hey I noticed some changes after the 0.8.1 update that I cant seem to wrap my head around yet.

Has the mod loading mechanic changed? As the supplied "Hello World" TUGModsTestModScript isn't functional anymore. (or doesnt seem to be)

I did some searching through the lua scriptfiles and found in TUGGameMode.lua that
Eternus.GameState:RegisterSlashCommand()
is now deprecated and replaced with
Eternus.CommandService:NKRegisterChatCommand()

Changed this but the example mod wont seem to load.
wy1oRQD.png

Do I need to change the class call?
Or do I have to include something more in the mod ?
Or maybe the mod loading is currently disabled so I have to include the class using overrides?
I'm not the most experienced coder haha so if anyone has any Hello World example for this new version I would really appreciate it ! :)

Also adding the reloading of assets as a keybinding in TUGConfigkeybinds.txt doesn't appear to work anymore.
Is there a hidden debug mode to enable this so I don't have to restart the game to test my edits?

OZx76Zk.png

Appreciate any help
Best Regards :)
Y8KRIoI.png Extra commands with CCommands!

Comments

  • johnycilohoklajohnycilohokla REGISTERED Posts: 283 Developer
    Cragrim wrote:
    Hey I noticed some changes after the 0.8.1 update that I cant seem to wrap my head around yet.

    Has the mod loading mechanic changed? As the supplied "Hello World" TUGModsTestModScript isn't functional anymore. (or doesnt seem to be)

    I did some searching through the lua scriptfiles and found in TUGGameMode.lua that
    Eternus.GameState:RegisterSlashCommand()
    is now depracated and replaced with
    Eternus.CommandService:NKRegisterChatCommand()

    Changed this but the example mod wont seem to load.
    wy1oRQD.png

    Do I need to change the class call?
    Or do I have to include something more in the mod ?
    Or maybe the mod loading is currently disabled so I have to include the class using overrides?
    I'm not the most experienced coder haha so if anyone has any Hello World example for this new version I would really appreciate it ! :)

    Also adding the reloading of assets as a keybinding doesn't appear to work anymore.
    Is there a hidden debug mode to enable this so I don't have to restart the game to test my edits?

    OZx76Zk.png

    Appreciate any help
    Best Regards :)

    Main Mods Classes are currently not working.
    I working on alternative to that, I will be releasing it as part of the common lib, not sure when but hopefully soon enough.
    You shouldn't need to reload assets using key bind anymore, you can leave the world and load it again, it should do a full reload of the game's lua scripts.
    My Blog
    jc.png
      yt.png  t.png  
  • CragrimCragrim REGISTERED Posts: 44
    Ah thank you very much Johny !
    Quick response :D

    I did some testing and it worked to insert the following code directly into TUGGameMode.lua to enable /fly command but I would really want to stay away from modifying any NerdKingdom code.

    Im trying to write a simple class that I can include somewhere to minimize my modifications.
    For example:
    Placing CCommands.lua in TUGGameCoreScriptsMods
    And instructing people to add a single line
    include("Scripts/Mods/CCommands.lua") or some such
    in one of the NerdKingdom files would be fairly harmless I think.
    	Eternus.CommandService:NKRegisterChatCommand("fly","ChatCommandFly")
    
    -------------------------------------------------------------------------------
    -- Chat command for flying
    function TUGGameMode:ChatCommandFly( userInput, args )
    	Eternus.CommandService:NKAddLocalText("Toggle flying mode...
    ")
    	
    	local player = Eternus.GameState:GetLocalPlayer()
    	
    	if player.m_isFlying == false then
    		player:NKGetCharacterController():EnableFlying()
    		player.m_isFlying = true
    	else
    		player:NKGetCharacterController():DisableFlying()
    		player.m_isFlying = false
    	end
    
    end
    
    Y8KRIoI.png Extra commands with CCommands!
  • johnycilohoklajohnycilohokla REGISTERED Posts: 283 Developer
    Cragrim wrote:
    Ah thank you very much Johny !
    Quick response :D

    I did some testing and it worked to insert the following code directly into TUGGameMode.lua to enable /fly command but I would really want to stay away from modifying any NerdKingdom code.

    Im trying to write a simple class that I can include somewhere to minimize my modifications.
    For example:
    Placing CCommands.lua in TUGGameCoreScriptsMods
    And instructing people to add a single line
    include("Scripts/Mods/CCommands.lua") or some such
    in one of the NerdKingdom files would be fairly harmless I think.
    	Eternus.CommandService:NKRegisterChatCommand("fly","ChatCommandFly")
    
    -------------------------------------------------------------------------------
    -- Chat command for flying
    function TUGGameMode:ChatCommandFly( userInput, args )
    	Eternus.CommandService:NKAddLocalText("Toggle flying mode...
    ")
    	
    	local player = Eternus.GameState:GetLocalPlayer()
    	
    	if player.m_isFlying == false then
    		player:NKGetCharacterController():EnableFlying()
    		player.m_isFlying = true
    	else
    		player:NKGetCharacterController():DisableFlying()
    		player.m_isFlying = false
    	end
    
    end
    

    Well it looks like I should be able to restore the Main Mod Class functionality, while I will be making it part of Common Lib I'm considering to release a small mod that will be able to just restore that functionality.
    This way once it is back all you will have to do is remove the mod and it will work just like it used to, no need for core changes and if more mods will need it, it will be compatible.
    I will drop a link to it here as well once it is done.
    My Blog
    jc.png
      yt.png  t.png  
  • CragrimCragrim REGISTERED Posts: 44
    Sounds good.. I need to study this some more.

    I don't know how this was implemented previously if it was part of the engine or what but if its custom lua content I cant find it in the older version.

    By the way, if you lost any backups from Steam auto updating here is a backup of all the old lua scripts from version 0.7.1 november 7 update. :)
    https://dl.dropboxusercontent.com/u/368 ... C-Nov7.rar
    Wish there was a way to disable steam auto updates and go back in version history. Its the main reason I really dislike steam, it breaks all the mods you have in your games.

    Best Regards
    Y8KRIoI.png Extra commands with CCommands!
  • johnycilohoklajohnycilohokla REGISTERED Posts: 283 Developer
    Cragrim wrote:
    Sounds good.. I need to study this some more.

    I don't know how this was implemented previously if it was part of the engine or what but if its custom lua content I cant find it in the older version.

    By the way, if you lost any backups from Steam auto updating here is a backup of all the old lua scripts from version 0.7.1 november 7 update. :)
    https://dl.dropboxusercontent.com/u/368 ... C-Nov7.rar
    Wish there was a way to disable steam auto updates and go back in version history. Its the main reason I really dislike steam, it breaks all the mods you have in your games.

    Best Regards

    Don't worry I have my own backups, well it wasn't there I have just made it :D
    It was part of the engine, but it wasn't too hard to re-do it in lua.
    I have the Survival working already (Initialize, Enter, Leave, Process), just need to do Creative but I will take care of that tomorrow.
    My Blog
    jc.png
      yt.png  t.png  
  • johnycilohoklajohnycilohokla REGISTERED Posts: 283 Developer
    Here is the fix, it also includes a fix for RegisterSlashCommand
    http://forum.nerdkingdom.com/viewtopic.php?f=39&t=1937
    My Blog
    jc.png
      yt.png  t.png  
  • ZakeZake REGISTERED Posts: 216 Seed
    Awesome work guys. I wanted to note that my mods folder is intact, so if everything is contained within the mods folder I don't expect anyone's files to get deleted.
    I think more than I say and say more than I do, but I do more than I used to and plan to continue.
    TUG modder (at least in the ounce of free time that occasionally flits by)
Sign In or Register to comment.