Important Pluton for Experimental Branch

Status
Not open for further replies.
I think we can generate it from heightmap and biome... would be easier imo.
 
  • Like
Reactions: mikec
Small question... Is it possible to connect multiple plugins together, like one has some def's what are needed in 3 of the plugins and that one has all the database and thing what gives response back to plugin what requested it...?
 
you can get another plugin with:
var pluginOther = Plugin.GetPlugin("OtherPluginName");
then invoke/call the method you want like:
pluginOther.Invoke("Method", param1, param2);

They return an object, but there is no guarantee that it works in all aspect, as I didn't tested if the return is usable from your plugin or not.
I called other methods from my plugins in another plugin, that works. I passed a dictionary and dumped the values to a file. That worked too.
 
It seems DamageAmount is a ReadOnly property and can't assign it. Tried your admin one too in case I had it wrong, same thing.

Code:
MissingMemberException: can't assign to read-only property DamageAmount of type 'PlayerHurtEvent'
Basically making:

Python:
PlayerHurtEvent.info.damageAmount = 0 # Should work.
 
Basically making:

Python:
PlayerHurtEvent.info.damageAmount = 0 # Should work.

Only thing is the PlayerHurtEvent is called after the the player was given bleeding and reduced health in Hooks.cs

This is where I get my no dmg to player for now, I modified the PlayerHurt function in Hooks with:

C#:
            if (!fromPlayer) {
                player.metabolism.bleeding.Add(Mathf.InverseLerp(0.0f, 100f, info.damageAmount));
                player.metabolism.SubtractHealth(info.damageAmount);
                player.TakeDamageIndicator(info.damageAmount, player.transform.position - info.PointStart);
            }

and so we don't see the red dmg effect:
C#:
            if (!fromPlayer) {
                player.SendEffect("takedamage_hit");
            }
****************************************************************************************************
****************************************************************************************************

NOW, If instead of my old version you put in Hooks.cs:
C#:
OnPlayerHurt.OnNext(new Events.PlayerHurtEvent(p, info));
just before
C#:
            if (!player.TestAttack(info) || !Realm.Server() || (info.damageAmount <= 0.0f))
                return;
            player.metabolism.bleeding.Add(Mathf.InverseLerp(0.0f, 100f, info.damageAmount));
            player.metabolism.SubtractHealth(info.damageAmount);
            player.TakeDamageIndicator(info.damageAmount, player.transform.position - info.PointStart);
            player.CheckDeathCondition(info);
and add hitinfo = info; to PlayerHurtEvent.cs next to Victim = player; (because we don't get hitinfo from there or hurtevent, I tested)

Then YES, on the first call of PlayerHurtEvent, we can set the PlayerHurtEvent.hitinfo.damageAmount in our plugin to set it to whatever damage we want (including 0) :)

That means we are calling PlayerHurtEvent twice for the same hit though. It's just my hacky way to think of it, I am sure you guys can figure something better
 
Only thing is the PlayerHurtEvent is called after the the player was given bleeding and reduced health in Hooks.cs

This is where I get my no dmg to player for now, I modified the PlayerHurt function in Hooks with:

C#:
            if (!fromPlayer) {
                player.metabolism.bleeding.Add(Mathf.InverseLerp(0.0f, 100f, info.damageAmount));
                player.metabolism.SubtractHealth(info.damageAmount);
                player.TakeDamageIndicator(info.damageAmount, player.transform.position - info.PointStart);
            }

and so we don't see the red dmg effect:
C#:
            if (!fromPlayer) {
                player.SendEffect("takedamage_hit");
            }
****************************************************************************************************
****************************************************************************************************

NOW, If instead of my old version you put in Hooks.cs:
C#:
OnPlayerHurt.OnNext(new Events.PlayerHurtEvent(p, info));
just before
C#:
            if (!player.TestAttack(info) || !Realm.Server() || (info.damageAmount <= 0.0f))
                return;
            player.metabolism.bleeding.Add(Mathf.InverseLerp(0.0f, 100f, info.damageAmount));
            player.metabolism.SubtractHealth(info.damageAmount);
            player.TakeDamageIndicator(info.damageAmount, player.transform.position - info.PointStart);
            player.CheckDeathCondition(info);
and add hitinfo = info; to PlayerHurtEvent.cs next to Victim = player; (because we don't get hitinfo from there or hurtevent, I tested)

Then YES, on the first call of PlayerHurtEvent, we can set the PlayerHurtEvent.hitinfo.damageAmount in our plugin to set it to whatever damage we want (including 0) :)

That means we are calling PlayerHurtEvent twice for the same hit though. It's just my hacky way to think of it, I am sure you guys can figure something better
Or balu could simply add a Set { } at the damageamount pointer..
 
Need the whole HitInfo I think because then you don't know where the dmg comes from, as far as utility of it anyways :)
He doesn't have too, I mean I know there are more important functions, just trying to get something working for my needs (and PvE in rust is a very small part).
 
Awesome changes Balu, now we have a nice control over damage (can use multiplier etc).
One thing I added in Hooks so that if info.damageAmount = 0.0f, we don't show damage/bleed effect since there was no damage to start with:

C#:
            if (info.damageAmount > 0.0f) {
                player.metabolism.bleeding.Add(Mathf.InverseLerp(0.0f, 100f, info.damageAmount));
                player.metabolism.SubtractHealth(info.damageAmount);
                player.TakeDamageIndicator(info.damageAmount, player.transform.position - info.PointStart);
                player.CheckDeathCondition(info);

                player.SendEffect("takedamage_hit");
            }
 
C#:
public void KillTimer(string name)
        {
            TimedEvent timer = GetTimer(name);
            if (timer != null)
                return;

            timer.Kill();
            Timers.Remove(name);
        }

is wrong....

It's only kill timer variable is null.

It should be

C#:
        public void KillTimer(string name)
        {
            TimedEvent timer = GetTimer(name);
            if (timer == null)
                return;

            timer.Kill();
            Timers.Remove(name);
        }

If null is return, otherwise kill timer :)

Change source will work timer perfectly.
 
Did I just see AttachParachute(p.basePlayer); :D

Sooo yeah I had to try it:
2014_10_16_00003.jpg
 
  • Funny
Reactions: CorrosionX
Not that I noticed, you can move while falling but normal running speed and fall just as usual... FOR NOW (I hope)
 
Status
Not open for further replies.