diff --git a/game/04-Variables/npcList.twee b/game/04-Variables/npcList.twee index 6e11fbf09fd6638a8c3c64721ea4676a74748936..04df280ab4a0061993c6d39d3e81fef156f02d68 100644 --- a/game/04-Variables/npcList.twee +++ b/game/04-Variables/npcList.twee @@ -1,34 +1,22 @@ :: npcList [widget] <<widget "npcList">> - /* note: anus, ballssize, buttsize, bottomsize are currently unused. and why is speechXescape even there? */ - <<set $baseNPC = {penis: 0, vagina: 0, breastsdesc: 0, chest: 0, lactation: 0, lefthand: 0, righthand: 0, anus: 0, mouth: 0, gender: 0, description: 0, fullDescription: 0, insecurity: 0, pronoun: 0, pronouns: {he: 0, his: 0}, penissize: 0, breastsize: 0, bottomsize: 0, ballssize: 0, penisdesc: 0, breastdesc: 0, health: 0, healthmax: 0, skincolour: 0, teen: 0, adult: 0, intro:0, speechpenisescape: 0, speechvaginaescape: 0, speechanusescape:0, type: 0, stance: 0, monster: 0, active: 0}>> - - <<set _n1 to clone($baseNPC)>> - <<set _n2 to clone($baseNPC)>> - <<set _n3 to clone($baseNPC)>> - <<set _n4 to clone($baseNPC)>> - <<set _n5 to clone($baseNPC)>> - <<set _n6 to clone($baseNPC)>> - - <<set $NPCList = [_n1, _n2, _n3, _n4, _n5, _n6]>> - - <<for _i = 0; _i < $NPCList.length; _i++>> - <<set $NPCList[_i].lefthand to "none">> - <<set $NPCList[_i].lefthand to "none">> - <<set $NPCList[_i].righthand to "none">> - <<set $NPCList[_i].penis to "none">> - <<set $NPCList[_i].vagina to "none">> - <<set $NPCList[_i].mouth to "none">> - <<set $NPCList[_i].chest to "none">> - <<set $NPCList[_i].gender to 0>> - <<set $NPCList[_i].pronoun to 0>> - <<set $NPCList[_i].description to 0>> - <<set $NPCList[_i].type to 0>> - <<set $NPCList[_i].stance to 0>> - <<set $NPCList[_i].monster to 0>> - <</for>> - + <<script>> + const NPCList = []; + for (let idx = 0; idx < 6; ++idx) { + NPCList.push(clone(setup.baseNPC)); + /* carry over values from existing generated npcs and add current index */ + /* uses .description to detect if npc is not a stub, in case of trouble try another variable */ + if (V.NPCList && V.NPCList[idx].description) { + const npc = NPCList[idx]; + npc.index = idx; + Object.assign(npc, V.NPCList[idx]); + if (!npc.type) npc.type = "human"; + } + } + V.NPCList = clone(NPCList); + <</script>> + /* should this even be here? */ <<set $BeastList to ["dog","cat","pig","wolf","dolphin","lizard","bear","boar","creature","horse","fox","hawk","cow","spider"]>> - <<set $npcListVersion to 2>> -<</widget>> \ No newline at end of file + <<set $npcListVersion to 3>> +<</widget>> diff --git a/game/04-Variables/variables-passageHeader.twee b/game/04-Variables/variables-passageHeader.twee index 379dfcbce41b4156ee30785f0cd4020beeca4f94..e54571083ea2227f4457fdd1d975c1fe1b9acb90 100644 --- a/game/04-Variables/variables-passageHeader.twee +++ b/game/04-Variables/variables-passageHeader.twee @@ -40,9 +40,6 @@ <<set $prngpull to State.prng.pull>> <<backComp>> - <!-- Failsafe if changing options immediately after load --> - <<run Engine.play($passage)>> - <<updatehistorycontrols>> <<set _preventUpdate to true>> /*prevent rewriting autosaves */ <<set _saveLoaded to true>> diff --git a/game/04-Variables/variables-versionUpdate.twee b/game/04-Variables/variables-versionUpdate.twee index 239723bf415423b1f55b4fd81c0461c6e24e5834..cfebe596496a9d570b14b17dfe7cc3a1272dc065 100644 --- a/game/04-Variables/variables-versionUpdate.twee +++ b/game/04-Variables/variables-versionUpdate.twee @@ -2387,6 +2387,7 @@ <</if>> <<if $index is undefined and $enemyno gte 1>> + <<set $index to 0>> <<for _n to 0; _n lt $NPCList.length; _n++>> <<if $NPCList[_n].desc is $description>> <<set $index to _n>> @@ -3561,17 +3562,11 @@ <<updateNewNamedNpcs>> - <!-- Jimmy: Reset NPC slots if necessary by checking .type === 0 + <!-- Jimmy: Reset NPC slots if necessary Old versions prior to 3.4.* did not have empty slots properly set to baseNPC. --> - <<for $_i = 0; $_i < $NPCList.length; $_i++>> - <<if $combat isnot 1>> - <<if $NPCList[$_i].type is 0>> - <<set $NPCList[$_i] to clone(setup.baseNPC)>> - <</if>> - <<elseif $NPCList[$_i].active is "active">> - <<set $NPCList[$_i].type to (typeof $NPCList[$_i].type isnot "string" ? "human" : $NPCList[$_i].type)>> - <</if>> - <</for>> + <<if $npcListVersion lt 3>> + <<npcList>> + <</if>> <!-- Jimmy: Run updater for EventSystem. Only runs if behind on schema, and if $event exists. --> @@ -5301,7 +5296,9 @@ <<unset $frozenValues.skyHidden>> <</if>> + <!-- Failsafe if changing options immediately after load --> <<run Weather.WeatherGeneration.generate(Time.date)>> + <<run Weather.sky.initialize()>> <</if>> <<if $options.clothingCaption is undefined>> diff --git a/game/base-clothing/update-clothes.js b/game/base-clothing/update-clothes.js index 2d0e6f8e5dbc70012aa6ad7104950ba9013d01a3..b84d3d67bd4614d8eaf97e8743e7df05ac72f50b 100644 --- a/game/base-clothing/update-clothes.js +++ b/game/base-clothing/update-clothes.js @@ -101,6 +101,7 @@ function updateClothingColours(item, itemRef) { default: // Catch-all case if people forget to adjust this widget for whatever clothing item is updated. Can make weird looking clothes if "custom" is selected. if (item.colour === 0) item.colour = itemRef.colour_options.random(); + if (item.accessory_colour === 0) item.accessory_colour = itemRef.accessory_colour_options.random(); } } @@ -195,7 +196,7 @@ function updateClothesItem(slot, item, debug) { item.accessory_colour = remapColours[item.accessory_colour] || item.accessory_colour; if ( ((item.colour === 0 || item.colour === "original") && itemRef.colour_options.length > 0) || - (item.accessory_colour === 0 && itemRef.accessory_colour_options.length > 0) + (item.accessory_colour === 0 && itemRef.accessory_colour_options?.length > 0) ) updateClothingColours(item, itemRef); diff --git a/game/base-system/widgets.twee b/game/base-system/widgets.twee index fe9c650e08de63347a80eaf052af302251b40536..f420c6c6ba8656edf091171959de3798bcb66bcf 100644 --- a/game/base-system/widgets.twee +++ b/game/base-system/widgets.twee @@ -3916,7 +3916,7 @@ <</widget>> <<widget "setup_pillory">> - <<set $pillory.tenant to {person : clone($baseNPC), exists : 0, duration : 0, served : 0, startTime: 0, endTime : 0, + <<set $pillory.tenant to {person : clone(setup.baseNPC), exists : 0, duration : 0, served : 0, startTime: 0, endTime : 0, crowd : 0, wet : 0, upperexposed : 0 , lowerexposed : 0, fruit : 0, fruitstock: 0, face : 0, ass : 0, genital : 0, broken : 0, lastviewed : 0, special : {name : "", desc : ""}}>> <</widget>>