forked from Mirrors/openclonk
show no power need rule in flagpole interaction menu overview
parent
0d1b68dc39
commit
43c7e92fd8
|
@ -128,7 +128,7 @@ protected func Initialize()
|
|||
lib_power = {};
|
||||
// A single variable to keep track whether power is needed.
|
||||
// Power is not needed when the no power need rule is active.
|
||||
lib_power.power_need = ObjectCount(Find_ID(Rule_NoPowerNeed)) == 0;
|
||||
lib_power.power_need = !FindObject(Find_ID(Rule_NoPowerNeed));
|
||||
return _inherited(...);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ public func GetInteractionMenus(object clonk)
|
|||
{
|
||||
var menus = _inherited() ?? [];
|
||||
// Only add a power menu if the structure is a flagpole (Library_Flag).
|
||||
if (this->~IsFlagpole())
|
||||
// And only if a power network is already initialized for this object.
|
||||
if (this->~IsFlagpole() && this->GetPowerHelper())
|
||||
{
|
||||
var power_menu =
|
||||
{
|
||||
|
@ -43,6 +44,24 @@ public func GetPowerDisplayMenuEntries(object clonk)
|
|||
if (!power_network)
|
||||
return menu_entries;
|
||||
|
||||
// If the no power need rule is active just state that.
|
||||
if (FindObject(Find_ID(Rule_NoPowerNeed)))
|
||||
{
|
||||
var entry =
|
||||
{
|
||||
Bottom = "1.1em",
|
||||
BackgroundColor = {Std = 0, OnHover = 0x50ff0000},
|
||||
Priority = 0,
|
||||
text =
|
||||
{
|
||||
Style = GUI_TextVCenter | GUI_TextLeft,
|
||||
Text = "$MsgPowerNoNeed$"
|
||||
}
|
||||
};
|
||||
PushBack(menu_entries, {symbol = Icon_Lightbulb, extra_data = "nopowerneed", custom = entry});
|
||||
return menu_entries;
|
||||
}
|
||||
|
||||
// Get all the power data.
|
||||
var power_production_current = power_network->GetActivePowerAvailable(true) / 10;
|
||||
var power_production_capacity = power_network->GetBarePowerAvailable() / 10;
|
||||
|
@ -122,6 +141,10 @@ public func OnPowerDisplayHover(id symbol, string extra_data, desc_menu_target,
|
|||
var power_stored_capacity = GetStoredPowerString(power_network->GetStoredPowerCapacity());
|
||||
text = Format("$DescPowerStored$", power_stored, power_stored_capacity, power_stored);
|
||||
}
|
||||
else if (extra_data == "nopowerneed")
|
||||
{
|
||||
text = "$DescPowerNoNeed$";
|
||||
}
|
||||
}
|
||||
GuiUpdateText(text, menu_id, 1, desc_menu_target);
|
||||
return;
|
||||
|
|
|
@ -5,7 +5,9 @@ MsgPowerConsumption=Stromverbrauch:
|
|||
MsgPowerConsumptionDemand=gesamte Nachfrage
|
||||
MsgPowerStored=Gespeicherter Strom:
|
||||
MsgPowerStoredCapacity=gesamte Kapazität
|
||||
MsgPowerNoNeed=The no power need rule is active.
|
||||
|
||||
DescPowerProduction=All the power producers in this network together have a capacity of producing %d {{Icon_Lightbulb}}, currently %d {{Icon_Lightbulb}} is being produced.
|
||||
DescPowerConsumption=Currently the consumers in this network demand %d {{Icon_Lightbulb}} in total to operate, %d {{Icon_Lightbulb}} is currently being supplied.
|
||||
DescPowerStored=Power storages are currently holding %s {{Icon_Lightbulb}} out of their total capacity of %s {{Icon_Lightbulb}}. This is equivalent of powering a consumer using up one {{Icon_Lightbulb}} for %s minutes.
|
||||
DescPowerStored=Power storages are currently holding %s {{Icon_Lightbulb}} out of their total capacity of %s {{Icon_Lightbulb}}. This is equivalent of powering a consumer using up one {{Icon_Lightbulb}} for %s minutes.
|
||||
DescPowerNoNeed=If the no power need rule is active, none of the power consumers require power supply to operate.
|
|
@ -5,7 +5,9 @@ MsgPowerConsumption=Power consumption:
|
|||
MsgPowerConsumptionDemand=total demand
|
||||
MsgPowerStored=Stored power:
|
||||
MsgPowerStoredCapacity=total capacity
|
||||
MsgPowerNoNeed=The no power need rule is active.
|
||||
|
||||
DescPowerProduction=All the power producers in this network together have a capacity of producing %d {{Icon_Lightbulb}}, currently %d {{Icon_Lightbulb}} is being produced.
|
||||
DescPowerConsumption=Currently the consumers in this network demand %d {{Icon_Lightbulb}} in total to operate, %d {{Icon_Lightbulb}} is currently being supplied.
|
||||
DescPowerStored=Power storages are currently holding %s {{Icon_Lightbulb}} out of their total capacity of %s {{Icon_Lightbulb}}. This is equivalent of powering a consumer using up one {{Icon_Lightbulb}} for %s minutes.
|
||||
DescPowerStored=Power storages are currently holding %s {{Icon_Lightbulb}} out of their total capacity of %s {{Icon_Lightbulb}}. This is equivalent of powering a consumer using up one {{Icon_Lightbulb}} for %s minutes.
|
||||
DescPowerNoNeed=If the no power need rule is active, none of the power consumers require power supply to operate.
|
Loading…
Reference in New Issue