001package com.fs.starfarer.api.fleet; 002 003import java.util.List; 004 005public interface RepairTrackerAPI { 006 007 public static class CREvent { 008 public float crAmount; 009 public String text; 010 public float elapsed = 0f; 011 public String id; 012 public CREvent(float crAmount, String text) { 013 this.crAmount = crAmount; 014 this.text = text; 015 } 016 public float getCrAmount() { 017 return crAmount; 018 } 019 public String getText() { 020 return text; 021 } 022 023 public void advance(float days) { 024 elapsed += days; 025 } 026 027 public boolean isExpired() { 028 return elapsed > 7; 029 } 030 public float getElapsed() { 031 return elapsed; 032 } 033 } 034 035 /** 036 * @param crChange from -1 to 1 037 * @param description shows up in the CR tooltip 038 */ 039 void applyCREvent(float crChange, String description); 040 041 /** 042 * Returned value is modified by crew fraction. 043 * @return from 0 to 1. 044 */ 045 float getCR(); 046 047 /** 048 * getCR() will return this value, modified by the crew fraction 049 * @param cr from 0 to 1. 050 */ 051 void setCR(float cr); 052 053 float getSuppliesFromScuttling(); 054 float getFuelFromScuttling(); 055 056 057 float getRecoveryRate(); 058 float getDecreaseRate(); 059 060 /** 061 * @return 0 to 1 062 */ 063 float getMaxCR(); 064 065 066 /** 067 * Current CR without the crew understrength multiplier, if any. 068 * @return 069 */ 070 float getBaseCR(); 071 072 073 List<CREvent> getRecentEvents(); 074 075 /** 076 * The "event" for gradual supply loss over the last week is not included in the return value 077 * of getRecentEvents(). 078 * @return 079 */ 080 CREvent getNoSupplyCRLossEvent(); 081 082 083 boolean isSuspendRepairs(); 084 void setSuspendRepairs(boolean suspendRepairs); 085 086 087 //void performRepairsUsingSupplies(float supplies); 088 void performRepairsFraction(float fraction); 089 090 float getRemainingRepairTime(); 091 092 /** 093 * Including both hull and armor. 094 * @return 0 to 1 095 */ 096 float computeRepairednessFraction(); 097 098// boolean isLogisticalPriority(); 099// void setLogisticalPriority(boolean priorizeRepairs); 100 101 boolean isMothballed(); 102 void setMothballed(boolean mothballed); 103 104 boolean isCrashMothballed(); 105 void setCrashMothballed(boolean crashMothballed); 106 107 float getRepairRatePerDay(); 108 109 /** 110 * Uses id to apply subsequent CR changes to the same "recent event". 111 * Useful for gradual CR loss, i.e. from star corona. 112 * @param crChange 113 * @param id 114 * @param description 115 */ 116 void applyCREvent(float crChange, String id, String description); 117 118 float getHeavyMachineryFromScuttling(); 119 120 float getCRPriorToMothballing(); 121 void setCRPriorToMothballing(float crPriorToMothballing); 122 123}