From 3bae3519ffdf8655ea4d4df4508a620cf7e67f7f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 1 Jun 2021 15:00:53 +0800 Subject: [PATCH] 1 --- server/gameserver/car.cc | 1 + server/gameserver/room.cc | 41 +++++++++++++++++++++++++++++---------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/server/gameserver/car.cc b/server/gameserver/car.cc index 91347c0..ff8577f 100644 --- a/server/gameserver/car.cc +++ b/server/gameserver/car.cc @@ -40,6 +40,7 @@ void Car::Initialize() born_frameno_ = room->GetFrameNo(); ability.hp = hero_meta_->i->health(); ability.max_hp = std::max(ability.hp, ability.max_hp); + TryAddBuff(this, meta->car_deactive_buff_id); } void Car::FillMFObjectPart(Room* room, Human* hum, cs::MFObjectPart* part_data) diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 286ac27..c075961 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -2133,16 +2133,36 @@ void Room::CreateLoots() int thing_id = thing_tpl->RandThing(); MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(thing_id); if (equip_meta) { - int loot_uniid = CreateLoot( - equip_meta->i->id(), - a8::Vec2 - ( - thing_tpl->i->x(), - thing_tpl->i->y() - ), - 1, - 1 - ); + if (equip_meta->i->equip_type() == EQUIP_TYPE_CAR) { + int car_uniid = AllocUniid(); + Car* c = CreateCar(nullptr, + car_uniid, + equip_meta, + a8::Vec2 + ( + thing_tpl->i->x(), + thing_tpl->i->y() + ), + 0); + if (c) { + CarObject car; + car.car_id = equip_meta->i->id(); + car.pos = c->GetPos(); + car_hash_[c->GetEntityUniId()] = car; + } + } else { + int loot_uniid = CreateLoot( + equip_meta->i->id(), + a8::Vec2 + ( + thing_tpl->i->x(), + thing_tpl->i->y() + ), + 1, + 1 + ); + } + #if 0 if (loot_uniid && equip_meta->i->equip_type() == EQUIP_TYPE_CAR) { Entity* loot_entity = GetEntityByUniId(loot_uniid); if (loot_entity && loot_entity->IsEntityType(ET_Loot)) { @@ -2155,6 +2175,7 @@ void Room::CreateLoots() car_hash_[loot_entity->GetEntityUniId()] = car; } } + #endif } } }