Sign in to follow this  
Alexgopen

[WIP] Digging like Mining

Recommended Posts

Possibly the first Wurm Unlimited mod released?

 

This is an edit to the Terraforming and Flattening classes in server.jar to drop dirt on the ground when you dig it instead of putting it in your inventory.

 

According to Warlander we're allowed to share modified classes, so I'll distribute my mods via a zip file containing the modified classes.

 

[03:29] <@Warlander> webba), you can release anything as long as it don't break connection with Steam
[03:29] <@Warlander> for example, adding direct connection to your server is not allowed
[03:29] <webba_> so  can i include original server code in my mod
[03:29] <@Warlander> or rebranding launcher etc.
[03:29] <@Warlander> yes
[03:29] <webba_> oh
[03:29] <webba_> sweet

Edited by Alexgopen
  • Like 13

Share this post


Link to post
Share on other sites

To make it like mining don't you need to pile the dirt around you if piles are limited?  So start at your feet then spiral around you to next neighbor if the tile pile is full.


Edited by yarnevk

Share this post


Link to post
Share on other sites

Something so long asked for in suggestions for WO, has this simple of a solution...


 


Many thanks, will give it a try this weekend when I test out WU :)


Share this post


Link to post
Share on other sites

To make it like mining don't you need to pile the dirt around you if piles are limited?  So start at your feet then spiral around you to next neighbor if the tile pile is full.

  • Like 2

Share this post


Link to post
Share on other sites

Love it and i like that you put the code for it and where it is.


(I don't know about what others think but i think this should become a standard thing to do in mods, will make modpacks far easier to construct)


 


I have a question and i may know the answer to but just double checking, Does this also work on things like peat, marsh, clay, and tar? Or do they go to the inventory?


Share this post


Link to post
Share on other sites

Love it and i like that you put the code for it and where it is.

(I don't know about what others think but i think this should become a standard thing to do in mods, will make modpacks far easier to construct)

 

I have a question and i may know the answer to but just double checking, Does this also work on things like peat, marsh, clay, and tar? Or do they go to the inventory?

Edited by Alexgopen
  • Like 1

Share this post


Link to post
Share on other sites

I don't think mining does that. IIRC it will say the space is too crowded here if your item pile fills up.

Edited by yarnevk

Share this post


Link to post
Share on other sites

Is this server side or client side?

 

Server side. I'm unable to get leveling to work like mining, the heights go crazy and drop a hole as deep as the floor of the map.  I think the Flattening class is decompiling incorrectly, so it's behaving in strange ways when I decompile, recompile, and reinsert it to the jar. 

  • Like 1

Share this post


Link to post
Share on other sites

Would anyone know the answer to my question as to whether we're allowed to share modified classes or not?


Share this post


Link to post
Share on other sites

Would anyone know the answer to my question as to whether we're allowed to share modified classes or not?

 

Was it difficult to get it recompiling? If not could always post a guide on how to decompile and recompile it which would allow them to apply your tutorial them selves since just 1 small mod like this at a time isn't going to be much use when there is more than 1 of them later I would assume.

  • Like 1

Share this post


Link to post
Share on other sites

Nice job Alexgopen! Can you please share with us the methods you used to modify a class file? How do you go about decompiling and compiling your code? My experience so far has resulted in too many errors with decompiled code to make any changes. I would love to hear how you did this.


Share this post


Link to post
Share on other sites

Nice job Alexgopen! Can you please share with us the methods you used to modify a class file? How do you go about decompiling and compiling your code? My experience so far has resulted in too many errors with decompiled code to make any changes. I would love to hear how you did this.

 

I initially used jd-gui to decompile classes but found it to work very poorly.

 

Later I switched to procyon and decompiled the entire server.jar with it, then when I want to mod something I just add the package and .java file of the class I want to edit to a project in eclipse, with all of the required libraries included (everything in the runtime folder, libs folder, common.jar, server.jar, and client.jar), and then write my code for the mod.  Then I save all my sources and copy the new modified .class file from my eclipse project's bin folder into the correct package in the original server.jar, and put up a server with that version of the server.jar to test it.  If I find that it's working as intended as far as I can tell, I send it off to our server's host to add to the actual server.jar used for the server I'm writing mods for.  Eventually players will mention stuff that may not be working as intended, or should be changed, and in my opinion rewarding sleep bonus for reporting bugs seems like a good way to keep your server running smoothly.  One example was that I made mob kill rare rolls guaranteed for goblins and trolls (but for a smaller amount of coins) as long as there was money in the coffers, as a means for players to earn money for deeds without depending on traders.  A player reported that most people just ended up saccing the rare coins for food/water/nutrition refreshes, so I changed the mod slightly so that the coins awarded would be non-rare. 

Share this post


Link to post
Share on other sites

I'm now finding that procyon occasionally misses casts when decompiling.  This has caused issues such as setting floats to 0 due to integer division, when the integers needed to be cast to floats, and then bugs have been occurring due to this.  An example of one would be infinite quality items in bsbs on my server when I missed a float cast that was not included in the decompiled version of the code. 


 


The ideal solution would be for WU mod devs to have access to the source code, but I doubt that would happen.  Only alternative would be reading tens of thousands of lines of code for each class you modify to make sure that the variables are cast to the necessary types, to prevent things like integer division from happening when it shouldn't. 


 


I'm currently testing procyon to decompile with the -ec argument to stop the removal of 'redundant' casts, so I'll let you know if it seems to work or not. 


 


Edit: Keeping redundant casts switch didnt fix the problem. Procyon will miss a lot of casts when decompiling, which leads to unintended ingame behaviour. 


Edited by Alexgopen
  • Like 1

Share this post


Link to post
Share on other sites

First, great work on the digging mod. This should have been a stock feature many moons ago!


 


 




 


The other two included mods are to disable spy protection, and to allow planting of deeds near non allied deeds, because chaos-type servers like ours disallow deed planting within 100 tiles of non-allied same-kingdom deeds by default.  You don't have to install these two additional mods, I just felt like including them in case they interested anyone. 




 


 


I've tried the mod to allow planting deeds anywhere, but it still seems we need to add a guard tower before deeding.


 


Do you know if this mod still works, or if there's another one that does? I see none on this forum and would rather not rely on GM powers. Just playing on Adventure mode with a few friends, but would like a little more 'freedom' of deed spots.


Share this post


Link to post
Share on other sites

First, great work on the digging mod. This should have been a stock feature many moons ago!

 

 

 

 

I've tried the mod to allow planting deeds anywhere, but it still seems we need to add a guard tower before deeding.

 

Do you know if this mod still works, or if there's another one that does? I see none on this forum and would rather not rely on GM powers. Just playing on Adventure mode with a few friends, but would like a little more 'freedom' of deed spots.

 

If it's a pvp server you would still need a tower to plant a deed.  The mod was just to allow us to plant near a same kingdom non allied deed (the start deed).  If you had other people playing as enemy kingdoms, being able to plant a deed without a tower would be a bad thing, because it would allow enemies to make war deeds on your doorstep. 

Edited by Alexgopen

Share this post


Link to post
Share on other sites

Some reason dig works for me but level stopped working, I briefly went to the beta version, and then deselected that and redid the classes again, but only digging drops as pile and leveling puts it in inv. anyone else experience this?


Share this post


Link to post
Share on other sites

Nah, works as intended for me. Great mod. 24 thumbs up.


 


Makes me wonder what other easy to do things that people wanted that Rolf has just blown off. Kinda pisses me off. For instance this dig mod saves a crap load of mouse work which saves a crap load of wear and tear on my hands. It's not always about easy. Sometimes it's about carpal tunnel.


Edited by Clatius
  • Like 2

Share this post


Link to post
Share on other sites
On 16.11.2015 22:04:44, Biervampyr said:

 

+1 to that :)

 

 

https://github.com/ago1024/WurmServerModLauncher/releases/download/v0.10/digtoground.zip

https://github.com/ago1024/WurmServerModLauncher/blob/master/src/demo/digtoground/org/gotti/wurmunlimited/mods/digtoground/DigToGround.java

 

it's essentially a code example which drops all dug items to the ground. Dirt, sand, clay. Same for dredging.

 

 

  • Like 3

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this