This repository has been archived by the owner on Oct 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is evoGUI v0.1.0. It does everything it's supposed to. It took an hour to write and another half-hour to get right.
- Loading branch information
0 parents
commit 7446dd2
Showing
7 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.lua text | ||
*.json text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.* | ||
|
||
!.git* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
EvoGUI is released under the MIT license. Informally, this means you can | ||
do basically whatever with it you like, as long as you leave this file intact. | ||
The full legalese is below. | ||
|
||
|
||
EvoGUI is Copyright (c) 2015 Octav "narc" Sandulescu | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
This is a [Factorio](http://www.factorio.com/) mod. It adds a small UI frame | ||
that informs you of the current biter evolution level, as well as your play | ||
time. | ||
|
||
|
||
## License ## | ||
|
||
The source of **EvoGUI** is Copyright 2015 Octav "narc" Sandulescu. It | ||
is licensed under the [MIT license][mit], available in this package in the file | ||
[LICENSE.md](LICENSE.md). | ||
|
||
[mit]: http://opensource.org/licenses/mit-license.html | ||
|
||
|
||
## Statistics ## | ||
|
||
20 exceptions were caught during the creation of this mod. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require "defines" | ||
require "evoGUI" | ||
|
||
local function log(message) | ||
for i, p in ipairs(game.players) do | ||
p.print(message) | ||
end | ||
end | ||
|
||
game.on_event(defines.events.on_tick, function(event) | ||
local status, err = pcall(evogui.update_gui) | ||
if err then log(string.format("[evoGUI] Error: %s", err)) end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require "defines" | ||
|
||
if not evogui then evogui = {} end | ||
evogui.previous = -1 | ||
|
||
local function update_gui() | ||
local run_time_seconds = math.floor(game.tick/60) | ||
local run_time_minutes = math.floor(run_time_seconds/60) | ||
local run_time_hours = math.floor(run_time_minutes/60) | ||
|
||
if evogui.previous ~= run_time_seconds then | ||
for i, player in ipairs(game.players) do | ||
if player.gui.top.evoGUI == nil then | ||
player.gui.top.add{type="frame", name="evoGUI", direction = "vertical"} | ||
player.gui.top.evoGUI.add{type="label", name="evolution_factor"} | ||
player.gui.top.evoGUI.add{type="label", name="run_time"} | ||
end | ||
player.gui.top.evoGUI.evolution_factor.caption = string.format("Biter evolution: %0.1f%%", game.evolution_factor * 100) | ||
player.gui.top.evoGUI.run_time.caption = string.format("Play time: %d:%02d:%02d", run_time_hours, run_time_minutes, run_time_seconds) | ||
end | ||
evogui.previous = run_time_seconds | ||
end | ||
end | ||
|
||
evogui.update_gui = update_gui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "EvoGUI", | ||
"version": "0.1.0", | ||
"title": "Evolution Factor Indicator", | ||
"author": "Octav \"narc\" Sandulescu", | ||
"contact": "[email protected]", | ||
"homepage": "None right now", | ||
"description": "Places an indicator on your UI telling you the current biter evolution factor (as a percentage). It also tells you how long you've been playing.", | ||
"dependencies": ["base >= 0.12.0"] | ||
} |