public void ServerPerformInteraction(HandActivate interaction) { Chat.AddExamineMsgFromServer(interaction.Performer, "You clear the multitool's internal buffer."); buffers.Clear(); isMultipleMaster = false; configurationBuffer = MultitoolConnectionType.Empty; }
public void ServerPerformInteraction(HandActivate interaction) { Chat.AddExamineMsgFromServer(interaction.Performer, "You Clear internal buffer"); ListBuffer.Clear(); MultiMaster = false; ConfigurationBuffer = MultitoolConnectionType.Empty; }
public void ServerPerformInteraction(PositionalHandApply interaction) { if (Validations.IsTarget(gameObject, interaction)) { return; } var multitoolBases = interaction.TargetObject.GetComponents <ISetMultitoolBase>(); foreach (var multitoolBase in multitoolBases) { if (Buffer == null || MultiMaster) { if (multitoolBase is ISetMultitoolMaster master) { ConfigurationBuffer = master.ConType; ListBuffer.Add(master); MultiMaster = master.MultiMaster; Chat.AddExamineMsgFromServer( interaction.Performer, $"You add the <b>{interaction.TargetObject.ExpensiveName()}</b> to the multitool's master buffer."); return; } } if (Buffer == null) { continue; } if (ConfigurationBuffer != multitoolBase.ConType) { continue; } switch (multitoolBase) { case ISetMultitoolSlave slave: slave.SetMaster(Buffer); Chat.AddExamineMsgFromServer(interaction.Performer, $"You connect the <b>{interaction.TargetObject.ExpensiveName()}</b> " + $"to the master device <b>{(Buffer as Component)?.gameObject.ExpensiveName()}</b>."); return; case ISetMultitoolSlaveMultiMaster slaveMultiMaster: slaveMultiMaster.SetMasters(ListBuffer); Chat.AddExamineMsgFromServer(interaction.Performer, $"You connect the <b>{interaction.TargetObject.ExpensiveName()}</b> to the master devices in the buffer."); return; default: Chat.AddExamineMsgFromServer(interaction.Performer, "This only seems to have the capability of <b>writing</b> to the buffer."); return; } } PrintElectricalThings(interaction); }
/// <summary> /// Populates the <see cref="Masters"/> and <see cref="Slaves"/> device lists with the relevant devices from the active scene. /// </summary> /// <param name="type">The multitool connection otype the device must support</param> public static void InitDeviceLists(MultitoolConnectionType type, bool forceRefresh = false) { currentConType = type; if (forceRefresh == false && masters.TryGetValue(type, out var master) && master != null && slaves.TryGetValue(type, out var slave) && slave != null) { return; } masters[type] = FindUtils.FindInterfacesOfType <IMultitoolMasterable>().Where(master => master.ConType == type).ToList(); slaves[type] = FindUtils.FindInterfacesOfType <IMultitoolSlaveable>().Where(master => master.ConType == type).ToList(); }
public void ServerPerformInteraction(PositionalHandApply interaction) { if (interaction.TargetObject != null) { var multitoolBases = interaction.TargetObject.GetComponents <IMultitoolLinkable>(); foreach (var multitoolBase in multitoolBases) { if (Buffer == null || isMultipleMaster) { if (multitoolBase is IMultitoolMasterable master) { configurationBuffer = master.ConType; buffers.Add(master); isMultipleMaster = master.MultiMaster; Chat.AddExamineMsgFromServer( interaction.Performer, $"You add the <b>{interaction.TargetObject.ExpensiveName()}</b> to the multitool's master buffer."); return; } } if (Buffer == null) { continue; } if (configurationBuffer != multitoolBase.ConType) { continue; } var slaveComponent = Buffer as Component; if (Vector3.Distance(slaveComponent.transform.position, interaction.TargetObject.transform.position) > Buffer.MaxDistance) { Chat.AddExamineMsgFromServer( interaction.Performer, $"This device is too far away from the master device <b>{slaveComponent.gameObject.ExpensiveName()}!"); return; } switch (multitoolBase) { case IMultitoolSlaveable slave: if (slave.TrySetMaster(interaction, Buffer)) { Chat.AddExamineMsgFromServer( interaction.Performer, $"You connect the <b>{interaction.TargetObject.ExpensiveName()}</b> " + $"to the master device <b>{slaveComponent.gameObject.ExpensiveName()}</b>."); } return; case IMultitoolMultiMasterSlaveable slaveMultiMaster: slaveMultiMaster.SetMasters(buffers); Chat.AddExamineMsgFromServer( interaction.Performer, $"You connect the <b>{interaction.TargetObject.ExpensiveName()}</b> to the master devices in the buffer."); return; default: Chat.AddExamineMsgFromServer( interaction.Performer, "This only seems to have the capability of <b>writing</b> to the buffer."); return; } } } PrintElectricalThings(interaction); }
public WindowTab(string name, MultitoolConnectionType type) { Name = name; Type = type; }
public void ServerPerformInteraction(PositionalHandApply interaction) { if (!Validations.IsTarget(gameObject, interaction)) { var MultitoolBases = interaction.TargetObject.GetComponents <ISetMultitoolBase>(); foreach (var MultitoolBase in MultitoolBases) { if (Buffer == null || MultiMaster) { ISetMultitoolMaster Master = (MultitoolBase as ISetMultitoolMaster); if (Master != null) { ConfigurationBuffer = Master.ConType; ListBuffer.Add(Master); MultiMaster = Master.MultiMaster; Chat.AddExamineMsgFromServer(interaction.Performer, "You add the master component " + interaction.TargetObject.ExpensiveName() + " to the Multi-tools buffer"); return; } } if (Buffer != null) { if (ConfigurationBuffer == MultitoolBase.ConType) { ISetMultitoolSlave Slave = (MultitoolBase as ISetMultitoolSlave); if (Slave != null) { Slave.SetMaster(Buffer); Chat.AddExamineMsgFromServer(interaction.Performer, "You set the " + interaction.TargetObject.ExpensiveName() + " to use the " + (Buffer as Component)?.gameObject.ExpensiveName() + " in the buffer"); return; } ISetMultitoolSlaveMultiMaster SlaveMultiMaster = (MultitoolBase as ISetMultitoolSlaveMultiMaster); if (SlaveMultiMaster != null) { SlaveMultiMaster.SetMasters(ListBuffer); Chat.AddExamineMsgFromServer(interaction.Performer, "You set the" + interaction.TargetObject.ExpensiveName() + " to use the devices in the buffer"); return; } Chat.AddExamineMsgFromServer(interaction.Performer, "This only seems to have the capability of accepting Writing to buffer"); return; } } } //conveyorbelt /* * ConveyorBelt conveyorBelt = interaction.TargetObject.GetComponent<ConveyorBelt>(); * if (conveyorBelt != null) * { * Chat.AddExamineMsgFromServer(interaction.Performer, "You set the internal buffer of the multitool to the Conveyor Belt"); * ConveyorBeltBuffer.Add(conveyorBelt); * } * ConveyorBeltSwitch conveyorBeltSwitch = interaction.TargetObject.GetComponent<ConveyorBeltSwitch>(); * if (conveyorBeltSwitch != null) * { * if (ConveyorBeltBuffer != null) * { * Chat.AddExamineMsgFromServer(interaction.Performer, "You set the Conveyor Belt Switch to use the Conveyor Belt in the buffer"); * conveyorBeltSwitch.AddConveyorBelt(ConveyorBeltBuffer); * } * else * { * Chat.AddExamineMsgFromServer(interaction.Performer, "Your Conveyor Belt buffer is empty fill it with something"); * } * } */ PrintElectricalThings(interaction); } }