Skip to content

Instantly share code, notes, and snippets.

@SamuXarick
Created February 17, 2023 21:38
Show Gist options
  • Save SamuXarick/29d18cd6bfa264bbb1f4fbf8ff40c757 to your computer and use it in GitHub Desktop.
Save SamuXarick/29d18cd6bfa264bbb1f4fbf8ff40c757 to your computer and use it in GitHub Desktop.
Is this the correct way to do a daily maintenance cost
local infrastructure_count = GSInfrastructure.GetInfrastructurePieceCount(company, GSInfrastructure.INFRASTRUCTURE_RAIL) + GSInfrastructure.GetInfrastructurePieceCount(company, GSInfrastructure.INFRASTRUCTURE_SIGNALS);
local vehicle_list = GSVehicleList();
vehicle_list.Valuate(GSVehicle.GetVehicleType);
vehicle_list.KeepValue(GSVehicle.VT_RAIL);
vehicle_list.Valuate(GSVehicle.GetProfitLastYear);
local maintenance_cost = GSInfrastructure.GetMonthlyInfrastructureCosts(company, GSInfrastructure.INFRASTRUCTURE_RAIL) + GSInfrastructure.GetMonthlyInfrastructureCosts(company, GSInfrastructure.INFRASTRUCTURE_SIGNALS);
local profits = 0;
foreach (vehicle, value in vehicle_list) {
profits += value + GSVehicle.GetProfitThisYear(vehicle);
}
local current_date = GSDate.GetCurrentDate();
local current_year = GSDate.GetYear(current_date);
local days_since_last_year = 365 + current_date - GSDate.GetDate(current_year, 1, 1);
local efficiency = infrastructure_count > 0 ? (profits - maintenance_cost * days_since_last_year / 30 ) / infrastructure_count : 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment