-
Notifications
You must be signed in to change notification settings - Fork 155
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
New MV Hydro Machine #412
New MV Hydro Machine #412
Conversation
The LV hydro is easy to make giving lot of power. The New hydro MV will put a tier system to it; thereby giving more incentive to player to pursue MV hydro plus a little survival aspect. This is a result of [Detailed discussion which is here](minetest-mods#411). Thanks to VanessaE for a good talk and support :)
The LV hydro is easy to make giving lot of power. The New hydro MV will put a tier system to it; thereby giving more incentive to player to pursue MV hydro plus a little survival aspect. This is a result of [Detailed discussion which is here](minetest-mods#411). Thanks to VanessaE for a good talk and support and enthusiasm to make one :) This will now produce around 175 EU (in between 150-200, so basically average). The MV hydro will give 10x more power than this one. :)
The LV hydro is easy to make giving lot of power. The New hydro MV will put a tier system to it; thereby giving more incentive to player to pursue MV hydro plus a little survival aspect. This is a result of [Detailed discussion which is here](minetest-mods#411). Thanks to VanessaE for a good talk and support :)
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 suppose you copypasted original water mill code. That’s not a good practice, you should use the same code when possible; see solar arrays for an example.
local run = function(pos, node) | ||
local meta = minetest.get_meta(pos) | ||
local water_flow = 0 | ||
local lava_nodes = 0 |
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.
Lava?
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 have no idea why lava node is zero there. May be it is there to check some exception or something. Again result of copy pasting entire code from another file xD. btw, should i remove that local lava_nodes
?! Don't know whether it will start doing some runtime crazy things. Happens to me all the time, when i try to change a line in minetest mods and it entirely crash on me ;)
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.
It is there because the water mill code itself is apparently copied from the geothermal generator =D
local lava_nodes = 0 | ||
local production_level = 0 | ||
local eu_supply = 0 | ||
local max_output = 35 * 50 -- 10 times better than LV hydro because of 2 diamonds extra and 4 stainless steel, a transformer and whatnot ;P. If 2 extra diamonds feels too hard to get; change it to mese may be. But i don't think that's a good idea. I would rather go for mese block or something if changing. Man hydro turbines are strong and long lasting. So, give it some value :) |
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.
Too long comment. You’d better write that in PR description rather than in 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.
ok. is there any function comment / more precisely documenting a method (as in python). Sorry, i have almost negligible experience of lua. It will be helpful if i will put in there :)
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.
There is LuaDoc. But still, comments are there to describe API (e.g. what does that function do and what arguments does it expect)
recipe = { | ||
{'technic:stainless_steel_ingot', 'technic:water_mill', 'technic:stainless_steel_ingot'}, | ||
{'default:diamond', 'technic:mv_transformer', 'default:diamond'}, | ||
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'}, |
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.
Misaligned. Either remove alignment (not to be confused with indent) or do it properly.
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, again that was a copy paste or may be due to long names of stainless_steel ingots. i will align it. Should have used a lua editor or a plugin on my editor 👍
technic/machines/LV/water_mill.lua
Outdated
@@ -32,8 +32,7 @@ local run = function(pos, node) | |||
local lava_nodes = 0 | |||
local production_level = 0 | |||
local eu_supply = 0 | |||
local max_output = 35 * 45 -- four param2's at 15 makes 60, cap it lower for "overload protection" | |||
-- (plus we want the gen to report 100% if three sides have full flow) | |||
local max_output = 35 * 5 -- keeping it around 175 mid value little more than previous 150 :) |
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.
45 here was maximum flow, while 35 was generation per “flow unit,” i.e. what is to be changed. You can change both, though, changing both maximum flow and generation per flow unit. But don’t forget to change eu_supply
formula accordingly.
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.
yeah, i pretty much copy pasted, with not even a variable name change. So, i guess, that was the problem. sorry about that. :) Ok, may be i will change the generation per flow unit. I mean why change a constant or a max value unnecessarily. Thanks for clarification 👍
recipe = { | ||
{'technic:stainless_steel_ingot', 'technic:water_mill', 'technic:stainless_steel_ingot'}, | ||
{'default:diamond', 'technic:mv_transformer', 'default:diamond'}, | ||
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'}, |
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.
You could use water mills instead of diamonds in the recipe, similar to solar arrays crafting.
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.
Yes, that's a good idea, i guess. Will be little bit tougher 3 water mills instead of 2 diamonds and 1 water mill right 👍
or node.name == "default:river_water_flowing" then | ||
return node.param2 -- returns approx. water flow, if any | ||
end | ||
return false |
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.
return 0
to simplify usage
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.
But, i think lua takes '0' as true
; so in this case, i should do return 1
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.
Er? Yes it does treat any number as true
, but if you return 0 you don’t need to check for that at all as it’s perfectly safe to add zero to any number)
} | ||
}) | ||
|
||
local function check_node_around_mill(pos) |
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.
get_water_flow
seems to be a better name
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 have no idea of this function. As you said copy paste :P. May be i will change the name. It's the same name in LV hydro too.
|
||
if production_level > 0 and | ||
minetest.get_node(pos).name == "technic:hydro_turbine" then | ||
technic.swap_node (pos, "technic:hydro_turbine_active") |
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.
extra space
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.
space, not blank line:
technic.swap_node (pos,
should be:
technic.swap_node(pos,
as in all surrounding code.
See http://dev.minetest.net/Lua_code_style_guidelines for details (but please don’t use double blank lines unless asked explicitly. That rule came from Python where functions are ended implicitly and not with a keyword as in Lua).
Thanks to [numberZero](https://github.com/numberZero) for a lot of clarification. Changed the generation per flow unit rather than the maximum flow.
According to the discussion and clarification by @numberZero; Some errors and update has been done. Please refer to [HERE](minetest-mods#412)
Some edits and corrections. Refer to the discussion and suggestions [HERE](minetest-mods#412)
Since Lead and Sulfur are missing from manual and they play an important role in making RE battery i thought it will be important to add them to Manual. Plus, Lead blocks got a place now in HV nuclear reactor layout.
Since Lead and Sulfur are missing from manual and they play an important role in making RE battery i thought it will be important to add them to Manual. Plus, Lead blocks got a place now in HV nuclear reactor layout.
Since Lead and Sulfur are missing from manual and they play an important role in making RE battery i thought it will be important to add them to Manual. Plus, Lead blocks got a place now in HV nuclear reactor layout.
lava node initialization not needed with water mill
Lava node initialization is not needed in water mill
updation of 2 branches unnecessarily created
merging my own branches
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.
LGTM, except of:
-
eu_supply = math.min(35 * water_flow, max_output)
in water mill. It should probably be
eu_supply = math.min(4 * water_flow, max_output)
as otherwise even little water flow make it produce max output possible. New MV Hydro Machine #412 (comment) -
This PR is apparently mixed with Update of substances > ore with lead and sulfur #414, despite the fact you used separate branches for them.
And thank you for the PR, it is great for balancing technic power generation)
|
||
for _, p in pairs(positions) do | ||
local check = get_water_flow(p) | ||
if check 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.
check
is always true. #412 (comment)
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.
oops..., forgot do the change in eu_supply
formula accordingly in LV water_mill.lua file. Thanks for spotting 💯
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.
Yes, apparently due to some confusion i mixed those 2 branches which has resulted in this. I will revert the changes asap. Thanks 👍
technic/machines/MV/init.lua
Outdated
@@ -13,7 +13,7 @@ if technic.config:get_bool("enable_wind_mill") then | |||
end | |||
dofile(path.."/generator.lua") | |||
dofile(path.."/solar_array.lua") | |||
|
|||
dofile(path.."/hydro_turbine.lua") | |||
-- Machines |
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.
Why removing the blank line before the header?
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.
oh lol no... i actually wrote below the blank line and then it seemed to me as a unnecessary blank line above the dofile()
function and rest is there 😱 I will correct that.
Separate branches are mandatory to avoid mixing of different PRs. That’s the reason of not doing PRs from master. Well, you have to split them now... I hope reverting or dropping merge commits will be enough... |
Revert "merging my own branches"
Changing the eu_supply formula accordingly. Refer to [PR review](minetest-mods#412 (review))
Correction in formatting. Refer to [PR review](minetest-mods#412 (review))
Thanks @numberZero for a thorough review 🥇 Looking at this PR Files comparison of MV Hydro; things seems to be ok now. But, i think i got the Manual Update PR still messed up. I am thinking of entirely closing this PR, deleting that branch, creating new one and doing a new PR. Will the second method work?! I think it should. |
reverting changes that shouldn't be there. Because, this is a manual update PR :) Refer to minetest-mods#412 (comment) and minetest-mods#412 (comment)
reverting changes that shouldn't be there. Because, this is a manual update PR :) Refer to minetest-mods#412 (comment) and minetest-mods#412 (comment)
reverting changes that shouldn't be there. Because, this is a manual update PR :) Refer to minetest-mods#412 (comment) and minetest-mods#412 (comment)
reverting changes that shouldn't be there. Because, this is a manual update PR :) Refer to minetest-mods#412 (comment) and minetest-mods#412 (comment)
reverting changes that shouldn't be there. Because, this is a manual update PR :) Refer to minetest-mods#412 (comment) and minetest-mods#412 (comment)
reverting changes that shouldn't be there. Because, this is a manual update PR :) Refer to minetest-mods#412 (comment) and minetest-mods#412 (comment)
reverting changes that shouldn't be there. Because, this is a manual update PR :) Refer to minetest-mods#412 (comment) and minetest-mods#412 (comment)
Remove redundant check. Lol, forgot this one. Yes. Thanks 👍
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.
Also run pngcrush/optipng on the new textures to ensure that they're optimized.
local function get_water_flow(pos) | ||
local node = minetest.get_node(pos) | ||
if node.name == "default:water_flowing" | ||
or node.name == "default:river_water_flowing" 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.
- How about river water?
- Wrong indent. Please use two tabs here.
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.
@SmallJoker Thank you for reviewing this code. Sorry, that i am not playing or following this game since 4-5 months now and probably won't come back for an indefinite period of time; it would be nice to know on which lines or line numbers i have to change the indent or is it for the entire file like 2 tabs extra?!
River water. yes. it would be good. But, i am clueless about what change i need?! Truthfully, i have forgotten almost what i did last time in this code section. sorry for that. I am willing to update anything required in these code files but i need some time and guidance. I mean do i have to include river water?! I think it's included in this get_water_flow
function. Anywhere else do i need the change too?!
Regards,
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.
It's indeed been a long time since this PR got some attention.
Regarding the indents: it's only for the highlighted line. Spaces should not be used (in this project) to indent the code line.
To make river water work, you can simply check whether the node has the group water
with a value of 3
.
-> if minetest.get_item_group(node.name, "water") == 3 then
(replaces the entire if
statement and makes the indent change request superfluous)
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 i have changed it now. @SmallJoker Please take a look.
Also, new texture files updated after crushing them on pngcrush.
Thanks again for helping 👍
Regards
meta:set_string("infotext", | ||
S("Hydro %s Generator"):format("MV").." ("..production_level.."%)") | ||
if production_level > 0 and | ||
minetest.get_node(pos).name == "technic:hydro_turbine" 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.
Wrong indent
Changes for proper indentation and river water update.
Texture updated after crushing it with pngcrush.
Changed some more indentation previously done and reviewed. Got it messed up in the new update while indenting. So, reverting them as they were; only not with spaces but tabs. Removed spaces in the tiles section too.
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.
Works, looks good.
I'm okay with the idea I guess, but a few users on my servers will be upset at the reduction in power output of their builds. |
@SmallJoker Thanks for the review. 👍 @VanessaE Well, that's quite true sometimes ;) Anything you change gonna upset few esp. the established 😝 You can do one thing though like upgrading or giving them MV ones in return of LV ones and distribute LV ones to new player or something. That will give them same or more power. or just may be upgrade their machines with some command like replace worldedit command (you know the regular stuff). They have to report it to you though or to mods of your server. Put it in announcement section and give them a little time. |
@SmallJoker Thank you again for the review and merging the update. Hope i can come with some more new ideas 😄 |
No problem. Thanks for your contribution! This project stalled for a while but now I'm trying to at least review the PRs ;) |
Hah, I found out this today on my local map and thought it's a bug. 😄 |
Decreased the value of LV hydro to 175 EU (quite easy to craft)
Upgrade on LV hydro to MV hydro (require a little resource and gives 10x more power)
Textures uploaded too.
Please refer to This discussion HERE
Please comment and give a review
Thanks and regards,