mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-13 09:18:05 -04:00
Added IMC message to notify OC of a 3rd party power system. Closes #1784.
This commit is contained in:
parent
37249142af
commit
2874f4720a
@ -361,6 +361,17 @@ public final class IMC {
|
|||||||
FMLInterModComms.sendMessage(MOD_ID, "blacklistHost", nbt);
|
FMLInterModComms.sendMessage(MOD_ID, "blacklistHost", nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies OpenComputers that there is some 3rd-party power system present
|
||||||
|
* that adds integration on its side.
|
||||||
|
* <p/>
|
||||||
|
* This will suppress the "no power system found" message on start up, and
|
||||||
|
* avoid auto-disabling power use.
|
||||||
|
*/
|
||||||
|
public static void registerCustomPowerSystem() {
|
||||||
|
FMLInterModComms.sendMessage(MOD_ID, "registerCustomPowerSystem", "true");
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
|
|
||||||
private static final String MOD_ID = "OpenComputers";
|
private static final String MOD_ID = "OpenComputers";
|
||||||
|
@ -135,8 +135,9 @@ class Settings(val config: Config) {
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
// power
|
// power
|
||||||
|
var is3rdPartyPowerSystemPresent = false
|
||||||
val pureIgnorePower = config.getBoolean("power.ignorePower")
|
val pureIgnorePower = config.getBoolean("power.ignorePower")
|
||||||
lazy val ignorePower = pureIgnorePower || !Mods.isPowerProvidingModPresent
|
lazy val ignorePower = pureIgnorePower || (!is3rdPartyPowerSystemPresent && !Mods.isPowerProvidingModPresent)
|
||||||
val tickFrequency = config.getDouble("power.tickFrequency") max 1
|
val tickFrequency = config.getDouble("power.tickFrequency") max 1
|
||||||
val chargeRateExternal = config.getDouble("power.chargerChargeRate")
|
val chargeRateExternal = config.getDouble("power.chargerChargeRate")
|
||||||
val chargeRateTablet = config.getDouble("power.chargerChargeRateTablet")
|
val chargeRateTablet = config.getDouble("power.chargerChargeRateTablet")
|
||||||
|
@ -90,6 +90,9 @@ object IMC {
|
|||||||
case t: Throwable => OpenComputers.log.warn("Failed registering ink provider.", t)
|
case t: Throwable => OpenComputers.log.warn("Failed registering ink provider.", t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (message.key == "registerCustomPowerSystem" && message.isStringMessage) {
|
||||||
|
Settings.get.is3rdPartyPowerSystemPresent = message.getStringValue == "true"
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
OpenComputers.log.warn(s"Got an unrecognized or invalid IMC message '${message.key}' from mod ${message.getSender}.")
|
OpenComputers.log.warn(s"Got an unrecognized or invalid IMC message '${message.key}' from mod ${message.getSender}.")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user