Prevent MLRS DamageSolved

Hello,

I never thought to test the MLRS system when it was added to the game, but with TruePVE enabled, I was able to fire volleys of rockets at target bases and do damage. On my server, raiding is prevented until Purge at end of the wipe. I was curious if anyone has a config to prevent MLRS damage to bases?

Thanks!

Sorry, on my phone I didn't see any other posts but when I got back to my PC, I found the shared config below:

{
      "name": "mlrs",
      "members": "MLRSRocket, rocket_mlrs",
      "exclusions": ""
    },

"mlrs cannot hurt anything",​

I have tried that and whenever I reload the plugin those lines dissappear. 

3Hiw6KaPHRJ4rC0.jpg PinkPhoenixSB

I have tried that and whenever I reload the plugin those lines dissappear. 

Mine seemed to stay. Maybe unload the plugin, save the config changes, then reload the plugin. I've seen where some plugins will save the currently loaded config and data when it unloads, so not sure if this is the case or not.

l33tpr0digy

Sorry, on my phone I didn't see any other posts but when I got back to my PC, I found the shared config below:

{
      "name": "mlrs",
      "members": "MLRSRocket, rocket_mlrs",
      "exclusions": ""
    },

"mlrs cannot hurt anything",​

so this did not work

Looks to me that the problem is not with our configs, but the initiator checks:

======================
==  STARTING TRACE  ==
==  17:22:14.53326  ==
======================
 From: MLRSRocket, rocket_mlrs
 To: BuildingBlock, wall
  Checking exclusions between [empty] and [empty]
   Shared locations: none
   No shared locations, or no matching exclusion mapping - no exclusions
 No exclusion found - looking up RuleSet...
 Using RuleSet "default"
 Initiator empty; allow and return​

TruePVE checks for a BaseProjectile, if the initiator of this BaseProjectile is empty, it adds the owner/creator of it as initiator. But... MLRS Rocket is a ServerProjectile and afaik these are not the same. 
They however DO get an owner/creator assigned when they are fired:
if (driver.IsValid())
{
    baseEntity.creatorEntity = driver;
    baseEntity.OwnerID = driver.userID;
}​

I tried to add the following 3 lines of code and it seems to work:
if (weapon is MLRSRocket && hitInfo.Initiator == null)
{
    hitInfo.Initiator = weapon.creatorEntity;
}

I added it right after the BaseProjectile check on line 978. So after this:

if (weapon is BaseProjectile && hitInfo.Initiator == null)
{
    var projectile = weapon as BaseProjectile;

    hitInfo.Initiator = projectile.GetOwnerPlayer();
}
c0rNUZy0rgK0NzJ.PNG bozz0546

Looks to me that the problem is not with our configs, but the initiator checks:

======================
==  STARTING TRACE  ==
==  17:22:14.53326  ==
======================
 From: MLRSRocket, rocket_mlrs
 To: BuildingBlock, wall
  Checking exclusions between [empty] and [empty]
   Shared locations: none
   No shared locations, or no matching exclusion mapping - no exclusions
 No exclusion found - looking up RuleSet...
 Using RuleSet "default"
 Initiator empty; allow and return​

TruePVE checks for a BaseProjectile, if the initiator of this BaseProjectile is empty, it adds the owner/creator of it as initiator. But... MLRS Rocket is a ServerProjectile and afaik these are not the same. 
They however DO get an owner/creator assigned when they are fired:
if (driver.IsValid())
{
    baseEntity.creatorEntity = driver;
    baseEntity.OwnerID = driver.userID;
}​

I tried to add the following 3 lines of code and it seems to work:
if (weapon is MLRSRocket && hitInfo.Initiator == null)
{
    hitInfo.Initiator = weapon.creatorEntity;
}

I added it right after the BaseProjectile check on line 978. So after this:

if (weapon is BaseProjectile && hitInfo.Initiator == null)
{
    var projectile = weapon as BaseProjectile;

    hitInfo.Initiator = projectile.GetOwnerPlayer();
}

Hi, I tried making these changes and it doesn't appear to work. First of all, it appears you are using the previous version 2.0.5 as 2.0.6 is different at line 978.

However, I rolled back to 2.0.5 to try this fix and it still didn't work. When I debugged the code and tried to output the hitInfo.Initiator and weapon.creatorEntity or weapon.OwnerID they all return null.

Did you change anything else? What does your rule look like in the config? Any help appreciated.

gJtPGZjlP30oxqp.png ZEODE

Hi, I tried making these changes and it doesn't appear to work. First of all, it appears you are using the previous version 2.0.5 as 2.0.6 is different at line 978.

However, I rolled back to 2.0.5 to try this fix and it still didn't work. When I debugged the code and tried to output the hitInfo.Initiator and weapon.creatorEntity or weapon.OwnerID they all return null.

Did you change anything else? What does your rule look like in the config? Any help appreciated.

I see, my bad. In the current version (2.0.6) you can add it below line 893. Search for the comment:

// after heli check, return true if initiator is null

And paste the fix above:

if (weapon is MLRSRocket && hitInfo.Initiator == null)
{
     hitInfo.Initiator = weapon.creatorEntity;
}

// after heli check, return true if initiator is null


Rules are like opposed above:

"mlrs cannot hurt anything"


{
      "name": "mlrs",
      "members": "MLRSRocket, rocket_mlrs",
      "exclusions": ""
},
c0rNUZy0rgK0NzJ.PNG JOSHZ

I see, my bad. In the current version (2.0.6) you can add it below line 893. Search for the comment:

// after heli check, return true if initiator is null

And paste the fix above:

if (weapon is MLRSRocket && hitInfo.Initiator == null)
{
     hitInfo.Initiator = weapon.creatorEntity;
}

// after heli check, return true if initiator is null

Rules are like opposed above:

"mlrs cannot hurt anything"


{
      "name": "mlrs",
      "members": "MLRSRocket, rocket_mlrs",
      "exclusions": ""
},
Yeah I already found it and tested with it, but it doesn't work. The rockets do not appear to have an owner/creatorEntity assigned.

I added debug code to output the hitInfo.Initiator, weapon.OwnerID, and weapon.creatorEntity of the rockets but they are always assigned a 0/null, so not sure how you got it working.

fixed in next update

Locked automatically