Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

Please Help: How to Disable handheld Drill?

Discussion in 'Modding' started by Iamkky, Jun 3, 2020.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Iamkky Trainee Engineer

    Messages:
    6
    Please, need help to disable handheld Drill.

    I would like to disable drill in hand of the player. Any help would be appreciated.
    Code bellow is a skeleton to best show to question.

    <code>
    [MyEntityComponentDescriptor(typeof(MyObjectBuilder_HandDrill), false)]
    public class PlanetaryWarfareHandDrillLogicComponent : MyGameLogicComponent
    {
    public override MyObjectBuilder_EntityBase GetObjectBuilder(bool copy = false)
    {
    return Container.Entity.GetObjectBuilder(copy);
    }

    public override void Init(MyObjectBuilder_EntityBase objectBuilder)
    {
    NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME;
    }

    public override void UpdateBeforeSimulation()
    {

    // I used isShooting to verify it's being used. Works ok.

    if ((Container.Entity as IMyHandheldGunObject<Sandbox.Game.Weapons.MyToolBase>).IsShooting){

    // I've tried EndShoot. But only works in singleplayer.
    (Container.Entity as IMyHandheldGunObject<Sandbox.Game.Weapons.MyToolBase>).EndShoot(MyShootActionEnum.PrimaryAction);


    // Instead I've tried delete, but Delete does not remove drill, just the visual, drill keeps working !!!
    Container.Entity.Delete();

    // In fact i just want to prevent drill from happen.
    }
    }
    }

    </code>

    Thks
     
Thread Status:
This last post in this thread was made more than 31 days old.