• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

ltmauve

Recruit
2 Badges
Jul 4, 2021
2
0
  • Surviving Mars
  • Surviving Mars: Digital Deluxe Edition
I'm attempting to make a new class of training building (in order to convert my colonists into biorobots.) However, the game doesn't seem to be registering the new class and is assigning any instance of these buildings a class of just "Building" (I've been using ECM to check it.)

Inside the spoiler is both the code for the class and the entry from items.lua for the mod.
Code:
DefineClass.ConversionFacility = {
    __parents = {"ElectricityConsumer", "TrainingBuilding"},
   
}
(There is more but I commented out in case there was a bad function causing the file to just not load or something. It did not help.)
Code:
PlaceObj('ModItemCode', {
    'FileName', "Code/ConversionFacility.lua",
}),
PlaceObj('ModItemBuildingTemplate', {
    'Group', "Habitats",
    'Id', "ConversionFacility",
    'template_class', "ConversionFacility",
    'pin_rollover_hint', T(871660287754, --[[ModItemBuildingTemplate ConversionFacility pin_rollover_hint]] "<image UI/Infopanel/left_click.tga 1400> Select"),
    'pin_rollover_hint_xbox', T(866263449281, --[[ModItemBuildingTemplate ConversionFacility pin_rollover_hint_xbox]] "<image UI/PS4/Cross.tga> View"),
    'construction_cost_Concrete', 10000,
    'construction_cost_Polymers', 15000,
    'construction_cost_Electronics', 15000,
    'build_points', 6000,
    'is_tall', true,
    'dome_required', true,
    'upgrade1_icon', "",
    'upgrade2_icon', "",
    'maintenance_resource_type', "Electronics",
    'consumption_max_storage', 10000,
    'display_name', T(273560678870, --[[ModItemBuildingTemplate ConversionFacility display_name]] "Robotifaction Facility"),
    'display_name_pl', T(711580370294, --[[ModItemBuildingTemplate ConversionFacility display_name_pl]] "Robotification Facilities"),
    'description', T(662294406918, --[[ModItemBuildingTemplate ConversionFacility description]] "Converts organic pops into robotic pops."),
    'build_category', "Habitats",
    'display_icon', "UI/Icons/Buildings/academy_of_science.tga",
    'build_pos', 15,
    'entity', "Academy",
    'encyclopedia_id', "ConversionFacility",
    'encyclopedia_text', T(664713061683, --[[ModItemBuildingTemplate ConversionFacility encyclopedia_text]] "Within this building, humans are converted into biorobots, in order to grant them immortality. Sterility is a small price to pay."),
    'encyclopedia_image', "UI/Encyclopedia/ResearchLab.tga",
    'key_bindable', false,
    'label1', "InsideBuildings",
    'label2', "TrainingBuildings",
    'palette_color1', "inside_accent_2",
    'palette_color2', "inside_base",
    'palette_color3', "inside_accent_research",
    'demolish_sinking', range(5, 10),
    'demolish_debris', 80,
    'entity2', "ResearchLabCP3",
    'entitydlc2', "contentpack3",
    'palette2_color1', "inside_base",
    'palette2_color2', "inside_accent_research",
    'palette2_color3', "inside_accent_research",
    'evaluation_points', 2,


}),
I would appreciate any help in getting this working.
 
Eh, I copied it into a mod and it seems fine?

Clipboard Image.jpg
 

Attachments

  • ConversionFacility.zip
    21,7 KB · Views: 0
Okay, thanks for the help. I think I realized what was going on.
I left a copy of my complete script as "Script.lua" in the Code folder, as one of the things I tried was having a code file named the same as the class, in case that helped. So I think that might have been it, because I just checked the rest of the code and that didn't work. And apparently SM just runs any lua file it can get its hands on, and the bad one was breaking it.

So now it's figuring out how to get my lua file to work and figuring out how to access the colonist name generator. (One of the features I wanted to add was to rename the treated colonists.) (EDIT: Oh, and figuring out how to lock it behind The Positronic Brain for balance reasons.)
 
Last edited: