Support for new wall tiles

If you have a module that you'd like comments on or would like to know how to create your very own module, post here

Moderator: Moderator

Post Reply
Message
Author
hager
Low Yeek
Posts: 5
Joined: Sat Sep 18, 2021 1:24 pm

Support for new wall tiles

#1 Post by hager »

Hello!

First of all I want to say that I love this game and I love how moddable it is. Big cudos to DarkGod for making it possible. I'm myself working on a graphic mod and I have a question regarding wall tiles.

While there are southern (granite_wall2) and northern (granite_wall3) wall tiles. There doesn't seem to be support for western and eastern wall tiles in the code (i.e. these tiles are all the inner granite_wall1 tile). It would be awesome to get support for more variations of wall tiles, i.e. multiple corner tiles (this is where it gets more complicated due to the number of tiles needed) and western and eastern tiles ("single" and "double"). To better explain what I'm talking about I'll include a picture. The western and eastern tiles makes the transition from floor to wall more distinguishable, while also adding the possibility to make more varied environments, and the corner tiles tie it all together. In this example is the southern corner tile, or rather southwestern corner tile connecting north and northwestern corner tiles connecting north.

Image

Though I have some understanding of code (i.e. being able to change some variables), the NicerTiles.lua file is a bit too intimidating for me. But taking a look at the current complexity of the tile builder, this might not be such an easy feat. Is this possible to do? It would add such an improvement in the atmosphere of the game.

Thanks!

hager
Low Yeek
Posts: 5
Joined: Sat Sep 18, 2021 1:24 pm

Re: Support for new wall tiles

#2 Post by hager »

I found the solution to this, it was luckily simplier than I thought.

Needed to add new lines in NicerTiles.lua, e.g.:

elseif gs ~= s and gn == s and gw ~= s and ge == s then self:replace(i, j, self:getTile(nt.south_west_corner))

and then create new entities in grids/basic.lua

south_west_corner="WALL_SWC"

newEntity{ base = "WALL", define_as = "WALL_SWC", image = "terrain/marble_floor.png", z=1, add_displays = {class.new{image="terrain/granite_wall_sw_corner.png",z=3}}}

rexorcorum
Graphical God
Posts: 482
Joined: Wed Jan 05, 2011 8:05 am
Location: There and Back again

Re: Support for new wall tiles

#3 Post by rexorcorum »

There is also the cave-type of wall tiles, that has more variables and edge cases, so you might want to look at is as well :).
~ [ RexOrcorum, a.k.a "rexo": Official Visual Magus, Addon Beautifier, Achiever, Knight of the 561 Trees, Dark Interfacer ] ~
darkgod wrote:~ [ DarkGod whips rexorcorum with Suslik (& many others as well) ] ~

hager
Low Yeek
Posts: 5
Joined: Sat Sep 18, 2021 1:24 pm

Re: Support for new wall tiles

#4 Post by hager »

Thanks rexo! I'll study the cave-type tiles as well :)

hager
Low Yeek
Posts: 5
Joined: Sat Sep 18, 2021 1:24 pm

Re: Support for new wall tiles

#5 Post by hager »

I've been making progress adding wall tiles in all possible combinations and directions. The same for doors. Turns out there was a lot of them. Here's a sample on how it currently looks in data/general/grids/halfling.lua for the new wall and door tiles:

Code: Select all

nice_tiler = { method="wall3d", inner={"HALFLING_WALL", 100, 1, 5}, north={"HALFLING_WALL_NORTH", 30, 1, 4}, south={"HALFLING_WALL_SOUTH", 30, 1, 6}, north_south={"HALFLING_WALL_NORTH_SOUTH", 30, 1, 2}, pillar_8={"HALFLING_WALL_PILLAR_8", 100, 1, 5}, pillar_8_double={"HALFLING_WALL_PILLAR_8_DOUBLE", 100, 1, 5}, pillar_8_west={"HALFLING_WALL_PILLAR_8_WEST", 100, 1, 5}, pillar_8_east={"HALFLING_WALL_PILLAR_8_EAST", 100, 1, 5}, west={"HALFLING_WALL_WEST", 30, 1, 3}, east={"HALFLING_WALL_EAST", 30, 1, 3}, small_pillar="HALFLING_WALL_SMALL_PILLAR", pillar_2="HALFLING_WALL_PILLAR_2", pillar_4="HALFLING_WALL_PILLAR_4", pillar_6="HALFLING_WALL_PILLAR_6", south_west_corner="HALFLING_WALL_SOUTH_WEST_CORNER", south_east_corner="HALFLING_WALL_SOUTH_EAST_CORNER", north_west_corner="HALFLING_WALL_NORTH_WEST_CORNER", north_east_corner="HALFLING_WALL_NORTH_EAST_CORNER", double="HALFLING_WALL_DOUBLE", west_north_inner_corner="HALFLING_WALL_WEST_NORTH_INNER_CORNER", east_north_inner_corner="HALFLING_WALL_EAST_NORTH_INNER_CORNER", west_south_inner_corner="HALFLING_WALL_WEST_SOUTH_INNER_CORNER", east_south_inner_corner="HALFLING_WALL_EAST_SOUTH_INNER_CORNER", south_west_inner="HALFLING_WALL_SOUTH_WEST_INNER", south_east_inner="HALFLING_WALL_SOUTH_EAST_INNER", granite_wall_double_double_north_inner_corners="HALFLING_WALL_DOUBLE_DOUBLE_NORTH_INNER_CORNERS", granite_wall_double_double_north_inner_corners_top="HALFLING_WALL_DOUBLE_DOUBLE_NORTH_INNER_CORNERS_TOP", granite_wall_double_double_south_inner_corners="HALFLING_WALL_DOUBLE_DOUBLE_SOUTH_INNER_CORNERS", granite_wall_double_east_north_inner_corner="HALFLING_WALL_DOUBLE_EAST_NORTH_INNER_CORNER", granite_wall_double_east_south_inner_corner="HALFLING_WALL_DOUBLE_EAST_SOUTH_INNER_CORNER", granite_wall_double_west_north_inner_corner="HALFLING_WALL_DOUBLE_WEST_NORTH_INNER_CORNER", granite_wall_double_west_south_inner_corner="HALFLING_WALL_DOUBLE_WEST_SOUTH_INNER_CORNER", granite_wall_double_west_north_inner_corner_top="HALFLING_WALL_DOUBLE_WEST_NORTH_INNER_CORNER_TOP", granite_wall_double_east_north_inner_corner_top="HALFLING_WALL_DOUBLE_EAST_NORTH_INNER_CORNER_TOP", granite_wall_double_double_north_west_south_east_inner_corners_top="HALFLING_WALL_DOUBLE_DOUBLE_NORTH_WEST_SOUTH_EAST_INNER_CORNERS_TOP", granite_wall_double_double_north_west_south_east_inner_corners="HALFLING_WALL_DOUBLE_DOUBLE_NORTH_WEST_SOUTH_EAST_INNER_CORNERS", granite_wall_double_double_north_east_south_west_inner_corners_top="HALFLING_WALL_DOUBLE_DOUBLE_NORTH_EAST_SOUTH_WEST_INNER_CORNERS_TOP", granite_wall_double_double_north_east_south_west_inner_corners="HALFLING_WALL_DOUBLE_DOUBLE_NORTH_EAST_SOUTH_WEST_INNER_CORNERS", west_north_inner_corner_top="HALFLING_WALL_WEST_NORTH_INNER_CORNER_TOP", east_north_inner_corner_top="HALFLING_WALL_EAST_NORTH_INNER_CORNER_TOP", west_south_inner_corner_top="HALFLING_WALL_WEST_SOUTH_INNER_CORNER_TOP", east_south_inner_corner_top="HALFLING_WALL_EAST_SOUTH_INNER_CORNER_TOP", double_inner="HALFLING_WALL_DOUBLE_INNER", south_west_inner_top="HALFLING_WALL_SOUTH_WEST_INNER_TOP", south_east_inner_top="HALFLING_WALL_SOUTH_EAST_INNER_TOP", double_inner_top="HALFLING_WALL_DOUBLE_INNER_TOP", south_west_corner_inner="HALFLING_WALL_SOUTH_WEST_CORNER_INNER", south_east_corner_inner="HALFLING_WALL_SOUTH_EAST_CORNER_INNER", south_west_corner_inner_top="HALFLING_WALL_SOUTH_WEST_CORNER_INNER_TOP", south_east_corner_inner_top="HALFLING_WALL_SOUTH_EAST_CORNER_INNER_TOP", north_door="HALFLING_WALL_NORTH_DOOR", north_south_door="HALFLING_WALL_NORTH_SOUTH_DOOR"},

nice_tiler = { method="door3d", north_south="HALFLING_DOOR_VERT", west_east="HALFLING_DOOR_HORIZ", north_east_corner="HALFLING_DOOR_NORTH_EAST_CORNER", south_east_corner="HALFLING_DOOR_SOUTH_EAST_CORNER", north_west_corner="HALFLING_DOOR_NORTH_WEST_CORNER", south_west_corner="HALFLING_DOOR_SOUTH_WEST_CORNER", south="HALFLING_DOOR_SOUTH", north="HALFLING_DOOR_NORTH", west="HALFLING_DOOR_WEST", east="HALFLING_DOOR_EAST", single="HALFLING_DOOR_SINGLE", north_double="HALFLING_DOOR_NORTH_DOUBLE", north_west="HALFLING_DOOR_NORTH_WEST", north_east="HALFLING_DOOR_NORTH_EAST", north_south_1379="HALFLING_DOOR_NORTH_SOUTH_1379", north_south_379="HALFLING_DOOR_NORTH_SOUTH_379", north_south_179="HALFLING_DOOR_NORTH_SOUTH_179", north_south_139="HALFLING_DOOR_NORTH_SOUTH_139", north_south_137="HALFLING_DOOR_NORTH_SOUTH_137", north_south_79="HALFLING_DOOR_NORTH_SOUTH_79", north_south_39="HALFLING_DOOR_NORTH_SOUTH_39", north_south_37="HALFLING_DOOR_NORTH_SOUTH_37", north_south_19="HALFLING_DOOR_NORTH_SOUTH_19", north_south_17="HALFLING_DOOR_NORTH_SOUTH_17", north_south_13="HALFLING_DOOR_NORTH_SOUTH_13", north_south_1="HALFLING_DOOR_NORTH_SOUTH_1", north_south_3="HALFLING_DOOR_NORTH_SOUTH_3", north_south_7="HALFLING_DOOR_NORTH_SOUTH_7", north_south_9="HALFLING_DOOR_NORTH_SOUTH_9", },
I'm overloading these grids along with data/general/maps and data/general/zones. However, I haven't managed to overload the DLC files. For example, I need to overload tome-cults/data/general/grids/maggot.lua (along with the rest of the DLC .lua files) as well. How can I achieve this? In worst case I can edit cults.teaac directly, but that wouldn't work as an easy to install add-on.

Thanks!

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: Support for new wall tiles

#6 Post by HousePet »

You can use a hook to edit the file as it is loaded into the game.
For example:

Code: Select all

class:bindHook("Entity:loadList", function(self, data)
	if data.file == "/data/zones/wilderness/grids.lua" then
		self:loadList("/data-moretales/wilderness-overlay-grids.lua", data.no_default, data.res, data.mod, data.loaded)
	end
end)
Where wilderness-overlay-grids.lua contains:

Code: Select all

newEntity{ base="ZONE_PLAINS", define_as = "ECHOINGCLIFFS",
	name="Path into the Echoing Cliffs",
	color=colors.GREY,
	add_displays = {class.new{image="terrain/road_going_right_01.png", z=8, display_h=1, display_y=0}},
	change_zone="moretales+echoing-cliffs",
}
My feedback meter decays into coding. Give me feedback and I make mods.

hager
Low Yeek
Posts: 5
Joined: Sat Sep 18, 2021 1:24 pm

Re: Support for new wall tiles

#7 Post by hager »

I realized when looking at your examples that the DLC's have another folder structure. For example, in order for me to overload grid files for Forbidden Cults I need to change the addon folder to

Code: Select all

tome-mod/overload/data-cults/general/grids
instead of

Code: Select all

tome-mod/overload/data/general/grids
I might certainly start using hooks for some edits that I do. But I think the above solution is sufficient for what I need.

Thanks for the help! Appreciated! :)

Post Reply