Auto light candlesSolved

Hello, Im using MA to spawn candles (smallcandleset, largecandleset), but it spawn them turned off, and when manually ignited, they burn out after while. I hacked together plugin that fixes it, but it affects all candles obviously and I dont like that. Would it be in plugin scope to deal with candles in MA, so I dont need to use my plugin for candles? Or even better would be OnMonumentAddonSpawned hook for modifications of items spawned by MA. Or is there another way that I missed?

namespace Oxide.Plugins
{
    [Info("Candles", "marcuzz", "0.0.1")]
    [Description("Lights candles on spawn.")]
    public class Candles : RustPlugin
    {
        void OnEntitySpawned(Candle candle)
        {
            if (candle == null)
                return;

            if (candle.CanIgnite()) 
            {
                candle.burnRate = 0;
                candle.Ignite(candle.transform.position);
            }
        }
    }
}​

Yes, it would be in scope to auto light candles. I will add this to the long list of TODOs, alongside lighting lanterns. I also plan to add hooks at some point.

If you want, you can submit a PR on the develop branch. Could probably add it to the SingleEntityAdapter.PostEntitySpawn() method. Something like this:

var candle = Entity as Candle;
if (candle != null)
{
    candle.SetFlag(BaseEntity.Flags.On, true);
    candle.CancelInvoke(candle.Burn);
}

Longer term, I will probably make this follow the day/night cycle (when aboveground) like I'm planning to do for lights and lanterns in the future.

If you want to get more involved with the project, I have a long list of features which I could go over with you.

Thanks for reply.  I assumed that disabled 'Patch' feature on MA means you dont want any contribution so I didnt even try to implement it in MA. I will submit PR and Im definitely interested to get involved. BUT as you can see, I cant get even 2 lines of code right lol

I always disable patching for plugins that have an associated Git repository because that means of collaboration is far inferior to that of PRs.

I have a project board tracking my overall plugin work, but it would probably be useful to create issues on the repo to provide more detail and allow discussion. I'll see if I can do that this weekend.

Merged post

I've merged your PR. Thanks for the contribution!

I've also moved most of my TODO list for the plugin into issues on the GitHub repo for visibility and discussion. Several have been tagged with "good first issue" to indicate that they are fairly approachable to newcomers. Let me know if anything sparks your interest. I can also go into the specifics how most of these things should be implemented.

https://github.com/WheteThunger/MonumentAddons/issues

Wow what a list! Thanks for sharing it, I've put some comments there. Since PR related to this thread is merged, we can close it and continue on githib.

Locked automatically