HIdden Entities and Such

Place to get help with not working mods / modding interface.
Post Reply
kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

HIdden Entities and Such

Post by kiba »

I am trying to implement an accumulator charger entity to complement the tile I made for my mod.

Basically, every tick, it check for the tile that the player is currently on, and based on the tile's name, it will do things.

I am implementing an accumulator charger entity that goes with this. So every time, it check for that particular tile, the accumulator will drain.

So far, I am trying to 'hide' it. Didn't really work the way I want it to. Apparently, you can't have an entity without creating item and recipe for it. Maybe it would be better to get rid of the tile and go entirely for the entity instead?

Right now I am trying to make it transparent, and so far the game is not cooperating with me. It's complaining about sprite being outside. No clues what that supposed to mean.

Anyway, I don't know what the hell I am doing.

User avatar
DedlySpyder
Filter Inserter
Filter Inserter
Posts: 253
Joined: Fri Jun 20, 2014 11:42 am
Contact:

Re: HIdden Entities and Such

Post by DedlySpyder »

I forget the exact process, but my powered entities mod (see signature) has invisible power poles. And, IIRC I didn't need an item or recipe for them, I think that relies on the mined property.

EDIT: After a quick check, I left the minable of normal power poles, since they can't be mined it doesn't matter.

But the main things you'll want are the flags, 0 collision box, collision mask, nil selection box, and you'll need a transparent picture (you can just take the one I use and rename it)

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

Re: HIdden Entities and Such

Post by Adil »

You don't need an item for entity and under no condition you are forced to have a recipe for an item.
Remove "-placeabe" flags from entity definition.
You need to specify a custom collision_mask, as a field in entity prototype, for example an empty one, like the plane mods do.
The "sprite outside of ..." is an error related to goofed image sizes. You need to make sure, that animation-related fields (direction_count, frames... etc.) do not make the game look for more of picture than there is.
I tend to use 'empty.png' picture from core mod, when doing invisible entities.
Also, you might have a look at klonan's power mods, some of that stuff is bound to have invisible accumulator in it.
DedlySpyder wrote:nil selection box
If I remember right it did error on that one. Dot-boxes of {{0,0},{0,0}} seem to work fine.
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.

User avatar
DedlySpyder
Filter Inserter
Filter Inserter
Posts: 253
Joined: Fri Jun 20, 2014 11:42 am
Contact:

Re: HIdden Entities and Such

Post by DedlySpyder »

Adil wrote:
DedlySpyder wrote:nil selection box
If I remember right it did error on that one. Dot-boxes of {{0,0},{0,0}} seem to work fine.
Maybe they fixed it at some point, or something caused from me taking a deep copy then setting selection box to nil

kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

Re: HIdden Entities and Such

Post by kiba »

Adil wrote:You don't need an item for entity and under no condition you are forced to have a recipe for an item.
Remove "-placeabe" flags from entity definition.
You need to specify a custom collision_mask, as a field in entity prototype, for example an empty one, like the plane mods do.
The "sprite outside of ..." is an error related to goofed image sizes. You need to make sure, that animation-related fields (direction_count, frames... etc.) do not make the game look for more of picture than there is.
I tend to use 'empty.png' picture from core mod, when doing invisible entities.
Also, you might have a look at klonan's power mods, some of that stuff is bound to have invisible accumulator in it.
DedlySpyder wrote:nil selection box
If I remember right it did error on that one. Dot-boxes of {{0,0},{0,0}} seem to work fine.
I don't understand how to get rid of the error. I tried to get rid of the animation fields altogether, but it had no impact.

(I made a transparent.png the size of 32x32.)

Code: Select all

data:extend({
  {
    type = "accumulator",
    name = "accelerator_charger",
    icon = "__base__/graphics/entity/accumulator/accumulator.png",
    flags = {"placeable-neutral", "player-creation"},
    minable = {hardness = 0.1, mining_time = 0.1, result="accelerator_charger"},
    indestructible = true,
    max_health = 150,
    order = "a-a-a",
    corpse = "medium-remnants",
    collision_mask = {"water-tile"},
    collision_box = {{-0.9, -0.9}, {0.9, 0.9}},
    selection_box = {{-1, -1}, {1, 1}},
    energy_source =
    {
      type = "electric",
      buffer_capacity = "5MJ",
      usage_priority = "terciary",
      input_flow_limit = "300kW",
      output_flow_limit = "300kW"
    },
    picture =
    {
      filename = "__MagneticFloor__/graphics/transparent.png",
      priority = "extra-high",
      width = 32,
      height = 32,
      shift = {0.0, 0.0}
    },
    charge_animation =
    {
      filename = "__MagneticFloor__/graphics/transparent.png",
      width = 32,
      height = 32,
      line_length = 0,
      frame_count = 1,
      shift = {0.482, -0.638},
      animation_speed = 0.5
    },
    charge_cooldown = 30,
    charge_light = {intensity = 0.3, size = 7},
    discharge_animation =
    {
      filename = "__MagneticFloor__/graphics/transparent.png",
      width = 32,
      height = 32,
      line_length = 0,
      frame_count = 1,
      shift = {0, 0},
      animation_speed = 0.5
    },
    discharge_cooldown = 60,
    discharge_light = {intensity = 0.7, size = 7},
    vehicle_impact_sound =  { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
    working_sound =
    {
      sound =
      {
        filename = "__base__/sound/accumulator-working.ogg",
        volume = 1
      },
      idle_sound = {
        filename = "__base__/sound/accumulator-idle.ogg",
        volume = 0.4
      },
      max_sounds_per_type = 5
    },
  }
})

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

Re: HIdden Entities and Such

Post by Adil »

Why is line_length = 0 ? Did you try 1 there?

Also, there's crop-cache.dat file in the game folder, I remember deleting that in the past to solve the problems, that seemed not my fault, and rarely it seemed to work.
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.

kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

Re: HIdden Entities and Such

Post by kiba »

Adil wrote:Why is line_length = 0 ? Did you try 1 there?
I don't understand what line_length, even after reading the documentation. Is it about loading how many images on a single width?
Also, there's crop-cache.dat file in the game folder, I remember deleting that in the past to solve the problems, that seemed [[not my fault, and rarely it seemed to work.
Deleting the crop-cache.dat works. Thanks!

I got rid of the animation, since it's invisible.

kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

Re: HIdden Entities and Such

Post by kiba »

Figured out how to resize the selection box, though it required me to restart factorio, which really slowed development down.

Now, I am wondering why it's not showing me 'not powered' errors.

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

Re: HIdden Entities and Such

Post by Adil »

kiba wrote: I don't understand what line_length, even after reading the documentation. Is it about loading how many images on a single width?
These are not yet documented, so my guess would be similar to yours, but it is intuitively wrong to have that number zero.
kiba wrote:Figured out how to resize the selection box, though it required me to restart factorio, which really slowed development down.
All prototype alterations require game reboot to take place. (Or fiddling with migrations, probably.)
kiba wrote:Now, I am wondering why it's not showing me 'not powered' errors.
Is it of the same force as your player?
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.

kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

Re: HIdden Entities and Such

Post by kiba »

Adil wrote: These are not yet documented, so my guess would be similar to yours, but it is intuitively wrong to have that number zero.
They are documented. I read it in the wiki, but I still don't understand what it means.
Adil wrote: All prototype alterations require game reboot to take place. (Or fiddling with migrations, probably.)
Yeah, and they causes slowdown in development speed. Either way, mods get developed slower.
Adil wrote: Is it of the same force as your player?
I am pretty sure that's the case. I'll have to check for sure.

User avatar
DedlySpyder
Filter Inserter
Filter Inserter
Posts: 253
Joined: Fri Jun 20, 2014 11:42 am
Contact:

Re: HIdden Entities and Such

Post by DedlySpyder »

kiba wrote:
Adil wrote: All prototype alterations require game reboot to take place. (Or fiddling with migrations, probably.)
Yeah, and they causes slowdown in development speed. Either way, mods get developed slower.
IIRC, there is a setting somewhere that saves a large amount of data to your drive, so that if you use a SSD the load time is drastically reduced

kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

Re: HIdden Entities and Such

Post by kiba »

Adil wrote:You don't need an item for entity and under no condition you are forced to have a recipe for an item.
Remove "-placeabe" flags from entity definition.
I removed all the flags, it's still complaining about the lack of item.

User avatar
DedlySpyder
Filter Inserter
Filter Inserter
Posts: 253
Joined: Fri Jun 20, 2014 11:42 am
Contact:

Re: HIdden Entities and Such

Post by DedlySpyder »

kiba wrote:
Adil wrote:You don't need an item for entity and under no condition you are forced to have a recipe for an item.
Remove "-placeabe" flags from entity definition.
I removed all the flags, it's still complaining about the lack of item.
I think it's your minable property, you are referencing an item in that that doesn't exist, so try removing it altogether

kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

Re: HIdden Entities and Such

Post by kiba »

DedlySpyder wrote:
kiba wrote:
Adil wrote:You don't need an item for entity and under no condition you are forced to have a recipe for an item.
Remove "-placeabe" flags from entity definition.
I removed all the flags, it's still complaining about the lack of item.
I think it's your minable property, you are referencing an item in that that doesn't exist, so try removing it altogether
Thanks. For some reason, I never thought to try removing minable altogether.

kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

Re: HIdden Entities and Such

Post by kiba »

Edit: Never mind.

Post Reply

Return to “Modding help”