In other languages:

Tutorial:Inspecting a live mod: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Moved links to full mod into own section again)
mNo edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Languages}}
== Introduction  ==  
== Introduction  ==  
Welcome to the Inspecting-a-live-mod tutorial!
Welcome to the Inspecting-a-live-mod tutorial!
Line 10: Line 11:


This is an advanced tutorial that assumes that you already know how Lua works and that
This is an advanced tutorial that assumes that you already know how Lua works and that
you have have familiarized yourself with at least the basic concepts
you have familiarized yourself with at least the basic concepts
of Factorio modding. On that basis this tutorial aims to provide a rough overview
of Factorio modding. On that basis this tutorial aims to provide a rough overview
on how real-life mods work and shows you how to assemble the
on how real-life mods work and shows you how to assemble the
Line 30: Line 31:
I recommend reading in the order that the files are loaded by the game. Have fun!
I recommend reading in the order that the files are loaded by the game. Have fun!


# Chapter 1    : [https://github.com/lossycrypt/eradicators-hand-crank-generator/blob/master/settings.lua settings.lua]
* Chapter 1    : [https://github.com/lossycrypt/eradicators-hand-crank-generator/blob/master/settings.lua settings.lua]
# Chapter 2    : [https://github.com/lossycrypt/eradicators-hand-crank-generator/blob/master/data.lua data.lua]
* Chapter 2    : [https://github.com/lossycrypt/eradicators-hand-crank-generator/blob/master/data.lua data.lua]
# Bonus Chapter : [https://github.com/lossycrypt/eradicators-hand-crank-generator/blob/master/migrations/2020-08-28_HCG_2.0.0.json migration.json]
* Bonus Chapter : [https://github.com/lossycrypt/eradicators-hand-crank-generator/blob/master/migrations/2020-08-28_HCG_2.0.0.json migration.json]
# Chapter 3    : [https://github.com/lossycrypt/eradicators-hand-crank-generator/blob/master/control.lua control.lua]
* Chapter 3    : [https://github.com/lossycrypt/eradicators-hand-crank-generator/blob/master/control.lua control.lua]


== Full mod ==  
== Full mod ==<!--links are at the end to not distract the reader too early-->


HCG is available in full on
HCG is available in full on

Latest revision as of 14:56, 6 September 2022

Introduction

Welcome to the Inspecting-a-live-mod tutorial!

In this tutorial I will take you on an annotated tour of my mod Eradicator's Hand Crank Generator Deluxe. That's a rather long name so I'll often call it just HCG hereafter. HCG is a fully functional mod that you can download and play with right now! It has extensive comments in the code to explain how and why it works.

This is an advanced tutorial that assumes that you already know how Lua works and that you have familiarized yourself with at least the basic concepts of Factorio modding. On that basis this tutorial aims to provide a rough overview on how real-life mods work and shows you how to assemble the theoretical concepts you have learned so far into a working whole. If you are not yet familiar with the basics, Gangsir's modding tutorial is a good starting point for learning them.

First settings.lua shows creation of some basic setting prototypes. Then data.lua covers most basic operations like creating new item, recipe, building and technology prototypes. And how to interact with prototypes of other mods. Finally in control.lua I explain how to make custom behavior for buildings - namely how to make the Hand Crank Generator produce power when the player presses a key on the keyboard.

You can read the files on the web on GitHub or download and extract the mod locally to your hard-drive.

Tutorial

I recommend reading in the order that the files are loaded by the game. Have fun!

Full mod

HCG is available in full on GitHub or on the Factorio Mod Portal.

See also