diff --git a/src/shaders/antsCompute.frag b/src/shaders/antsCompute.frag index 3a319b7..443392a 100644 --- a/src/shaders/antsCompute.frag +++ b/src/shaders/antsCompute.frag @@ -337,20 +337,27 @@ void main() { float aheadMatId = texture(tWorld, aheadUv).x; int aheadMatInt = int(aheadMatId); + // food: pick up from any adjacent cell if (aheadMatInt == MAT_FOOD) { isCarrying = 1.; cargoMaterialId = aheadMatId; angle += PI; storage = getMaxScentStorage(vUv); } else if (aheadMatInt != MAT_AIR && aheadMatInt != MAT_HOME) { - vec4 props = texelFetch(uMaterialProps, ivec2(aheadMatInt, 0), 0); - float behavior = props.r; - float hardness = props.b; - if (behavior == BEHAVIOR_POWDER && hardness <= ANT_CARRY_STRENGTH) { - isCarrying = 1.; - cargoMaterialId = aheadMatId; - angle += PI; - storage = getMaxScentStorage(vUv); + // powder: don't grab the surface we're walking on — only dig + // when facing diagonally into material (DIG priority angles us there) + vec2 belowCell = roundUvToCellCenter(pos - vec2(0., cellSize)); + bool isWalkingSurface = all(equal(aheadUv, belowCell)); + if (!isWalkingSurface) { + vec4 props = texelFetch(uMaterialProps, ivec2(aheadMatInt, 0), 0); + float behavior = props.r; + float hardness = props.b; + if (behavior == BEHAVIOR_POWDER && hardness <= ANT_CARRY_STRENGTH) { + isCarrying = 1.; + cargoMaterialId = aheadMatId; + angle += PI; + storage = getMaxScentStorage(vUv); + } } } }