[MOD 0.13.x] Handcraft Counter

Topics and discussion about specific mods
Refferic
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Jul 27, 2015 8:58 pm
Contact:

[MOD 0.13.x] Handcraft Counter

Post 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
Attachments
handcraftcounter_1.0.2.zip
(1.32 KiB) Downloaded 105 times
Last edited by Refferic on Sat Sep 10, 2016 3:16 pm, edited 3 times in total.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [MOD 0.13.x] Handcraft Counter

Post 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)
Refferic
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Jul 27, 2015 8:58 pm
Contact:

Re: [MOD 0.13.x] Handcraft Counter

Post 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
Threndor
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Sep 05, 2015 2:48 am
Contact:

Re: [MOD 0.13.x] Handcraft Counter

Post 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.
Threndor
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Sep 05, 2015 2:48 am
Contact:

Re: [MOD 0.13.x] Handcraft Counter

Post 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!
Post Reply

Return to “Mods”