Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Custom role saving #345

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ChapterMaster.yyp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"daemon7.png","CopyToMask":-1,"filePath":"datafiles/images/diplomacy",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"daemon8.png","CopyToMask":-1,"filePath":"datafiles/images/diplomacy",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"daemon9.png","CopyToMask":-1,"filePath":"datafiles/images/diplomacy",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"diplomacy_icons.png","CopyToMask":-1,"filePath":"datafiles/images/diplomacy",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"diplomacy10.png","CopyToMask":-1,"filePath":"datafiles/images/diplomacy",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"diplomacy11.png","CopyToMask":-1,"filePath":"datafiles/images/diplomacy",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"diplomacy12.png","CopyToMask":-1,"filePath":"datafiles/images/diplomacy",},
Expand All @@ -184,6 +183,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"diplomacy6.png","CopyToMask":-1,"filePath":"datafiles/images/diplomacy",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"diplomacy7.png","CopyToMask":-1,"filePath":"datafiles/images/diplomacy",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"diplomacy8.png","CopyToMask":-1,"filePath":"datafiles/images/diplomacy",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"diplomacy_icons.png","CopyToMask":-1,"filePath":"datafiles/images/diplomacy",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"instructions.txt","CopyToMask":9223372036854775807,"filePath":"datafiles/images/diplomacy",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"symbol1.png","CopyToMask":-1,"filePath":"datafiles/images/diplomacy",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"symbol2.png","CopyToMask":-1,"filePath":"datafiles/images/diplomacy",},
Expand Down Expand Up @@ -397,10 +397,10 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"eldar.json","CopyToMask":-1,"filePath":"datafiles/main/names",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"genestealercult.json","CopyToMask":-1,"filePath":"datafiles/main/names",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"hulk.json","CopyToMask":-1,"filePath":"datafiles/main/names",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"imperial_ship.json","CopyToMask":-1,"filePath":"datafiles/main/names",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"imperial.json","CopyToMask":-1,"filePath":"datafiles/main/names",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ork_ship.json","CopyToMask":-1,"filePath":"datafiles/main/names",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"imperial_ship.json","CopyToMask":-1,"filePath":"datafiles/main/names",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ork.json","CopyToMask":-1,"filePath":"datafiles/main/names",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ork_ship.json","CopyToMask":-1,"filePath":"datafiles/main/names",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"sector.json","CopyToMask":-1,"filePath":"datafiles/main/names",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"space_marine.json","CopyToMask":-1,"filePath":"datafiles/main/names",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"star.json","CopyToMask":-1,"filePath":"datafiles/main/names",},
Expand Down Expand Up @@ -1439,6 +1439,6 @@
],
"templateType": null,
"TextureGroups": [
{"resourceType":"GMTextureGroup","resourceVersion":"1.3","name":"Default","autocrop":true,"border":2,"compressFormat":"bz2","directory":"","groupParent":null,"isScaled":false,"loadType":"default","mipsToGenerate":0,"targets":-1,},
{"resourceType":"GMTextureGroup","resourceVersion":"1.3","name":"Default","autocrop":true,"border":2,"compressFormat":"bz2","customOptions":"","directory":"","groupParent":null,"isScaled":false,"loadType":"default","mipsToGenerate":0,"targets":-1,},
],
}
38 changes: 38 additions & 0 deletions objects/obj_creation_popup/Draw_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,44 @@ if (col_shift){
confirm_gear_button.alpha = target_gear > 0 ? 0.5 : 1;
confirm_gear_button.rects = draw_unit_buttons([614,716], "CONFIRM",[1,1], 38144,, fnt_40k_14b, confirm_gear_button.alpha);
if (point_and_click(confirm_gear_button.rects) and (target_gear = 0)) {
var possible_custom_roles = [
["chapter_master", eROLE.ChapterMaster],
["honour_guard",eROLE.HonourGuard],
["veteran",eROLE.Veteran],
["terminator",eROLE.Terminator],
["captain",eROLE.Captain],
["dreadnought",eROLE.Dreadnought],
["champion",eROLE.Champion],
["tactical",eROLE.Tactical],
["devastator",eROLE.Devastator],
["assault",eROLE.Assault],
["ancient",eROLE.Ancient],
["scout",eROLE.Scout],
["chaplain",eROLE.Chaplain],
["apothecary",eROLE.Apothecary],
["techmarine",eROLE.Techmarine],
["librarian",eROLE.Librarian],
["sergeant",eROLE.Sergeant],
["veteran_sergeant",eROLE.VeteranSergeant],
];

var _role_id = ide;
for(var i = 0; i < array_length(possible_custom_roles); i++){
if(possible_custom_roles[i][1] == _role_id){
var c_role = {
name: obj_creation.role[100][_role_id],
wep1: obj_creation.wep1[100][_role_id],
wep2: obj_creation.wep2[100][_role_id],
gear: obj_creation.gear[100][_role_id],
mobi: obj_creation.mobi[100][_role_id],
armour: obj_creation.armour[100][_role_id]
}
show_debug_message($"Updating role {_role_id} from {obj_creation.custom_roles}");
variable_struct_set(obj_creation.custom_roles, possible_custom_roles[i][0], c_role);
}
}
show_debug_message($"New obj_creation.custom_roles {obj_creation.custom_roles}");

obj_creation.cooldown = 8000;
instance_destroy();
}
Expand Down
3 changes: 3 additions & 0 deletions scripts/scr_chapter_new/scr_chapter_new.gml
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ function scr_chapter_new(argument0) {
if(struct_exists(chapter_object, "custom_squads")){
obj_creation.custom_squads = chapter_object.custom_squads;
}




points = chapter_object.points;
maxpoints=chapter_object.points;
Expand Down
2 changes: 1 addition & 1 deletion scripts/scr_chapter_random/scr_chapter_random.gml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function scr_chapter_random(argument0) {
chapter_master_specialty=choose(1,1,1,1,1,2,2,2,2,2,3);



custom_roles = {};



Expand Down
3 changes: 3 additions & 0 deletions scripts/scr_save_chapter/scr_save_chapter.gml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ function scr_save_chapter(chapter_id){
traits: [],
}

chap.custom_roles = custom_roles;


global.chapter_creation_object = chap;

var data_json = json_stringify({chapter: global.chapter_creation_object}, true);
Expand Down
Loading