19#ifndef HEADER_ITEM_EVENT_INFO_HPP
20#define HEADER_ITEM_EVENT_INFO_HPP
22#include "items/item.hpp"
23#include "utils/vec3.hpp"
39 enum EventType {IEI_COLLECT, IEI_NEW, IEI_SWITCH} m_type;
82 int kart_id,
const Vec3 &xyz,
const Vec3 &normal)
108 bool isSwitch()
const {
return m_type == IEI_SWITCH; }
145 return ItemState::ITEM_BUBBLEGUM;
Describes a chain of 8-bit unsigned integers.
Definition: network_string.hpp:53
This class stores a delta, i.e.
Definition: item_event_info.hpp:36
int m_ticks
Time at which this event happens.
Definition: item_event_info.hpp:42
int getIndex() const
Returns the index of this item.
Definition: item_event_info.hpp:111
bool isItemCollection() const
Returns true if this event represents collection of an item.
Definition: item_event_info.hpp:105
int getTicksTillReturn() const
Returns the ticks till return, used only by collection events.
Definition: item_event_info.hpp:139
int16_t m_ticks_till_return
Ticks for the item to return, atm used by collecting banana with bomb to delay the return for banana.
Definition: item_event_info.hpp:60
int m_kart_id
The kart id that collected an item if >=0; if -1 it indicates a new item, and a -2 indicates a switch...
Definition: item_event_info.hpp:50
bool isNewItem() const
Returns if this event represents a new item.
Definition: item_event_info.hpp:102
Vec3 m_xyz
In case of new items the position of the new item.
Definition: item_event_info.hpp:53
const Vec3 & getXYZ() const
Returns the location of a new item.
Definition: item_event_info.hpp:125
bool isSwitch() const
Returns true if this event represent a switch usage.
Definition: item_event_info.hpp:108
EventType
Type of this event.
Definition: item_event_info.hpp:39
const Vec3 & getNormal() const
Returns the normal of a new item only.
Definition: item_event_info.hpp:132
ItemEventInfo(int ticks, int index, int kart_id, int16_t ttr)
Constructor for collecting an existing item.
Definition: item_event_info.hpp:69
Vec3 m_normal
The normal of an item.
Definition: item_event_info.hpp:56
int m_index
Index of this item in the item list.
Definition: item_event_info.hpp:46
ItemEventInfo(int ticks)
Constructor for switching items.
Definition: item_event_info.hpp:91
ItemState::ItemType getNewItemType() const
Returns the type of this item.
Definition: item_event_info.hpp:143
int getKartId() const
Returns the id of the kart that collected an item.
Definition: item_event_info.hpp:118
void saveState(BareNetworkString *buffer)
Stores this event into a network string.
Definition: item_event_info.cpp:67
int getTicks() const
Returns the time of the event in ticks.
Definition: item_event_info.hpp:114
ItemEventInfo(int ticks, ItemState::ItemType type, int index, int kart_id, const Vec3 &xyz, const Vec3 &normal)
Constructor for creating a new item (i.e.
Definition: item_event_info.hpp:81
ItemType
The list of all items.
Definition: item.hpp:62
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35
Declares the general types that are used by the network.