Page 1 of 1
make_unit_melee_ammo_type(6) - Question
Posted: Fri Sep 25, 2015 7:19 pm
by TheSAguy
Where in vanilla can I find this function?
I see where Bob' used it in his mod, it breaks out as follow, but looking for the vanilla function.
Code: Select all
ammo_type =
{
category = "melee",
target_type = "entity",
action =
{
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "damage",
damage = { amount = 30 , type = "physical"}
},
{
type = "damage",
damage = { amount = 15 , type = "acid"}
}
}
}
}
},
Thanks.,
Re: make_unit_melee_ammo_type(6) - Question
Posted: Fri Sep 25, 2015 7:54 pm
by daniel34
It's defined directly at the top of data\base\prototypes\entity\demo-entities.lua and used once in demo-enemies.lua and three times in enemies.lua. It's used to return the ammo_type of the four biter types and the first parameter equals the amount of damage.
Code: Select all
Search "make_unit_melee_ammo_type" (5 hits in 3 files)
Factorio\data\base\prototypes\entity\enemies.lua (3 hits)
Line 91: ammo_type = make_unit_melee_ammo_type(15),
Line 140: ammo_type = make_unit_melee_ammo_type(30),
Line 189: ammo_type = make_unit_melee_ammo_type(100),
Factorio\data\base\prototypes\entity\demo-enemies.lua (1 hit)
Line 31: ammo_type = make_unit_melee_ammo_type(6),
Factorio\data\base\prototypes\entity\demo-entities.lua (1 hit)
Line 6: function make_unit_melee_ammo_type(damagevalue)
Re: make_unit_melee_ammo_type(6) - Question
Posted: Fri Sep 25, 2015 9:30 pm
by TheSAguy
Thanks Daniel,
How did you run that search? I always need to open each file and search?
Thanks.
Re: make_unit_melee_ammo_type(6) - Question
Posted: Fri Sep 25, 2015 9:49 pm
by ratchetfreak
TheSAguy wrote:Thanks Daniel,
How did you run that search? I always need to open each file and search?
Thanks.
grep on linux
otherwise on windows you can get notepad++ and do a search in multiple files in a directory (recursively if you want to) It also has syntax highlighting
Re: make_unit_melee_ammo_type(6) - Question
Posted: Fri Sep 25, 2015 9:54 pm
by daniel34
ratchetfreak wrote:on windows you can get notepad++ and do a search in multiple files in a directory (recursively if you want to) It also has syntax highlighting
That's exactly what I did. I opened all *.lua files in the factorio directory in notepad++ (windows search for ext:lua), then went to search and replace (CTRL+F), entered the term and clicked "search all open files".
You can also save the session, so you just need one click to open the session, then search through all the files at once. The result is shown on the bottom window (which I copied and pasted into my post) and by doubleclicking you are jumping directly to that line.
By the way, this is a very easy way to get into modding, reading the already available code in vanilla. If you're unsure about a function or term, just search all files for that and you get a pretty good overview. That's how I learned most of the stuff I know about making mods in factorio and the connections between them.
Re: make_unit_melee_ammo_type(6) - Question
Posted: Sat Sep 26, 2015 1:46 am
by TheSAguy
daniel34 wrote:
By the way, this is a very easy way to get into modding, reading the already available code in vanilla. If you're unsure about a function or term, just search all files for that and you get a pretty good overview. That's how I learned most of the stuff I know about making mods in factorio and the connections between them.
This is
exactly how I've learned everything I know of Factorio modding
I even use Notepad++. Never know of the cool search though. Thanks!