Skip to content

Game crashes on shutdown with microcontroller turned on #525

@xenerax

Description

@xenerax

Describe the bug
When i run this code on a microcontroller the games crashes when pressing the "exit to main menu" button. Running this on a computer makes this not happen and turning the MC of prevents this as well.

--##### setup constructor #####
local TargetConstructor   = classes.Build_ConstructorMk1_C
local Targets = component.proxy(component.findComponent(TargetConstructor))
local ThisTarget = Targets[1]

--##### setup control pannel #####
local ThisPanel = component.proxy(component.findComponent(classes.LargeControlPanel))[1]

--##### setup control modules #####
local ThisButtonSet = ThisPanel:GetModule(3,5,0)
local ThisPotiSelect = ThisPanel:GetModule(7,5,0)
local ThisMicroDisplaySet = ThisPanel:GetModule(3,6,0)
local ThisMicroDisplaySelect = ThisPanel:GetModule(7,6,0)
local ThisTextDisplaySet = ThisPanel:GetModule(3,3,0)
local ThisTextDisplaySelect = ThisPanel:GetModule(7,3,0)

local Recipes = ThisTarget:GetRecipes()		--table/array in dem die rezepte gespeichert sind

ThisButtonSet:setColor(255,0,0,0.01)		--button color auf rot schwach leuchtend
ThisPotiSelect.max = #Recipes			--setzt maximal wert vom poti auf anzahl rezepte
ThisPotiSelect.min = 1					--setzt min wert auf 1

ThisTextDisplaySelect.size = 35			--schriftgröße anpassen
ThisTextDisplaySet.size = 35				--schriftgröße anpassen


event.ignoreAll()						--events ignorieren
event.clear()							--event historie löschen

event.listen(ThisPotiSelect)				--auf event von poti 
event.listen(ThisButtonSet)				--auf event von button


while true do
	
	local e,s = event.pull()								--event informationen e(event) und s(sender) ziehen
	if(s == ThisPotiSelect or s == ThisButtonSet) then			--wenn s => sender poti oder button ist dann...
		
		
		if e == "valueChanged" then						--wenn e vom poti kommt dann...
		
			--if ThisPotiSelect.Value > #Recipes then		--umschlagen von max auf 1 und umgekehrt beim zählen
            --  ThisPotiSelect.Value = 1							--aber ohne funktion wegen min/max weiter oben
            --elseif ThisPotiSelect.Value < 1 then
            --  ThisPotiSelect.Value = #Recipes
            --end
		
			ThisMicroDisplaySelect:setText(ThisPotiSelect.Value)			--setzt zal von poti in display
			ThisTextDisplaySelect.text = Recipes[ThisPotiSelect.Value].name	--setzt namen von rezept von zahl von poti in textdisplay
			
		
		elseif e == "Trigger" then								--wenn e vom button kommt dann...
			ThisMicroDisplaySet:setText(ThisPotiSelect.Value)			--setzt zahl von poti in displa wenn button pressed
			ThisTarget:setRecipe(Recipes[ThisPotiSelect.Value])		--setzt rezept in gebäude
			ThisTextDisplaySet.text = ThisTarget:getRecipe().name		--liest rezept von gebeude und setzt in textdisplay
		end	
	end	
end

recipie_changer_constructor.txt

Provide the Debug-File you can generate with SMM.
SMMDebug-2026-02-02-15-42-03.zip

To Reproduce
Steps to reproduce the behavior:

  1. Build controlpanel, constructor, put MC on one of them and connect them with network cable
  2. load my script
  3. ad modules to panel like this
Image
  1. turn on MC
  2. save game

Expected behavior
Pressing "exit to main menu" button crashes the game.

Additional context
version 1.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions