新手玩家

- 贡献度
- 0
- 金元
- 260
- 积分
- 26
- 精华
- 0
- 注册时间
- 2018-10-21
|
function ShuttleInfo:CanLaunch()
return self.shuttle_obj == false
end
function UIGetBuildingPrerequisites(cat_id, template, bCreateItems)
if template.build_category ~= cat_id or template.hide_from_build_menu then
return false
end
local tech_shown, tech_enabled, tech_rollover = GetBuildingTechsStatus(template.name, template.build_category)
local available_prefabs = UICity:GetPrefabs(template.name)
local prefab_item = template.require_prefab and RocketPayload_GetMeta(template.name)
local require_prefab = not tech_enabled and prefab_item and not prefab_item.locked
if not tech_shown and not require_prefab and available_prefabs == 0 then
return false
end
local wonder_exists
if template.wonder then
if 0 < #(UICity.labels[template.name] or empty_table) then
wonder_exists = true
else
local sites = UICity.labels.ConstructionSite or empty_table
for i = 1, #sites do
local site = sites[i]
if site.building_class_proto.template_name == template.name then
wonder_exists = true
break
end
end
if not wonder_exists then
local sites = UICity.labels.ConstructionSiteWithHeightSurfaces or empty_table
for i = 1, #sites do
local site = sites[i]
if site.building_class_proto.template_name == template.name then
wonder_exists = true
break
end
end
end
end
end
wonder_exists = false
local can_build, description, cost_text
if wonder_exists then
description = T({
3968,
"You can only build this building once."
})
can_build = false
elseif available_prefabs > 0 then
cost_text = T({
3969,
"Available prefabs: <number>",
number = available_prefabs
})
can_build = true
elseif require_prefab then
description = T({
3970,
"You need prefab parts for this building. Use a resupply Rocket to bring more <em>prefabs</em> from Earth, or research the corresponding <em>Technology</em>."
})
can_build = false
elseif not tech_enabled then
description = tech_rollover
can_build = false
elseif cat_id == "Domes" and AreDomesCapped() then
description = T({
7907,
"Maximum number of Domes has been reached"
})
can_build = false
else
can_build = true
end
if not description then
local construction_cost = GetConstructionDescription(template, cost_text)
local class = g_Classes[template.template_class]
description = class and class.GetIPDescription(template) or T({
template.description,
template
})
if construction_cost ~= "" then
description = description .. Untranslated([[
]]) .. construction_cost
end
end
local action
if bCreateItems then
if require_prefab or available_prefabs > 0 then
function action(obj, data)
if GetUIStyleGamepad() then
g_LastBuildItem = "Salvage"
end
local params
if UICity:GetPrefabs(template.name) > 0 then
params = {supplied = true, prefab = true}
elseif not data.enabled then
return
end
GetInGameInterface():SetMode(data.construction_mode, {
template = data.name,
selected_dome = obj and obj.selected_dome,
params = params
})
end
else
function action(obj, data)
if GetUIStyleGamepad() then
g_LastBuildItem = "Salvage"
end
GetInGameInterface():SetMode(data.construction_mode, {
template = data.name,
selected_dome = obj and obj.selected_dome
})
end
end
end
return true, require_prefab, can_build, action, description
end
|
|