Skip to content

Commit

Permalink
Merge branch 'main' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
afwbkbc committed Nov 3, 2024
2 parents c946673 + c9e4fb3 commit 23dd8cc
Show file tree
Hide file tree
Showing 98 changed files with 2,263 additions and 498 deletions.
15 changes: 15 additions & 0 deletions GLSMAC_data/default/bases.gls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const pops = #include('bases/pops');

const result = {

init: () => {
//pops.init();
},

define: () => {
pops.define();
},

};

return result;
46 changes: 46 additions & 0 deletions GLSMAC_data/default/bases/pops.gls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const define = (id, name, renders_human_x, renders_progenitor_x, properties) => {
// TODO: if (!properties) { ... }
let rh = [];
for ( x of renders_human_x ) {
rh []= {
type: 'sprite',
file: 'newicons.pcx',
x: x, y: 501,
w: 38, h: 48,
};
}
let rp = [];
for ( x of renders_progenitor_x ) {
rp []= {
type: 'sprite',
file: 'aliencit.pcx',
x: x, y: 41,
w: 38, h: 48,
};
}
#game.bases.define_pop(id, {
name: name,
renders_human: rh,
renders_progenitor: rp,
} + properties);
};

const result = {
define: () => {

define('Worker', 'Worker', [79, 118], [40], {tile_worker: true});
define('Talent', 'Talent', [1, 40], [1], {tile_worker: true});
define('Doctor', 'Doctor', [352], [196], {});
define('Technician', 'Technician', [313], [157], {});
define('Librarian', 'Librarian', [391], [235], {});
define('Engineer', 'Engineer', [430], [274], {});
define('Empath', 'Empath', [469], [313], {});
define('Thinker', 'Thinker', [508], [352], {});
define('Transcend', 'Transcend', [547], [391], {});
define('Drone', 'Drone', [157, 196], [79], {});
define('DronePlus', 'Drone', [235, 274], [118], {});

},
};

return result;
36 changes: 32 additions & 4 deletions GLSMAC_data/default/main.gls.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const units = #include('units');
const factions = #include('factions');
const resources = #include('resources');
const map = #include('map');
const units = #include('units');
const bases = #include('bases');

#game.on.configure((e) => {

Expand All @@ -25,12 +28,33 @@ let random_health = () => {
return #game.random.get_float(#to_float(0.1), #to_float(1));
};

const pop_types = [
'Worker',
'Talent',
'Doctor',
'Librarian',
];

let add_pops = ( base, count ) => {
for (let i = 0; i < count; i++) {
const type = pop_types[(#game.random.get_int(0, #size(pop_types) - 1))];
base.create_pop({
type: type,
});
}
};

units.init();

let all_bases = [];

#game.on.start((e) => {

// init units
// init game data
resources.define();
map.define();
units.define();
bases.define();

// init players
players = #game.players.get_all();
Expand Down Expand Up @@ -92,14 +116,15 @@ units.init();
}
}
if (!has_adjactent_bases) {
#game.bases.spawn(
let base = #game.bases.spawn(
owner,
tile,
{
// name: 'base name',
population: #game.random.get_int(0, 4) * #game.random.get_int(0, 4) + #game.random.get_int(1, 3),
}
);
add_pops(base, #game.random.get_int(1, 7));
all_bases []= base;
bases_spawned++;
}
}
Expand All @@ -112,6 +137,9 @@ units.init();
});

#game.on.turn((e) => {
for ( base of all_bases ) {
add_pops(base, 1);
}
//
});

Expand Down
46 changes: 46 additions & 0 deletions GLSMAC_data/default/map.gls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const result = {

define: () => {

#game.on.get_tile_yields((e) => {

let result = {
Nutrients: 0,
Minerals: 0,
Energy: 0,
};

// TODO: fix increments of properties in GSE

if (e.tile.has_fungus) {
if (e.player.faction.is_progenitor) { // tmp
//result.Energy += 2;
result.Energy = result.Energy + 2;
}
} else {
if (e.tile.is_land) {
//result.Nutrients += (e.tile.moisture - 1);
result.Nutrients = result.Nutrients + (e.tile.moisture - 1);
if (e.tile.rockiness > 1) {
//result.Minerals++;
result.Minerals = result.Minerals + 1;
}
if (e.tile.has_river) {
result.Energy = result.Energy + 1;
}
} else {
//result.Nutrients++;
result.Nutrients = result.Energy + 1;
if (e.player.faction.id == 'PIRATES') { // tmp
//result.Minerals++;
result.Minerals = result.Minerals + 1;
}
}
}
return result;
});
},

};

return result;
33 changes: 33 additions & 0 deletions GLSMAC_data/default/resources.gls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const define = (id, levels_y, minusplus_y) => {

#game.resources.define(id, {
name: id,
render: {
type: 'sprite_map',
file: 'newicons.pcx',
yields: {
grid_x: 174, grid_y: levels_y, grid_margin: 1,
cell_width: 40, cell_height: 40, cells_count: 8,
},
plus: {
x: 24, y: minusplus_y,
width: 22, height: 22,
},
minus: {
x: 47, y: minusplus_y,
width: 22, height: 22,
},
}
});

};

const result = {
define: () => {
define('Nutrients', 304, 13);
define('Minerals', 345, 36);
define('Energy', 386, 59);
},
};

return result;
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Or copy `GLSMAC` file and `GLSMAC_data` directory into your SMAC directory and r

Run ./bin/GLSMAC --help to see more options. Debug builds have extra options that aren't available for release builds.

Supported SMAC releases: GOG, Loki, Planetary Pack (if you have something else and it doesn't work - double-check that you have SMACX expansion and then create issue)
Supported SMAC releases: GOG, Steam, Loki, Legacy (if you have something else and it doesn't work - double-check that you have SMACX expansion and then create issue)

### Reporting problems

Expand Down
Loading

0 comments on commit 23dd8cc

Please sign in to comment.