midspace / Space-Engineers-Admin-script-mod

Modding script for Space Engineers with dozens of Admin commands for creating game scenarios or supporting servers.
44 stars 13 forks source link

magic welder command #101

Open midspace opened 9 years ago

midspace commented 9 years ago
MyAPIGateway.Session.DamageSystem.RegisterBeforeDamageHandler(0, DamageHandler);

private void DamageHandler(object target, ref MyDamageInformation info)
{
    if (info.Type == Sandbox.Common.ObjectBuilders.Definitions.MyDamageType.Weld)
    {
        VRage.ModAPI.IMyEntity entity = MyAPIGateway.Entities.GetEntityById(info.AttackerId);
        var toolbase = entity as Sandbox.Game.Weapons.MyEngineerToolBase;
        var handheld = entity as Sandbox.Game.Entities.IMyHandheldGunObject<Sandbox.Game.Weapons.MyToolBase>;

   }
}
protected MySlimBlock GetTargetBlock()
{
    if (this.ReachesCube(this.m_toolActionDistance) && this.m_targetGrid != null)
    {
        return this.m_targetGrid.GetCubeBlock(this.m_targetCube);
    }
    return null;
}