src/core/WeaponSystem.js
/**
	* Resets the internal data structures and sets an initial weapon.
	*
	* @return {WeaponSystem} A reference to this weapon system.
	*/
Resets the internal data structures and sets an initial weapon.
@return {WeaponSystem} A reference to this weapon system.
Resets the internal data structures and sets an initial weapon . @return { WeaponSystem } A reference to this weapon system .
reset() {
		for ( let i = ( this.weapons.length - 1 ); i >= 0; i -- ) {
			const weapon = this.weapons[ i ];
			this.removeWeapon( weapon.type );
		}
		this.addWeapon( WEAPON_TYPES_BLASTER );
		this.changeWeapon( WEAPON_TYPES_BLASTER );
		this.nextWeaponType = null;
		this.currentWeapon.status = WEAPON_STATUS_READY;
		return this;
	}
reset ( ) { for ( let i = ( this . weapons . length - 1 ) ; i >= 0 ; i -- ) { const weapon = this . weapons [ i ] ; this . removeWeapon ( weapon . type ) ; } this . addWeapon ( WEAPON_TYPES_BLASTER ) ; this . changeWeapon ( WEAPON_TYPES_BLASTER ) ; this . nextWeaponType = null ; this . currentWeapon . status = WEAPON_STATUS_READY ; return this ; }
Resets the internal data structures and sets an initial weapon.
Resets the internal data structures and sets an initial weapon .
// remove existing weapons if necessary // add weapons to inventory // change to initial weapon // reset next weapon // the initial weapon is always ready to use