// automatically generated by the FlatBuffers compiler, do not modify

/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */

import * as flatbuffers from 'flatbuffers';



export class OtherScience implements flatbuffers.IUnpackableObject<OtherScienceT> {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):OtherScience {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

static getRootAsOtherScience(bb:flatbuffers.ByteBuffer, obj?:OtherScience):OtherScience {
  return (obj || new OtherScience()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

static getSizePrefixedRootAsOtherScience(bb:flatbuffers.ByteBuffer, obj?:OtherScience):OtherScience {
  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
  return (obj || new OtherScience()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

race():string|null
race(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
race(optionalEncoding?:any):string|Uint8Array|null {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(optionalEncoding?:any):string|Uint8Array|null {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

drive():number {
  const offset = this.bb!.__offset(this.bb_pos, 8);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

weapons():number {
  const offset = this.bb!.__offset(this.bb_pos, 10);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

shields():number {
  const offset = this.bb!.__offset(this.bb_pos, 12);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

cargo():number {
  const offset = this.bb!.__offset(this.bb_pos, 14);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

static startOtherScience(builder:flatbuffers.Builder) {
  builder.startObject(6);
}

static addRace(builder:flatbuffers.Builder, raceOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, raceOffset, 0);
}

static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
  builder.addFieldOffset(1, nameOffset, 0);
}

static addDrive(builder:flatbuffers.Builder, drive:number) {
  builder.addFieldFloat32(2, drive, 0.0);
}

static addWeapons(builder:flatbuffers.Builder, weapons:number) {
  builder.addFieldFloat32(3, weapons, 0.0);
}

static addShields(builder:flatbuffers.Builder, shields:number) {
  builder.addFieldFloat32(4, shields, 0.0);
}

static addCargo(builder:flatbuffers.Builder, cargo:number) {
  builder.addFieldFloat32(5, cargo, 0.0);
}

static endOtherScience(builder:flatbuffers.Builder):flatbuffers.Offset {
  const offset = builder.endObject();
  return offset;
}

static createOtherScience(builder:flatbuffers.Builder, raceOffset:flatbuffers.Offset, nameOffset:flatbuffers.Offset, drive:number, weapons:number, shields:number, cargo:number):flatbuffers.Offset {
  OtherScience.startOtherScience(builder);
  OtherScience.addRace(builder, raceOffset);
  OtherScience.addName(builder, nameOffset);
  OtherScience.addDrive(builder, drive);
  OtherScience.addWeapons(builder, weapons);
  OtherScience.addShields(builder, shields);
  OtherScience.addCargo(builder, cargo);
  return OtherScience.endOtherScience(builder);
}

unpack(): OtherScienceT {
  return new OtherScienceT(
    this.race(),
    this.name(),
    this.drive(),
    this.weapons(),
    this.shields(),
    this.cargo()
  );
}


unpackTo(_o: OtherScienceT): void {
  _o.race = this.race();
  _o.name = this.name();
  _o.drive = this.drive();
  _o.weapons = this.weapons();
  _o.shields = this.shields();
  _o.cargo = this.cargo();
}
}

export class OtherScienceT implements flatbuffers.IGeneratedObject {
constructor(
  public race: string|Uint8Array|null = null,
  public name: string|Uint8Array|null = null,
  public drive: number = 0.0,
  public weapons: number = 0.0,
  public shields: number = 0.0,
  public cargo: number = 0.0
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  const race = (this.race !== null ? builder.createString(this.race!) : 0);
  const name = (this.name !== null ? builder.createString(this.name!) : 0);

  return OtherScience.createOtherScience(builder,
    race,
    name,
    this.drive,
    this.weapons,
    this.shields,
    this.cargo
  );
}
}
