AdditionalPylons

mommy.lua

Oct 22nd, 2025 (edited)
925
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 KB | None | 0 0
  1. local args = {...}
  2.  
  3. local heart = "\x03"
  4. local hist = {}
  5. local f = fs.open("mommy_config.json","r")
  6. local text = f.readAll()
  7. local config = textutils.unserialiseJSON(text)
  8. f.close()
  9. config.emoji = string.char(config.emoji)
  10.  
  11. local function choice(t)
  12.     return t[math.random(1,#t)]
  13. end
  14. local function fill(s)
  15.     strconfig = {
  16.         ["emoji"]=config.emoji,
  17.         ["affectionate_term"]=choice(config.affectionate_terms),
  18.         ["role"]=choice(config.roles),
  19.         ["pronoun"]=choice(config.pronouns)
  20.     }
  21.     for i,v in pairs(strconfig) do
  22.         s = string.gsub(s, "{"..i.."}", v)
  23.     end
  24.     return s
  25. end
  26. local function respond(r)
  27.     term.setBackgroundColor(colors.black)
  28.     term.setTextColor(config.color)
  29.     if r then
  30.         if not config.only_negative then
  31.             print(fill(choice(config.positive_responses)))
  32.         end
  33.     else
  34.         print(fill(choice(config.negative_responses)))
  35.     end
  36. end
  37.  
  38. if #args>0 then
  39.     if fs.isDir(args[1]) then
  40.         term.setBackgroundColor(colors.black)
  41.         term.setTextColor(colors.yellow)
  42.         term.clear()
  43.         term.setCursorPos(1,1)
  44.         print(os.version())
  45.         shell.exit()
  46.     else
  47.         respond(shell.execute(table.unpack(args)))
  48.         return
  49.     end
  50. end
  51. while true do
  52.     term.setBackgroundColor(colors.black)
  53.     term.setTextColor(colors.yellow)
  54.     write(heart.." "..shell.dir().."> ")
  55.     term.setTextColor(colors.white)
  56.     hist[#hist+1]=read(nil,hist,shell.complete)
  57.     respond(shell.run(hist[#hist]))
  58. end
Advertisement
Add Comment
Please, Sign In to add comment