Closed S-S-X closed 3 years ago
Any opinions on this? Acceptable for this case or do you think node name change should be reverted here?
Changed solar array naming to follow commonly used naming technic:tier_machinename. All other machines seem to follow this convention, also textures are named like this (even for solar arrays).
This makes it bit simpler which is good but also adds another alias and generally changing node name is not exactly nice thing to do.
(commit message is bit misleading: tier is removed from automatically generated node name and moved one level up)
I think the node name should be not altered at all (besides _active
, etc. suffixes) for any of the machines.
As for the name changes, I'm all for consistency, so 👍 (I've searched for "hv_solar" way too many times...)
I think the node name should be not altered at all (besides
_active
, etc. suffixes) for any of the machines.
There's no other changes to actual node names so far, commits to remove tier is just to make caller responsible for adding tier if he wants it somewhere in name. Inside Technic those tier parts are just moved up one level up to allow free form node names.
Simply put only change to node naming so far is:
Names like technic:solar_array_mv
becomes technic:mv_solar_array
for all solar arrays.
Aliases like minetest.register_alias("technic:solar_array_mv", "technic:mv_solar_array")
are added for all solar arrays.
Basic automated registration tests done, however part of tests are currently disabled for base machine and battery box because all fields are not yet available through definition table. Basic API interface however is done and rest of it should be mostly added feature instead of breaking changes.
Test report contains notification about this:
Pending → spec/api_spec.lua @ 139
Technic API Machine registration registers my_mod:my_battery
spec/api_spec.lua:139: Battery box registration does not include all fields
Pending → spec/api_spec.lua @ 196
Technic API Machine registration registers my_mod:machine_base
spec/api_spec.lua:196: Base machine registration does not include all fields
Removed WIP label as I think merging this should be decided before continuing to work on actual API features.
Changes are fairly big and some testing is needed, I've however tested this against extended-tests branch and there it passed every test case just fine. There's however no verification if all builtin machines are actually still registered or if I managed to remove some...
edit. yes, I did forgot to include tier for node names but fixed now.
edit2. if interested here's full test report: luacov.report.txt (with tests from extended-tests branch)
Merged master branch (extended-tests) and cleaned up commits a bit, will do another iteration later for commits that have mixed up code and tests.
If there's no objections I think I'll be merging this one soon.
I'll add few simple tests for overload and API to this branch before that, very soon.
Also @BuckarooBanzay opinion about renaming solar array nodes to follow style of texture names and other machine names: _technic:solar_arraymv becomes _technic:mv_solararray and similar for lv and hv other solar arrays. If that feels like bad idea it can be removed easily from this PR and even keep common style for automatic texture naming.
Started working on refactoring network and registration stuff on top of this change few days ago, mostly fixing TODO notes I've left when rewriting core network code on #96
Cleaned up debug prints and rebased... and I think I'll do that again to clean up first commits...
Tested cable plates placement using machines a bit: Constructor and deployer works fine, replacer however seems to be broken.
Tested placement using machines a bit: Constructor and deployer works fine, replacer however seems to be broken.
replacer has not worked for cable plates because they don't use param values. Replacer only stores item name, param and param2.
Did some little play testing, jumpdrive and space cannons were fine so machine registration compatibility is tested. Screwdriver was not fine with cable plates because for some reason I had paramtype2 = "facedir"
, fixed that.
Closes #117
Changes excluding tests: https://github.com/mt-mods/technic/compare/master...ecea17ec9979a4e0b6a0ac4d3298398175f6c136
API
Updates machine and cable registration API to follow signature of
minetest.register_node
function. Allows registering from different mod and setting any mod name for nodes. Updates cable plate placement to use actual math instead of weird lookup tables. Reduces hard coded data in core source files. Reduces nested registration wrappers.List of updated registration functions
function technic.register_base_machine(name, def)
function technic.register_base_machine(data)
function technic.register_solar_array(name, def)
function technic.register_solar_array(data)
function technic.register_battery_box(name, def)
function technic.register_battery_box(data)
function technic.register_cable(nodename, data)
function technic.register_cable(tier, size, description, prefix, override_cable, override_cable_plate)
function technic.register_cable_plate(nodename, data)
technic.register_cable
, added new function for this.Compatibility
minetest.register_node
interface:function technic.register_alloy_furnace(def)
function technic.register_centrifuge(def)
function technic.register_compressor(def)
function technic.register_extractor(def)
function technic.register_freezer(def)
function technic.register_grinder(def)
function technic.register_electric_furnace(def)
There's another branch to do similar with chests, usable starting point with working API interface but incomplete implementation.