spawn placeholder function completed

This commit is contained in:
Chr1Z93 2023-10-19 18:20:16 +02:00
parent ce38acca4f
commit 9ae435e1ed
4 changed files with 111 additions and 16 deletions

View File

@ -3,7 +3,6 @@
"ComponentTags_path": "ComponentTags.json",
"CustomUIAssets_path": "CustomUIAssets.json",
"DecalPallet_path": "DecalPallet.json",
"Decals": [],
"GameComplexity": "",
"GameMode": "Arkham Horror LCG - Super Complete Edition",
"GameType": "",
@ -200,6 +199,7 @@
"TokenArranger.022907",
"ChaosBagManager.023240",
"ArkhamSCE330-1092023-Page1.964222",
"PlaceholderBoxDummy.a93466",
"SoulsofDarkness.a94e6b"
],
"PlayArea": 1,

View File

@ -0,0 +1,45 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 0.82353,
"g": 0.20157,
"r": 0
},
"Description": "This dummy is there to hold the up-to-date script file for placeholder boxes to be available for placeholder box spawning.",
"DragSelectable": true,
"GMNotes": "",
"GUID": "a93466",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "require(\"core/DownloadBox\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "BlockRectangle",
"Nickname": "Placeholder Box Dummy",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 78,
"posY": 1.645,
"posZ": -33,
"rotX": 0,
"rotY": 0,
"rotZ": 0,
"scaleX": 1,
"scaleY": 1,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
}

View File

@ -56,6 +56,7 @@ local GuidReferences = {
MythosArea = "9f334f",
NavigationOverlayHandler = "797ede",
OptionPanelSource = "830bd0",
PlaceholderBoxDummy = "a93466",
PlayArea = "721ba2",
PlayAreaZone = "a2f932",
PlayerCardPanel = "2d30ee",

View File

@ -724,7 +724,56 @@ end
-- spawns a placeholder box for the selected object
function onClick_spawnPlaceholder()
-- get object references
local item = library[contentToShow][currentListItem]
local dummy = guidReferenceApi.getObjectByOwnerAndType("Mythos", "PlaceholderBoxDummy")
-- error handling
if not item.boxsize or item.boxsize == "" or not item.boxart or item.boxart == "" then
print("Error loading object.")
return
end
-- get data for placeholder
local spawnPos = {-39.5, 2, -87}
local meshTable = {
big = "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj",
small = "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj",
wide = "http://pastebin.com/raw.php?i=uWAmuNZ2"
}
local scaleTable = {
big = {1.00, 0.14, 1.00},
small = {2.21, 0.46, 2.42},
wide = {2.00, 0.11, 1.69}
}
local placeholder = spawnObject({
type = "Custom_Model",
position = spawnPos,
rotation = {0, 270, 0},
scale = scaleTable[item.boxsize],
})
placeholder.setCustomObject({
mesh = meshTable[item.boxsize],
diffuse = item.boxart,
material = 3
})
placeholder.setColorTint({1, 1, 1, 71/255})
placeholder.setName(item.name)
placeholder.setDescription("by " .. (item.author or "Unknown"))
placeholder.setGMNotes(item.url)
placeholder.setLuaScript(dummy.getLuaScript())
Player.getPlayers()[1].pingTable(spawnPos)
-- hide download window
if xmlVisibility.downloadWindow then
xmlVisibility.downloadWindow = false
UI.hide('downloadWindow')
end
end
-- toggles the visibility of the respective UI
@ -764,25 +813,25 @@ function updatePreviewWindow()
local maskData = {}
if item.boxsize == "big" then
maskData = {
image = "box-cover-mask-big",
width = "870",
height = "435",
offsetXY = "154 60"
}
image = "box-cover-mask-big",
width = "870",
height = "435",
offsetXY = "154 60"
}
elseif item.boxsize == "small" then
maskData = {
image = "box-cover-mask-small",
width = "792",
height = "594",
offsetXY = "135 13"
}
image = "box-cover-mask-small",
width = "792",
height = "594",
offsetXY = "135 13"
}
elseif item.boxsize == "wide" then
maskData = {
image = "box-cover-mask-wide",
width = "756",
height = "630",
offsetXY = "-190 -70"
}
image = "box-cover-mask-wide",
width = "756",
height = "630",
offsetXY = "-190 -70"
}
end
-- loading empty image as placeholder until real image is loaded