Fire Armor now working after being crafted

Place to get help with not working mods / modding interface.
Post Reply
User avatar
cibravo
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Dec 11, 2023 12:54 pm
Contact:

Fire Armor now working after being crafted

Post by cibravo »

Hi

I'm just getting started with modding and began with the fire armor, but after following the tutorial and crafting it... nothing happens?
Does this not work with the latest version of Factorio?

The game loads without issue and no error is shown.?

Bilka
Factorio Staff
Factorio Staff
Posts: 3155
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Fire Armor now working after being crafted

Post by Bilka »

Hey, the tutorial is up to date for the latest version. I assume that by "working" you mean it doesn't spawn the fire after you put on the armor? In that case, the issue will be with the control.lua.

For example, maybe you forgot to save the file, or it has the wrong name. Or you're subscribing to the wrong event or some code in the event is wrong so it doesn't spawn the fire. It is hard to debug that without seeing the code that you have, so it would help if you could post it.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
cibravo
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Dec 11, 2023 12:54 pm
Contact:

Re: Fire Armor now working after being crafted

Post by cibravo »

Yes you are correct, it”s not spawning any fire.
I”ll go through all the files again and compare them to the tutorial.

Thanks - at least now I know it should work. :D

User avatar
cibravo
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Dec 11, 2023 12:54 pm
Contact:

Re: Fire Armor now working after being crafted

Post by cibravo »

I've compared all the files to the tutorial and I can't see any difference.
The only "issue" I found was in the .cfg file where vscode sees the ' in the text - It's warm to the touch, as a format mistake, but the cfg should only affect the item name in-game and not the functionality, as far as I understand.

My control.lua looks like this.

Code: Select all

--control.lua

script.on_event(defines.events.on_player_changed_position,
  function(event)
    local player = game.get_player(event.player_index) -- get the player that moved            
    -- if they're wearing our armor
    if player.character and player.get_inventory(defines.inventory.character_armor).get_item_count("fire-armor") >= 1 then
       -- create the fire where they're standing
       player.surface.create_entity{name="fire-flame", position=player.position, force="neutral"} 
    end
  end
)
my mod structure looks like this

fire-armor - folder
locale - folder
en - folder
config.cfg - file
info.json - file
data.lua - file
item.lua - file
control.lua - file

Not really sure what i'm doing wrong here.

Bilka
Factorio Staff
Factorio Staff
Posts: 3155
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Fire Armor now working after being crafted

Post by Bilka »

Hm, that sounds all correct. Just to confirm, you're crafting the armor, wearing it, moving around and no fire is spawned?

Maybe you could zip the mod and upload it here, perhaps that reveals something. Also, just to confirm, make sure you're not working on a copy of the mod or something, we've all made that mistake...
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
cibravo
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Dec 11, 2023 12:54 pm
Contact:

Re: Fire Armor now working after being crafted

Post by cibravo »

-- EDIT --

It's working now. Not sure what had happened, but the control.lua file was missing all content in the mods folders zip file.
After copy/paste the code to control.lua and copying into mods folder again it works. So was a fault between keyboard and chair :D

-- EDIT --
Yes, crafted it according to recipy, wearing it and moving - nothing spawns.

Noticed there is a bar to the left of the armor that says 0%. Is that for the power armor energy, or does it need to be fueled by anything?

https://gyazo.com/bb14b56a836efa6b5d9f8b114237dacf
Attachments
fire-armor_0.1.0.zip
The zip file of the fire-armor from my mod dev folder
(1.88 KiB) Downloaded 13 times

Post Reply

Return to “Modding help”