Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
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
narc0tiq committed Jul 21, 2015
0 parents commit 7446dd2
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.lua text
*.json text
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.*

!.git*
24 changes: 24 additions & 0 deletions LICENSE.md
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.
17 changes: 17 additions & 0 deletions README.md
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.
13 changes: 13 additions & 0 deletions control.lua
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)
25 changes: 25 additions & 0 deletions evoGUI.lua
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
10 changes: 10 additions & 0 deletions info.json
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"]
}

0 comments on commit 7446dd2

Please sign in to comment.