Jump to content

Carbon Update

Pending 1.9.7

CupsOhJoe
CupsOhJoe

Posted

Any plans to update the plugin for Carbon?

CupsOhJoe

Posted

Failed to call internal hook 'OnLootSpawn' on plugin 'BagOfHolding v1.9.7' [767976070] (Object reference not set to an instance of an object)
   at void Oxide.Plugins.BagOfHolding.OnLootSpawn(LootContainer lootContainer) in /home/container/carbon/plugins/BagOfHolding.cs:line 1140
   at object Oxide.Plugins.BagOfHolding.InternalCallHook(uint hook, object[] args) in BagOfHolding.cs/Internal:line 967
Failed to call internal hook 'OnLootSpawn' on plugin 'BagOfHolding v1.9.7' [767976070] (Object reference not set to an instance of an object)
   at void Oxide.Plugins.BagOfHolding.OnLootSpawn(LootContainer lootContainer) in /home/container/carbon/plugins/BagOfHolding.cs:line 1140
   at object Oxide.Plugins.BagOfHolding.InternalCallHook(uint hook, object[] args) in BagOfHolding.cs/Internal:line 967
Failed to call internal hook 'OnLootSpawn' on plugin 'BagOfHolding v1.9.7' [767976070] (Object reference not set to an instance of an object)
   at void Oxide.Plugins.BagOfHolding.OnLootSpawn(LootContainer lootContainer) in /home/container/carbon/plugins/BagOfHolding.cs:line 1140
   at object Oxide.Plugins.BagOfHolding.InternalCallHook(uint hook, object[] args) in BagOfHolding.cs/Internal:line 967

BlackLightning

Posted

Looking at the line of code in the stacktrace, I get the sense this isn't really a Carbon compatibility issue, but rather a Carbon framework issue, or some bad plugin that is calling hooks incorrectly. I've seen a recurring theme with Carbon servers where hooks are called with null arguments, which doesn't happen in Oxide. While it's possible for developers to add null checks in such cases, whatever is the source of the problem, it's creating unnecessary work for many developers to handle, so the problem should be handled at the source rather than in plugins that have correctly defined hooks.

private void OnLootSpawn(LootContainer lootContainer)
{
    if (lootContainer.OwnerID != 0 || lootContainer.skinID != 0) // <----- This line
        return;

    if (!_config.LootConfig.SpawnChanceByPrefabId.TryGetValue(lootContainer.prefabID, out var spawnChanceByProfile))
        return;

    ScheduleLootSpawn(lootContainer, spawnChanceByProfile);
}

Here is the decompiled Oxide code for reference, which demonstrates that OnLootSpawn cannot be called with null ("this" can never be null).

public virtual void SpawnLoot()
{
	if (base.inventory == null)
	{
		Debug.Log("CONTACT DEVELOPERS! LootContainer::PopulateLoot has null inventory!!!");
		return;
	}
	base.inventory.Clear();
	ItemManager.DoRemoves();
	if (Interface.CallHook("OnLootSpawn", this) == null)
	{
		PopulateLoot();
		if (shouldRefreshContents)
		{
			Invoke(SpawnLoot, UnityEngine.Random.Range(minSecondsBetweenRefresh, maxSecondsBetweenRefresh));
		}
	}
}

I can't imagine how the logic would be different in Carbon to result in this issue, so another possibility is that you have some bad plugin installed which is calling "OnLootSpawn" with null or unspecified arguments. You could try searching all your plugin files for "OnLootSpawn" to narrow it down. If you see anything like CallHook("OnLootSpawn") or CallHook(nameof(OnLootSpawn)) exactly, then that's obviously incorrect code which needs to be fixed by that plugin's maintainer. To get a directional indicator of whether this is a Carbon framework issue vs something caused by another plugin, you could also try unloading all other plugins (on a test server) and triggering loot spawns, either by directly spawning individual loot containers, or via the "spawn.fill_groups" server command (which may spawn many loot containers).

CupsOhJoe

Posted

This may a good conversation to bring up to Raul, I know carbon is more detrimental with null checks. I'll see what Raul says.

BlackLightning

Posted

Have you gotten any update from Raul or others on the Carbon team?

At this point, there's not much value in keeping the ticket open as this issue isn't with this plugin.

1.7m

Downloads

Total number of downloads.

8k

Customers

Total customers served.

121.2k

Files Sold

Total number of files sold.

2.5m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.