FILES ----- items\active\effects\chain.lua DIFFS ----- items\active\effects\chain.lua 14,16c14,15 < local segmentCount = math.floor((vec2.mag(chainVec) / chain.segmentSize) + 0.5) < local chainAngle = vec2.angle(chainVec) < if chainVec[1] < 0 then chainAngle = math.pi - chainAngle end --- > local chainDirection = chainVec[1] < 0 and -1 or 1 > local chainLength = vec2.mag(chainVec) 18,25c17,50 < local segmentOffset = vec2.mul(vec2.norm(chainVec), chain.segmentSize) < local thisOffset = vec2.add(startPosition, vec2.mul(segmentOffset, 0.5)) < for i = 1, segmentCount do < local image = chain.segmentImage < if i == segmentCount and chain.endSegmentImage then image = chain.endSegmentImage end < if chain.taper then < local taperFactor = 1 - ((i - 1) / segmentCount) * chain.taper < image = image .. "?scale=1.0=" .. util.round(taperFactor, 5) --- > local arcAngle = 0 > if chain.arcRadius then > arcAngle = chainDirection * 2 * math.asin(chainLength / (2 * chain.arcRadius)) > chainLength = chainDirection * arcAngle * chain.arcRadius > end > > local segmentCount = math.floor((chainLength / chain.segmentSize) + 0.5) > if segmentCount > 0 then > local chainStartAngle = vec2.angle(chainVec) - arcAngle / 2 > if chainVec[1] < 0 then chainStartAngle = math.pi - chainStartAngle end > > local segmentOffset = vec2.mul(vec2.norm(chainVec), chain.segmentSize) > segmentOffset = vec2.rotate(segmentOffset, -arcAngle / 2) > local thisOffset = vec2.add(startPosition, vec2.mul(segmentOffset, 0.5)) > local lastDrawnSegment = chain.drawPercentage and math.ceil(segmentCount * chain.drawPercentage) or segmentCount > for i = 1, lastDrawnSegment do > local image = chain.segmentImage > if i == lastDrawnSegment and chain.endSegmentImage then image = chain.endSegmentImage end > if chain.taper then > local taperFactor = 1 - ((i - 1) / lastDrawnSegment) * chain.taper > image = image .. "?scale=1.0=" .. util.round(taperFactor, 5) > end > local drawable = { > image = image, > centered = true, > mirrored = chainVec[1] < 0, > rotation = chainStartAngle + (i - 1) * chainDirection * (arcAngle / segmentCount), > position = thisOffset, > fullbright = chain.fullbright or false > } > table.insert(drawables, {drawable}) > > segmentOffset = vec2.rotate(segmentOffset, arcAngle / segmentCount) > thisOffset = vec2.add(thisOffset, segmentOffset) 27,36d51 < local drawable = { < image = image, < centered = true, < mirrored = chainVec[1] < 0, < rotation = chainAngle, < position = thisOffset, < fullbright = chain.fullbright or false < } < table.insert(drawables, {drawable}) < thisOffset = vec2.add(thisOffset, segmentOffset)