mt-mods / technic

Technic mod for Minetest
18 stars 25 forks source link

CNC upgrade function useless in technic_run callback #190

Closed S-S-X closed 3 years ago

S-S-X commented 3 years ago

Calling upgrade_machine(meta) here is practically useless because old machines actually did clear field after production was completed or output inventory full: https://github.com/mt-mods/technic/blob/6d10de1bd32ae24461f3ce62e2041c320d70446d/technic_cnc/api.lua#L256-L259

Either remove it completely or better make it check for technic_power_machine meta field instead as it seems that is not (and was not) used for anything but was set for old CNC machines. Old machine initialization code before mk2 upgrade: https://github.com/mt-mods/technic/blob/43554b870ce7b01a803d6de516189411ae4dfdb5/technic_cnc/cnc.lua#L257-L265

Checking technic_power_machine allows clearing last unnecessary meta field from already upgraded machines.

Attempt to upgrade program data in upgrade function is not really useful because it is cleared when production completed on old machines, it works but approximately 100% of machines wont actually have any program set for upgrade: https://github.com/mt-mods/technic/blob/6d10de1bd32ae24461f3ce62e2041c320d70446d/technic_cnc/api.lua#L225-L241