All pastes #1194094 Raw Edit

Stuff

public text v1 · immutable
#1194094 ·published 2008-09-04 20:40 UTC
rendered paste body
--- C:\Users\Jeremy\AppData\Local\Temp\obj_Miner.iss-revBASE.svn001.tmp.iss	Thu Sep  4 15:39:09 2008
+++ F:\InnerSpace\Scripts\EVEbot\Behaviors\obj_Miner.iss	Wed Sep  3 20:11:50 2008
@@ -9,6 +9,7 @@
 
 objectdef obj_Miner
 {
+	variable obj_Combat Combat
 	variable string SVN_REVISION = "$Rev: 709 $"
 	variable int Version
 
@@ -38,6 +39,11 @@
 		This.TripStartTime:Set[${Time.Timestamp}]
 		Event[OnFrame]:AttachAtom[This:Pulse]
 		UI:UpdateConsole["obj_Miner: Initialized", LOG_MINOR]
+		/* Initialize combat */
+		This.Combat:Initialize
+		/* Set it to defensive */
+		This.Combat.CurrentState:Set["IDLE"]
+		This.Combat:SetMode["DEFENSIVE"]
 	}
 
 	method Shutdown()
@@ -77,6 +83,17 @@
 			return
 		}
 
+		/* No reason to do our shit if we're not safe */
+		
+		if !${Social.IsSafe}
+		{
+			UI:UpdateConsole["Miner: Social unsafe! Cleaning up and fleeing"]
+			call This.Cleanup_Environment
+			call Combat.Flee
+			Combat.Override:Set[TRUE]
+			return
+		}
+
 		switch ${This.CurrentState}
 		{
 			case IDLE
@@ -269,7 +286,7 @@
 
 		UI:UpdateConsole["Mining"]
 
-		while ( !${EVEBot.ReturnToStation} && \
+		while (${Social.IsSafe} && !${EVEBot.ReturnToStation} && \
 				${_Me.Ship.UsedCargoCapacity} <= ${Config.Miner.CargoThreshold}	)
 		{
 			if ${Ship.TotalMiningLasers} == 0
@@ -454,13 +471,21 @@
 			Bookmarks:StoreLocation
 		}
 		call This.Cleanup_Environment
-		This.TotalTrips:Inc
-		This.PreviousTripSeconds:Set[${This.TripDuration}]
-		This.TotalTripSeconds:Inc[${This.PreviousTripSeconds}]
-		This.AverageTripSeconds:Set[${Math.Calc[${This.TotalTripSeconds}/${This.TotalTrips}]}]
-		UI:UpdateConsole["Cargo Hold has reached threshold, returning"]
-		call ChatIRC.Say "Cargo Hold has reached threshold"
-		call This.Statslog
+		if ${Social.IsSafe}
+		{
+			This.TotalTrips:Inc
+			This.PreviousTripSeconds:Set[${This.TripDuration}]
+			This.TotalTripSeconds:Inc[${This.PreviousTripSeconds}]
+			This.AverageTripSeconds:Set[${Math.Calc[${This.TotalTripSeconds}/${This.TotalTrips}]}]
+			UI:UpdateConsole["Cargo Hold has reached threshold, returning"]
+			call ChatIRC.Say "Cargo Hold has reached threshold"
+			call This.Statslog
+		}
+		else
+		{
+			Combat.Override:Set[TRUE]
+			call Combat.Flee
+		}
 
 	}