Quests, new sounds, explosives, bugfixes, asdfasdf
This commit is contained in:
@@ -26,6 +26,8 @@ namespace Subsurface.Items.Components
|
||||
|
||||
private static Item draggingConnected;
|
||||
|
||||
private List<StatusEffect> effects;
|
||||
|
||||
int[] wireId;
|
||||
|
||||
public List<Connection> Recipients
|
||||
@@ -67,21 +69,31 @@ namespace Subsurface.Items.Components
|
||||
IsOutput = (element.Name.ToString() == "output");
|
||||
Name = ToolBox.GetAttributeString(element, "name", (IsOutput) ? "output" : "input");
|
||||
|
||||
effects = new List<StatusEffect>();
|
||||
|
||||
wireId = new int[MaxLinked];
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
for (int i = 0; i < MaxLinked; i++)
|
||||
switch (subElement.Name.ToString().ToLower())
|
||||
{
|
||||
if (wireId[i]<1) index = i;
|
||||
case "link":
|
||||
int index = -1;
|
||||
for (int i = 0; i < MaxLinked; i++)
|
||||
{
|
||||
if (wireId[i]<1) index = i;
|
||||
}
|
||||
if (index == -1) break;
|
||||
|
||||
wireId[index] = ToolBox.GetAttributeInt(subElement, "w", -1);
|
||||
|
||||
break;
|
||||
|
||||
case "statuseffect":
|
||||
effects.Add(StatusEffect.Load(subElement));
|
||||
break;
|
||||
}
|
||||
if (index == -1) break;
|
||||
|
||||
wireId[index] = ToolBox.GetAttributeInt(subElement, "w", -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int FindEmptyIndex()
|
||||
@@ -149,6 +161,13 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
ic.ReceiveSignal(signal, recipient, sender, power);
|
||||
}
|
||||
|
||||
foreach (StatusEffect effect in recipient.effects)
|
||||
{
|
||||
|
||||
//effect.Apply(ActionType.OnUse, 1.0f, recipient.item, recipient.item);
|
||||
recipient.item.ApplyStatusEffect(effect, ActionType.OnUse, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
}
|
||||
|
||||
public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f)
|
||||
public override void ReceiveSignal(string signal, Connection connection, Item sender, float power = 0.0f)
|
||||
{
|
||||
switch (connection.Name)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
{
|
||||
class SignalCheckComponent : ItemComponent
|
||||
{
|
||||
private string output;
|
||||
|
||||
private string targetSignal;
|
||||
|
||||
[InGameEditable, HasDefaultValue("1", true)]
|
||||
public string Output
|
||||
{
|
||||
get { return output; }
|
||||
set { output = value; }
|
||||
}
|
||||
|
||||
[InGameEditable, HasDefaultValue("", true)]
|
||||
public string TargetSignal
|
||||
{
|
||||
get { return targetSignal; }
|
||||
set { targetSignal = value; }
|
||||
}
|
||||
|
||||
public SignalCheckComponent(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f)
|
||||
{
|
||||
switch (connection.Name)
|
||||
{
|
||||
case "signal_in":
|
||||
item.SendSignal((signal == targetSignal) ? output : "0", "signal_out");
|
||||
|
||||
break;
|
||||
case "set_output":
|
||||
output = signal;
|
||||
break;
|
||||
case "set_targetsignal":
|
||||
targetSignal = signal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user