-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdventureScript.lua
82 lines (69 loc) · 2.44 KB
/
AdventureScript.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
-- AdventureScript
-- by META IIII (aka AdventureTours)
util.require_natives('3095a.g')
util.keep_running()
local auto_updater = require('auto-updater')
local config = require('lib.AdventureScript.config')
local state = require('lib.AdventureScript.state')
local controls = require('lib.AdventureScript.controls')
local gridSpawn = require('lib.AdventureScript.gridspawn')
local tour = require('lib.AdventureScript.tour')
local vehicles = require('lib.AdventureScript.vehicles')
local ui = require('lib.AdventureScript.ui')
local menuHelpers = require('lib.AdventureScript.menu')
---
--- ----------------------------------------
--- START OF HEXAROBI AUTO-UPDATER
util.ensure_package_is_installed('lua/auto-updater')
if auto_updater ~= nil then
auto_updater.run_auto_update(config.auto_update_config)
end
--- END OF HEXAROBI AUTO-UPDATER
--- ----------------------------------------
---
--- Initialize
menuHelpers.initializeMenu()
gridSpawn.initialize()
--- Tick handler for gamepad controls and grid spawn listener
util.create_tick_handler(function()
if controls.r3Hold() and state.show_on_screen_controls then
ui.showGamepadControls(tour.isDrivingBus())
end
-- Gamepad shortcuts (R3 + DPad)
if controls.r3Hold() and controls.dpadDownPress() then
vehicles.spawnAdventureToursBus()
end
if controls.r3Hold() and controls.doubleTapDpadDown() then
if tour.isDrivingBus() then
tour.goToNextTourStop()
end
end
if controls.r3Hold() and controls.doubleTapDpadUp() then
if tour.isDrivingBus() then
tour.goToPreviousTourStop()
end
end
if controls.r3Hold() and controls.dpadRightPress() then
state.spawnModeEnabled = not state.spawnModeEnabled
end
-- Delete the tour bus (unless driving) and all spawned vehicles
if controls.r3Hold() and controls.dpadLeftPress() then
if not tour.isDrivingBus() then
tour.deleteTourBus()
end
vehicles.deleteSpawnedVehicles()
end
-- Delete all vehicles in radius
if controls.r3Hold() and controls.doubleTapDpadLeft() then
vehicles.deleteVehiclesInArea()
end
-- Grid spawn handler
if state.spawnModeEnabled == true then
DISABLE_CONTROL_ACTION(0, 142, true)
gridSpawn.handleSpawn(state.spawnTargetHash, state.spawnTargetDimensions, vehicles.makeAdventureVehicle)
end
end)
util.on_stop(function()
gridSpawn.handleCleanup()
end)
ui.showLogo()