Back to Home

ESO Lua File v100035

ingame/housingeditor/gamepad/housingfurnitureretrieval_gamepad.lua

[◄ back to folders ]
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
ZO_HousingFurnitureRetrieval_Gamepad = ZO_HousingFurnitureList_Gamepad:Subclass()
function ZO_HousingFurnitureRetrieval_Gamepad:New(...)
    return ZO_HousingFurnitureList_Gamepad.New(self, ...)
end
function ZO_HousingFurnitureRetrieval_Gamepad:Initialize(...)
    ZO_HousingFurnitureList_Gamepad.Initialize(self, ...)
    SHARED_FURNITURE:RegisterCallback("RetrievableFurnitureChanged", function(fromSearch)
        if fromSearch then
            self:ResetSavedPositions()
        end
    end)
end
function ZO_HousingFurnitureRetrieval_Gamepad:InitializeKeybindStripDescriptors()
    ZO_HousingFurnitureList_Gamepad.InitializeKeybindStripDescriptors(self)
        order = 0,
        name =  GetString(SI_HOUSING_EDITOR_MODIFY),
        keybind = "UI_SHORTCUT_PRIMARY",
        callback =  function() 
                        local targetData = self.furnitureList.list:GetTargetData()
                        if targetData.furnitureObject:GetDataType() == ZO_HOUSING_PATH_NODE_DATA_TYPE then
                            ZO_HousingFurnitureBrowser_Base.SelectNodeForReplacement(targetData.furnitureObject)
                        else
                            ZO_HousingFurnitureBrowser_Base.SelectFurnitureForReplacement(targetData.furnitureObject)
                        end
                        SCENE_MANAGER:HideCurrentScene()
                    end,
    })
    self:AddFurnitureListKeybind({    
        order = 1,
        name =  GetString(SI_HOUSING_EDITOR_PRECISION_EDIT),
        keybind = "HOUSING_EDITOR_SENARY_ACTION",
        callback =  function()
                        local targetData = self.furnitureList.list:GetTargetData()
                        if targetData.furnitureObject:GetDataType() == ZO_HOUSING_PATH_NODE_DATA_TYPE then
                            ZO_HousingFurnitureBrowser_Base.SelectNodeForPrecisionEdit(targetData.furnitureObject)
                        else
                            ZO_HousingFurnitureBrowser_Base.SelectFurnitureForPrecisionEdit(targetData.furnitureObject)
                        end
                        SCENE_MANAGER:HideCurrentScene()
                    end,
    })
    self:AddFurnitureListKeybind({    
        order = 4,
        name =  function()
                    local targetData = self.furnitureList.list:GetTargetData()
                    if targetData and targetData.furnitureObject:GetDataType() == ZO_HOUSING_PATH_NODE_DATA_TYPE then
                        return GetString(SI_HOUSING_EDITOR_PATH_REMOVE_NODE)
                    else
                        return GetString(SI_HOUSING_EDITOR_PUT_AWAY)
                    end
                end,
        keybind = "UI_SHORTCUT_SECONDARY",
        callback =  function() 
                        local targetData = self.furnitureList.list:GetTargetData()
                        if targetData.furnitureObject:GetDataType() == ZO_RECALLABLE_HOUSING_DATA_TYPE then
                            ZO_HousingFurnitureBrowser_Base.PutAwayFurniture(targetData.furnitureObject)
                        else
                            ZO_HousingFurnitureBrowser_Base.PutAwayNode(targetData.furnitureObject)
                        end
                    end,
    })
        order = 6,
        name = GetString(SI_WORLD_MAP_ACTION_SET_PLAYER_WAYPOINT),
        keybind = "UI_SHORTCUT_RIGHT_STICK",
        callback = function()
            local targetData = self.furnitureList.list:GetTargetData()
            SHARED_FURNITURE:SetPlayerWaypointTo(targetData.furnitureObject)
        end,
        enabled = function()
            local targetData = self.furnitureList.list:GetTargetData()
            if not targetData then
                return false
            end
            local dataType = targetData.furnitureObject:GetDataType()
            return dataType == ZO_RECALLABLE_HOUSING_DATA_TYPE or dataType == ZO_HOUSING_PATH_NODE_DATA_TYPE
        end
    })
        order = 5,
        name =  GetString(SI_HOUSING_FURNITURE_SET_STARTING_NODE),
        keybind = "UI_SHORTCUT_QUATERNARY",
        callback =  function() 
                        local targetData = self.furnitureList.list:GetTargetData()
                        ZO_HousingFurnitureBrowser_Base.SetAsStartingNode(targetData.furnitureObject)
                    end,
        visible =   function()
                        local targetData = self.furnitureList.list:GetTargetData()
                        return targetData and targetData.furnitureObject:GetDataType() == ZO_HOUSING_PATH_NODE_DATA_TYPE and not targetData.furnitureObject:IsStartingPathNode()
                    end,
    })
end
--Overridden from ZO_HousingFurnitureList_Gamepad
function ZO_HousingFurnitureRetrieval_Gamepad:GetCategoryTreeDataRoot()
    return SHARED_FURNITURE:GetRetrievableFurnitureCategoryTreeData()
end
--Overridden from ZO_HousingFurnitureList_Gamepad
function ZO_HousingFurnitureRetrieval_Gamepad:GetNoItemText()
    if SHARED_FURNITURE:DoesPlayerHaveRetrievableFurniture() then
        return GetString(SI_HOUSING_FURNITURE_NO_SEARCH_RESULTS)
    else
        return GetString(SI_HOUSING_FURNITURE_NO_RETRIEVABLE_FURNITURE)
    end
end
--Overridden from ZO_HousingFurnitureList_Gamepad
function ZO_HousingFurnitureRetrieval_Gamepad:CompareFurnitureEntries(a, b)
    return a:CompareTo(b)
end