Page 1 of 1

[MOD 0.13.x] Handcraft Counter

Posted: Tue Sep 06, 2016 6:21 pm
by Refferic
Description:
This mod counts the total amount of handcrafted items and displays it as a text on screen. Requested by Arumba07 in his Twitch stream, when playing Bobs Mods + Lazy achievement, Arumba asked if there was an easy way to show the total amount of handcrafted items, for when the goal of the achievement could not be met. Well there is now! 8-)

**Important: it does not work with the current saves, only with new games.**

Image

Name: HandCraft Counter
Version: 1.0.1
Factorio Version: 0.13.x
Release: 2016-Sep-06
Category: Non-Game-Changing, Graphics
License: MIT License (https://opensource.org/licenses/MIT)

Changes/Planned for v1.0.3:
- nothing planned

[Update 1.0.2 ]
+ Fixed error message

[ Update 1.0.1 ]
+ Saves between loading games
+ Multiplayer friendly (Thanks to Nexela)
+ Added a point between the thousands (Yeah, I kinda craft many things by hand I noticed.)

Download:
https://mods.factorio.com/mods/Refferic ... aftcounter

Re: [MOD 0.13.x] Handcraft Counter

Posted: Wed Sep 07, 2016 2:39 am
by Nexela
Not multiplayer friendly though. And it doesn't save between loads but since I like the concept I fixed it for ya.

Here is my good deed for the day, No credit needed :)

Code: Select all

local function init(player_index)
	global.player = global.player or {}
	global.player[player_index] = global.player[player_index] or {}
	global.player[player_index].craft_count_enabled = true
	global.player[player_index].count = 1  -- this is 1 because we are doing an init after crafting the first item
	game.players[player_index].gui.left.add{type = "label", name = "craft_count", caption = "Crafted " .. global.player[player_index].count .. " items.", style = "description_title_label_style"}
end

local function update(player_index)
	local player_count = global.player[player_index].count
	local gui=game.players[player_index].gui.left.craft_count
	player_count = player_count+1
	global.player[player_index].count=player_count
	if player_count == 111 then
    	game.players[player_index].print("There goes the achievement, you crafted " .. player_count .. " items by hand.. #Restart! :)")
   	end
	if gui then
		gui.caption = "Crafted " .. player_count .. " items."
	else
		game.players[player_index].gui.left.add{type = "label", name = "craft_count", caption = "Crafted " .. player_count .. " items.", style = "description_title_label_style"}
	end
end

script.on_event(defines.events.on_player_crafted_item, function(event)
	if global.player and global.player[event.player_index] and global.player[event.player_index].craft_count_enabled then
		update(event.player_index)
	else
		init(event.player_index)
	end
end)

Re: [MOD 0.13.x] Handcraft Counter

Posted: Sat Sep 10, 2016 2:41 pm
by Refferic
[ Update 1.0.1 ]
+ Saves between loading games
+ Multiplayer friendly (Thanks to Nexela)
+ Added a point between the thousands (Yeah, I kinda craft many things by hand I noticed.)

[Update 1.0.2 ]
+ Fixed error message

Re: [MOD 0.13.x] Handcraft Counter

Posted: Thu Nov 17, 2016 12:48 am
by Threndor
Does this invalidate achievements? I just finished a run and it noted I got three (including Lazy), but Steam isn't showing them. This was the only mod I had loaded, and I'd prefer to not have to go through that again... it's an extremely slow start.

Re: [MOD 0.13.x] Handcraft Counter

Posted: Thu Nov 17, 2016 3:03 am
by Threndor
Ok, that was odd. I turned off the mod, and Steam immediately gave me credit for all the achievements. Including ones earned when I'd been doing a Bob's mod run.

So: FYI: every so often turn off -ALL- mods and you might get a few more achievements popping up!