Muzzle fire animation / fuel deactivation

Place to get help with not working mods / modding interface.
Post Reply
Odynius
Inserter
Inserter
Posts: 21
Joined: Wed Feb 22, 2017 10:36 pm
Contact:

Muzzle fire animation / fuel deactivation

Post by Odynius »

Hey guys,

I'm just working on a mod that implements bunkers into Factorio and am pretty happy with it, except two points which you can maybe help me with:

Just one note, so you can follow me better: I used the "car" entity, so the player is able to enter the building and fire out of it. Of course it can't drive.

First problem: Can I adjust the Muzzle fire animatin? Right now it's in the middle of the texture, but ideally it should be at the windows, which would also depend on the direction of the target. (Model is the Terran bunker from SC2)

Second Problem: Even though i set the burner consumption to 0 it gives me the no fuel symbol, when there is none. This isn't to bad, because you just have to put some coal or whatever in it, and then it's gone, since it can't drive - therefore can't consume anything - but if I release it, I would like to make at as realistic as possible.

Thx guys!

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Muzzle fire animation / fuel deactivation

Post by Adil »

Does it fire its own guns, or the player's ones?

Those triangle icons are the bane of the modding, you cannot really make them go away without inserting some dummy fuel\connecting to dummy power source.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

Odynius
Inserter
Inserter
Posts: 21
Joined: Wed Feb 22, 2017 10:36 pm
Contact:

Re: Muzzle fire animation / fuel deactivation

Post by Odynius »

Thank you for your answer.

I guess, I'm just going to live with the fuel problem then.

It's using its own gun, just like the car does. I assume this might be somehow connected to the gun_turret node? I'm new to modding and didn't deal with that until now.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Muzzle fire animation / fuel deactivation

Post by Adil »

Well, car turret is defined in /data/items/gun.lua and its definition has field `projectile_creation_distance`. That probably will help with gunshots.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

Odynius
Inserter
Inserter
Posts: 21
Joined: Wed Feb 22, 2017 10:36 pm
Contact:

Re: Muzzle fire animation / fuel deactivation

Post by Odynius »

Oh I should have taken a closer look. Gonna try it out. Thanks mate!

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Muzzle fire animation / fuel deactivation

Post by Nexela »

Second Problem: Even though i set the burner consumption to 0 it gives me the no fuel symbol, when there is none. This isn't to bad, because you just have to put some coal or whatever in it, and then it's gone, since it can't drive - therefore can't consume anything - but if I release it, I would like to make at as realistic as possible.
Create an on build script that inserts 1 piece of coal into entity when placed


control.lua

Code: Select all

local function on_built(event)
    if event.created_entity,name == "my-entities-name" then
        event.created_entity.insert({name="coal", amount=1})
    end
end
script.on_event({defines.events.on_built_entity, defines.events.on_robot_built_entity}, on_built)

Odynius
Inserter
Inserter
Posts: 21
Joined: Wed Feb 22, 2017 10:36 pm
Contact:

Re: Muzzle fire animation / fuel deactivation

Post by Odynius »

Okay, I got that fire animation going now!

And thanks to Nexela, I will try to implement that. I have never worked with "if, then"-functions though - do i just put it at the top of my entity.lua?

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Muzzle fire animation / fuel deactivation

Post by Adil »

The code he provided you, is self contained, you indeed can put it in any place of control.lua. The important part is the `script.on_event({defines.events.on_built_entity, defines.events.on_robot_built_entity}, on_built)`, which binds the defined function to relevant ingame events.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

Odynius
Inserter
Inserter
Posts: 21
Joined: Wed Feb 22, 2017 10:36 pm
Contact:

Re: Muzzle fire animation / fuel deactivation

Post by Odynius »

All righty. God bless the factorio community!

EDIT: In case someone else wants to use Nexelas control.lua. I found a small typo, this one is working:

Code: Select all

local function on_built(event)
    if event.created_entity.name == "my-entities-name" then
        event.created_entity.insert({name="coal", amount=1})
    end
end
script.on_event({defines.events.on_built_entity, defines.events.on_robot_built_entity}, on_built)

Wybbw
Burner Inserter
Burner Inserter
Posts: 19
Joined: Thu Mar 02, 2017 10:31 pm
Contact:

Re: Muzzle fire animation / fuel deactivation

Post by Wybbw »

****SOLVED***

hi I im making a gun mod and was wondering where u found the script animation for the muzzle fire. ive got tracers going and bullet casing dropping I just want that muzzle flash. I am new at this and deff not lazy and have been searching perhaps you could point me in the right direction.

foodfactorio
Filter Inserter
Filter Inserter
Posts: 454
Joined: Tue Jun 20, 2017 1:56 am
Contact:

Re: Muzzle fire animation / fuel deactivation

Post by foodfactorio »

oh hi, if you did the terran building mod, nice work :)

there was a recent problem i found where i couldnt load the mod with another mod, and posted here with a screenshot of the error, if you happen to have a chance to help?
viewtopic.php?f=51&t=45001&start=820#p303008
(also me from the mod portal - im not dustine lol) = https://mods.factorio.com/mods/Dustine/ ... ssion/9108
my 1st Mod Idea :) viewtopic.php?f=33&t=50256

Post Reply

Return to “Modding help”