[General] Implement handling of game setting records

Add and use unplaceableRecordTypes table in config.lua
This commit is contained in:
David Cernat
2021-07-18 11:47:00 +02:00
parent b509a0b3c3
commit 9cc8aa44e7
4 changed files with 48 additions and 10 deletions
+12 -1
View File
@@ -1213,6 +1213,16 @@ function commandHandler.StoreRecord(pid, cmd)
storedTable[inputSetting] = inputValue
end
-- Remove any stored settings that are mutually exclusive with the one we've added
if config.mutuallyExclusiveRecordSettings[inputType] ~= nil and
tableHelper.containsValue(config.mutuallyExclusiveRecordSettings[inputType], inputSetting) then
for _, excludedSetting in pairs(config.mutuallyExclusiveRecordSettings[inputType]) do
if excludedSetting ~= inputSetting then
storedTable[excludedSetting] = nil
end
end
end
local message = "Storing " .. inputType .. " " .. inputSetting .. " with value " .. inputValue .. "\n"
Players[pid]:Message(message)
else
@@ -1377,6 +1387,7 @@ function commandHandler.CreateRecord(pid, cmd)
elseif inputType == "creature" then packetBuilder.AddCreatureRecord(id, savedTable)
elseif inputType == "door" then packetBuilder.AddDoorRecord(id, savedTable)
elseif inputType == "enchantment" then packetBuilder.AddEnchantmentRecord(id, savedTable)
elseif inputType == "gamesetting" then packetBuilder.AddGameSettingRecord(id, savedTable)
elseif inputType == "ingredient" then packetBuilder.AddIngredientRecord(id, savedTable)
elseif inputType == "light" then packetBuilder.AddLightRecord(id, savedTable)
elseif inputType == "lockpick" then packetBuilder.AddLockpickRecord(id, savedTable)
@@ -1392,7 +1403,7 @@ function commandHandler.CreateRecord(pid, cmd)
tes3mp.SendRecordDynamic(pid, true, false)
if not tableHelper.containsValue({"spell", "cell", "script"}, inputType) then
if not tableHelper.containsValue(config.unplaceableRecordTypes, inputType) then
if inputType ~= "enchantment" then
if inputType == "creature" or inputType == "npc" then
message = message .. "You can spawn an instance of it using /spawnat "