-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more mekanism input adapters #19
Add more mekanism input adapters #19
Conversation
look i have no idea if this works, but from eyeballing `methods.csv` and reading lines in ComputerCraft itself I am fairly certain that this might work although i could be wrong because mekanism sucks sometimes.
not something special really, just the bare minimum to monitor a chemical tank
how the fuck did i miss that..
All complaints go to: https://github.com/SkyTheCodeMaster
This is great! Whenever you get to a stopping point I will review in more detail but looks pretty good so far! The only note I would make is concerning units. For consistency with other adapters I would use Thanks for contributing ❤️ |
FYI, I found this improved computer API documentation: https://mekanism.github.io/computer_data/10.4.0.html This is for the very newly released 1.20.x Mekanism version, so it may be slightly off but is probably better than the spreadsheet. |
holy shit that is so much better |
This supports all of the types afaik
its a direct copy paste of the previous addition
these were so easy wtf
oh my god i hate this so much thank god it is over
Hey @Autist69420, are you at a stopping point with this? If so I can merge and continue with the rest of them. :) |
Been a bit lazy lately, you can merge everything I have now if ya want I can always open more PRs :p although I haven't added everything to the input.lua file yet so 🤷 |
It happens to the best of us. :) I will merge everything to |
src/telem/lib/input.lua
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may move Mekanism stuff to input/mekanism.lua
to keep this file a little more tidy, haven't decided yet. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the smartest approach since this is a little messy 😛
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry ahead of time for the pings!!
Adapters reviewed:
- BioGeneratorInputAdapter
- ChemicalTankInputAdapter
- DigitalMinerInputAdapter
- DynamicTankInputAdapter
- GasGeneratorInputAdapter
- IsotopicCentrifugeInputAdapter
- LaserAmplifierInputAdapter
- LaserInputAdapter
- MechanicalPipeInputAdapter
- PressurizedTubeInputAdapter
- QuantumEntangloporterInputAdapter
- UniversalCableInputAdapter
Current input categories for Mekanism (I will expand this as I review)
- basic: This should included the fundamental indicators for a machine. For example, most "filled percentage" values and energy production/consumption rates are appropriate here. Avoid including specific max/min/current capacity metrics; those usually belong in their respective category.
- advanced: Machine-specific configuration, flags, or statuses
- fuel: Any non-basic metric relating to a resource consumed for energy production, like fissile fuel, biofuel, ethylene, etc.
- coolant: Any non-basic metric relating to coolant
- waste: Any non-basic metric relating to waste
- formation: Any non-basic metrics related to facts about the machine itself, such as physical dimensions, component parts, and mod-level configurations.
- energy: Any non-basic metrics related to energy. Most often this will be energy capacity.
- steam: This category is only used by the turbine and will probably go away because it is dumb.
- input: Any non-basic metric relating to input resources, except energy (items, fluids, chemicals, etc.)
- output: Any non-basic metric relating to output resources, except energy (items, fluids, chemicals, etc.)
metrics:insert(Metric{ name = self.prefix .. 'fuel_amount', value = (generator.getBioFuel().amount / 1000), unit = "B", source = source }) -- might error might not, no clue! | ||
metrics:insert(Metric{ name = self.prefix .. 'fuel_filled_percentage', value = generator.getBioFuelFilledPercentage(), unit = nil, source = source }) | ||
metrics:insert(Metric{ name = self.prefix .. 'fuel_needed', value = (generator.getBioFuelNeeded() / 1000), unit = 'B/t', source = source }) | ||
metrics:insert(Metric{ name = self.prefix .. 'production_rate', value = mekanismEnergyHelper.joulesToFE(generator.getProductionRate()), unit = nil, source = source }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit should be 'FE/t'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 6814f0d, hopefully
metrics:insert(Metric{ name = self.prefix .. 'fuel_capacity', value = (generator.getBioFuelCapacity() / 1000), unit = "B", source = source }) | ||
metrics:insert(Metric{ name = self.prefix .. 'fuel_amount', value = (generator.getBioFuel().amount / 1000), unit = "B", source = source }) -- might error might not, no clue! | ||
metrics:insert(Metric{ name = self.prefix .. 'fuel_filled_percentage', value = generator.getBioFuelFilledPercentage(), unit = nil, source = source }) | ||
metrics:insert(Metric{ name = self.prefix .. 'fuel_needed', value = (generator.getBioFuelNeeded() / 1000), unit = 'B/t', source = source }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the unit here should be B
? From what I can tell, needed
is max_capacity - current
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 6814f0d
-- do nothing | ||
|
||
-- Literally all we have lmao | ||
elseif v == 'basic' then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think to preserve API parity, fuel_*
should be changed to bio_fuel_*
.
Categories should be expanded:
Basic:
- energy_filled_percentage
- bio_fuel_filled_percentage
- production_rate
Fuel:
- bio_fuel_capacity
- bio_fuel
- bio_fuel_needed
Energy:
- energy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blehhh my responses are gonna get sillier the more send it: 6814f0d
self.prefix = 'mekdigitalminer:' | ||
|
||
-- TODO make these constants | ||
local allCategories = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend basic and energy; may add advanced and formation in later updates.
-- do nothing | ||
|
||
-- Literally all we have lmao | ||
elseif v == 'basic' then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Categories should be expanded:
Basic:
- energy_filled_percentage
- energy_usage
- get_to_mine
- is_running
Energy:
- energy
metrics:insert(Metric{ name = self.prefix .. 'energy', value = mekanismEnergyHelper.joulesToFE(miner.getEnergy()), unit = "FE", source = source }) | ||
metrics:insert(Metric{ name = self.prefix .. 'energy_filled_percentage', value = (miner.getEnergyFilledPercentage()), unit = nil, source = source }) | ||
metrics:insert(Metric{ name = self.prefix .. 'energy_usage', value = mekanismEnergyHelper.joulesToFE(miner.getEnergyUsage()), unit = "FE/t", source = source }) | ||
metrics:insert(Metric{ name = self.prefix .. 'get_to_mine', value = miner.getToMine(), unit = "items", source = source }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metric name should not include the function verb, recommend to_mine
.
Use singular units whenever possible, recommend "item" here.
metrics:insert(Metric{ name = self.prefix .. 'energy_filled_percentage', value = (miner.getEnergyFilledPercentage()), unit = nil, source = source }) | ||
metrics:insert(Metric{ name = self.prefix .. 'energy_usage', value = mekanismEnergyHelper.joulesToFE(miner.getEnergyUsage()), unit = "FE/t", source = source }) | ||
metrics:insert(Metric{ name = self.prefix .. 'get_to_mine', value = miner.getToMine(), unit = "items", source = source }) | ||
metrics:insert(Metric{ name = self.prefix .. 'is_running', value = (miner.isRunning() and 1 or 0), unit = nil, source = source }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove function verb from name, recommend running
.
Thought about this one for a bit, as I do like labelling true/false flags differently. But, Induction Matrix adapter does this for isFormed() => formed
, so probably better to follow the precedent.
Christ that is a lot of reviews, I'll get to nibbling on them slowly over the week |
self:super('constructor') | ||
|
||
-- TODO this will be a configurable feature later | ||
self.prefix = 'mekchemtank:' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend mekdynamictank:
for prefix
self.prefix = 'mekchemtank:' | ||
|
||
-- TODO make these constants | ||
local allCategories = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend basic category only, see comments in read()
-- do nothing | ||
|
||
-- Literally all we have lmao | ||
elseif v == 'basic' then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend putting everything in basic category to match Chemical Tank adapter layout.
I think tank_capacity
and chemical_tank_capacity
would be the most correct here. Dynamic Tanks can store more mB of chemical vs fluid for the same structure dimensions, so there are technically two maximum capacities depending on the contents. 🤷
self.prefix = 'mekgasgen:' | ||
|
||
-- TODO make these constants | ||
local allCategories = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend basic, fuel, energy
-- do nothing | ||
|
||
-- Literally all we have lmao | ||
elseif v == 'basic' then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Categories should be expanded:
Basic:
- energy_filled_percentage
- fuel_filled_percentage
- production_rate
Fuel:
- fuel_amount
- fuel_capacity
- fuel_needed
Energy:
- energy
self:super('constructor') | ||
|
||
-- TODO this will be a configurable feature later | ||
self.prefix = 'mekunicable:' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefix should be mekcentrifuge:
self.prefix = 'mekunicable:' | ||
|
||
-- TODO make these constants | ||
local allCategories = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend adding energy category
-- do nothing | ||
|
||
-- Literally all we have lmao | ||
elseif v == 'basic' then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend this category layout:
Basic:
- energy_usage
- energy_filled_percentage
- input_filled_percentage
- output_filled_percentage
Energy:
- energy
- energy_needed
Input:
- input
- input_capacity
Output:
- output
- output_capacity
self.prefix = 'meklaseramp:' | ||
|
||
-- TODO make these constants | ||
local allCategories = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend basic, energy
-- do nothing | ||
|
||
-- Literally all we have lmao | ||
elseif v == 'basic' then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename energy_max
to max_energy
to align with induction matrix and turbine adapters. I would also add an energy category:
Basic:
- energy_filled_percentage
Energy:
- energy
- max_energy
- energy_needed
The energy category across most machines is nearly identical... I may try to look into ways of applying metric "templates" for common categories in the future to improve code reuse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same notes on this as Laser Amplifier:
- category list update
- energy_max => max_energy
- move everything to energy category except energy_filled_percentage
Merging this for now, as the Mekanism integration is being rewritten with fluent queries. |
THIS IS A DRAFT, THERE IS NO WAY IN HELL I'D BE ABLE TO ADD SUPPORT FOR EVERYTHING
This PR adds support for even more mekanism inputs!!!! I'd hope to add support for EVERYTHING but currently it is very basic. There are over 700 rows in the CSV im looking up stuff in, its a really bad CSV too, send help.
List of blocks that have support