allow to cut the pump's source and drain (#1144)

issue1247
Maikel de Vries 2014-10-18 19:12:55 +02:00
parent 406821f92a
commit c6d87151d4
3 changed files with 46 additions and 14 deletions

View File

@ -105,20 +105,48 @@ func Initialize()
public func IsInteractable() { return GetCon() >= 100; }
public func GetInteractionMetaInfo(object clonk)
public func GetInteractionCount()
{
if (switched_on)
return { Description = "$MsgTurnOff$", IconName = nil, IconID = Icon_Stop };
else
return { Description = "$MsgTurnOn$", IconName = nil, IconID = Icon_Play };
var cnt = 1;
if (source_pipe)
cnt++;
if (drain_pipe)
cnt++;
return cnt;
}
/** Turn on or off. */
public func Interact(object clonk)
public func GetInteractionMetaInfo(object clonk, int num)
{
switched_on = !switched_on;
CheckState();
// Turning on/off.
if (num == 0)
{
if (switched_on)
return { Description = "$MsgTurnOff$", IconName = nil, IconID = Icon_Stop };
else
return { Description = "$MsgTurnOn$", IconName = nil, IconID = Icon_Play };
}
// Cutting the source pipe.
if (num == 1 && source_pipe)
return { Description = "$MsgCutSource$", IconName = nil, IconID = Icon_Cancel };
// Cutting the drain pipe.
if ((num == 2 || (num == 1 && !source_pipe)) && drain_pipe)
return { Description = "$MsgCutDrain$", IconName = nil, IconID = Icon_Cancel };
}
public func Interact(object clonk, int num)
{
// Turning on/off.
if (num == 0)
{
switched_on = !switched_on;
CheckState();
}
// Cutting the source pipe.
else if (num == 1 && source_pipe)
source_pipe->RemoveObject();
// Cutting the drain pipe.
else if ((num == 2 || (num == 1 && !source_pipe)) && drain_pipe)
drain_pipe->RemoveObject();
return true;
}
@ -163,7 +191,7 @@ private func GetDrainObject()
return this;
}
/** Re turns object to which the liquid is pumped */
/** Returns object from which the liquid is pumped */
private func GetSourceObject()
{
if (source_pipe) return source_pipe->GetConnectedObject(this) ?? this;

View File

@ -1,4 +1,6 @@
Name=Pumpe
Description=Die Pumpe kann beliebige Flüssigkeiten von A nach B pumpen. Pumpt sie Flüssigkeiten abwärts, erzeugt sie dabei sogar ein wenig Strom.
Description=Die Pumpe kann beliebige Fl<EFBFBD>ssigkeiten von A nach B pumpen. Pumpt sie Fl<46>ssigkeiten abw<62>rts, erzeugt sie dabei sogar ein wenig Strom.
MsgTurnOff=Pumpe abschalten
MsgTurnOn=Pumpe anschalten
MsgTurnOn=Pumpe anschalten
MsgCutSource=Zufluss trennen
MsgCutDrain=Abfluss trennen

View File

@ -1,4 +1,6 @@
Name=Pump
Description=The pump can transport liquid from A to B. If it pumps liquids downwards, it even generates a bit of power.
MsgTurnOff=Turn off pump
MsgTurnOn=Turn on pump
MsgTurnOn=Turn on pump
MsgCutSource=Cut off source
MsgCutDrain=Cut off drain