I heard about the recent zero-day patch removing the powerful reflection API hooks for Lua in PZ. This has unfortunately completely disabled my advanced mod that took a year and a half and a several experiments that provides players with access to realtime loading, rendering and fully controlling shaders in PZ: ShadeHammer.
In order for this mod to work I need the following API:
Expose the following classes:
-
FBOTexture(OffscreenBuffer & Current inCore) & Grabbing the backingTexturefield inside with a getter. -
ShaderMap -
skinnedmodel.ShaderProgram -
opengl.ShaderProgram -
zombie.iso.weather.WeatherShader -
The
ShaderPrograminstances loaded in Singleton group object introduced in Build 42. (I used one barely exposed shader to gain access to all shaders so unless this was exposed I couldn't get anything) -
Both
skinnedmodel&openglShaderProgram objects passed through theLuaExposer. -
The OpenGL-assigned program ID for the
ShaderProgram. -
The uniforms with their
locandtypefields to map to Uniforms properly to modify.
The reason why I need the shader programs and their IDs is to use the exposed SpriteRenderer API to assign values and pass them to Uniforms in shaders. I can also create new shaders using:
--- @param name string
function ShadeHammer.wrapSkinnedShader(name)
local model = loadZomboidModel('Dummy_Shader_Model_' .. name, 'Vehicles_Wheel_' .. name, 'Vehicles/vehicle_wheel',
name, false);
local shader = Reflect.getJavaFieldValue(model, 'Effect');
local shaderName = Reflect.getJavaFieldValue(shader, 'name');
print('discovered shader\'s name: '.. shaderName);
return LuaShader:new(shader, shaderName);
end
All of this worked to make all of this possible: