mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2025-05-11 12:31:08 +00:00
Added "this" to tabFormat
This commit is contained in:
parent
b5a850bbee
commit
6273181bf8
6 changed files with 14 additions and 11 deletions
js/technical
|
@ -147,9 +147,9 @@ function constructTabFormat(layer, id, family){
|
|||
|
||||
}
|
||||
if (isFunction(tabLayer)) {
|
||||
return tabLayer()
|
||||
return tabLayer.bind(location)()
|
||||
}
|
||||
updateTempData(tabLayer, tabTemp, tabFunc)
|
||||
updateTempData(tabLayer, tabTemp, tabFunc, {layer, id, family})
|
||||
return tabTemp
|
||||
}
|
||||
|
||||
|
|
|
@ -109,18 +109,20 @@ function updateTemp() {
|
|||
}
|
||||
}
|
||||
|
||||
function updateTempData(layerData, tmpData, funcsData) {
|
||||
|
||||
function updateTempData(layerData, tmpData, funcsData, useThis) {
|
||||
for (item in funcsData){
|
||||
if (Array.isArray(layerData[item])) {
|
||||
if (item !== "tabFormat" && item !== "content") // These are only updated when needed
|
||||
updateTempData(layerData[item], tmpData[item], funcsData[item])
|
||||
updateTempData(layerData[item], tmpData[item], funcsData[item], useThis)
|
||||
}
|
||||
else if ((!!layerData[item]) && (layerData[item].constructor === Object) || (typeof layerData[item] === "object") && traversableClasses.includes(layerData[item].constructor.name)){
|
||||
updateTempData(layerData[item], tmpData[item], funcsData[item])
|
||||
updateTempData(layerData[item], tmpData[item], funcsData[item], useThis)
|
||||
}
|
||||
else if (isFunction(layerData[item]) && !isFunction(tmpData[item])){
|
||||
let value = layerData[item]()
|
||||
let value
|
||||
|
||||
if (useThis !== undefined) value = layerData[item].bind(useThis)()
|
||||
else value = layerData[item]()
|
||||
if (value !== value || value === decimalNaN){
|
||||
if (NaNalert === true || confirm ("Invalid value found in tmp, named '" + item + "'. Please let the creator of this mod know! Would you like to try to auto-fix the save and keep going?")){
|
||||
NaNalert = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue