Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- turfserver by Chuny
- -- version 1.1
- local m = {}
- local content_root = ".\\content\\turf-server\\"
- local function if_exists(path)
- log(string.format("checking: %s", path))
- local f = io.open(content_root .. path)
- if f then
- log(string.format("using: %s", path))
- f:close()
- return path
- end
- end
- function m.make_key(ctx, filename)
- local suffix = (ctx.timeofday == 0) and "DAY" or "NIGHT"
- if string.match(filename, "Asset\\model\\bg\\common\\pitch\\sourceimages\\#windx11\\turf_bsm_alp_rgba32%.ftex") then
- local path = string.format("Asset\\model\\bg\\st%03d\\sourceimages\\tga\\#windx11\\turf_bsm_alp_rgba32_%s.ftex", ctx.stadium, suffix)
- return if_exists(path)
- elseif string.match(filename, "Asset\\model\\bg\\st(%d+)\\sourceimages\\tga\\#windx11\\pitch_alp%.ftex") then
- local path = string.format("Asset\\model\\bg\\st%03d\\sourceimages\\tga\\#windx11\\pitch_alp_%s.ftex", ctx.stadium, suffix)
- return if_exists(path)
- elseif string.match(filename, "Asset\\model\\bg\\st(%d+)\\sourceimages\\tga\\#windx11\\pitch_detail_alp%.ftex") then
- local path = string.format("Asset\\model\\bg\\st%03d\\sourceimages\\tga\\#windx11\\pitch_detail_alp_%s.ftex", ctx.stadium, suffix)
- return if_exists(path)
- elseif string.match(filename, "Asset\\model\\bg\\st(%d+)\\sourceimages\\tga\\#windx11\\pitch_specular_mask%.ftex") then
- local path = string.format("Asset\\model\\bg\\st%03d\\sourceimages\\tga\\#windx11\\pitch_specular_mask_%s.ftex", ctx.stadium, suffix)
- return if_exists(path)
- end
- end
- function m.get_filepath(ctx, filename, key)
- if key then
- return content_root .. key
- end
- end
- function m.init(ctx)
- if content_root:sub(1,1) == "." then
- content_root = ctx.sider_dir .. content_root
- end
- ctx.register("livecpk_make_key", m.make_key)
- ctx.register("livecpk_get_filepath", m.get_filepath)
- end
- return m
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement