void WeaponItem::ObjectTouch(HOBJECT hObject) { if (!hObject) return; // If we hit non-player objects, just ignore them... if (IsPlayer(hObject)) { CCharacter* pCharObj = (CCharacter*)g_pLTServer->HandleToObject(hObject); if (pCharObj && !pCharObj->IsDead()) { HMESSAGEWRITE hMessage = g_pLTServer->StartMessageToObject(this, hObject, MID_ADDWEAPON); g_pLTServer->WriteToMessageByte(hMessage, m_nWeaponId); g_pLTServer->WriteToMessageByte(hMessage, m_nAmmoId); g_pLTServer->WriteToMessageFloat(hMessage, (LTFLOAT)m_nAmmo); g_pLTServer->WriteToMessageByte(hMessage, m_bIsLevelPowerup); g_pLTServer->EndMessage(hMessage); } } }
void WeaponItem::ObjectTouch(HOBJECT hObject, bool bForcePickup/*=false*/) { if (!hObject) return; // If we hit non-player objects, just ignore them... if (IsPlayer(hObject)) { CCharacter* pCharObj = (CCharacter*)g_pLTServer->HandleToObject(hObject); if (pCharObj && !pCharObj->IsDead()) { CAutoMessage cMsg; cMsg.Writeuint32(MID_ADDWEAPON); cMsg.Writeuint8(m_nWeaponId); cMsg.Writeuint8(m_nAmmoId); cMsg.Writeint32(m_nAmmo); cMsg.Writebool(bForcePickup); g_pLTServer->SendToObject(cMsg.Read(), m_hObject, hObject, MESSAGE_GUARANTEED); } } }
void AmmoBox::ObjectTouch(HOBJECT hObject, bool bForcePickup/*=false*/) { if (!hObject) return; // If we hit non-player objects, just ignore them... if (IsPlayer(hObject)) { CCharacter* pCharObj = (CCharacter*)g_pLTServer->HandleToObject(hObject); if (pCharObj && !pCharObj->IsDead()) { int nValidIds = 0; for (int i=0; i < AB_MAX_TYPES; i++) { if (m_nAmmoId[i] != WMGR_INVALID_ID && m_nAmmoCount[i] > 0) { nValidIds++; } } if (nValidIds) { CAutoMessage cMsg; cMsg.Writeuint32(MID_AMMOBOX); cMsg.Writeuint8(nValidIds); for (int i=0; i < AB_MAX_TYPES; i++) { if (m_nAmmoId[i] != WMGR_INVALID_ID && m_nAmmoCount[i] > 0) { cMsg.Writeuint8(m_nAmmoId[i]); cMsg.Writeint32(m_nAmmoCount[i]); } } g_pLTServer->SendToObject(cMsg.Read(), m_hObject, hObject, MESSAGE_GUARANTEED); } } } }