Only half of tech image shown

Place to get help with not working mods / modding interface.
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Only half of tech image shown

Post by FreeER »

I'm reworking the Tutorial on the Wiki (that adds a bomber) and for some reason only the right half of my technology icon is being shown in the research menu
Can anyone tell me why?
64x64 only half shown
64x64 only half shown
bomber_tech.png (8.5 KiB) Viewed 4766 times
The larger image that I resized with Adobe PhotoShop to be 64x64
The larger image that I resized with Adobe PhotoShop to be 64x64
bomber_tech_old.png (13.33 KiB) Viewed 4766 times
if for some reason you'd like to download the rest of the mod (maybe because you are lazy and do not want to change code to make it use the bomber_tech.png) the Tutorial is here. I encountered this issue in Chapter 5 (which is where the technology is added).
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net
Nirahiel
Filter Inserter
Filter Inserter
Posts: 351
Joined: Mon Sep 23, 2013 2:18 pm
Contact:

Re: Only half of tech image shown

Post by Nirahiel »

Maybe because the icons should be 32 by 32 ? :)
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Only half of tech image shown

Post by FreeER »

Nirahiel wrote:Maybe because the icons should be 32 by 32 ? :)
lol, I wondered that myself, but if that was the case
1) it would show a quarter of the image not half and
2) the images in /data/base/graphics/technology are 64x64
I wish it were that simple though...
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net
Nirahiel
Filter Inserter
Filter Inserter
Posts: 351
Joined: Mon Sep 23, 2013 2:18 pm
Contact:

Re: Only half of tech image shown

Post by Nirahiel »

Here are some improvements for your code :

Code: Select all

    local drop = false
    local biters = 0
    for k,v in pairs(bomb) do
      if v.force.equals(game.forces.enemy) then
        drop = true
        if v.name == "small-biter" or v.name == "medium-biter" or v.name == "big-biter" then
          biters = biters + 1
          if biters < 5 then --if five or more will be killed then drop
            drop = false
          end
        end
      end
    end
You create a drop var and set it to false, then for each entity of the bomb table, you reset it back to true, and then back to false again if biters < 5.
Here is what I'd do :

Code: Select all

    local drop = false
    local biters = 0
    for k,v in pairs(bomb) do
      if v.force.equals(game.forces.enemy) then
        if v.name == "small-biter" or v.name == "medium-biter" or v.name == "big-biter" then
          biters = biters + 1
        end
      end
    end
    if biters > 4 then
      drop = true
    end
But then you could make your script even better by not calling a for loop and just doing

Code: Select all

local enemies = game.findenemyunits(game.player.character.position, 5)
Find all enemies in a radius of 5 around the player.
Then something like

Code: Select all

if #enemies > 4 then
  drop = true
end
should work :)
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Only half of tech image shown

Post by FreeER »

Nirahiel wrote:Here are some improvements for your code :
In your first 'improved' code, it only gets set to true if there are more than 4 biters, if you happen to run across a spawner (and it for some reason does not have enough biters) you'd be unable to destroy it. Also I seemed to have issues with targeting worms...

Ah I forgot about findenemyunits (actually I don't think it existed when I originally made this mod) lol. That would certainly make it much better, BUT I also intend to change it to use capsules so that the player can actually control the bombs. Before the capsules were created I thought about using code to auto switch out the player's weapon with a rocket launcher (or similar) but...capsules just seem like a better idea to me xD
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net
User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: Only half of tech image shown

Post by rk84 »

@FreeER There is one thing that has been bothering me for while Talk:Modding_Tutorial
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Nirahiel
Filter Inserter
Filter Inserter
Posts: 351
Joined: Mon Sep 23, 2013 2:18 pm
Contact:

Re: Only half of tech image shown

Post by Nirahiel »

FreeER wrote:
Nirahiel wrote:Here are some improvements for your code :
In your first 'improved' code, it only gets set to true if there are more than 4 biters
Same thing for you dude, if you set it to true, but then set it to false again before the end of the for loop, then after the for loop exits, your variable will be set to false.
I really just improved your code, I didn't change it's behavior.
The get enemies thing should also target worms and spawners ... i guess
kovarex
Factorio Staff
Factorio Staff
Posts: 8293
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Only half of tech image shown

Post by kovarex »

Try to delete crop-cache, it's location depends on system, but it is in the directory where you saves directory is.
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Only half of tech image shown

Post by FreeER »

kovarex wrote:Try to delete crop-cache, it's location depends on system, but it is in the directory where you saves directory is.
ah ha! You sir are a genius :D
rk84 wrote:@FreeER There is one thing that has been bothering me for while Talk:Modding_Tutorial
Oh, I'll fix that lol! I don't think I really truly understood those two files when I wrote the tutorial lol
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net
User avatar
Animar
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Sat Dec 21, 2013 8:06 am
Contact:

Re: Only half of tech image shown

Post by Animar »

Back to Topic
FreeER wrote: I'm reworking the Tutorial on the Wiki (that adds a bomber) and for some reason only the right half of my technology icon is being shown in the research menu
Can anyone tell me why?
I run in the same issue 32 Pixel just work fine but in a very ugly way, if i try to use 64x64 ( wich even the base research imgaes are ) i got only the top left quarter shown, as you can see

Image
kovarex
Factorio Staff
Factorio Staff
Posts: 8293
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Only half of tech image shown

Post by kovarex »

Animar wrote:Back to Topic
FreeER wrote: I'm reworking the Tutorial on the Wiki (that adds a bomber) and for some reason only the right half of my technology icon is being shown in the research menu
Can anyone tell me why?
I run in the same issue 32 Pixel just work fine but in a very ugly way, if i try to use 64x64 ( wich even the base research imgaes are ) i got only the top left quarter shown, as you can see

Image
This didn't help?:
kovarex wrote:Try to delete crop-cache, it's location depends on system, but it is in the directory where you saves directory is.
User avatar
Animar
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Sat Dec 21, 2013 8:06 am
Contact:

Re: Only half of tech image shown

Post by Animar »

I shouldn't do anything if i where half asleep, i apologize that i didn't saw that you already posted a solution for that :oops:
Post Reply

Return to “Modding help”