With SWVR, all your code is designed to be put inside ENT:Initialize()
and there only. If you find yourself having to write code elsewhere (such as overriding functions), then the base is missing a feature! Message me to get it added ASAP.
Because of this, assume ALL code examples below are inside of ENT:Initialize()
Setting up your ship with the basic necessary values is extremely easy. Simply run the setup function.
self:Setup(1000, 1500, nil, 550, 9, true, true)
Of course, you'll also probably want a pilot. There is a function meant just for this!
self:AddPilot(Vector(300, 0, 600), nil, {
exitpos = Vector(-400, 0, 0),
fpvpos = Vector(300, 0, 95)
})
In theory, these two lines of actual code are the ONLY lines required to get a ship up and running.
Of course, at this state you won't have engine effects, cool sounds, weapons, seats, etc.
In SWVR, adding weapons is extremely easy!
Simply create a weapon group first:
self:AddWeaponGroup("Pilot", "weapons/rz2_shoot.wav", self:InitBulltet{
damage = 50,
color = "red",
delay = 0.12,
overheatAmount = 30
})
Now, you'll probably want to add some weapons to that group.
self:AddWeapon("Pilot", "Right", Vector(120, 87, 45))
self:AddWeapon("Pilot", "Left", Vector(120, -87, 45))
Finally, you should update your AddPilot
call to include the new weapon group. Keep in mind, any weapon groups you add to a pilot/seat must be defined BEFORE you add the pilot/seat.
self:AddPilot(Vector(300, 0, 600), nil, {
exitpos = Vector(-400, 0, 0),
fpvpos = Vector(300, 0, 95),
weapons = {"Pilot"} -- Name of the group(s)
})
To be honest i would rename the Function that is used here. Just call it "Init" or "CreateVehicle." Then you can call that from the Initialize of the baseclass and you wont have to add the "self.BasClass.Initialize(self)"