make_unit_melee_ammo_type(6) - Question

Place to get help with not working mods / modding interface.
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1455
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

make_unit_melee_ammo_type(6) - Question

Post 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.,
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: make_unit_melee_ammo_type(6) - Question

Post 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)
quick links: log file | graphical issues | wiki
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1455
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: make_unit_melee_ammo_type(6) - Question

Post by TheSAguy »

Thanks Daniel,
How did you run that search? I always need to open each file and search?

Thanks.
ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: make_unit_melee_ammo_type(6) - Question

Post 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
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: make_unit_melee_ammo_type(6) - Question

Post 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.
quick links: log file | graphical issues | wiki
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1455
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: make_unit_melee_ammo_type(6) - Question

Post 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 :D
I even use Notepad++. Never know of the cool search though. Thanks!
Post Reply

Return to “Modding help”