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

Feature: Warps need to be connected to the same electricity network #190

Merged
merged 29 commits into from
Mar 30, 2021
Merged

Feature: Warps need to be connected to the same electricity network #190

merged 29 commits into from
Mar 30, 2021

Conversation

bbassie
Copy link
Contributor

@bbassie bbassie commented Nov 8, 2020

This pull request contains a refactor of the warp list to enable to make it easier to implement this feature.
image

image

@bbassie
Copy link
Contributor Author

bbassie commented Nov 8, 2020

Creating a warp will now error if you are standing too close to water, this should also fix being able to create land with warps.
image

@Cooldude2606
Copy link
Member

  • The new warp looks nice, makes me wonder if the center colour could be based on the icon selected, possibility through using a table lookup.
  • The left padding on the text feilds needs to be set back to 0, the text looks to cramped being pushed against the edge.
  • Warp proximity bypass is not working correctly, any role which has the bypass is unable to warp at all, the expected behaviour is that anyone with the bypass is able to goto any warp without the requirement of being on a warp. I suspect the issue is because the permission is not checked for during the new connected network check.
  • Longer names break the scroll bar, although I think this might be a factorio issue.

* Add bypass styling and functionality
* Fix using wrong warp position for goto label
* Add warp placement checks
* Edit remove warp to keep the corpses of the entities
* Fix warp label and textbox
* Make Warp container wider by 20
@bbassie
Copy link
Contributor Author

bbassie commented Nov 15, 2020

  • The new warp looks nice, makes me wonder if the center colour could be based on the icon selected, possibility through using a table lookup.

Maybe for the future ;)

  • The left padding on the text fields needs to be set back to 0, the text looks to cramped being pushed against the edge.

Added a bit more padding

  • Warp proximity bypass is not working correctly, any role which has the bypass is unable to warp at all, the expected behavior is that anyone with the bypass is able to goto any warp without the requirement of being on a warp. I suspect the issue is because the permission is not checked for during the new connected network check.

Proximity should be working now

  • Longer names break the scroll bar, although I think this might be a Factorio issue.

This seems to be a Factorio issue yea

@Cooldude2606
Copy link
Member

All previous comments have been adressed, I have a few further suggestions for colours and tooltips.

  • The tooltips will look better if kepted short and palced onto a new line. I suggest Go to x __1__ y __2__\nDistance Bypass and Go to x __1__ y __2__\nNetwork Bypass.
  • On the topic of tooltips, adding \nCooldown Bypass onto the progress bar if the player has the permission would keep styling consistent, this information is not currenrly present anywhere.
  • Using grey for the current warp does not provide enough contrast against the white of the other names so I suggest having the current warp show as blue.
  • Blue can also be used to show that a player is unable warp because of they cooldown.
  • Final style suggestion, using blue for all warps when a player is not on a warp but has bypass does not make much sence to me, this will be the base state of the warps so I think it should be white.
  • One coding suggestion I found while playing with the colours, your if statements in update_icon_button can be reduced with the following format:
if not warp_player_is_on then
    if bypass_warp_proximity then
        --[[ Block - Bypass Not In Range ]]
    else
        --[[ Block - Not In Range ]]
    end
elseif warp_player_is_on.warp_id == warp.warp_id then
    --[[ Block - Same Warp ]]
elseif on_cooldown then
    --[[ Block - Cooldown ]]
else
    if warp_electric_network_id == player_warp_electric_network_id then
        --[[ Block - Allowed ]]
    elseif bypass_warp_proximity then
        --[[ Block - Bypass Different Network ]]
    else
        --[[ Block - Different Network ]]
    end
end

The following shows the warp system I used to test and the colours I described above.
warpSystem
warpColours

* Changed cooldown color to be same as the disabled one;
Because debate about the color usage I made the change to using icons.
@bbassie
Copy link
Contributor Author

bbassie commented Jan 23, 2021

@Cooldude2606 Please fix CI & review my latest commit.

bbassie and others added 4 commits January 24, 2021 01:58
* Fixed that it clears table every warp update.
* Dirty fix unknown signal icon, it gets replaced by the old icon
@Cooldude2606
Copy link
Member

Git actions have beeen fixed, the fix has been merged into your pr.

Copy link
Member

@Cooldude2606 Cooldude2606 left a comment

Choose a reason for hiding this comment

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

Due to the time that I am reviewing this, I have not tested in game or looked at styling.
Most of the comments are suggestions that could be considered rather than required changes.
I will review the styling tomorrow.

modules/control/warps.lua Outdated Show resolved Hide resolved
modules/control/warps.lua Outdated Show resolved Hide resolved
modules/gui/warp-list.lua Show resolved Hide resolved
modules/gui/warp-list.lua Outdated Show resolved Hide resolved
modules/gui/warp-list.lua Outdated Show resolved Hide resolved
modules/gui/warp-list.lua Outdated Show resolved Hide resolved
modules/gui/warp-list.lua Show resolved Hide resolved
modules/gui/warp-list.lua Outdated Show resolved Hide resolved
modules/gui/warp-list.lua Outdated Show resolved Hide resolved
modules/gui/warp-list.lua Show resolved Hide resolved
bbassie and others added 4 commits January 24, 2021 19:41
Co-authored-by: Cooldude2606 <cooldude260607@gmail.com>
* Variable name.
* Moved variable initialisation to outside a function.
* Fixed indentation.
* Updated function names to be more representative of what they do.
* Added more comments
* Moved some variables around for easier readability and such
Copy link
Member

@Cooldude2606 Cooldude2606 left a comment

Choose a reason for hiding this comment

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

All suggested changes which where implemented look correct.
I will do a final check in game before I approve the PR.

@Cooldude2606
Copy link
Member

Comments from in game testing:

  • The "bypass" and "same warp" feel smaller than the other icons, manual size adjustment might be required.
  • The "not in range" icon feels too large compered to the other icons, manual size adjustment might be required.
  • The description of "bypass" in the sub tooltip is too long, excluding it based on permissions would be a bonus.
  • The info doesnt sit right, idk if its because its the only blue thing or if its the size, but something feels off with it. (it could be its new and im not used to seeing it)
  • Status icons are not vertically centered, when the name wraps onto a new line the icon does not remained centered.
  • Making the gui a bit wider to compensate for the room now taken up by the icon would be a plus. (maybe only when the player has edit accessed, since without edit the name can expand further right)
  • Should presses "Discard changes" remove a warp with the edit was opened as a result of presing "New warp"? (i think this would require a bit of work todo and would not provide much benefit beyound consistency)

@bbassie
Copy link
Contributor Author

bbassie commented Jan 26, 2021

Comments from in game testing:

  • The "bypass" and "same warp" feel smaller than the other icons, manual size adjustment might be required.
  • The "not in range" icon feels too large compered to the other icons, manual size adjustment might be required.

When I have the time I'll look for better icons, doing custom formatting for each icon seems too over done.

  • The description of "bypass" in the sub tooltip is too long, excluding it based on permissions would be a bonus.

Will change the description, doing the second part maybe.

  • The info doesnt sit right, idk if its because its the only blue thing or if its the size, but something feels off with it. (it could be its new and im not used to seeing it)

Think because it's new, maybe good to add to other GUI's to inform users about what it does.

  • Status icons are not vertically centered, when the name wraps onto a new line the icon does not remained centered.
  • Making the gui a bit wider to compensate for the room now taken up by the icon would be a plus. (maybe only when the player has edit accessed, since without edit the name can expand further right)

I'll make it single line and increase the with if it gets too small (like you said maybe per user, but we'll see).

  • Should presses "Discard changes" remove a warp with the edit was opened as a result of presing "New warp"? (i think this would require a bit of work todo and would not provide much benefit beyound consistency)

Will look into this, it’s interesting!

* Pressing `Discard changes` removes warp if it has been pressed after `New warp`.
* Changed `not_available` (not in range) status icon to a cross, fits the sizing of the other icons better.
* Renamed locals key `'warp-list.discard-tooltip'` to `'warp-list.remove-tooltip'`
* Added textfield squashable and strechable to make it dynamic to the container size.
* Container size changes depending on permissiong `'allow_add_warp'`
* Pressing `Discard changes` removes warp if it has been pressed after `New warp`.
* Changed `not_available` (not in range) status icon to a cross, fits the sizing of the other icons better.
* Renamed locals key `'warp-list.discard-tooltip'` to `'warp-list.remove-tooltip'`
* Added textfield squashable and strechable to make it dynamic to the container size.
* Container size changes depending on permissiong `'allow_add_warp'`
Copy link
Member

@Cooldude2606 Cooldude2606 left a comment

Choose a reason for hiding this comment

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

  • New icons look great, even if this was only a result of updating to 1.1
  • Remove warp on first edit works as expected, but it might be possible to use a boolean?
  • One change was missed relating to playing a sound, one was corrected and the other not.
  • Because of the truncated warp name, could the full name be added at the top of the tooltip.
  • I will be asking for an additional review of the locale file to ensure it is consistent.

modules/gui/warp-list.lua Outdated Show resolved Hide resolved
modules/gui/warp-list.lua Show resolved Hide resolved
modules/control/warps.lua Show resolved Hide resolved
locale/en/gui.cfg Outdated Show resolved Hide resolved
locale/en/gui.cfg Outdated Show resolved Hide resolved
* Removed 1 time use local
* Fixed double permission check
* Locale fixes
@mark9064 mark9064 self-requested a review February 9, 2021 21:14
Copy link
Member

@mark9064 mark9064 left a comment

Choose a reason for hiding this comment

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

I might've missed a few things as always. I also haven't checked any variable names for errors. Looks pretty good overall though!

locale/en/gui.cfg Outdated Show resolved Hide resolved
locale/en/gui.cfg Outdated Show resolved Hide resolved
locale/en/gui.cfg Show resolved Hide resolved
locale/en/gui.cfg Outdated Show resolved Hide resolved
locale/en/gui.cfg Outdated Show resolved Hide resolved
modules/gui/warp-list.lua Outdated Show resolved Hide resolved
modules/gui/warp-list.lua Outdated Show resolved Hide resolved
modules/gui/warp-list.lua Outdated Show resolved Hide resolved
modules/gui/warp-list.lua Show resolved Hide resolved
modules/gui/warp-list.lua Outdated Show resolved Hide resolved
Cooldude2606 and others added 5 commits March 30, 2021 03:35
All changes where corrections to spelling and grammar in comments.

Co-authored-by: mark9064 <30447455+mark9064@users.noreply.github.com>
Copy link
Member

@Cooldude2606 Cooldude2606 left a comment

Choose a reason for hiding this comment

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

My last review covered all functional code, and marks review covered all spelling and grammar, with my last changes which implimented marks request, I am happy to merge this pr.

@Cooldude2606 Cooldude2606 merged commit 8431b2e into explosivegaming:dev Mar 30, 2021
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.

3 participants