Add forgotten files

FossilOrigin-Name: 489bb6c39a3f2436b30a1323b5395d1ce92f84f13c20c6489004d60842de79c8
This commit is contained in:
Jonathan Schleifer 2025-03-25 23:03:58 +00:00
parent 5835957d74
commit f76b9643ec
2 changed files with 58 additions and 0 deletions

12
src/Player.h Normal file
View file

@ -0,0 +1,12 @@
#import "DynamicEntity.h"
@interface Player: DynamicEntity
// special client ent that receives input and acts as camera
@property (class, nonatomic) Player *player1;
// sequence id for each respawn, used in damage test
@property (nonatomic) int lifeSequence;
@property (nonatomic) int frags;
@property (copy, nonatomic) OFString *team;
+ (instancetype)player;
@end

46
src/Player.m Normal file
View file

@ -0,0 +1,46 @@
#import "Player.h"
static Player *player1;
@implementation Player
+ (void)initialize
{
if (self == Player.class)
player1 = [[Player alloc] init];
}
+ (instancetype)player
{
return [[self alloc] init];
}
+ (void)setPlayer1:(Player *)player1_
{
player1 = player1_;
}
+ (Player *)player1
{
return player1;
}
- (instancetype)init
{
self = [super init];
_team = @"";
return self;
}
- (id)copy
{
Player *copy = [super copy];
copy->_lifeSequence = _lifeSequence;
copy->_frags = _frags;
copy->_team = [_team copy];
return copy;
}
@end