Exemplo n.º 1
0
		public static float RequestBackgroundResource(Vessel vessel, float amount, string resource) {
			if (!Instance.vesselData.ContainsKey(vessel)) { return 0f; }

			modifiedResources.Clear();

			ResourceModuleHandler.AddResource(Instance.vesselData[vessel], -amount, resource, modifiedResources);
			float ret = ResourceModuleHandler.ClampResource(modifiedResources);

			return amount - ret;
		}
Exemplo n.º 2
0
		private void HandleResources(Vessel v) {
			VesselData data = vesselData[v];
			if (v.protoVessel.protoPartSnapshots.Count <= 0 || data.resourceModules.Count <= 0) {
				Debug("Vessel " + v.vesselName + " has no resource modules", DebugLevel.ALL);
				return;
			}

			HashSet<ProtoPartResourceSnapshot> modified = new HashSet<ProtoPartResourceSnapshot>();

			foreach (ResourceModuleHandler d in data.resourceModules) {
				modified = d.HandleResource(v, data, modified);
			}

			ResourceModuleHandler.ClampResource(modified);
		}