Difference between revisions of "Logic Sorter"
From Unofficial Stationeers Wiki
Emilgardis (talk | contribs) (fix heading) |
Emilgardis (talk | contribs) (MIPS -> IC10) |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 12: | Line 12: | ||
| item_rec1 = [[Kit (Sorter)]] | | item_rec1 = [[Kit (Sorter)]] | ||
}} | }} | ||
+ | {{Distinguish|Sorter}} | ||
+ | ==Description== | ||
− | |||
<blockquote><q>Contains an Internal Memory which is assessed to check whether something should be sorted. When an item is in the Import slot Slot, the stack is checked and if result is true the thing is moved to the Export2 slot slot, otherwise it is moved to the Export slot slot. The Mode is used in how the stack is assessed, by default the mode is ALL, so every instruction in the stack would need to return true.</q><br> | <blockquote><q>Contains an Internal Memory which is assessed to check whether something should be sorted. When an item is in the Import slot Slot, the stack is checked and if result is true the thing is moved to the Export2 slot slot, otherwise it is moved to the Export slot slot. The Mode is used in how the stack is assessed, by default the mode is ALL, so every instruction in the stack would need to return true.</q><br> | ||
'''- Stationpedia'''</blockquote> | '''- Stationpedia'''</blockquote> | ||
− | + | ||
− | Logic sorter is similar in almost every way to the previous sorter but has a internal memory | + | Logic sorter is similar in almost every way to the previous sorter but has a internal memory that can be configured with logic and bit shifting to sort items passing through. When an item enters the import slot, it is checked against the filters in memory. If the Mode is 0(All) then every filter must return true for the item to be sent to the export 2 slot. If the mode is 1(Any) then as long as one of the filters returns true, the item matches and will be sent to the export 2 slot. |
+ | |||
+ | ==Filter Instructions== | ||
+ | Check the in game Stationpedia [F1 on your keyboard] for formatting and instruction sizes to determine how to populate the memory. Be warned that the stationpedia fails to document the endianness (bit 0 is the least significant bit). While the stationpedia does document that the Logic Sorter has 256 bytes of memory, it is addressed as 32 x 8-byte (64-bit) numbers. | ||
− | = | + | If you wish your sorter to send [[Steel Ingot]]s to the second output you should place the value 0xd8f8af8d_01 ( = 931885190401 decimal ) into memory 0. More complicated programs will have to consider whether they want to use Mode 0 (match All), Mode 1 (match Any), or Mode 2 (match None). |
− | + | ||
+ | It is more readable to calculate the instructions using [[IC10]] like this: | ||
+ | |||
+ | {{ICCode| | ||
+ | alias sorter d0 | ||
+ | define steel HASH("ItemSteelIngot") | ||
+ | s sorter Mode 1 # Any | ||
+ | clr sorter # erase any stale instructions in RAM | ||
+ | sll r0 steel 8 | ||
+ | or r0 r0 SorterInstruction.FilterPrefabHashEquals | ||
+ | put sorter 0 r0 | ||
+ | }} | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 39: | Line 54: | ||
|LimitNextExecutionCount || 6 || Ensures the next executable instruction will only return true a specified number of times. Each time it returns true, it decrements by one. | |LimitNextExecutionCount || 6 || Ensures the next executable instruction will only return true a specified number of times. Each time it returns true, it decrements by one. | ||
|} | |} | ||
+ | |||
+ | <pre> | ||
+ | MSB LSB | ||
+ | 6666555555555544444444443333333333222222222211111111110000000000 | ||
+ | 3210987654321098765432109876543210987654321098765432109876543210 | ||
+ | FilterPrefabHashEquals | ||
+ | ########################( PREFAB_HASH)( 1) | ||
+ | FilterPrefabHashNotEquals | ||
+ | ########################( PREFAB_HASH)( 2) | ||
+ | FilterSortingClassCompare | ||
+ | ################################( SORTING_CLASS)(CONDOP)( 3) | ||
+ | FilterSlotTypeCompare | ||
+ | ################################( SLOT_TYPE)(CONDOP)( 4) | ||
+ | FilterQuantityCompare | ||
+ | ################################( QUANTITY)(CONDOP)( 5) | ||
+ | LimitNextExecutionByCount | ||
+ | ########################( COUNT)( 6) | ||
+ | </pre> | ||
{{Data Network Header}} | {{Data Network Header}} | ||
Line 84: | Line 117: | ||
| SortingClass || Integer || Class group of items. | | SortingClass || Integer || Class group of items. | ||
|- | |- | ||
− | | Quantity || Integer || Size of stack. | + | | Quantity || Integer || Size of item stack. |
|- | |- | ||
| PrefabHash || Integer || Returns [[ItemHash]] of item in slot. | | PrefabHash || Integer || Returns [[ItemHash]] of item in slot. | ||
Line 131: | Line 164: | ||
| ScanningHead || 36 || || Flare || 37 || || Blocked || 38 || | | ScanningHead || 36 || || Flare || 37 || || Blocked || 38 || | ||
|- | |- | ||
− | | SuitMod || 39 || || || || || | + | | SuitMod || 39 || || Crate || 40 || || Portables || 41 || |
|} | |} |
Latest revision as of 17:52, 1 August 2024
File:StructureLogicSorter.png | |
Operation | |
---|---|
Power Usage | 5W |
Prefab Hash | 873418029 |
Prefab Name | StructureLogicSorter |
Construction | |
Placed with | Kit (Sorter) |
Placed on | Small Grid |
Stage 1 | |
Deconstruction | |
Deconstructed with | Hand Drill |
Item received | Kit (Sorter) |
Contents
Description[edit]
Contains an Internal Memory which is assessed to check whether something should be sorted. When an item is in the Import slot Slot, the stack is checked and if result is true the thing is moved to the Export2 slot slot, otherwise it is moved to the Export slot slot. The Mode is used in how the stack is assessed, by default the mode is ALL, so every instruction in the stack would need to return true.
- Stationpedia
Logic sorter is similar in almost every way to the previous sorter but has a internal memory that can be configured with logic and bit shifting to sort items passing through. When an item enters the import slot, it is checked against the filters in memory. If the Mode is 0(All) then every filter must return true for the item to be sent to the export 2 slot. If the mode is 1(Any) then as long as one of the filters returns true, the item matches and will be sent to the export 2 slot.
Filter Instructions[edit]
Check the in game Stationpedia [F1 on your keyboard] for formatting and instruction sizes to determine how to populate the memory. Be warned that the stationpedia fails to document the endianness (bit 0 is the least significant bit). While the stationpedia does document that the Logic Sorter has 256 bytes of memory, it is addressed as 32 x 8-byte (64-bit) numbers.
If you wish your sorter to send Steel Ingots to the second output you should place the value 0xd8f8af8d_01 ( = 931885190401 decimal ) into memory 0. More complicated programs will have to consider whether they want to use Mode 0 (match All), Mode 1 (match Any), or Mode 2 (match None).
It is more readable to calculate the instructions using IC10 like this:
alias sorter d0 define steel HASH("ItemSteelIngot") s sorter Mode 1 # Any clr sorter # erase any stale instructions in RAM sll r0 steel 8 or r0 r0 SorterInstruction.FilterPrefabHashEquals put sorter 0 r0
Sorter Instruction | OP Code | Description |
---|---|---|
FilterPrefabHashEquals | 1 | Compares Hash of item in import slot to the set hash and returns true if equal. |
FilterPrefabHashNotEquals | 2 | Compares Hash of item in import slot to the set hash and returns true if not equal. |
FilterSortingClassCompare | 3 | Compares the sorting class of an object in input slot. Example would be all ores. |
FilterSlotTypeCompare | 4 | Compares the item type of an object in the input slot. See slot type table below for item comparisons. |
FilterQuantityCompare | 5 | Compares the stack size of the items in the import slot. |
LimitNextExecutionCount | 6 | Ensures the next executable instruction will only return true a specified number of times. Each time it returns true, it decrements by one. |
MSB LSB 6666555555555544444444443333333333222222222211111111110000000000 3210987654321098765432109876543210987654321098765432109876543210 FilterPrefabHashEquals ########################( PREFAB_HASH)( 1) FilterPrefabHashNotEquals ########################( PREFAB_HASH)( 2) FilterSortingClassCompare ################################( SORTING_CLASS)(CONDOP)( 3) FilterSlotTypeCompare ################################( SLOT_TYPE)(CONDOP)( 4) FilterQuantityCompare ################################( QUANTITY)(CONDOP)( 5) LimitNextExecutionByCount ########################( COUNT)( 6)
Data Network Properties[edit]
These are all Data Network properties of this device.
Data Parameters[edit]
These are all parameters that can be written with a Logic Writer, Batch Writer, or Integrated Circuit (IC10), and can be read with a Logic Reader, Batch Reader, or Integrated Circuit (IC10).
Parameter Name | Data Type | Access | Value | Description | ||
---|---|---|---|---|---|---|
Power | Boolean | Read
|
0 | Unpowered | Can be read to return if the Logic Sorter is correctly powered or not, set via the power system, return 1 if powered and 0 if not | |
1 | Powered | |||||
Mode | Integer | Read Write
|
0 | All | The mode of the Logic Sorter. | |
1 | Any | |||||
2 | None | |||||
Error | Boolean | Read
|
0 | 1 if device is in error state, otherwise 0 | ||
1 | Error | |||||
Lock | Boolean | Read Write
|
0 | Unlocked | Disable manual operation of the Logic Sorter. | |
1 | Locked | |||||
On | Boolean | Read Write
|
0 | Off | The current state of the Logic Sorter. | |
1 | On | |||||
RequiredPower | Integer | Read
|
||||
ClearMemory | Integer | Write
|
||||
ExportCount | Integer | Read
|
||||
ImportCount | Integer | Read
|
||||
PrefabHash | Integer | Read
|
||||
ReferenceId | Integer | Read
|
||||
NameHash | Integer | Read
|
Data Slots[edit]
These are all parameters, that can be read with a Slots Reader. The outputs are listed in the order a Slots Reader's "VAR" setting cycles through them.
Number | Name | Description |
---|---|---|
0 | Import | Import slot. |
1 | Export (reject) | Export slot. |
2 | Export (accept) | Export slot. |
3 | Data Disk | Diskslot |
Name | Data Type | Description |
---|---|---|
MaxQuantity | Integer | Returns maximum stacksize. |
Damage | Integer | Item durability in percent. |
Class | Integer | Item class ID for slot type comparison. |
SortingClass | Integer | Class group of items. |
Quantity | Integer | Size of item stack. |
PrefabHash | Integer | Returns ItemHash of item in slot. |
Occupied | Boolean | Returns whether the slot occupied. (0 for no, 1 for yes). |
OccupantHash | Integer | Returns ItemHash of item in slot. |
Item Slot Classes / Types[edit]
Reading the class attribute of the input slot will give one of the following values:
Note that you can useSlotClass.<Item>directly in IC code instead of the numeric value
- NOTE The classes listed in this section are FilterSlotTypeCompare and NOT sorting class. eg: SortingClass.Ores vs SlotClass.Ore
Item | Value | Description | Item | Value | Description | Item | Value | Description |
---|---|---|---|---|---|---|---|---|
None | 0 | Helmet | 1 | Suit | 2 | |||
Back | 3 | GasFilter | 4 | GasCanister | 5 | |||
Motherboard | 6 | Circuitboard | 7 | DataDisk | 8 | |||
Organ | 9 | Ore | 10 | Includes reagent mixes from recycler and ices | Plant | 11 | ||
Uniform | 12 | Entity | 13 | Battery | 14 | |||
Egg | 15 | Belt | 16 | Tool | 17 | |||
Appliance | 18 | Ingot | 19 | Torpedo | 20 | |||
Cartridge | 21 | AccessCard | 22 | Magazine | 23 | |||
Circuit | 24 | Bottle | 25 | ProgrammableChip | 26 | |||
Glasses | 27 | CreditCard | 28 | DirtCanister | 29 | |||
SensorProcessingUnit | 30 | LiquidCanister | 31 | LiquidBottle | 32 | |||
Wreckage | 33 | SoundCartridge | 34 | DrillHead | 35 | |||
ScanningHead | 36 | Flare | 37 | Blocked | 38 | |||
SuitMod | 39 | Crate | 40 | Portables | 41 |