// Handle static color changes void CheckAndSetEmissives() { if (block.IsFunctional) { CurrentColor = ErrorColor; // Set to error color by default to easily spot an error. float mult = 1f; if (!block.IsWorking) { NeedsUpdate = MyEntityUpdateEnum.NONE; CurrentColor = NonWorkingColor; mult = ThrusterNotWorking_EmissiveMultiplier; } else if (block.Enabled) { CurrentColor = OnColor; mult = ThrusterOn_EmissiveMultiplier; } else { CurrentColor = OffColor; mult = ThrusterOff_EmissiveMultiplier; } block.SetEmissiveParts(EmissiveMaterialName, CurrentColor, mult); if (subpart != null) { subpart.SetEmissiveParts(EmissiveMaterialName, CurrentColor, mult); } } else { if (!ChangeColorByThrustOutput) { NeedsUpdate = MyEntityUpdateEnum.NONE; block.SetEmissiveParts(EmissiveMaterialName, NonFunctionalColor, ThrusterNonFunctional_EmissiveMultiplier); if (subpart != null) { subpart.SetEmissiveParts(EmissiveMaterialName, NonFunctionalColor, ThrusterNonFunctional_EmissiveMultiplier); } } } }
private void OnIsWorkingChanged(VRage.Game.ModAPI.IMyCubeBlock obj) { if (MyAPIGateway.Session == null) { return; } if (MyAPIGateway.Utilities.IsDedicated && MyAPIGateway.Multiplayer.IsServer) { return; } var color = IsWorking ? GREEN : RED; m_block.SetEmissiveParts(EMISSIVE_MATERIAL_NAME, color, 1f); }