def set_target(ent_id, target_id): ent = entity.GetEntity(ent_id) if ent is None: return lambda: None old_target_id = ent.SetTargetId(target_id) def Undo(): same_ent = entity.GetEntity(ent_id) if same_ent: same_ent.SetTargetId(old_target_id) return Undo
def set_pos(ent_id, pos): ent = entity.GetEntity(ent_id) if ent is None: return lambda: None old_pos = ent.SetPos(pos) def Undo(): same_ent = entity.GetEntity(ent_id) if same_ent: same_ent.SetPos(old_pos) return Undo
def set_path(ent_id, path): ent = entity.GetEntity(ent_id) if ent is None: return lambda: None ent.PushPath(path) def Undo(): same_ent = entity.GetEntity(ent_id) if same_ent: same_ent.PopPath() return Undo
def add_force(ent_id, direction, magnitude, catalog): ent = entity.GetEntity(ent_id) if ent is None: return lambda: None force_id = ent.AddForce(direction, magnitude, catalog, None) def Undo(): same_ent = entity.GetEntity(ent_id) if same_ent: same_ent.DelForce(force_id) return Undo
def Undo(): same_ent = entity.GetEntity(ent_id) if same_ent: same_ent.SetPos(old_pos)
def Undo(): same_ent = entity.GetEntity(ent_id) if same_ent: same_ent.SetTargetId(old_target_id)
def Undo(): same_ent = entity.GetEntity(ent_id) if same_ent: same_ent.PopPath()
def Undo(): same_ent = entity.GetEntity(ent_id) if same_ent: same_ent.DelForce(force_id)