OnStructureRepair sometimes didn't call the orignal functionNot An Issue
just installed a rust server locally and try to learn how to develop a umod plugin,after few helloworld test I found that OnStructureRepair doen't works as expected.
looks like sometimes OnStructureRepair didn't return back to orignal function.
code here:
using Oxide.Core;
using ProtoBuf;
using System;

namespace Oxide.Plugins
{
    [Info("testp", "arryboom", "0.1.0")]
    [Description("Makes epic stuff happen")]
    class testp : RustPlugin
    {
        private void Init()
        {
            Puts("A baby plugin is born!");
        }
        [ChatCommand("xxw")]
        private void FriendCommand(BasePlayer player, string command, string[] args)
        {
                player.ChatMessage("who is your daddy");
                return;
        }
        [ConsoleCommand("addcommand")]
        private void ccmdAddCommand(ConsoleSystem.Arg arg)
        {
          Puts("tt");
        }
		object OnStructureRepair(BaseCombatEntity entity, BasePlayer player)
		{
			Puts("OnItemRepair works!");
			player.GiveItem(ItemManager.CreateByItemID(int.Parse("785728077")));
			return null;
		}
		void OnPlayerRespawned(BasePlayer player)
		{
			Puts("OnPlayerReSpawn works!");
			player.GiveItem(ItemManager.CreateByItemID(int.Parse("785728077"),100));
			player.GiveItem(ItemManager.CreateByItemID(int.Parse("1318558775")));
			return;
		}
    }
}​


expected when I fix a entity it will recover the health of entity and give me something(here was pistol ammo) at the same time.
but I got pistol ammo only at the first few click on entity with repair hammer,there has no health of entity has been added.
and weired thing is,when I tried click more time(~15) it will start to recover the health of entity and give me pistol ammo as expected.


video can be found here(if above cannot showed).
https://streamable.com/0unz0


I thought it was maybe the plugin conflict,so after this video restart server and load this testp.cs only,the problem continuted,by the doc https://umod.org/documentation/games/rust#onstructurerepair

  • Returning a non-null value cancels repair
return null shouldn't disturb the orignal repair procdure,is there any missing part or misunderstand for me?

all things are up to date.

Oxide.Rust Version: 2.0.4253

Are there any warnings in the SERVER console?

Merged post

As I see on the video there are no warnings in the console. Who knows, what if it's a rust feature
Locked automatically