DreamWeave-MP / CoreScripts

The serverside Lua scripts used to implement core functionality in S3MP.
MIT License
0 stars 1 forks source link

Urm fixes #23

Closed magicaldave closed 1 year ago

magicaldave commented 1 year ago

Adds packetBuilder handling for the new lighting/cell functionality within the server.

In order to test these fixes, download the CI artifact for https://github.com/DreamWeave-MP/Dreamweave/pull/27 or build the urm-fixes branch of the core along with the corresponding one in coreScripts.

This example script can be used to test some of the functionality.


cellMethods.createCell = function(pid, cmd)
  local cellName

  if not cmd[2] then
    cellName = "Balmora, Caius Cosades' House"
  else
    cellName = cmd[2]
  end

  cellMethods.push(pid, cellName, cellTable)

end

cellMethods.push = function (pid, cellName)
    tes3mp.LogAppend(enumerations.log.WARN, "Attempting to push cell: " .. cellName)

    tes3mp.ClearRecords()

    tes3mp.SetRecordType(enumerations.recordType["CELL"])

  local cellTable = {
    region = "sheogorad",
    quasiEx = true,
    fog = {
      red = 0,
      blue = 255,
      green = 0,
      density  = 25.55443,
    },
    hasWater = true,
    waterLevel = 255.255
  }

  RecordStores["cell"].data.permanentRecords[cellName .. " but blue"] = cellTable

  RecordStores["cell"]:QuicksaveToDrive()

  packetBuilder.AddCellRecord(cellName .. " but blue", cellTable)

    tes3mp.SendRecordDynamic(pid, true, false)

end

customCommandHooks.registerCommand("blue", cellMethods.createCell)

return cellMethods
magicaldave commented 1 year ago

Prior to actually merging these, we should be able to also add these attributes when creating a custom cell record via chat.