readme and minor api change

brake-improvement
D00Med 2017-01-26 19:54:50 +10:00
parent b98f5f53c9
commit a6a9685e0d
2 changed files with 72 additions and 1 deletions

View File

@ -126,7 +126,7 @@ function vehicles.object_drive(entity, dtime, def)
local boost = def.boost or false
local boost_duration = def.boost_duration or 5
local boost_charge = def.boost_charge or 4
local boost_effect = def.boost_effect
local boost_effect = def.boost_effect or nil
local hover_speed = def.hover_speed or 1.5
local jump_speed = def.jump_speed or 5
local simple_vehicle = def.simple_vehicle or false

View File

@ -18,3 +18,74 @@ Boats and watercraft:
The speed boat can be used on water, but if it is driven onto land it will stop completely. If you are lucky you can move back into water, but be careful because this does not always work.
Other things:
Vehicles will explode if they touch lava, so be careful.
Don't drive cars or planes etc. into water! they will sink.
If you do get a vehicle in a tricky spot, you can punch it whilst driving and it will be dropped.
The API:
vehicles.object_drive is the function used for the movement of vehicles.
It should be used in this format:
vehicles.object_drive(entity, dtime, {
})
In the above case, entity is used in place of an entity or object. If the function was to be used inside on_step for an entity, 'entity' would be replaced with 'self.object'
The table should contain the relevant variables listed below. The function is written so that these are all somewhat optional.
speed: This defines the speed of the vehicle, if unset it will be '10'
fixed: Setting this to 'true' will disable movement from the vehicle
decell: This defines the decelleration of the vehicle. The default is 0
shoots: If true then the vehicle can shoot with 'sneak'(arrow must be defined, default is false)
arrow: This should be the entity name for the weapon fired (default is nil) (requires an item with the name arrow_name.."_item" to be in the drivers inventory)
reload_time: how long it takes before the weapon can be fired again (default is 1)
shoot_y: y offset of the weapon, default is 1.5
shoot_angle: This will make the weapon shoot at a differrent vertical angle (default is 0)
infinite_arrow: if this is set then the vehicle won't need an arrow item to be in the inventory
arrow2/reload_time2/shoots2/shoot_y2/infinite_arrow2: same as above but fired with 'use/aux1'
jump: can be either 'hover' or 'jump' (default is nil). Hover lasts longer than jump.
fly: if true then the vehicle will fly (default is false)
fly_mode: can be either 'hold' or 'rise' (default is 'hold'). hold will keep the vehicle in place when 'jump' is pressed, and 'rise' will cause the vehicle to rise when the same key is pressed.
rise_speed: dependant on fly_mode being set to 'rise'. Defines the speed at which the vehicle will rise. (default is 0.1)
gravity: the gravity acting on the vehicle. This should be positive. (default is 1)
boost: if set to 'true' then the vehicle can boost with 'use/aux1' (default is false)
boost_duration: dependant on 'boost'. Determines how long a boost will last (default is 5).
boost_charge: dependant on 'boost'. Determines how long it takes before boost can be used again (default is 4)
boost_effect: particle texture that will fly out from behind the vehicle whilst boosting (default is nil)
hover_speed: the speed at which the vehicle will hover if 'jump' is set to 'hover' (default is 1.5)
jump_speed: the speed at which the vehicle will jump if 'jump' is set to 'jump' (default is 5)
simple_vehicle: removes all functionality except basic movement, use to reduce lag. (not implemented yet), default is false
is_watercraft: if set to true then the vehicle won't be stopped by water.
it will act like a boat unless swims is true. (default is false)
swims: will allow the vehicle to move underwater (not yet implemented) (default is false)
driving_sound: name of the sound file that will play when the vehicle is driving (default is nil)
sound_duration: !VERY IMPORTANT! if there is a driving sound then this should match it's duration. If this is not set then the sound could overlap and increase in volume (default is 5)
extra_yaw: use this if the model has incorrect rotation. It will rotate the model so it faces the right way whilst being driven (default is 0)
moving_anim/stand_anim/jump_anim/shoot_anim/shoot_anim2: animations for actions. Can be set individually. (default is nil)