Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/Starbound-1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Silverfeelin committed Jun 8, 2017
2 parents 8045605 + 648326c commit b757a97
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name" : "SpawnableItemPack",
"priority" : -1,
"requires" : ["Manipulated UI"],
"version" : "1.2.0",
"version" : "1.3.0",
"link" : "steam://url/CommunityFilePage/733665104",
"steamContentId" : "733665104"
}
37 changes: 34 additions & 3 deletions interface/scripted/mmupgrade/mmupgradegui.config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,22 @@
"centered": true
}
},
{
"op": "add",
"path": "/gui/sipImageSelectionIconSlot",
"value": {
"type": "itemslot",
"file": "/assetMissing.png",
"position": [
312,
161
],
"zlevel": 22,
"visible": true,
"centered": false,
"callback": "null"
}
},
{
"op": "add",
"path": "/gui/sipImageSelection",
Expand Down Expand Up @@ -1184,6 +1200,23 @@
"fishingreel"
]
},
{
"baseImage": "/interface/sip/categories/mech.png",
"hoverImage": "/interface/sip/categories/mech.png?brightness=30",
"baseImageChecked": "/interface/sip/categories/mechselected.png",
"hoverImageChecked": "/interface/sip/categories/mechselected.png?brightness=30",
"pressedOffset": [
0,
-1
],
"position": [
38,
-231
],
"data": [
"mechpart"
]
},
{
"baseImage": "/interface/sip/categories/silver.png",
"hoverImage": "/interface/sip/categories/silver.png?brightness=30",
Expand Down Expand Up @@ -1807,9 +1840,7 @@
"sipImageSelection",
"sipImageSelection2",
"sipImageSelection3",
"sipImageSelectionIcon",
"sipImageSelectionIcon2",
"sipImageSelectionIcon3",
"sipImageSelectionIconSlot",
"sipImageSelectionRarity",
"sipLabelSelectionName",
"sipLabelSelectionDescription",
Expand Down
Binary file added interface/sip/categories/mech.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added interface/sip/categories/mechselected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 24 additions & 13 deletions scripts/spawnableItemPack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ sip.widgets = {
itemRarity = "sipImageSelectionRarity",
itemImage = "sipImageSelection",
itemImage2 = "sipImageSelection2",
itemImage3 = "sipImageSelection3"
itemImage3 = "sipImageSelection3",
itemSlot = "sipImageSelectionIconSlot"
}

sip.descriptionMissing = sip.lines.descriptionMissing
Expand All @@ -58,7 +59,7 @@ function sip.init()

sip.items = root.assetJson("/sipItemDump.json")
sip.customItems = root.assetJson("/sipCustomItems.json")

-- Simple check for the first custom item to exist. Will obviously not catch all missing items.
-- If the first custom item does not exist, do not load /any/ custom items.
if #sip.customItems == 0 then
Expand All @@ -78,9 +79,9 @@ function sip.init()
end
end
end

sip.loadModItems(sip.items)

sip.categories = nil
sip.changingCategory = false
sip.showCategories(false)
Expand All @@ -92,7 +93,7 @@ function sip.init()
sip.previousSearch = ""
sip.filter()
sip.changeQuantity()

local category, categoryData = sip.getSelectedCategory()
if category then
widget.setSize("sipCategoryIndex", {0,0})
Expand All @@ -106,7 +107,7 @@ function sip.init()
if weaponLevel then
sip.weaponLevel = weaponLevel
end

--logENV()
end

Expand All @@ -123,7 +124,7 @@ function sip.loadModItems(itemList)
end
end
end

return itemList
end
--[[
Expand Down Expand Up @@ -184,6 +185,15 @@ function sip.showItems(category)
end

function sip.setInventoryIcon(widgets, item)
if type(widgets) == "string" then
if type(item) == "string" then
widget.setItemSlotItem(widgets, {name=item})
else
widget.setItemSlotItem(widgets, item)
end
return
end

local directives = item.directives or ""

if type(item.icon) == "string" and item.icon ~= "null" then
Expand Down Expand Up @@ -286,7 +296,8 @@ function sip.setPreviewIcon(widgets, item)
end

function sip.clearPreview()
local widgets = {"sipImageSelectionIcon", "sipImageSelectionIcon2", "sipImageSelectionIcon3", "sipImageSelection", "sipImageSelection2", "sipImageSelection3"}
widget.setItemSlotItem(sip.widgets.itemSlot, nil);
local widgets = {"sipImageSelection", "sipImageSelection2", "sipImageSelection3"}
for _,v in ipairs(widgets) do
widget.setImage(v, "/assetMissing.png")
end
Expand Down Expand Up @@ -386,7 +397,7 @@ function sip.spawnItem(itemName, quantity)
local weaponLevel = nil
if not pcall(function()
local cfg = root.itemConfig(itemName)

if cfg.config then
if cfg.config.level then
weaponLevel = sip.weaponLevel
Expand All @@ -406,10 +417,10 @@ function sip.spawnItem(itemName, quantity)
sb.logError(sip.lines.spawnItemMissing, itemName)
return
end

local params = nil
if weaponLevel then params = { level = weaponLevel } end

local it, rest = math.floor(quantity / 1000), quantity % 1000
for i=1,it do
player.giveItem({name=itemName, count=1000, parameters = params })
Expand Down Expand Up @@ -568,7 +579,7 @@ function sip.itemSelected()

local directives = item.directives or ""

sip.setInventoryIcon({"sipImageSelectionIcon", "sipImageSelectionIcon2", "sipImageSelectionIcon3"}, item)
sip.setInventoryIcon(sip.widgets.itemSlot, item)
sip.setPreviewIcon({"sipImageSelection", "sipImageSelection2", "sipImageSelection3"}, item)
end

Expand Down Expand Up @@ -601,7 +612,7 @@ function sip.changeWeaponLevel(_, data)
level = n
else return end
end

sip.weaponLevel = math.clamp(level, 1, 10)
widget.setText("sipSettingsScroll.weaponLevel", tostring(sip.weaponLevel))
end
Expand Down
2 changes: 1 addition & 1 deletion sipItemDump.json

Large diffs are not rendered by default.

0 comments on commit b757a97

Please sign in to comment.