Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

Commit

Permalink
11 ; Practice Driving
Browse files Browse the repository at this point in the history
  • Loading branch information
DrNewbie committed Oct 23, 2016
1 parent a4d390d commit a8adaa0
Show file tree
Hide file tree
Showing 7 changed files with 155 additions and 12 deletions.
19 changes: 13 additions & 6 deletions UnHackMe/lua/AchievmentManager.lua
@@ -1,8 +1,15 @@

-- This disables the triggering of achievments
function AchievmentManager:award(id, ...)
return
function AchievmentManager:award(id)
return
end
function AchievmentManager:award_progress(stat, value, ...)
return
function AchievmentManager:_give_reward(id, skip_exp)
return
end
function AchievmentManager:award_progress(stat, value)
return
end
function AchievmentManager:award_steam(id)
return
end
function AchievmentManager.steam_unlock_result(achievment)
return
end
13 changes: 13 additions & 0 deletions lua/choose_safehouse.lua
Expand Up @@ -28,6 +28,9 @@ function MenuManager:open_safehouse_menu()
if DW and DW.Hooks then
opts[#opts+1] = { text = "Spawn 'DW Plus'", callback_func = callback(self, self, "select_safehouse_adv_menu", {item = 11}) }
end
if SafeHousePlus.settings.driving_test == 1 then
opts[#opts+1] = { text = "Play 'Practice Driving'", callback_func = callback(self, self, "select_safehouse_menu_driving_test", {}) }
end
--opts[#opts+1] = { text = "Play 'Quick Shooting'", callback_func = callback(self, self, "select_safehouse_menu_spawn", {item = 101}) }

if SafeHousePlus.settings.unit_tool == 1 then
Expand Down Expand Up @@ -58,6 +61,16 @@ function mysplit(inputstr, sep)
return t
end

function MenuManager:select_safehouse_menu_driving_test()
local _default = "units/pd2_dlc_shoutout_raid/vehicles/fps_vehicle_muscle_1/fps_vehicle_muscle_1"
SafeHousePlus.EnemyType = SafeHousePlus.EnemyType or _default
if not tostring(SafeHousePlus.EnemyType):find("vehicles") then
SafeHousePlus.EnemyType = _default
end
SafeHousePlus:spawnsomething(Vector3(-425, 1150, 1050))
managers.player:warp_to(Vector3(-85, 1000, 1050), Rotation(0, 0, 0))
end

function MenuManager:select_safehouse_adv_menu(params)
params.thisone = params.thisone or false
params.item = params.item or 0
Expand Down
25 changes: 23 additions & 2 deletions lua/menu.lua
Expand Up @@ -17,7 +17,8 @@ _G.SafeHousePlus = _G.SafeHousePlus or {}
nogameover_before_timeup = 0,
difficulty = 7,
multi_type = 0,
corpse_no_gone = 0
corpse_no_gone = 0,
driving_test = 0
}
SafeHousePlus.Difficulty = SafeHousePlus.Difficulty or "normal"

Expand Down Expand Up @@ -45,6 +46,8 @@ _G.SafeHousePlus = _G.SafeHousePlus or {}
["safehouseplus_multi_type_menu_desc"] = "Enable spawn different type enemy.",
["safehouseplus_corpse_no_gone_menu_title"] = "Don't remove corpse",
["safehouseplus_corpse_no_gone_menu_desc"] = "Enable = Don't remove corpse",
["safehouseplus_driving_test_menu_title"] = "Practice Driving",
["safehouseplus_driving_test_menu_desc"] = "Allow you to practice driving",
})
end)

Expand All @@ -59,7 +62,8 @@ _G.SafeHousePlus = _G.SafeHousePlus or {}
nogameover_before_timeout = 0,
difficulty = 7,
multi_type = 0,
corpse_no_gone = 0
corpse_no_gone = 0,
driving_test = 0
}
self:Save()
end
Expand Down Expand Up @@ -153,6 +157,23 @@ _G.SafeHousePlus = _G.SafeHousePlus or {}
value = _bool,
menu_id = SafeHousePlus.options_menu,
})
MenuCallbackHandler.set_safehouseplus_driving_test_toggle_callback = function(self, item)
if tostring(item:value()) == "on" then
SafeHousePlus.settings.driving_test = 1
else
SafeHousePlus.settings.driving_test = 0
end
SafeHousePlus:Save()
end
_bool = SafeHousePlus.settings.driving_test == 1 and true or false
MenuHelper:AddToggle({
id = "set_safehouseplus_driving_test_toggle_callback",
title = "safehouseplus_driving_test_menu_title",
desc = "safehouseplus_driving_test_menu_desc",
callback = "set_safehouseplus_driving_test_toggle_callback",
value = _bool,
menu_id = SafeHousePlus.options_menu,
})
MenuCallbackHandler.set_safehouseplus_multi_type_toggle_callback = function(self, item)
if tostring(item:value()) == "on" then
SafeHousePlus.settings.multi_type = 1
Expand Down
2 changes: 1 addition & 1 deletion lua/missionnow.lua
Expand Up @@ -21,7 +21,7 @@ Hooks:PostHook(MissionManager, "init", "MissionManagerinit_PostHook", function(m
tweak_data and tweak_data.narrative and tweak_data.levels and PackageManager and
PackageManager:loaded("packages/game_base_init") and
Global.game_settings and Global.game_settings.level_id == "chill" then
if SafeHousePlus.settings.vehicle_loaded == 1 then
if SafeHousePlus.settings.vehicle_loaded == 1 or SafeHousePlus.settings.driving_test == 1 then
log("[SafeHousePlus] Vehicle Loaded")
local _others_package = { "levels/narratives/bain/cage/world/world",
"levels/narratives/vlad/shout/world/world",
Expand Down
3 changes: 3 additions & 0 deletions lua/overrides/VehicleManager_all_players_in_vehicles.lua
@@ -0,0 +1,3 @@
function VehicleManager:all_players_in_vehicles()
return true
end
103 changes: 101 additions & 2 deletions lua/press_that.lua
Expand Up @@ -216,7 +216,9 @@ end
function SafeHousePlus:spawnsomething(_pos, _dead_unit)
_dead_unit = _dead_unit or nil
local pos = SafeHousePlus.Spawn_Location.Human.pos
if _pos then pos = _pos end
if _pos then
pos = _pos
end
if SafeHousePlus.settings.multi_type == 1 then
local _multi = 0
for k, v in pairs(SafeHousePlus.EnemyType_Multi) do
Expand Down Expand Up @@ -254,7 +256,10 @@ function SafeHousePlus:spawnsomething(_pos, _dead_unit)
end
if _is_vehicle then
pos = SafeHousePlus.Spawn_Location.Vehicles.pos
end
if _pos then
pos = _pos
end
end
if not _is_vehicle and not _spawn:find("characters") then
log("[SafeHousePlus] Error, spawnsomething, _spawn: " .. tostring(_spawn))
end
Expand Down Expand Up @@ -370,6 +375,100 @@ function SafeHousePlus:DoInit()
if SafeHousePlus.settings.nogameover_before_timeup == 1 then
SafeHousePlus:Spawn_One_AI({alone = 1})
end
if SafeHousePlus.settings.driving_test == 1 then
dofile(SafeHousePlus.ModPath .. "lua/overrides/VehicleManager_all_players_in_vehicles.lua")
local _driving_test_pos = {
{pos = Vector3(-745, 1160, 1000)},
{pos = Vector3(-745, 1460, 1000)},
{pos = Vector3(-745, 1760, 1000)},
{pos = Vector3(-745, 2060, 1000)},
{pos = Vector3(-745, 2360, 1000)},
{pos = Vector3(-745, 2660, 1000)},
{pos = Vector3(-745, 2960, 1000)},
{pos = Vector3(-745, 3260, 1000)},
{pos = Vector3(-745, 3560, 1000)},
{pos = Vector3(-745, 3860, 1000)},
{pos = Vector3(0, 1160, 1000)},
{pos = Vector3(0, 1460, 1000)},
{pos = Vector3(0, 1760, 1000)},
{pos = Vector3(0, 2060, 1000)},
{pos = Vector3(0, 2360, 1000)},
{pos = Vector3(0, 2660, 1000)},
{pos = Vector3(0, 2960, 1000)},
{pos = Vector3(0, 3260, 1000)},
{pos = Vector3(0, 3560, 1000)},
{pos = Vector3(0, 3860, 1000)},
{pos = Vector3(-1490, 1160, 1000)},
{pos = Vector3(-1490, 1460, 1000)},
{pos = Vector3(-1490, 1760, 1000)},
{pos = Vector3(-1490, 2060, 1000)},
{pos = Vector3(-1490, 2360, 1000)},
{pos = Vector3(-1490, 2660, 1000)},
{pos = Vector3(-1490, 2960, 1000)},
{pos = Vector3(-1490, 3260, 1000)},
{pos = Vector3(-1490, 3560, 1000)},
{pos = Vector3(-1490, 3860, 1000)},
{pos = Vector3(-2235, 1160, 1000)},
{pos = Vector3(-2235, 1460, 1000)},
{pos = Vector3(-2235, 1760, 1000)},
{pos = Vector3(-2235, 2060, 1000)},
{pos = Vector3(-2235, 2360, 1000)},
{pos = Vector3(-2235, 2660, 1000)},
{pos = Vector3(-2235, 2960, 1000)},
{pos = Vector3(-2235, 3260, 1000)},
{pos = Vector3(-2235, 3560, 1000)},
{pos = Vector3(-2235, 3860, 1000)},
{pos = Vector3(-2235, 860, 1000)},
{pos = Vector3(-2235, 560, 1000)},
{pos = Vector3(-2235, 260, 1000)},
{pos = Vector3(-2235, -40, 1000)},
{pos = Vector3(-2235, -340, 1000)},
{pos = Vector3(-2235, -640, 1000)},
{pos = Vector3(-2235, -940, 1000)},
{pos = Vector3(-2235, -1240, 1000)},
{pos = Vector3(-1490, -1240, 1000)},
{pos = Vector3(-745, -1240, 1000)},
{pos = Vector3(0, -1240, 1000)},
{pos = Vector3(745, -1240, 1000), rot = Rotation(0, 90, -20)},
{pos = Vector3(1445, -1240, 1255), rot = Rotation(0, 90, -20)},
{pos = Vector3(2145, -1240, 1510), rot = Rotation(0, 90, -20)},
{pos = Vector3(2845, -1240, 1765), rot = Rotation(0, 90, -20)},
{pos = Vector3(3545, -1240, 2020), rot = Rotation(0, 90, -20)},
{pos = Vector3(4245, -1240, 2275)},
{pos = Vector3(4245, -940, 2275)},
{pos = Vector3(4245, -640, 2275)},
{pos = Vector3(4245, -340, 2275)},
{pos = Vector3(4245, -40, 2275)},
{pos = Vector3(4245, 260, 2275)},
{pos = Vector3(4245, 560, 2275)},
{pos = Vector3(4245, 860, 2275)},
{pos = Vector3(4245, 1160, 2275)},
{pos = Vector3(4245, 1460, 2275)},
{pos = Vector3(4245, 1760, 2275)},
{pos = Vector3(745, 1760, 1000), rot = Rotation(0, 90, -20)},
{pos = Vector3(1445, 1760, 1255), rot = Rotation(0, 90, -20)},
{pos = Vector3(2145, 1760, 1510), rot = Rotation(0, 90, -20)},
{pos = Vector3(2845, 1760, 1765), rot = Rotation(0, 90, -20)},
{pos = Vector3(3545, 1760, 2020), rot = Rotation(0, 90, -20)},
{pos = Vector3(4245, 2060, 2275)},
{pos = Vector3(4245, 2360, 2275)},
{pos = Vector3(4245, 2660, 2275)},
{pos = Vector3(4245, 2960, 2275)},
{pos = Vector3(4245, 3260, 2275)},
{pos = Vector3(4245, 3560, 2275)},
{pos = Vector3(4245, 3860, 2275)},
{pos = Vector3(4245, 4160, 2275)},
{pos = Vector3(4245, 4460, 2275)},
{pos = Vector3(3545, 4460, 2020), rot = Rotation(0, 90, -20)},
}
local _driving_test_unit_name = Idstring("units/payday2/props/air_prop_runway_fence/air_prop_runway_fence_gate_v3")
for _, v in pairs(_driving_test_pos) do
_u = safe_spawn_unit(_driving_test_unit_name, v.pos, v.rot or Rotation(0, 90, 0))
if _u and alive(_u) and _u:interaction() then
_u:interaction():set_active(false, false)
end
end
end
log("[SafeHousePlus] DoInit")
end
end
Expand Down
2 changes: 1 addition & 1 deletion mod.txt
Expand Up @@ -2,7 +2,7 @@
"name":"SafeHouse Plus",
"author":"Dr_Newbie",
"contact":"Allow you open other difficulty safehouse, give you real target shooting and do some customization.",
"version":"10",
"version":"11",
"hooks":[
{"hook_id":"core/lib/managers/mission/coremissionscriptelement", "script_path":"lua/event.lua"},
{"hook_id":"lib/managers/localizationmanager", "script_path":"lua/swap_weapon/function.lua"},
Expand Down

0 comments on commit a8adaa0

Please sign in to comment.