Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.BuildMode = function(self, plot)
- if isInterpolating then
- return
- end
- if plot and not inBuild then
- inBuild = true
- module:TweenFromChar(module:GetBuildPos(plot, true), 1)
- zoom = 1
- rotation = 0
- --camPos = Vector3.new(0, 0, -50)
- local movementDelta = Vector2.new(0, 0)
- do
- local keysDown = {}
- local oldPos, conDown, conUp, conChange = nil, nil, nil, nil
- local mousePos = Vector2.new(mouseZoneOffset + 1, mouseZoneOffset + 1)
- local rotateFlat = 0
- local zoomFlat = 0
- local lastThumbstick = Vector2.new()
- local setZoom = function(value)
- zoom = clamp(value, 0, 3)
- end
- conChange = inputService.InputChanged:connect(function(obj, used)
- if obj.UserInputType.Name == "MouseWheel" and not used then
- setZoom(zoom - obj.Position.z * zoomSpeed)
- else
- if obj.UserInputType.Name == "MouseMovement" then
- mousePos = obj.Position
- if keysDown.RButton then
- do
- if oldPos then
- local delta = oldPos.X - mousePos.X
- rotation = rotation + delta * rotSpeed
- end
- oldPos = mousePos
- if obj.UserInputType.Name:sub(1, 7) == "Gamepad" and obj.KeyCode.Name == "Thumbstick2" then
- local x, y = obj.Position.X, obj.Position.Y
- if (thumbstickDeadzone >= math.abs(x) or not -x) and (thumbstickDeadzone >= math.abs(lastThumbstick.X) or not 0) then
- rotateFlat = not keysDown.ButtonL1 or rotateFlat
- zoomFlat = (thumbstickDeadzone < math.abs(y) and y) or (thumbstickDeadzone < math.abs(lastThumbstick.Y) and 0) or zoomFlat
- if (((thumbstickDeadzone >= math.abs(x) or not -x) and thumbstickDeadzone < math.abs(lastThumbstick.X) and thumbstickDeadzone >= math.abs(y)) or not y) and (thumbstickDeadzone >= math.abs(lastThumbstick.Y) or not 0) then
- movementDelta = Vector2.new(movementDelta.X, movementDelta.Y)
- lastThumbstick = obj.Position
- end
- end
- end
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement