| 813 | } |
| 814 | |
| 815 | void queuePower(Entity &ent, uint32_t pset_idx, uint32_t pow_idx, uint32_t tgt_idx) |
| 816 | { |
| 817 | CharacterPower * ppower = getOwnedPowerByVecIdx(ent, pset_idx, pow_idx); |
| 818 | const Power_Data powtpl = ppower->getPowerTemplate(); |
| 819 | QueuedPowers qpowers; |
| 820 | qpowers.m_pow_idxs = {pset_idx, pow_idx}; |
| 821 | qpowers.m_active_state_change = true; |
| 822 | qpowers.m_timer_updated = true; |
| 823 | qpowers.m_activation_state = true; |
| 824 | qpowers.m_tgt_idx = tgt_idx; |
| 825 | qpowers.m_recharge_time = powtpl.RechargeTime; |
| 826 | qpowers.m_activate_period = powtpl.ActivatePeriod; |
| 827 | qpowers.m_time_to_activate = powtpl.TimeToActivate; |
| 828 | |
| 829 | //if other powers are queued, remove them first, but skip the first if it is activating |
| 830 | for(auto rpow_idx = (ent.m_queued_powers.begin() + (ent.m_is_activating?1:0));rpow_idx < ent.m_queued_powers.end(); rpow_idx++) |
| 831 | { |
| 832 | rpow_idx->m_activation_state = false; //sends to client that powers are no longer queued |
| 833 | rpow_idx->m_active_state_change = true; |
| 834 | } |
| 835 | |
| 836 | ent.m_queued_powers.push_back(qpowers); //add to activation Queue |
| 837 | ent.m_char->m_char_data.m_has_updated_powers = true; |
| 838 | |
| 839 | if (powtpl.Type == PowerType::Toggle && !powtpl.GroupMembership.empty()) //scan for toggles with the same group |
| 840 | { |
| 841 | for(auto &rpow_idx : ent.m_auto_powers) |
| 842 | { |
| 843 | ppower = getOwnedPowerByVecIdx(ent, rpow_idx.m_pow_idxs.m_pset_vec_idx, rpow_idx.m_pow_idxs.m_pow_vec_idx); |
| 844 | const Power_Data temppow = ppower->getPowerTemplate(); |
| 845 | |
| 846 | if (temppow.Type == PowerType::Toggle && !temppow.GroupMembership.empty() |
| 847 | && powtpl.GroupMembership[0] == temppow.GroupMembership[0]) //and shut those off |
| 848 | { |
| 849 | rpow_idx.m_activation_state = false; |
| 850 | rpow_idx.m_active_state_change = true; |
| 851 | } |
| 852 | } |
| 853 | } |
| 854 | |
| 855 | ent.m_char->m_char_data.m_has_updated_powers = true; |
| 856 | } |
| 857 | |
| 858 | void queueRecharge(Entity &ent, uint32_t pset_idx, uint32_t pow_idx, float time) |
| 859 | { |
no test coverage detected