Skip to content

Commit

Permalink
misc script fixes/additions
Browse files Browse the repository at this point in the history
  • Loading branch information
apple1417 committed Oct 13, 2018
1 parent 273ca6a commit 2f423e9
Show file tree
Hide file tree
Showing 17 changed files with 349 additions and 211 deletions.
11 changes: 9 additions & 2 deletions Options World/Help.dlg
Expand Up @@ -14,6 +14,7 @@ terminal when (PickOption) {
"TTRS:notrans=Unlock All Items" next: AllItems
"TTRS:notrans=Show Full Signs" next: AllSigns
"TTRS:notrans=Random Portals" next: Portals
"TTRS:notrans=Jetpack" next: Jetpack
"TTRS:notrans=Scavenger Hunt" next: Scavenger
"TTRS:notrans=Möbius Mode" next: Mobius
"TTRS:notrans=Moody Sigils" next: Moody
Expand Down Expand Up @@ -78,6 +79,11 @@ Also note that no matter the randomization mode, with the same seed you will alw
goto: Loop
}

terminal when (Jetpack) {
text: "TTRS:notrans=Gives you a jetpack in every world except nexus. Going too far outside of the level will cause the jetpack to overheat."
goto: Loop
}

terminal when (Scavenger) {
text: [[TTRS:notrans=Picks a method to beat the game and hides all sigils not required for it. In the Short mode all these sigils are in your first hub, in Full they can be anywhere.

Expand All @@ -90,15 +96,15 @@ Note that this option, like Random Portals, affect seeds. The same seed will giv
terminal when (Mobius) {
text: [[TTRS:notrans=Links all the levels together so when you leave one you instantly enter another, skipping Nexus. When you achieve a win condition the exit portal switches to send you to messenger ending.

The win conditons are as follows:
The win conditions are as follows:
All Sigils - When you collect all the sigils
All of a Colour - When you collect all sigils of a single colour. Stars count as their own colour.
All of a Shape - When you collect all sigils of a single shape. Stars count as their own shape.
Eternalize Ending - When Eternalize Ending normally triggers, when you collect all green, yellow, and red tetrominoes.
Two Tower Floors - When you have all the sigils to be able to unlock any two tower floors (at the same time).
Random Arrangers - When you have the sigils to be able to complete all the random arranger hints it gives you at the start of the game.

These win conditons are additive - if you select both All of a Colour and All of a Shape you can finish on either.
These win conditions are additive - if you select both All of a Colour and All of a Shape you can finish on either.

Item arrangers and the two stars in nexus, which would normally be inaccessable, are scattered throughout the levels.

Expand All @@ -116,6 +122,7 @@ terminal when (Errors) {

Sigils are missing. Puzzles you've never completed have no sigil at the end. Note that this is intended in Scavenger Hunt mode.
Show Full Signs is on, but some signs show question marks. This is generally caused by a sigil being missing, but it's a bit more obvious, especially in Nexus.
Loading is especially slow. Some errors will stop the precaching from starting, causing loads to be a lot slower. Note however that just rapidly changing worlds (for example in möbius mode) can also cause this.

To confirm one of these errors enter A1 and open the console (` or F1) and look for the message "'____' does not have a value assigned to it". If you see this message please send me a pastebin of your log file for that session, it's at [Talos Folder]\Log\Talos.log or Talos_Unrestricted.log for the moddable version.]]
goto: Loop
Expand Down
Binary file modified Options World/Options_RandomizerOptions.lua
Binary file not shown.
Binary file modified PaintItemUnlocking.lua
Binary file not shown.
3 changes: 2 additions & 1 deletion Plaintext Scripts/DevIsland_SignUpdater.txt
Expand Up @@ -8,6 +8,7 @@ Wait(CustomEvent("Randomizer_Finished"))
-- talosProgress : CTalosProgress
local talosProgress = nexGetTalosProgress(worldGlobals.worldInfo)
local showAll = talosProgress:IsVarSet("Randomizer_ShowAll")
local print = worldGlobals.print

local icons = {
["I"]="▄▄",
Expand Down Expand Up @@ -129,7 +130,7 @@ local function updateText()
local _, count = string.gsub(collected, sigil, "")
if count >= 1 then
if count > 1 then
conLogF("How did you collect " .. sigil .. " more than once???")
print("How did you collect " .. sigil .. " more than once???")
end
text[colour][i]:SetText(textPtr[colour][i], icons[type], true)
text["Default"][i]:SetText(textPtr["Default"][i], "✘", true)
Expand Down
9 changes: 9 additions & 0 deletions Plaintext Scripts/Islands_JetpackFixer.txt
@@ -0,0 +1,9 @@
local event = Wait(Event(worldInfo.PlayerBorn))
-- player : CPlayerPuppetEntity
local player = event:GetBornPlayer()

-- This will probably be expanded
local jetpack = nexGetTalosProgress(worldInfo):GetCodeValue("Randomizer_Jetpack")
if jetpack == 1 then
player:AddJetpack()
end
7 changes: 5 additions & 2 deletions Plaintext Scripts/Nexus_Extras.txt
Expand Up @@ -6,6 +6,9 @@

-- talosProgress : CTalosProgress
local talosProgress = nexGetTalosProgress(worldGlobals.worldInfo)
local print = worldGlobals.print
local printWarning = worldGlobals.printWarning
local printError = worldGlobals.printError

-- It's easier to open all gates, even the ones that'll dissapear later
if talosProgress:IsVarSet("Randomizer_NoGates") then
Expand Down Expand Up @@ -45,13 +48,13 @@ if talosProgress:IsVarSet("Randomizer_Portals") then
for i=1, #portalNames do
local locationNum = talosProgress:GetCodeValue(portalNames[i])
if locationNum < 0 then
conErrorF("Portal " .. portalNames[i] .. " does not have a location assigned to it!\n")
printError("Portal " .. portalNames[i] .. " does not have a location assigned to it!\n")
-- To make sure you notice, incase you're not looking at console
portalList[i]:SetPlacement(OOB)
else
portalList[i]:SetPlacement(portalLocations[locationNum])
if talosProgress:IsVarSet("Randomizer_Debug") then
conWarningF(string.format("Placing %s at %s\n", portalList[i]:GetName(), portalNames[locationNum]))
printWarning(string.format("Placing %s at %s\n", portalList[i]:GetName(), portalNames[locationNum]))
end
end
end
Expand Down
96 changes: 96 additions & 0 deletions Plaintext Scripts/Nexus_PrecachingFixer.txt
@@ -0,0 +1,96 @@
-- We want to get the player, but also have to wait for rando setup to finish
local event = Wait(All(Event(worldInfo.PlayerBorn), CustomEvent("Randomizer_Finished")))
-- player : CPlayerPuppetEntity
local player = event.all[1]:GetBornPlayer()

--[[
Workshop maps in general break precaching, let alone when the next world
to cache can vary from playthrough to playthrough, so I have to manually
re-implement it
]]--


-- talosProgress : CTalosProgress
local talosProgress = nexGetTalosProgress(worldGlobals.worldInfo)
--[[
Caching causes a bunch of log lines, which spam the console and are kind
of annoying, so if debug mode is on don't do anything
]]
if not talosProgress:IsVarSet("Randomizer_Debug") then
local function cache(world, high)
if high then
worldInfo:AddToWorldCache_AsHighPriority("Content/Talos/Levels/Randomizer/" .. world .. ".wld")
else
worldInfo:AddToWorldCache("Content/Talos/Levels/Randomizer/" .. world .. ".wld")
end
end

local fileNames = {
"Cloud_1_01", "Cloud_1_02", "Cloud_1_03", "Cloud_1_04",
"Cloud_1_05", "Cloud_1_06", "Cloud_1_07", "Cloud_1_08",
"DeveloperIsland",
"Cloud_1_01", "Cloud_1_02", "Cloud_1_03", "Cloud_1_04",
"Cloud_1_05", "Cloud_1_06", "Cloud_1_07", "Cloud_1_08",
"Cloud_1_01", "Cloud_1_02", "Cloud_1_03", "Cloud_1_04",
"Cloud_1_05", "Cloud_1_06", "Cloud_1_07", "Cloud_1_08",
"Islands_01"
}

--[[
The basic idea for Nexus is to cache everything in the player's hub with
high priority, and everything else on standard
]]--
local function cacheA()
cache("Islands_02", true)
cache("Islands_03", false)
for i=1, #fileNames do
cache(fileNames[i], i <= 9)
end
end

local function cacheB()
cache("Islands_02", false)
cache("Islands_03", true)
for i=1, #fileNames do
cache(fileNames[i], 10 <= i and i <= 17)
end
end

local function cacheC()
cache("Islands_02", false)
cache("Islands_03", false)
for i=1, #fileNames do
cache(fileNames[i], 18 <= i)
end
end

local function cacheAll()
cache("Islands_02", false)
cache("Islands_03", false)
for i=1, #fileNames do
cache(fileNames[i], false)
end
end

-- Use the player's y value to try work out what world they're likely to visit next
local y = player:GetPlacement().vy
if -100 < y and y <= 0 then
cacheA()
elseif -200 < y and y <= -100 then
cacheB()
elseif y <= -200 then
cacheC()
else
cacheAll()
end

-- If the player goes down an elevator try redo caching, in case they don't reset
RunHandled(WaitForever,
OnEvery(Event(AButton.Used)),
cacheA,
OnEvery(Event(BButton.Used)),
cacheB,
OnEvery(Event(CButton.Used)),
cacheC
)
end
6 changes: 3 additions & 3 deletions Plaintext Scripts/PaintItemUnlocking.txt
Expand Up @@ -4,7 +4,7 @@
This lets us optimize the script a bit, no need to use a RunHandled(),
but this is still functionally equivalent, with the same paint sets
]]--
Wait(Delay(0.00001))
Wait(CustomEvent("Randomizer_Finished"))

local function RandomFomStringChars(str, multiplier)
local len = #str
Expand All @@ -17,13 +17,13 @@ local function RandomFomStringChars(str, multiplier)
end

-- talosProgress : CTalosProgress
local talosProgress = nexGetTalosProgress(worldGlobals.worldInfo)
local talosProgress = nexGetTalosProgress(worldInfo)
local randomSeed = talosProgress:GetCodeValue("PaintItemSeed")
if randomSeed == -1 then
randomSeed = mthRoundF(mthRndF()*8909478)
talosProgress:SetCode("PaintItemSeed", randomSeed)
end
local worldName = string.match(worldGlobals.worldInfo:GetWorldFileName(), "([^/]+)%.wld$")
local worldName = string.match(worldGlobals.currentWorld, "([^/]+)%.wld$")
if randomSeed < 0 then
randomSeed = -randomSeed
end
Expand Down

0 comments on commit 2f423e9

Please sign in to comment.