Skip to content
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 look is now customizable and minor behaviour fixes #26

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

0x098
Copy link
Contributor

@0x098 0x098 commented Aug 16, 2020

+ui colors now customizable with a third tab in the menu named 'Customization'
+seagull ragdoll spawn only once now (sometimes spawned multiple when killed)
+bait hooking adjustments... so they dont get stuck in displacements and nocollide
+bait release timer so it does not reattach instantly
+bait spawn height offset addition to avoid creating black holes of bait
+removed broken cashreg model (it was the dod version i think)
+stove cooking offset higher since some stuff were not cooked at their set positions
+'b' now opens the menu if cvar fishing_mod_b_opens_always is 1 or greater
+could not buy bait if it was equal to the money player has.
+equipping the fishingrod now messages the player of default bind
+entities fishingrod, bobber and hook are no longer possible to "tool" and "property" (context menu)
+added crosshair to see where the player is aiming (also customizable color)
+minor fixes

+ui colors now customizable with a third tab in the menu named 'Customization'
+seagull ragdoll spawn only once now (sometimes spawned multiple when killed)
+bait hooking adjustments so they dont get stuck in displacements and nocollide
+bait release timer so it does not reattach instantly
+bait spawn height offset addition to avoid creating black holes of bait
+removed broken cashreg model
+stove cooking offset higher since some stuff were not cooked at their set positions
+'b' now opens the menu if its bound to '+zoom' or not at all
+could not buy bait if it was equal to the money player has.
+equipping the fishingrod now messages the player of default bind
+entities fishingrod, bobber and hook are no longer possible to "tool" and "property" (context menu)
+added crosshair to see where the player is aiming (also customizable)
+minor fixes
lua/fishing_mod/cl_init.lua Outdated Show resolved Hide resolved
Myaats
Myaats previously requested changes Aug 16, 2020
Copy link

@Myaats Myaats left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick read through, these are some of the biggest issues in my view. But from now on please never do another mega commit with multiple changes. It makes it almost impossible to review each change and suggest better implementations

lua/entities/entity_fishing_rod/cl_init.lua Outdated Show resolved Hide resolved
lua/entities/entity_fishing_rod/init.lua Outdated Show resolved Hide resolved
lua/fishing_mod/catch/stove.lua Outdated Show resolved Hide resolved
lua/fishing_mod/cl_init.lua Outdated Show resolved Hide resolved
lua/fishing_mod/catch/stove.lua Outdated Show resolved Hide resolved
@0x098 0x098 requested a review from Myaats August 16, 2020 20:15
@Earu
Copy link
Member

Earu commented Sep 5, 2020

@m4tsa mind reviewing these changes?

Copy link
Member

@Earu Earu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall there are a lot of inconsistencies namely:

  • variable casing all over the place
  • function casing all over the place
  • unneeded checks
  • unneeded parenthesis in ifs
  • short and bad variable names, your variable names should be descriptive and not less than 3 characters unless its something widely known such as pos, x, y etc...
  • lots of unneeded ifs that can be merged
  • inconsistencies in spaces between operators, you've added spaces in some places but not others

My review is non-exhaustive, I'm not going to add a comment for each individual issues because they appear A LOT of times in your changes.

lua/entities/entity_fishing_rod/cl_init.lua Outdated Show resolved Hide resolved
lua/entities/entity_fishing_rod/cl_init.lua Outdated Show resolved Hide resolved
lua/entities/entity_fishing_rod/init.lua Outdated Show resolved Hide resolved
lua/fishing_mod/catch/stove.lua Outdated Show resolved Hide resolved
lua/fishing_mod/catch/stove.lua Outdated Show resolved Hide resolved
lua/fishing_mod/cl_shop_menu.lua Outdated Show resolved Hide resolved
lua/fishing_mod/cl_shop_menu.lua Outdated Show resolved Hide resolved
lua/fishing_mod/cl_shop_menu.lua Outdated Show resolved Hide resolved
lua/fishing_mod/sv_init.lua Outdated Show resolved Hide resolved
lua/weapons/weapon_fishing_rod.lua Outdated Show resolved Hide resolved
@Myaats
Copy link

Myaats commented Sep 5, 2020

@m4tsa mind reviewing these changes?

I'd rather just close the PR, currently it has more drawbacks and bad practices than benefits

@Earu
Copy link
Member

Earu commented Sep 5, 2020

It might be salvageable but a lot of work needs to be done on it @0x098 @m4tsa

@Myaats
Copy link

Myaats commented Sep 5, 2020

I suggest we just close this and require every feature on the list to be done in it's own PR that can be independently reviewed.

@Earu
Copy link
Member

Earu commented Sep 5, 2020

I don't see the point of creating a new PR for this, we're gonna lose all the relevant conversations, and what for? So it can look like a quick clean PR?

Earu
Earu previously approved these changes Sep 20, 2020
@Earu
Copy link
Member

Earu commented Sep 20, 2020

This looks better, @m4tsa please review these changes

@Myaats
Copy link

Myaats commented Sep 20, 2020

This looks better, @m4tsa please review these changes

Just because he actually tested his code and found some issues (there are probably more lurking around) instead of fixing the concerns posted does not make the PR any better in my eyes.

@Earu
Copy link
Member

Earu commented Sep 20, 2020

I'd argue that usually if you test more and fix more issues it makes a contribution better though (?)

fixing the concerns posted

Which are? The changes you've requested have been made and so have mine.

@Myaats
Copy link

Myaats commented Sep 20, 2020

I'd argue that usually if you test more and fix more issues it makes a contribution better though (?)

fixing the concerns posted

Which are? The changes you've requested have been made and so have mine.

I am not able to review changes individually to see if they make sense. So far I have only been able to look quickly through and look for obvious errors.

@Myaats Myaats requested a review from Earu May 4, 2021 08:55
Copy link
Member

@Earu Earu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TL:DR

  • you have a lot of magic numbers that seem to be constants, make them actual constants and give them names
  • you have a lot of inconsistencies with your variable naming and spacing of arguments
  • you have unnecessary operations like *1

But all in all this is getting better

surface.DrawRect(0, 0, x, y)
surface.DrawRect(3, 24, x-6, y-24-3)
surface.DrawRect(3, 24, x - 6, y - 24 - 3)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if your -3 is a constant please make it a variable such as CONSTANT = 3, if not then just put the actual number instead of doing unnecessary operations

text_height, text_width = surface.GetTextSize(string.Replace(string.Replace(data.text, "\t", ""), "\n", ""))
text_height, text_width = text_height + 8, text_width + 8
surface.DrawRect(xy.x - text_height / 2 - pad, xy.y - text_width / 2 - 1 - pad + 16, text_height + pad * 2, text_width + pad * 1)
surface.DrawRect(xy.x - text_height / 2 + 3 - pad, xy.y - text_width / 2 + 2 - pad + 16, text_height - 6 + pad * 2, text_width - 6 + pad * 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you multiply by 1?

if IsValid(LocalPlayer():GetActiveWeapon()) and LocalPlayer():GetActiveWeapon():GetClass() == "weapon_fishing_rod" then
surface.SetDrawColor(crosshair.r, crosshair.g, crosshair.b, crosshair.a)
local xy = chpos:ToScreen()
surface.DrawRect( xy.x, xy.y+5, 1, 10)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inconsistent spacing between numbers and operators

local force_b = 1
concommand.Add("fishing_mod_b_opens_always", function(ply, cmd, args)
if isnumber(tonumber(args[1])) then
force_b = math.Clamp(math.Round(args[1]),0,1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inconsistent spacing between commas and arguments

if temp_data then
for k, v in pairs(temp_data) do
if k and v then
if #tostring(k) < 4 then return end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that looks really wonky

end
surface.DrawRect(0, 0, w, h)
end

baitsbutton:SetPos(3 + (xpx - 6) / 2, 24) -- baits shop start of conf
baitsbutton:SetSize((xpx - 6) / 2, 22)
baitsbutton:SetPos(3 + (xpx - 6) / 3, 24) -- baits shop start of conf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this was part of the original code but when you do operations with "magic numbers" please make them constants such as CONSTANT = 3 it greatly helps reading

elseif not self.selected then
baitsbutton:SetColor(button_not_selected)
end
if baitsbutton:IsHovered() then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your variables have switched from PascalCase to snake_case to whateverthisis

self:SetVisible(false)
function self:Think()
x, y = self:GetParent():GetSize()
self:SetSize(x - 6, y - 3 - 46)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is 3 ? Constant again ? Same comment as above

savebutton.DoClick = function()
if fishingmod.SaveUIColors then
fishingmod.SaveUIColors()
chat.AddText(Color(0, 255, 0, 255), "[Fishing Mod]", Color(255, 255, 255), ": Colors have been saved!")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you're gonna re-use colors, please store them instead of re-creating them, creating tables in lua is intensive. This can be avoided

@@ -326,19 +658,19 @@ function PANEL:Init()
end

function PANEL:SetSale(multiplier)
self.percent = math.Round((multiplier*-1+1)*100)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just -multiplier ?

@Earu Earu dismissed their stale review May 4, 2021 09:37

outdated approval

@Python1320
Copy link
Member

Is there still something major preventing merge? Considering this is the only fishingmod upgrade done for a long time I am inclined to just approve it for testing regardless of its prettyness. Easy to validate update requests get merged muuch faster.

@Earu
Copy link
Member

Earu commented Jul 24, 2021

@Python1320 for me not really, but I think @m4tsa still has things to say

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants