Skip to content

Commit 307ab67

Browse files
committed
* +/- 1 frame tolerance for sus suicide calculation
1 parent d962184 commit 307ab67

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

application/controllers/Data.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public function __construct()
99
{
1010
parent::__construct();
1111
$this->output->set_header('X-Powered-By: 🐹🐹');
12+
// $this->output->enable_profiler(TRUE); // DEBUG
1213

1314
$this->load->library('session');
1415

application/models/Additional_data.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,11 +629,11 @@ public function get_ops_to_fix_data($verified = false, $op_ids_with_unambiguous_
629629
FROM events AS e
630630
INNER JOIN entities AS victim ON victim.aid = e.victim_aid
631631
LEFT JOIN (
632-
SELECT ee.operation_id, ee.victim_id, ee.frame
632+
SELECT ee.operation_id, ee.victim_id, ee.frame, (ee.frame + 1) AS frame_plus, (GREATEST(ee.frame, 1) - 1) AS frame_minus
633633
FROM events AS ee
634634
WHERE ee.victim_id = ee.attacker_id AND ee.victim_id IS NOT NULL AND ee.event = 'hit'
635635
GROUP BY ee.operation_id, ee.victim_id
636-
) AS hits ON hits.operation_id = e.operation_id AND hits.victim_id = e.victim_id AND (hits.frame = e.frame OR hits.frame = e.frame - 1 OR hits.frame = e.frame + 1)
636+
) AS hits ON hits.operation_id = e.operation_id AND hits.victim_id = e.victim_id AND (hits.frame = e.frame OR hits.frame_plus = e.frame OR hits.frame_minus = e.frame)
637637
WHERE e.victim_aid = e.attacker_aid AND hits.victim_id IS NULL AND victim.is_player = 1 AND e.event = 'killed'
638638
) AS sus_suicide_events
639639
GROUP BY sus_suicide_events.operation_id
@@ -664,11 +664,11 @@ public function get_op_sus_suicides($id)
664664
$this->db->select('e.id')
665665
->from('events AS e')
666666
->join('entities AS victim', 'victim.aid = e.victim_aid')
667-
->join("(SELECT ee.operation_id, ee.victim_id, frame
667+
->join("(SELECT ee.operation_id, ee.victim_id, ee.frame, (ee.frame + 1) AS frame_plus, (GREATEST(ee.frame, 1) - 1) AS frame_minus
668668
FROM events AS ee
669669
WHERE ee.victim_id = ee.attacker_id AND ee.victim_id IS NOT NULL AND ee.event = 'hit'
670670
GROUP BY ee.operation_id, ee.victim_id
671-
) AS hits", 'hits.operation_id = e.operation_id AND hits.victim_id = e.victim_id AND (hits.frame = e.frame OR hits.frame = e.frame - 1 OR hits.frame = e.frame + 1)', 'LEFT')
671+
) AS hits", 'hits.operation_id = e.operation_id AND hits.victim_id = e.victim_id AND (hits.frame = e.frame OR hits.frame_plus = e.frame OR hits.frame_minus = e.frame)', 'LEFT')
672672
->where("e.victim_aid = e.attacker_aid AND hits.victim_id IS NULL AND victim.is_player = 1 AND e.event = 'killed'")
673673
->where('e.operation_id', $id);
674674

0 commit comments

Comments
 (0)