Jump to content

Compile Issue ('BaseEntity' cannot be handled by a pattern of type 'HumanNPC')

Closed 0.2.2 0.2.3

Shane156
Shane156

Posted

Hi,

For me, on oxide, this plugin never loads on server start, I get this error:

107 RoamingNPCs - Failed to compile: An expression of type 'BaseEntity' cannot be handled by a pattern of type 'HumanNPC'. | Line: 1418, Pos: 17

I asked CHATGPT why this happens, and how reloading it fixes it and it says you have to reference HumanNPC so that it's loaded before RoamingNPC

[Reference("HumanNPC")]

I asked chatgpt because I thought I'm the only one experiencing this, but I guess everyone else has this issue too?

Can you please look into this for me? as I have to current;y manually reload after every restart

Kind Regards

walkinrey

Posted

We are developing on oxide and have never faced this issue 
HumanNPC is Rust's npc class, it's not a plugin, so chatgpt is wrong here
Maybe you have some plugin with same name?

Shane156

Posted

Hi @walkinrey,

My server is also oxide and sorry for referencing chatgpt, maybe that made it more confusing, I was just trying to suggest a fix.

Basically, my problem is that after a server restart, your plugin fails to compile with the following message:

107 RoamingNPCs - Failed to compile: An expression of type 'BaseEntity' cannot be handled by a pattern of type 'HumanNPC'. | Line: 1418, Pos: 17

I don't want to post a single line of your code here, but looking at 1418 it does say HumanNPC

My theory is that the HumanNPC plugin needs to be running first in order for your plugin to compile and I believe after server restart, your plugin is trying to compile before HumanNPC is running

Quote

113 RoamingNPCs - Failed to compile: An expression of type 'BaseCombatEntity' cannot be handled by a pattern of type 'HumanNPC'. | Line: 6107, Pos: 31

then i have to run command o.reload RoamingNPCs and then it compiles

Quote

 

[CSharp] Started Oxide.Compiler v successfully

RoamingNPCs was compiled successfully in 1934ms

Loaded plugin Roaming NPCs v0.2.1 by walkinrey & Max39ru

 

I have to do this after every last restart

You say HumanNPC is Rusts NPC Class.. I thought it was the plugin from Razor? - https://umod.org/plugins/human-npc

But I guess not
 - as I just unloaded Razors Plugin and reloads RoamingNPCs and it still compiles
 

Quote

 

Calling 'Unload' on 'HumanNPC v0.6.5' took 337ms

Unloaded plugin Human NPC v0.6.5 by Razor

Unloaded plugin Roaming NPCs v0.2.1 by walkinrey & Max39ru

Loaded plugin Roaming NPCs v0.2.1 by walkinrey & Max39ru

 

Hmm, so yeah.. I'm not sure what's happening and if I'm alone with this problem.. but for what ever reason, after server restart I run plugins command and I see 

 

Quote

113 RoamingNPCs - Failed to compile: An expression of type 'BaseCombatEntity' cannot be handled by a pattern of type 'HumanNPC'. | Line: 6107, Pos: 31

And it's fixed by simply
 

Quote

o.reload RoamingNPCs

I can look into somehow running that reload command after server restart, but that would be a workaround.. Ideally, I would like to find root cause so that I can restart server and for your plugin to compile.

Do you have any ideas? I'm willing to give you access to my test server, screen-share, or do anything to help you.. would just like this to be working on server start

I'm running Oxide on a Linux Serve, if you need any additional information, please let me know 

walkinrey

Posted

I can make some change related to it but i'm not sure it'll help 100%. I'll drop update next week probably
For now you can try to use this or any similar plugin

 

Shane156

Posted

Thank you @walkinrey,  I hope you can fix and thank you for the workaround, I'll use that for now.

RickySpanish343

Posted

168 RoamingNPCs - Failed to compile: An expression of type 'BaseCombatEntity' cannot be handled by a pattern of type 'HumanNPC'. | Line: 6116, Pos: 31

having the same issue 

Shane156

Posted

Thanks for commenting @RickySpanish343, nice to know I'm not alone.. No idea what we are doing different to @walkinrey but hopefully he can figure it out 🤞

I will actually spin up another server now with only the RoamingNPCs plugin to see if another plugin is conflicting with it somehow.. I'll report back soon 🫡

  • Like 1
walkinrey

Posted

Yep, it's because of HumanNPC plugin, because it's called same name as Rust's class. I'll add a static reference to fix it, but i think this plugin should be updated to not be named as Rust class 

walkinrey

Posted

Changed Status from Pending to Closed

Changed Fixed In to 0.2.3

Shane156

Posted

HI @walkinrey,

Sorry as I didn't have time yet to test with only your plugin, but I have just updated my server with your new update and I rebooted and it works fine now! Thank you so much for your help! and keep up the good work with your plugins.. looking forward to the one where they can build a house 😎

2.1m

Downloads

Total number of downloads.

9.8k

Customers

Total customers served.

142.2k

Files Sold

Total number of files sold.

3m

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.