Skip to content
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
2 changes: 1 addition & 1 deletion ChapterMaster.yyp
Original file line number Diff line number Diff line change
Expand Up @@ -1259,4 +1259,4 @@
"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,},
],
}
}
2 changes: 1 addition & 1 deletion objects/obj_controller/Alarm_5.gml
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ if (fest_scheduled>0) and (fest_repeats>0){
//research and forge related actions
research_end();
apothecary_simple();

merge_ork_fleets();
//complex route plotting for player fleets
with (obj_p_fleet){
if (array_length(complex_route)>0 && action == ""){
Expand Down
67 changes: 36 additions & 31 deletions objects/obj_en_fleet/Alarm_1.gml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ var orb=orbiting;
if (round(owner)!=eFACTION.Imperium) and (navy=1) then owner= noone;

//TODO centralise orbiting logic
var _is_orbiting = is_orbiting();
if (orbiting != 0 && action=="" && owner!=noone){
var orbiting_found=instance_exists(orbiting);
var orbiting_found=_is_orbiting;
if (orbiting_found){
orbiting_found = variable_instance_exists(orbiting, "present_fleet");
if (orbiting_found){
Expand All @@ -24,7 +25,12 @@ if ((trade_goods="Khorne_warband") or (trade_goods="Khorne_warband_landing_force
khorne_fleet_cargo();
}

if (instance_exists(orbiting)) {
if (_is_orbiting) {
turns_static++;
if (turns_static>15 && owner==eFACTION.Ork){
ork_fleet_move();
_is_orbiting=false;
}
if (instance_exists(obj_crusade))
and (orbiting.owner <= eFACTION.Ecclesiarchy)
and (owner = eFACTION.Imperium)
Expand Down Expand Up @@ -114,19 +120,17 @@ if (instance_exists(orbiting)) {
}

if (navy && action=="") {
var orbit = instance_nearest(x,y, obj_star);
orbiting = point_distance(x,y,orbit.x,orbit.y)<50?orbit:false;
if trade_goods != "player_hold" {


if (trade_goods="") and (instance_exists(orbiting)){
if (trade_goods="") and (_is_orbiting){
if (orbiting.present_fleet[20]>0) then exit;
}


// Check if the ground battle is victorious or not
if (obj_controller.faction_status[eFACTION.Imperium]="War") and (trade_goods="invading_player") and (guardsmen_unloaded=1) {
if (instance_exists(orbiting)) {
if (_is_orbiting) {

//slightly more verbose than the last way, but reduces reliance on fixed array sizes
var tar = array_reduce(orbiting.p_guardsmen, function(prev, curr, idx) {
Expand Down Expand Up @@ -154,7 +158,7 @@ if (navy && action=="") {
// Invade the player homeworld as needed
navy_attack_player_world();
// Bombard the shit out of the player homeworld
if (obj_controller.faction_status[eFACTION.Imperium]="War") and (trade_goods="") and (guardsmen_unloaded=0) and (instance_exists(orbiting)){
if (obj_controller.faction_status[eFACTION.Imperium]="War") and (trade_goods="") and (!guardsmen_unloaded) and (_is_orbiting){
var bombard=false;
if (orbiting!=noone){
if (orbiting.object_index==obj_star) then bombard=true;
Expand Down Expand Up @@ -259,7 +263,7 @@ if (navy && action=="") {

if (obj_controller.faction_status[eFACTION.Imperium]="War") and (action="") and (trade_goods="") and (guardsmen_unloaded=0) {
var hold = false;
if (is_orbiting()){
if (_is_orbiting){
var player_owns_planet = scr_get_planet_with_owner(orbiting, eFACTION.Player);
hold = player_owns_planet or (orbiting.present_fleet[eFACTION.Player] > 0)
}
Expand Down Expand Up @@ -323,7 +327,7 @@ if (navy && action=="") {
if (fleet_distance<homeworld_distance) and (fleet_distance<7000) and (fleet_distance>40) and (instance_exists(obj_temp7)) {// Go towards that fleet
planet_nearby=instance_nearest(fleet_nearby.x,fleet_nearby.y,obj_star);

if (instance_exists(planet_nearby)) and (instance_exists(orbiting)){
if (instance_exists(planet_nearby)) and (_is_orbiting){
if (fleet_distance<=500) and (planet_nearby!=orbiting){// Case 1; really close, wait for them to make the move
with(obj_temp7){instance_destroy();}
with(obj_temp8){instance_destroy();}
Expand Down Expand Up @@ -387,7 +391,7 @@ if (navy && action=="") {



if (action="") and (instance_exists(orbiting)) and (guardsmen_unloaded=1){// Move from one planet to another
if (action="") and (_is_orbiting) and (guardsmen_unloaded=1){// Move from one planet to another
var o=0,that=0,highest=0,cr=0;
o=0;that=0;highest=0;cr=0;

Expand Down Expand Up @@ -436,14 +440,14 @@ if (navy && action=="") {
send_navy_to_forge();
}
// Bombard the shit out of things when able
else if (trade_goods=="") and (instance_exists(orbiting)) and (action=""){
else if (trade_goods=="") and (_is_orbiting) and (action=""){
imperial_navy_bombard();
}


// If the guardsmen all die then move on
var o=0;
if (guardsmen_unloaded=1) and (instance_exists(orbiting)){
if (guardsmen_unloaded=1) and (_is_orbiting){
var o=0,guardsmen_alive=1;
repeat(orbiting.planets){
o+=1;
Expand Down Expand Up @@ -525,14 +529,18 @@ if (navy && action=="") {
trade_goods="goto_recruiting";
action_x=c_plan.x;
action_y=c_plan.y;
set_fleet_movement();
set_fleet_movement()
_is_orbiting=false;
}

with(obj_temp_inq){instance_destroy();}exit;
with(obj_temp_inq){
instance_destroy();
}
exit;
}
// Get recruits
if (action="") and (trade_goods="goto_recruiting"){
if (instance_exists(orbiting)){
if (_is_orbiting){
var o=0,that=0,te=0,te_large=0;
repeat(orbiting.planets){
o+=1;
Expand Down Expand Up @@ -580,25 +588,22 @@ if (navy && action=="") {
}
}

var dir;dir=0;
var ret;ret=0;
var dir=0;
var ret=0;


if (action==""){
if (instance_exists(orbiting)){orbiting=orbiting;}// orbiting.present_fleet[owner]+=1;
else{orbiting=instance_nearest(x,y,obj_star);orbiting=orbiting;}
var max_dis;max_dis=400;
if (action=="" && _is_orbiting){
var max_dis=400;

if (instance_exists(orbiting)){
if (orbiting.owner=eFACTION.Player) and (obj_controller.faction_status[eFACTION.Imperium]="War") and (owner=eFACTION.Imperium){
var i;i=0;
repeat(4){i+=1;
if (orbiting.p_owner[i]=1) then orbiting.p_pdf[i]-=capital_number*50000;
if (orbiting.p_owner[i]=1) then orbiting.p_pdf[i]-=frigate_number*10000;
if (orbiting.p_pdf[i]<0) then orbiting.p_pdf[i]=0;
}

if (orbiting.owner=eFACTION.Player) and (obj_controller.faction_status[eFACTION.Imperium]="War") and (owner=eFACTION.Imperium){
for (var i=1;i<=orbiting.planets;i++){
if (orbiting.p_owner[i]=1) then orbiting.p_pdf[i]-=capital_number*50000;
if (orbiting.p_owner[i]=1) then orbiting.p_pdf[i]-=frigate_number*10000;
if (orbiting.p_pdf[i]<0) then orbiting.p_pdf[i]=0;
}
}


// 1355;

Expand Down Expand Up @@ -918,7 +923,7 @@ if (action==""){
}*/
}

if (owner = eFACTION.Tyranids) {// Juggle bio-resources
if (owner == eFACTION.Tyranids) {// Juggle bio-resources
if (capital_number*2>frigate_number){
capital_number-=1;frigate_number+=2;
}
Expand Down Expand Up @@ -1005,7 +1010,7 @@ if (action==""){
}
}

if (owner=eFACTION.Ork) and (action=""){// Should fix orks converging on useless planets
if (owner=eFACTION.Ork) and (action==""){// Should fix orks converging on useless planets
ork_fleet_move();
}
}
Expand Down
1 change: 1 addition & 0 deletions objects/obj_en_fleet/Alarm_4.gml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ if (action==""){
}

if (cont=20){// Move the entire fleet, don't worry about the other crap
turns_static = 0;
var eta=0;

if (trade_goods!="") and (owner != eFACTION.Tyranids) and (owner != eFACTION.Chaos) and (string_count("Inqis",trade_goods)=0) and (string_count("merge",trade_goods)=0)and (string_count("_her",trade_goods)=0) and (trade_goods!="cancel_inspection") and (trade_goods!="return"){
Expand Down
4 changes: 3 additions & 1 deletion objects/obj_en_fleet/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ hurt=0;
orbiting=0;
rep=3;
minimum_eta=2;
turns_static = 0;
navy=0;
guardsmen_ratio=0;
guardsmen_unloaded=0;
complex_route = [];
warp_able = false;
ii_check=floor(random(5))+1;
etah=0;safe=0;
etah=0;
safe=0;
//TODO set up special save method for faction specific fleet variables
inquisitor=-1;

Expand Down
8 changes: 0 additions & 8 deletions scripts/scr_enemy_ai_c/scr_enemy_ai_c.gml
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,6 @@ function scr_enemy_ai_c() {
}


// This is the ork landing code
ork_fleet_arrive_target();








// traitors below here
Expand Down
32 changes: 28 additions & 4 deletions scripts/scr_fleet_functions/scr_fleet_functions.gml
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ function get_largest_player_fleet(){
function is_orbiting(){
if (action != "") then return false;
var nearest = instance_nearest(x,y,obj_star);
if (point_distance(x,y,nearest.x, nearest.y)<50){
orbiting = nearest;
if (point_distance(x,y,nearest.x, nearest.y)<10 && nearest.name != ""){
orbiting = nearest.id;
return true
}
orbiting=false;
Expand All @@ -126,6 +126,7 @@ function set_fleet_movement(fastest_route = true){
action = "";

if (action==""){
turns_static = 0;
var sys, mine, fleet;
var connected=0,cont=0,target_dist=0;
if (fastest_route){
Expand Down Expand Up @@ -733,7 +734,7 @@ function fleet_arrival_logic(){

if (cur_star.x=old_x) and (cur_star.y=old_y) and (cur_star.owner=self.owner) and (cur_star.action="") and ((owner = eFACTION.Tau) or (owner = eFACTION.Chaos)) and (mergus=10) and (trade_goods!="csm") and (trade_goods!="Khorne_warband"){// Move somewhere new
var stue, stue2;stue=0;stue2=0;
var goood;goood=0;
var goood=0;

with(obj_star){if (planets=1) and (p_type[1]="Dead") then instance_deactivate_object(id);}
stue=instance_nearest(x,y,obj_star);
Expand Down Expand Up @@ -763,7 +764,11 @@ function fleet_arrival_logic(){


if (owner = eFACTION.Ork){

if (is_orbiting()){
with (orbiting){
ork_fleet_arrive_target();
}
}
var kay, temp5, temp6, temp7;
kay=0;temp5=0;temp6=0;temp7=0;

Expand Down Expand Up @@ -835,3 +840,22 @@ function choose_fleet_sprite_image(){
}



function merge_fleets(main_fleet, merge_fleet){
main_fleet.capital_number += merge_fleet.capital_number;
main_fleet.frigate_number += merge_fleet.frigate_number;
main_fleet.escort_number += merge_fleet.escort_number;
var _merge_cargo = struct_get_names(merge_fleet.cargo_data);
//TODO custom merge stuff
for (var i=0;i<array_length(_merge_cargo);i++){
if (!struct_exists(main_fleet.cargo_data, _merge_cargo[i])){
main_fleet.cargo_data[$ _merge_cargo[i]] = merge_fleet.cargo_data[$ _merge_cargo[i]];
}
}
with(merge_fleet){
instance_destroy();
}

}


1 change: 1 addition & 0 deletions scripts/scr_load/scr_load.gml
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ function scr_load(save_part, save_id) {
fla.orbiting=ini_read_real("Fleet",$"ef{i}orb",0);
fla.navy=ini_read_real("Fleet",$"ef{i}navy",0);
fla.guardsmen_unloaded=ini_read_real("Fleet",$"ef{i}unl",0);
fla.turns_static=ini_read_real("Fleet",$"ef{i}turns_static",0);
fla.inquisitor=ini_read_real("Fleet",$"ef{i}inquis",-1);
fla.complex_route = return_json_from_ini("Fleet", $"ef{i}complex_route", []);

Expand Down
Loading