dinhkarate Posted January 11, 2023 Share Posted January 11, 2023 I really want to get tile_data.old_tatic_id and ground_tile_def.name in tilemanager.lua in original script game. But I don't know how to add to the original script so I tried to clone it in my mod, and think it gonna replace the original script. I tried to put it a table and then call it in my prefab by the way require 'tilemanager' --I think it like we call a library in lua. but when I call the table I already define in tilemanager.lua it got nil. I have tried to make a function. Here is the code turfss = {} -- package local function AddTile(tile_name, tile_range, tile_data, ground_tile_def, minimap_tile_def, turf_def) assert(mod_protect_TileManager == false, "Calling AddTile directly is not allowed") tile_name = string.upper(tile_name) tile_range = string.upper(tile_range) tile_data = tile_data or {} assert(TILE_RANGES[tile_range], "invalid tile_range: "..tile_range) local tile_id = GetTileID(tile_name, TILE_RANGES[tile_range], tile_data.old_static_id) --Minh cần tile_data.old_tatic_id và ground_tile_def.name WORLD_TILES[tile_name] = tile_id INVERTED_WORLD_TILES[tile_id] = tile_name GROUND_NAMES[tile_id] = tile_data.ground_name or tile_name table.insert(turfss, {tile = tile_data.old_static_id, name = "turf_" .. string.lower(tile_name)}) if ground_tile_def then ValidateGroundTileDef(ground_tile_def) ground_tile_def.old_static_id = tile_data.old_static_id table.insert(GroundTiles.ground, {tile_id, ground_tile_def}) -- if ground_tile_def.flooring then GROUND_FLOORING[tile_id] = true end if ground_tile_def.hard then GROUND_HARD[tile_id] = true end if ground_tile_def.roadways then GROUND_ROADWAYS[tile_id] = true end if ground_tile_def.cannotbedug then TERRAFORM_IMMUNE[tile_id] = true end AddAssets(ground_tile_def, assets) end if minimap_tile_def then ValidateMinimapTileDef(minimap_tile_def) table.insert(GroundTiles.minimap, {tile_id, minimap_tile_def}) --GroundTiles.minimap la ten table, tile_id --minimap assets get added from minimap.lua AddAssets(minimap_tile_def, minimapassets) end if turf_def then ValidateTurfDef(turf_def) GroundTiles.turf[tile_id] = turf_def end end local function GettingTurf() return turfss end Link to comment https://forums.kleientertainment.com/forums/topic/145522-help-with-addtile-tilemanagerlua/ Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now