Skip to content

Commit

Permalink
Print times of impacts
Browse files Browse the repository at this point in the history
  • Loading branch information
arda-guler committed Oct 27, 2024
1 parent 7e225fa commit 8ca86fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion command_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def set_vars_field():
vars_text += "Scene Lock: None\n"

if scene_rot_target:
vars_text += "Scene Rot. Target: " + str(scene_rot_target) + "\n"
vars_text += "Scene Rot. Target: " + str(scene_rot_target.get_name()) + "\n"
else:
vars_text += "Scene Rot. Target: None\n"

Expand Down
17 changes: 9 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ def delete_observation(obs_name):
observations.remove(obs_tbd)
del obs_tbd

def vessel_body_crash(v, b):
def vessel_body_crash(v, b, sim_time):
# a vessel has crashed into a celestial body. We will convert the vessel object
# into a surface point on the body (a crash site) and remove all references to
# the vessel object
Expand Down Expand Up @@ -1290,7 +1290,7 @@ def vessel_body_crash(v, b):
create_surface_point(crash_site_name, b, crash_site_color, crash_site_gpos)

note_name = v.name.upper() + "_IMPACT"
batch_commands.append(["note", note_name, v.name + " has impacted " + b.name + "."])
batch_commands.append(["note", note_name, v.name + " has impacted " + b.name + " at t=" + str(sim_time) + "."])

delete_vessel(v.name)

Expand Down Expand Up @@ -1351,6 +1351,7 @@ def rotate_scene(pivot, target, dt):

theta = math.atan2(dx, dz)

theta = 180/math.pi * theta
base_mtx = matrix3x3()
rot_mtx = base_mtx.rotated(theta, vec3(0, 1, 0))

Expand Down Expand Up @@ -2753,7 +2754,7 @@ def main(scn_filename=None, start_time=0):
for v in vessels:
for b in bodies:
if vessel_body_collision and v.get_alt_above(b) <= 0:
vessel_body_crash(v, b)
vessel_body_crash(v, b, sim_time)

proximity_zone_violations = []
colliding_vessels = []
Expand All @@ -2773,11 +2774,11 @@ def main(scn_filename=None, start_time=0):

if rel_vel_mag > 0.282842712474619: # more energy than 40 J/g
fragment(vc.name, 5, rel_vel_mag**0.5)
output_buffer.append([vc.name + "_ALERT", "note", vc.name + " has broken-up after a collision with " + prox_vessel.name + "!"])
output_buffer.append([vc.name + "_ALERT", "note", vc.name + " has broken-up after a collision with " + prox_vessel.name + " at t=" + str(sim_time) + "!"])
delete_vessel(vc.name)
else:
if not [vc.name + "_WARNING", "note", vc.name + " has bumped into " + prox_vessel.name + "!"] in output_buffer:
output_buffer.append([vc.name + "_WARNING", "note", vc.name + " has bumped into " + prox_vessel.name + "!"])
if not [vc.name + "_WARNING", "note", vc.name + " has bumped into " + prox_vessel.name + " at t=" + str(sim_time) + "!"] in output_buffer:
output_buffer.append([vc.name + "_WARNING", "note", vc.name + " has bumped into " + prox_vessel.name + " at t=" + str(sim_time) + "!"])

if rel_vel_mag > rel_vel_max:
rel_vel_max = rel_vel_mag
Expand All @@ -2789,8 +2790,8 @@ def main(scn_filename=None, start_time=0):
for violation_set in proximity_zone_violations:
prox_vessel = violation_set[0]
for vl in violation_set[1]:
if not [vl.name + "_WARNING", "note", vl.name + " has violated the proximity zone around " + prox_vessel.name + "!"] in output_buffer:
output_buffer.append([vl.name + "_WARNING", "note", vl.name + " has violated the proximity zone around " + prox_vessel.name + "!"])
if not [vl.name + "_WARNING", "note", vl.name + " has violated the proximity zone around " + prox_vessel.name + " at t=" + str(sim_time) + "!"] in output_buffer:
output_buffer.append([vl.name + "_WARNING", "note", vl.name + " has violated the proximity zone around " + prox_vessel.name + " at t=" + str(sim_time) + "!"])

# update resources
for res in resources:
Expand Down

0 comments on commit 8ca86fa

Please sign in to comment.