Sign in to follow this  
Sila

make diging same way as mining

Recommended Posts

Code for placing a rock shard on your tile when mining is



Item newItem = ItemFactory.createItem(146, (float)power, performer.getPosX(), performer.getPosY(), Server.rand.nextFloat() * 360.0F, performer.isOnSurface(), act.getRarity(), -10L, null);

newItem.setLastOwnerId(performer.getWurmId());
newItem.setDataXY(tilex, tiley);

For digging dirt the code to put it in your inventory or a dredge's is



Item created = ItemFactory.createItem(createdItemTemplate, Math.min((float)(power + source.getRarity()), 100.0F), null);
created.setRarity(act.getRarity());
if ((dredging) && (h < -0.5D)) {
source.insertItem(created, true);
} else {
performer.getInventory().insertItem(created);
}

The method used by mining is



public static Item createItem(int templateId, float qualityLevel, float posX, float posY, float rot, boolean onSurface, byte rarity, long bridgeId, @Nullable String creator)
throws NoSuchTemplateException, FailedException
{
return createItem(templateId, qualityLevel, posX, posY, rot, onSurface, (byte)0, rarity, bridgeId, creator);
}

So in Terraforming.class the method call used when you finish digging should be changed to



Item newItem = ItemFactory.createItem(createdItemTemplate, Math.min((float)(power + source.getRarity()), 100.0F), performer.getPosX(), performer.getPosY(), Server.rand.nextFloat() * 360.0F, performer.isOnSurface(), act.getRarity(), -10L, null);
if ((dredging) && (h < -0.5D)) {
source.insertItem(created, true);
} else {
newItem.setLastOwnerId(performer.getWurmId());
newItem.setDataXY(performer.getPosX(), performer.getPosY());
}

This should work to drop dirt at your feet when you dig it, unless you use a dredge, in which case it puts it in the dredge still because I figure it would be hard to go around picking up dirt off the sea floor.


  • Like 1

Share this post


Link to post
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
Sign in to follow this