Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a check for the TAGame.Car_TA:ReplicatedDemolishGoalExplosion component #274

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion carball/json_parser/actor/car.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,34 @@ def update(self, actor: dict, frame_number: int, time: float, delta: float) -> N
}

def add_demo(self, actor, frame_number):
if 'TAGame.Car_TA:ReplicatedDemolish' in actor:
if 'TAGame.Car_TA:ReplicatedDemolishGoalExplosion' in actor:
demo_data = actor['TAGame.Car_TA:ReplicatedDemolishGoalExplosion']
# add attacker and victim player ids
attacker_car_id = demo_data['attacker']

victim_car_id = demo_data['victim']
if attacker_car_id != -1 and victim_car_id != -1 and attacker_car_id < 1e9 and victim_car_id < 1e9:
# Filter out weird stuff where it's not a demo
# frame 1 of 0732D41D4AF83D610AE2A988ACBC977A (rlcs season 4 eu)
attacker_player_id = self.parser.car_player_ids[attacker_car_id]
victim_player_id = self.parser.car_player_ids[victim_car_id]
if attacker_player_id != -1 and victim_player_id != -1:
demo_data['attacker_player_id'] = attacker_player_id
demo_data['victim_player_id'] = victim_player_id
# add frame_number
demo_data['frame_number'] = frame_number
self.parser.demos_data.append(demo_data)
logger.debug('ReplicatedDemolish: Att: %s, Def: %s' %
(attacker_player_id, victim_player_id))
logger.debug('RepDemo Names: Att: %s. Def: %s' %
(self.parser.player_dicts[attacker_player_id]['name'],
self.parser.player_dicts[victim_player_id]['name']))
actor.pop('TAGame.Car_TA:ReplicatedDemolishGoalExplosion')
elif 'TAGame.Car_TA:ReplicatedDemolish' in actor:
demo_data = actor['TAGame.Car_TA:ReplicatedDemolish']
# add attacker and victim player ids
attacker_car_id = demo_data['attacker']

victim_car_id = demo_data['victim']
if attacker_car_id != -1 and victim_car_id != -1 and attacker_car_id < 1e9 and victim_car_id < 1e9:
# Filter out weird stuff where it's not a demo
Expand Down
1 change: 1 addition & 0 deletions carball/json_parser/frame_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def parse_frames(self):
for new_actor in frame['new_actors']:
actor_id = new_actor['actor_id']
object_name = self.objects[new_actor['object_id']]

self.actors[actor_id] = {
'Id': actor_id,
'TypeName': object_name,
Expand Down