-- This script changes the "Morph restoration" function of the Sea-Dome in -- Gondolin; in addition to its original virtually useless effect, it will -- now reverse the effects of gender-changing traps. To do this, of -- course, the script needs to know what your original sex was; if the -- script was active when you created the character, it'll be remembered -- then, otherwise (especially if you've already been affected by a trap), -- you should see the notes below. -- -- To install this script, follow these steps: -- -- - Copy this file into the lib/scpt/ directory of your ToME -- installation. Edit if necessary, as described below. -- - Edit the file lib/scpt/init.lua and add the line: -- -- tome_dofile("genmorph.lua") -- -- after the line 'tome_dofile("joke.lua")' [or anywhere near the -- bottom is good]. -- - Edit the file lib/edit/ba_info.txt and find the lines: -- -- N:49:Morph restoration -- C:1500:1500:1500 -- I:37:0:r -- -- Change the 37 to 75. -- -- NOTE: Some of the game's internal handling of player sex is not -- accessible via Lua, so you'll need to save and reload your character -- after using Morph restoration for the sex restoration to become visible. -- Storage for the player's original sex. player.psex_orig = -1 add_loadsave(player.psex_orig, -1) add_hooks { [HOOK_BIRTH] = function() -- The easy way: get original sex at birth. player.psex_orig = player.psex end, [HOOK_GAME_START] = function() if player.psex == -1 then -- Original sex didn't get set at birth, most -- likely because the character was created before -- this script was added; set original sex to -- current sex. player.psex_orig = player.psex end -- If your character has already been gender- -- trapped (why else install this script? :-}), -- you'll probably want to temporarily uncomment -- this and adjust appropriately to forcibly set -- your character's original sex to the right value. --if player_name() == "Adelia Burrows" then -- player.psex_orig = SEX_FEMALE --end end } add_building_action { -- Index is used in ba_info.txt to set the actions ["index"] = 75, ["action"] = function() -- Original function of the building action. set_mimic(0, 0, 0) -- Restore player sex if needed (and if we can). if player.psex_orig ~= -1 and player.psex ~= player.psex_orig then player.psex = player.psex_orig msg_print("The transmutation is reversed!") end -- Redraw and update stuff. player.redraw = bor(player.redraw, PR_TITLE) player.update = bor(player.update, PU_BODY, PU_BONUS, PU_SANITY) return TRUE, TRUE, FALSE end }