Important Pluton for Experimental Branch

Status
Not open for further replies.

balu92

Retired Staff
Retired Staff
Trusted Member
Jul 11, 2014
338
75
28
34
I think we can generate it from heightmap and biome... would be easier imo.
 
  • Like
Reactions: mikec

Skully

Plugin Developer
Plugin Developer
Sep 8, 2014
91
7
8
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...?
 

balu92

Retired Staff
Retired Staff
Trusted Member
Jul 11, 2014
338
75
28
34
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.
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
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.
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
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
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
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..
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
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).
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
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");
            }
 

[KR]teledong

New Member
Member
Oct 13, 2014
6
0
1
37
Parts Unknown
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.
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
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.