GithubHelp home page GithubHelp logo

narc0tiq / evogui Goto Github PK

View Code? Open in Web Editor NEW
37.0 12.0 12.0 140 KB

A Factorio mod to add a GUI with the biter evolution factor and the current play time. Purely informative.

Home Page: https://mods.factorio.com/mods/Narc/EvoGUI

License: MIT License

Lua 100.00%

evogui's Introduction

This is a Factorio mod. It adds a small UI frame that informs you of the current biter evolution level, as well as your play time.

Many thanks for

  • The many downloads so far! Glad you guys are liking it.
  • Continuous Integration by CircleCI: Circle CI
  • Many, many improvements made by Afforess! Thanks so much, you're the best!
  • The wonderful translations contributed by these awesome people: JoCKeRiL (Hebrew), Rikkilook (Russian), theRustyKnife (Czech), thomaskneisel and BenediktMagnus (German), diilmac (Polish), Xagros (Korean), futuroattore86 (Italian).
  • Updating assistance by @kylewill0725!

License

The source of EvoGUI is Copyright 2015-2019 Octav "narc" Sandulescu. It is licensed under the MIT license, available in this package in the file LICENSE.md.

Statistics

78 exceptions were caught during the creation of this mod.

evogui's People

Contributors

afforess avatar benediktmagnus avatar gimoxagros avatar kylewill0725 avatar narc0tiq avatar silasary avatar thomaskneisel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

evogui's Issues

Evolution factor effects (what spawns, what's the next threshold?)

Via http://www.factorioforums.com/forum/viewtopic.php?p=102240#p102240

Two parts to this:

  • A list of what can spawn right now (e.g., at evolution 34%: Can spawn: Small biter, Small spitter, Medium biter), and;
  • The next spawn threshold (e.g., at 50%, Medium spitter will spawn)

Both should be optional and controlled by sensor settings, as in #13. Notably, this would be done as a separate sensor from the regular evolution factor one.

Remove mod name from remote sensor display names on the settings screen.

(via https://forums.factorio.com/viewtopic.php?p=158391#p158391)

If we want to separate them from the built-in sensors, we might put "[addon]" in there somewhere, but I'm not sure the difference matters at all to the player.

Note: at least one mod that registers a remote sensor (namely, Rescaled-Evolution-Factor) is passing a mod_name different from its actual mod name, presumably because of the behaviour we're about to change. This likely results in people thinking "EvoGUI sucks because it didn't notice I removed that mod and left its sensor behind but it doesn't do anything".

In-place multisensor (with WrenchFu)

A machine you craft and drop into the world, and can (re)configure using WrenchFu, that can keep your EvoGUI updated with information around itself.

Stats like:

  • logistic network data (robot counts, percentage filled, item counts for specific items)
  • pollution level
  • amount of ore/miners nearby

Graceful degradation: without WrenchFu, you can still configure the device when placing it, but you'll have to pick it up and put it back down again to reconfigure it.

Localization aid: parametrize the thousands and decimal separators

If they were to be per-player settings, that would be perfectly deterministic and fine (though it does mean players have to configure it once; can't have everything).

(alternately, peek through Factorio locales -- maybe the separators already exist as locale keys?)

Settings screen

Required by #5, a settings screen would give us a place from whence we could categorize information (e.g., between always-visible, visible-on-expand, and never-visible).

It may further be expanded later, as needed.

Value sensor settings open during a save can't be closed after loading the save.

What the title says. If you save the game with a sensor settings GUI open (e.g., the play_time sensor settings), then later load that save, you will not be able to make the sensor settings GUI go away without console hax (/c game.local_player.gui.center.[sensor_name]_settings.destroy()).

This is very unfriendly and needs to stop now.

Add Rocket Sent Count to evoGUI.

I would love it if such a kind and wonderful man would be willing to grab the rocket sent count and add it to evoGUI.

If possible remove the scoreboard or give instructions how to modify the control.lua.

Thanks!

Remote sensors on by default

Hello,

if anybody registers a new remote sensor (probably by mod), it should be activated by force for easier user experince.

Otherwise it can lead to confusion if an expected display don't get shown.

How to determine if (remote) sensor is visible?

Hi,

I've just written my first sensor mod (github) for EvoGUI and in the on-tick handler I was thinking how nice it would be to have some way to know whether the sensor is currently displayed or not (otherwise, no point in updating the sensor data). This may already be possible (let me know if it is) but I've only just scratched the surface of the Evo codebase and didn't see anything yet.

Maybe Evo could register custom event, 'sensor-toggle' - mods get the numeric event id via remote API and hook to the event. When sensor is shown/hidden, the event fires with a table payload such as:

{ event = 'sensor-toggle', sensor = '<sensor-name>', active = true|false }

That way I can set a local variable when the event fires, and in my on-tick handler rapidly exit out if the sensor is not currently visible.

Configurable GUI update frequency

It can probably be safely dropped from 60 to 30 ticks or even lower, so let's let the players decide. It's fine for it to remain a shared config -- I don't feel like splitting the updates between players.

Attempt to index field 'evoGUI' (a nil value)

Factorio version 0.15.22
EvoGui version 0.5.0

Chat log reads:
[evoGUI|on_tick:update_gui] Error: Evo|GUI/evoGUI.lua:101: attempt to index a field 'evoGUI' (a nil value)

This was in an existing game, where EvoGUI was present from the start. Issue occurred when Factorio updated from 0.15.21 to 0.15.22. Changing the Factorio version back to 0.15.21 stops the error from occurring.

Per-sensor settings

Basically, give sensors a settings_gui() method and let them do their job. A potential setting would be whether to show position/surface on the player list.

If a sensor's settings is open, no other sensor should be able to open a new one (hide the main settings gui before opening the sensor's?).

"Flashing reds": some information is very important when the value jumps

Source (see bottom of post).

When a value like biter evolution changes by a large amount, it would be very good to annoy the player about it. This can be as simple as changing the draw color to red (or alternating white and red), or as complex as showing a popup in the middle of the screen for a second or two.

This requires configuration (issue #6), to determine which values we care about, how much change constitutes a "big" change (e.g., 0.4% in 10 seconds), and how we want the value highlighted.

0.15.22 error

0.15.22 throws a console error message on each update:
[EvoGUI|on_tick:update_gui]Error: __EvoGUI__/evoGUI.lua:101:attempt to index field 'evogui' (a nil value)

Remote sensor per-sensor settings

As mentioned at #68 (comment), remote sensors should have the ability to register a per-sensor setting button, too. Keep it simple: they ask us for a settings button with a given name, we add the button and (optionally) pass the GUIElement back, then it's their problem to listen for on_gui_click on that button.

Have sensor mods use events for updates?

I've added a bunch of new sensors to my mod and amongst other things it seems the remote.call api is somewhat laggy. Would it be better to allow sensor updates to be sent via events?

Mockup of code in a sensor mod:

local evoEvents = remote.call( 'EvoGUI', 'events' )
local sensor_update = evoEvents.update

local function updateMySensors()

  local someVals = something()

  game.raise_event( sensor_update,
    { mySensorID, val1, val2, ... }
  )

end

On receiving end (in EvoGUI) the handler does something like:

local function updateHandler( update )
  local sensor = update[1]
  local display = localeCache[sensor]
  for i = 2, #update do
   display[i] = update[i]
  end
  -- then set caption of label for sensor to display
end

Obviously very crap code in samples above, but hopefully enough to show general idea. Instead of sending table it might be easier to just pass multiple params to the raise_event(), first being sensor id, second being locale string, any others being params to locale?

If my understanding of how events work is correct, it will also allow the game to hold the event until a later frame in order to maintain UPS and FPS.

Error since most recent Factorio 15 update

When I opened my save the following message started appearing once every second.
[EvoGUI|on_tick:update_gui] Error: EvoGUI/evoGUI.lua:101 attempt to index field 'evoGUI' (a nil value)
Everything was working great last night

Player location value sensor is off by one for negative positions.

I was messing around with the chunk grid on and with evoGUI showing player coords. Happened to notice that the chunk division wasn't lining up with where evoGUI said I was.

The experimentation that followed revealed whatever coordinate is negative evoGUI will be off by 1 for that coordinate.

I'm thinking that string.format() isn't playing nice with negative numbers. It is making the 0,0 tile appear as if it is a special 2 by 2 tile. lol

Changed my local copy with some math.floor and everything lined up on positive and negative sides.

OLD:

string.format('@%d, %d', p.position.x, p.position.y)

NEW:

string.format('@%d, %d', math.floor(p.position.x), math.floor(p.position.y))

This is the file and line number https://github.com/narc0tiq/evoGUI/blob/master/value_sensors/player_locations.lua#L129

Locale maintenance (ongoing)

I've forked your repo. and am working on the Hebrew translation we discussed. I will make a pull request later :)

Factorio 0.12.11 update

Via http://factorioforums.com/forum/viewtopic.php?p=113046#p113046:

  • Lua API calls on_load, on_init, on_configuration_changed, on_event and generate_event_name have been moved to a new namespace called script (so from now use script.on_load(...)).
  • on_configuration_changed is fired when the map version changes, a mod version changes, a mod is added, or a mod is removed and passes "data":
    • Pushes old_version="x.x.x", new_version="x.x.x" when loading map versions other than the current version
    • When a mod version is changed it appears as a table of mod changes: {["Mod name"] = {old_version="x.x.x", new_version="x.x.x"}, ...}
    • When a mod is added it appears as: ["Mod name"] = {old_version=nil, new_version="x.x.x"}
    • When a mod is removed it appears as: ["Mod name"] = {old_version="x.x.x", new_version=nil}

Feature Request: Total Biters Kill Count.

I think it would be wonderful to have the game show the total biter kill count. Here is a example how I pull the count for small biters:

/c game.local_player.print(game.local_player.force.get_kill_count("small-biter"))

Better directions

Via http://www.factorioforums.com/forum/viewtopic.php?p=104208#p104208: the current proof-of-concept direction markers with the four-directional single-character arrows are okay, but they could be better.

Either:

  • 8- or 16-way cardinal directions ("E", "NW", "WSW"); or
  • compass bearings (000-359).

I think the latter would be overkill, but it's not technically any harder to do than the former. Maybe a set of radio buttons.

Make the display smaller/omit some information (sometimes)

Source (plus subsequent conversation).

This will require some thinking and some extra UI.

First and foremost, we want to be able to split the potentially displayed information into about three categories:

  • always visible
  • visible in rotation/expansion (separate categories?)
  • never visible

This requires the existence of a settings screen (see issue #6).

With those categories, then, the display functions need to split into

  • information gathering (creates strings)
  • information display (one per each visible category)

I'm currently leaning towards the "mouseover to expand" idea with a short animation between states.

Advance Options for Kill Counter.

I would love to see advance options for the kill counter. Mainly being able to say disable certain things like spanners or other count.

For me I don't really pay attention as much to spawners and I for sure don't want to look at other :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.