Page 1 of 1
HIdden Entities and Such
Posted: Wed Jul 27, 2016 2:47 am
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.
Re: HIdden Entities and Such
Posted: Wed Jul 27, 2016 2:41 pm
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)
Re: HIdden Entities and Such
Posted: Wed Jul 27, 2016 4:13 pm
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.
Re: HIdden Entities and Such
Posted: Wed Jul 27, 2016 4:27 pm
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
Re: HIdden Entities and Such
Posted: Thu Jul 28, 2016 4:17 am
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
},
}
})
Re: HIdden Entities and Such
Posted: Thu Jul 28, 2016 10:23 am
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.
Re: HIdden Entities and Such
Posted: Fri Jul 29, 2016 12:45 am
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.
Re: HIdden Entities and Such
Posted: Sat Jul 30, 2016 12:29 am
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.
Re: HIdden Entities and Such
Posted: Sun Jul 31, 2016 7:14 pm
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?
Re: HIdden Entities and Such
Posted: Mon Aug 01, 2016 4:01 am
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.
Re: HIdden Entities and Such
Posted: Tue Aug 02, 2016 2:48 pm
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
Re: HIdden Entities and Such
Posted: Wed Aug 03, 2016 12:02 am
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.
Re: HIdden Entities and Such
Posted: Wed Aug 03, 2016 2:50 pm
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
Re: HIdden Entities and Such
Posted: Thu Aug 04, 2016 1:48 am
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.
Re: HIdden Entities and Such
Posted: Thu Aug 04, 2016 2:20 am
by kiba
Edit: Never mind.