I try to do this for water_surface_underground, but I fail. I can't see any "ocean_water" in your room and I am now completely lost ... Some help neededminmay wrote:I actually did that for my room for the "ocean_water" material:This onUpdate hook makes it behave exactly like the default ocean_water as long as the player is not inside my room. It is easy to do the same for Duncan's room. It's a nasty hack, of course, but necessary as long as the game limits us to 3 water materials.Code: Select all
-- Water shaders are partially hardcoded. If a material is not named -- "ocean_water", "water_surface_calm", or "water_surface_underwater", it won't -- work. So I redefine ocean_water and have it change depending on whether or -- not the player is in my room. defineMaterial{ name = "ocean_water", shader = "ocean_water", diffuseMap = "assets/textures/env/ocean_foam_dif.tga", normalMap = "assets/textures/env/ocean_normal.tga", displacementMap = "assets/textures/env/ocean_disp.tga", doubleSided = false, lighting = true, alphaTest = false, blendMode = "Translucent", textureAddressMode = "Wrap", glossiness = 80, depthBias = 0, texOffset = 0, foamOffset = 0, foamAmount = 1, waveAmplitude = 50, onUpdate = function(self, time) if min_room.script.inRoom then self:setParam("texOffset", time*0.004) self:setParam("waveAmplitude", 0) self:setParam("foamAmount", 0) self:setParam("foamOffset", 0) -- set textures every frame because of saving/loading self:setTexture("diffuseMap","assets/textures/env/ocean_foam_dif.tga") self:setTexture("normalMap","assets/textures/env/tomb_rock_tile_normal.tga") self:setTexture("displacementMap","mod_assets/rooms/minmay/flat_disp.tga") else -- normal ocean_water behaviour -- these are the default textures so they do not need to be set every frame -- in case of save/load if min_room.script.justLeftRoom then self:setTexture("diffuseMap","assets/textures/env/ocean_foam_dif.tga") self:setTexture("normalMap","assets/textures/env/ocean_normal.tga") self:setTexture("displacementMap","assets/textures/env/ocean_disp.tga") min_room.script.updatedWater() end self:setParam("texOffset", time*0.2) self:setParam("foamOffset", math.sin(time) * 0.5) end end, }
EDIT: at the end, it seems that I have found where ocean material appears:
Code: Select all
WATER_SURFACE_ID = "water_surface_underground_2"
function makeGlass()
--minlib.gobj.spawnOn(min_ambmarker,"min_glass_surface","min_glass_surface")
local surf = findEntity(WATER_SURFACE_ID)
if surf then
surf.watersurface:setPlaneY(0)
surf.watersurface:setFogDensity(0)
surf.watersurface:setReflectionColor(vec(1,1,1))
surf.watersurfacemesh:setMaterial("ocean_water")
surf.watersurfacemesh:setOffset(vec(0,0,0))
end
for i=1,6 do
findEntity("min_invplat"..i).controller:activate()
end
end
EDIT: the solution was in fact very simple... changing material wasn't necessary. I got it.
Code: Select all
inordeal=false
function entering()
if not inordeal then inordeal=true
raisewater()
end
end
function exiting()
if inordeal then inordeal=false
lowwater()
end
end
WATER_SURFACE_ID = "dc_water_surface_underground_1"
function raisewater()
local surf = findEntity(WATER_SURFACE_ID)
if surf then
surf.watersurface:setPlaneY(0.1)
surf.watersurfacemesh:setOffset(vec(0,0.1,0))
end
end
function lowwater()
local surf = findEntity(WATER_SURFACE_ID)
if surf then
surf.watersurface:setPlaneY(-0.4)
surf.watersurfacemesh:setOffset(vec(0,-0.4,0))
end
end