添加弹药

This commit is contained in:
aozhiwei 2019-04-02 17:12:07 +08:00
parent a72692b860
commit 3f80cd943f
6 changed files with 22 additions and 14 deletions

View File

@ -13,7 +13,7 @@ Human::Human()
movement = new MovementComponent(); movement = new MovementComponent();
movement->owner = this; movement->owner = this;
default_weapon.weapon_idx = 0; default_weapon.weapon_idx = 0;
default_weapon.weapon_id = 12102; default_weapon.weapon_id = 12101;
default_weapon.weapon_lv = 1; default_weapon.weapon_lv = 1;
default_weapon.meta = MetaMgr::Instance()->GetEquip(default_weapon.weapon_id); default_weapon.meta = MetaMgr::Instance()->GetEquip(default_weapon.weapon_id);
weapons.reserve(MAX_WEAPON_NUM); weapons.reserve(MAX_WEAPON_NUM);

View File

@ -404,7 +404,7 @@ void Player::UpdateDropWeapon()
{ {
Vector2D dir = Vector2D::UP; Vector2D dir = Vector2D::UP;
dir.Rotate(a8::RandAngle()); dir.Rotate(a8::RandAngle());
entity->pos = pos + dir * (5 + rand() % 50); entity->pos = pos + dir * (25 + rand() % 50);
} }
entity->item_id = weapon_id; entity->item_id = weapon_id;
entity->count = 1; entity->count = 1;

View File

@ -124,4 +124,5 @@ void Weapon::ToPB(cs::MFWeapon* pb_obj)
pb_obj->set_weapon_id(weapon_id); pb_obj->set_weapon_id(weapon_id);
pb_obj->set_weapon_lv(weapon_lv); pb_obj->set_weapon_lv(weapon_lv);
pb_obj->set_num(num); pb_obj->set_num(num);
pb_obj->set_ammo(ammo);
} }

View File

@ -70,6 +70,7 @@ struct Weapon
int weapon_id = 0; int weapon_id = 0;
int weapon_lv = 0; int weapon_lv = 0;
int num = 0; int num = 0;
int ammo = 0;
MetaData::Equip* meta = nullptr; MetaData::Equip* meta = nullptr;
void ToPB(cs::MFWeapon* pb_obj); void ToPB(cs::MFWeapon* pb_obj);

View File

@ -125,6 +125,7 @@ message MFWeapon
optional int32 weapon_id = 1; //id weapon_id == 0 optional int32 weapon_id = 1; //id weapon_id == 0
optional int32 weapon_lv = 2; // optional int32 weapon_lv = 2; //
optional int32 num = 3; // optional int32 num = 3; //
optional int32 ammo = 4; //
} }
//- //-
@ -357,21 +358,23 @@ message MFActivePlayerData
optional int32 cur_scope = 10; // 1 2 4 8 15 optional int32 cur_scope = 10; // 1 2 4 8 15
/* /*
0: 9mm 0: 9mm
1: 762mm 1: 556mm
2: 556mm 2: 762mm
3: 12gauge 3: 12gauge
4: frag 4: rpg火药
5: smoke 5: frag
6: bandage 6: smoke
7: healthkit 7: healthkit
8: soda 8:
9: painkiller 9:
10:
11:
10: 1xscope 12: 1xscope
11: 2xscope 13: 2xscope
12: 4xscope 14: 4xscope
13: 8xscope 15: 8xscope
14: 15xscope 16: 15xscope
*/ */
repeated int32 inventory = 11; // repeated int32 inventory = 11; //

View File

@ -64,6 +64,9 @@ message Equip
optional int32 number = 18; // optional int32 number = 18; //
optional int32 volume = 19; // optional int32 volume = 19; //
optional int32 bullet_rad = 20; // optional int32 bullet_rad = 20; //
optional string inventory_slot = 21; //
optional int32 _inventory_slot = 22; //
} }
message Player message Player