• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

First Machine Age's Mods (Combined repo.)


Commit MetaInfo

Revisão67da0ba0a43ac706defce9e9807bee77ad694ec5 (tree)
Hora2020-02-16 08:21:55
Autormelchior <melchior@user...>
Commitermelchior

Mensagem de Log

Concept for LogicNetwork standard interface

Mudança Sumário

Diff

--- a/FirstMachineAge_Common/Common.csproj
+++ b/FirstMachineAge_Common/Common.csproj
@@ -44,6 +44,7 @@
4444 <ItemGroup>
4545 <Compile Include="Helpers.cs" />
4646 <Compile Include="Properties\AssemblyInfo.cs" />
47+ <Compile Include="ILogicNetNode.cs" />
4748 </ItemGroup>
4849 <ItemGroup>
4950 <Folder Include="vs_libs\" />
--- /dev/null
+++ b/FirstMachineAge_Common/ILogicNetNode.cs
@@ -0,0 +1,98 @@
1+using System;
2+using System.Collections.Generic;
3+
4+using Vintagestory.API.Common;
5+using Vintagestory.API.MathTools;
6+
7+namespace FirstMachineAge
8+{
9+
10+
11+ /*
12+ Domain (LogicDomain) <- Circuits (LogicNetwork) <- Subcircuit <LogicNetworkSubcircuit) <- BlockFace; <EndpointDescriptor>
13+ */
14+ //basic single ended, digital logic for this ... complex multi-bus / analog is a different interface
15+ public interface ILogicNetNode<T> where T: Block //Blocks only, since these are meant to be placable in-world
16+ {
17+ ICollection<LogicDomain> DOMAINs { get; } //Rod-logic, Tension-Cable & Pulley, Electrical, Pnumatic, Hydraulic, Redstone?, more than 1 == some kinda adaptor
18+
19+ LogicNetwork Circuit { get; } //Per domain (AKA Network ID), encloses several 'sub' circuits (possibly monotonic), all connected (at least 1 io). Zero - considered unassigned or invalid
20+
21+ IDictionary<BlockFacing, LogicNetworkSubcircuit> SubCircuits { get; } //A CONNECTED 'Sub' Circuit; MUST be unique for each sub-circuit; an IO going somewhere, doing SOMETHING...
22+
23+ IDictionary<BlockFacing, bool> VALUEs { get; set;} //Boolean STATE - per face, may/should trigger "events" on changes forced or 'natural'
24+
25+ IDictionary<BlockFacing, EndpointDescriptor> AvailableConnections { get; } //Pins, sockets, connections; Inputs - Outputs, Both? Which faces?? Default Pullups/down???
26+
27+
28+
29+ bool TryGetNetwork(IWorldAccessor world, BlockPos anywhere, out LogicNetwork linkedNet);
30+
31+ bool HasInterface(BlockPos anywhere, BlockFacing face);
32+
33+ EndpointDescriptor GetInterface(BlockPos anywhere, BlockFacing face);
34+
35+ bool CanLink(Block otherNetBlock, BlockFacing forFace);
36+
37+ bool CanLink(Block otherNetBlock, EndpointDescriptor byInterface);//for a GUI to see what could connect if anything
38+
39+
40+ LogicNetworkSubcircuit MakeConnection(BlockPos atLocation, BlockFacing forFace);//point blank connections allowed ~ depending
41+
42+ void BreakConnection( LogicNetworkSubcircuit cutLink);
43+
44+ void BreakConnection(BlockFacing cutLinkBySide);
45+
46+ }
47+
48+ public abstract class LogicDomain
49+ {
50+ readonly static string NAME;//TTL, CMOS, Rod-Logic, Cable-Link, Pnumatic, ect...
51+ //Global ID tag?
52+ //Other information about domain features
53+
54+ }
55+
56+ public abstract class LogicNetwork
57+ {
58+ LogicDomain ParentDomain { get; }
59+ ulong NetworkID { get; }//Monotonic - reuse ID# only at own peril.
60+ IList<LogicNetworkSubcircuit> ConnectedSubCircuits { get; }
61+
62+ }
63+
64+ public abstract class LogicNetworkSubcircuit
65+ {
66+ uint SubCircuitID { get; }
67+ IList<LogicNetworkSubcircuit> AtttachedNodes { get; }
68+ LogicNetwork ParentCircuit { get; }
69+ }
70+
71+ //As it might change 'dyamically' or be editable...
72+ public abstract class EndpointDescriptor
73+ {
74+ sbyte Number { get; }
75+ readonly string Description;
76+ BlockFacing ForFace { get; }
77+ LogicIO EndKind { get; }
78+ DefaultState Normally { get; }
79+ }
80+
81+ public enum LogicIO
82+ {
83+ Input,
84+ Output,
85+ Both,//Just don't connect to same Sub-Circuit!
86+ }
87+
88+ //Pullups/downs, floatin' or random?
89+ public enum DefaultState
90+ {
91+ High,
92+ Low,
93+ Undefined//! - Mabey Random, or can't be determined before execution
94+ }
95+
96+
97+}
98+