Merge pull request #95 from djsheehy/master

Inventory hardware: clearing a biomass yields energy. Fixes #94
This commit is contained in:
Simon Fortier 2018-01-01 15:19:50 -05:00 committed by GitHub
commit 0f7b40f3ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -38,7 +38,12 @@ public class CubotInventory extends CpuHardware {
getCpu().getRegisterSet().getRegister("B").setValue(cubot.getHeldItem());
} else if (a == INV_CLEAR) {
if (cubot.spendEnergy(100)) {
if (cubot.getHeldItem() == 0x0001) {
int energy = GameServer.INSTANCE.getConfig().getInt("biomassEnergyValue");
cubot.storeEnergy(energy);
cubot.setHeldItem(0);
}
else if (cubot.spendEnergy(100)) {
cubot.setHeldItem(0);
}
}

View File

@ -44,6 +44,8 @@ minBiomassRespawnCount=2
# Maximum biomass blob count for the WorldGenerator
maxBiomassCount=10
maxBiomassRespawnCount=6
# Energy generated by consuming biomass
biomassEnergyValue=1000
# Maximum energy of the battery hardware in kJ
battery_max_energy=60000
# Time for biomass respawn in ticks