invisible floor with movement speed modifier?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

invisible floor with movement speed modifier?

Post by ownlyme »

when i replace all the graphics with invisible ones, something like a black hole is created, it uses whatever has been displayed there before.
I even tried it with the vanilla prototype by making all the concrete graphics transparent, but didn't help.

background:
i'm working on a powered floor mod, the floor is the size of 2x2 tiles, they have 8 edges so a fraction of the texture is transparent
if someone can help me decrease the amount of entities i need per tile, that would be helpful too..
i need:
- power pole (power an area of 4x4)
- turbine (gets steam via script)
- lamp (glow at night)
- movement speed modifier
- displayed floor tile (none of the above have a render_layer property -_-)

thank you for reading.

code of my floor:

Code: Select all

{
    
        type = "tile",
        name = "powerfloor-floor",
        needs_correction = false,
        --minable = {hardness = 0.2, mining_time = 0.5, result = "powerfloor-floor"},
        mined_sound = { filename = "__base__/sound/deconstruct-bricks.ogg" },
        collision_mask = {"ground-tile"},
        walking_speed_modifier = 1.52,
        layer = 60,
        decorative_removal_probability = 0.99,
        variants =
        {
            main =
            {
                {
                    picture = "__Powerfloor__/graphics/transparent1.png",
                    count = 1,
                    size = 1
                },
            },
           inner_corner =
           {
               picture = "__Powerfloor__/graphics/transparent512x128.png",
               count = 1,
			   size = 1,x=0,y=0,
           },
           outer_corner =
           {
               picture = "__Powerfloor__/graphics/transparent512x128.png",
               count = 1,
			   size = 1,x=0,y=0,
           },
           side =
           {
               picture = "__Powerfloor__/graphics/transparent512x128.png",
               count = 1,
			   size = 1,x=0,y=0,
           },
           -- u_transition =
           -- o_transition =

        },
        walking_sound =
        {
            {
                filename = "__base__/sound/walking/concrete-01.ogg",
                volume = 1.2
            },
            {
                filename = "__base__/sound/walking/concrete-02.ogg",
                volume = 1.2
            },
            {
                filename = "__base__/sound/walking/concrete-03.ogg",
                volume = 1.2
            },
            {
                filename = "__base__/sound/walking/concrete-04.ogg",
                volume = 1.2
            }
        },
        map_color = {r=80, g=80, b=80},
        ageing=0,
        vehicle_friction_modifier = 0.45,
        transitions = {
      tile_transitions.water_transition_template
      (
          water_tile_type_names,
          "__base__/graphics/terrain/water-transitions/stone-path.png",
          "__base__/graphics/terrain/water-transitions/hr-stone-path.png",
          {
            o_transition_tall = false,
            u_transition_count = 4,
            o_transition_count = 4,
            side_count = 8,
            outer_corner_count = 8,
            inner_corner_count = 8,
            --base = { layer = 40 }
          }
      ),
    },
        transitions_between_transitions = {
      tile_transitions.water_transition_template
      (
          water_tile_type_names,
          "__base__/graphics/terrain/water-transitions/stone-path-transitions.png",
          "__base__/graphics/terrain/water-transitions/hr-stone-path-transitions.png",
          {
            inner_corner_tall = true,
            inner_corner_count = 3,
            outer_corner_count = 3,
            side_count = 3,
            u_transition_count = 1,
            o_transition_count = 0,
          }
      ),
    }
    }
Attachments
blackhole.png
blackhole.png (762.1 KiB) Viewed 2255 times
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: invisible floor with movement speed modifier?

Post by eradicator »

Tiles do not stack and are are always rendered as the lowest layer. If you want to make something that looks like a tile but still be able to see the "ground" beneath it, then you have to use something that's not a tile. Tiles also don't allow layering so that's not an option either.

Also i don't get what the steam is for, are they not connected to the electricity network? (As far as i know you can hide power wires per entity in the current version if they look ugly.)
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: invisible floor with movement speed modifier?

Post by ownlyme »

oh i really can hide power wires? i thought that was impossible...
thanks, gonna try that out.
the problem with the tiles is that i need some kind of movement speed modifier, but basically you should still be able to see what ever is below it
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: invisible floor with movement speed modifier?

Post by eradicator »

ownlyme wrote:the problem with the tiles is that i need some kind of movement speed modifier, but basically you should still be able to see what ever is below it
Not gonna happen. There can never be anything "below" a tile.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: invisible floor with movement speed modifier?

Post by ownlyme »

i saw a movement speed modifier on some trivial smoke prototypes, but it probably won't affect vehicles.
does that even work? i tried spawning one of them and either they are invisible or dont work..
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: invisible floor with movement speed modifier?

Post by ownlyme »

eradicator wrote:(As far as i know you can hide power wires per entity in the current version if they look ugly.)
How would you do that? i just found a hack that involves spawning them on another surface
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

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

Re: invisible floor with movement speed modifier?

Post by Bilka »

ownlyme wrote:
eradicator wrote:(As far as i know you can hide power wires per entity in the current version if they look ugly.)
How would you do that? i just found a hack that involves spawning them on another surface
0.16 changelog wrote:Added optional Electric pole prototype "draw_copper_wires" and "draw_circuit_wires".
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
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: invisible floor with movement speed modifier?

Post by ownlyme »

okay cool,
about my hidden concrete question:
i found this:
find_tiles_filtered{…, has_hidden_tile=…
what's this hidden tile? would that be the solution to my problem?

btw: if a prototype has some unusual properties, why not put them into the factorio-data-master on github?
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: invisible floor with movement speed modifier?

Post by eradicator »

ownlyme wrote:okay cool,
about my hidden concrete question:
i found this:
find_tiles_filtered{…, has_hidden_tile=…
what's this hidden tile? would that be the solution to my problem?

btw: if a prototype has some unusual properties, why not put them into the factorio-data-master on github?
Wild speculation: The engine does store what tile was "originally" there if you build concrete etc, so that it can place it back when you remove the concrete. That might be a "hidden tile". But as you can see the api doesn't even tell you the name of that tile, it only tells wheather it exists. And regardless, this has no effect on rendering. There is no "solution" to your problem unless you can find something else to give the movement bonus (i remember seeing an odd mod that had movement bonus on...something, but i can't remember what it was). Or you could script the movement bonus.
ownlyme wrote:
eradicator wrote:(As far as i know you can hide power wires per entity in the current version if they look ugly.)
How would you do that? i just found a hack that involves spawning them on another surface
Got a link?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: invisible floor with movement speed modifier?

Post by ownlyme »

viewtopic.php?f=25&t=23470 second last post
but i dunno why you would use that now that there is a wire hiding property

i assume by scripting you mean comparing the player position with all the positions of my tiles?
unless i can merge those zones that would be quite heavy,
i think using a find-entities-in-area check every 3 ticks would be even heavier...
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: invisible floor with movement speed modifier?

Post by eradicator »

ownlyme wrote:viewtopic.php?f=25&t=23470 second last post
but i dunno why you would use that now that there is a wire hiding property
That post is from 2016. Cross-surface connecting has been removed quite some time ago.
ownlyme wrote:i assume by scripting you mean comparing the player position with all the positions of my tiles?
Yes. Something using on_player_changed_position and a truth map of all tile positions. I.e.

Code: Select all

local pos = player.position
if tiles[pos.x] and tiles[pos.x][pos.y] then
  --dostuff
  end
Is that a nice solution? No. It's just "a" solution. And if you do it wrong every other mod author accessing player speed will be waiting with a pitchfork at your doorstep :p.

Imho: Just give up on the idea that you can see "below" the floor. Just pretend it's all concrete below. And voila you only need one texture and it works fine...
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: invisible floor with movement speed modifier?

Post by ownlyme »

SOLUTION:
i just copied all the vanilla tiles and replace them upon building

but i had to copy them manually because iterating through data.raw["tile"] caused suuuuper weird error messages

Code: Select all

local extend = {}
for name, tile in pairs(data.raw["tile"]) do
if tile.map_color and name ~="out-of-map" then --tried different filters, these were just the last ones i tried, so yes it also happens with non-water tiles
	local newtile = {}
	newtile.name = "power-"..name
	newtile.type = "tile"
	local temptile = table.deepcopy(tile) --this weird approach was also just my last attempt trying to sort the table manually..
	for key, entry in pairs(temptile) do
		if key~="name" and key ~="type"then
			newtile[key] = entry
		end
	end
	newtile.autoplace = nil
	newtile.walking_speed_modifier = 1.8
	newtile.vehicle_friction_modifier =0.65
	table.insert(extend,newtile)
	break
end
end
data:extend({extend})

Attachments
weird.png
weird.png (48.35 KiB) Viewed 1922 times
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

Post Reply

Return to “Modding help”