[ModApi] MyObjectBuilder_TurretControlBlock does not fire Init(...)

J P shared this bug 5 months ago
Reported

I am trying to develop a mod.

But for some reason I could not hook into "SpaceEngineers.Game.ModAPI.IMyTurretControlBlock"s Init function.

I attached a little example mod to test with.


Steps to reproduce:


Create a new world. Add mod (rename ".cs.txt" to only ".cs" and place in appropriate location; can't upload cs-files)


  • Now build a Missionblock. ("AI Basic (Task)"-Block)
  • Building the MissionBlock should fire the "success" message.
  • Now build a CustomTurretController.
  • Building the CustomTurretController does not show the message in my case.


Here is the code again:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sandbox.ModAPI;
using VRage.Collections;
using VRage.Game;
using VRage.Game.Components;
using VRage.ModAPI;
using Sandbox.Game.Entities;
using VRageMath;
using VRage.Utils;
using VRage.Game.ModAPI.Ingame.Utilities;
using Sandbox.ModAPI.Interfaces.Terminal;

namespace bug_test
{
	// mission block
    [MyEntityComponentDescriptor(typeof(MyObjectBuilder_BasicMissionBlock), false)]
    public class mission_test : MyGameLogicComponent
    {
        public override void Init(MyObjectBuilder_EntityBase objectBuilder)
        {
			MyAPIGateway.Utilities.ShowMessage("missionblock", "success");
		}
	}
	
	// custom turret
    [MyEntityComponentDescriptor(typeof(MyObjectBuilder_TurretControlBlock), false)]
    public class turret_test : MyGameLogicComponent
    {
        public override void Init(MyObjectBuilder_EntityBase objectBuilder)
        {
			MyAPIGateway.Utilities.ShowMessage("turretblock", "success");
		}
	}
}
	

Replies (1)

photo
1

Hello, engineer!

Thank you for reaching our forum.

This issue has been reported into our internal system.

Kind Regards

Keen Software House: QA Department

Leave a Comment
 
Attach a file