X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fvehicles%2Fsv_vehicles.qh;h=e593922fcb0f4beb788cc77ad65d1b0bf754cca2;hb=c34ce256dad53ee55c890a98ea42469ce2ee4401;hp=36b4f5f3e970431cda92d07acf5068382bcadc1b;hpb=09aa2385846362f77aa2da3f25a3a4d07f5ab1db;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/vehicles/sv_vehicles.qh b/qcsrc/common/vehicles/sv_vehicles.qh index 36b4f5f3e..e593922fc 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qh +++ b/qcsrc/common/vehicles/sv_vehicles.qh @@ -2,23 +2,24 @@ #define VEHICLES_DEF_H #ifdef SVQC -#include "../server/tturrets/include/turrets_early.qh" -#include "sv_vehicles.qh" - -// #define VEHICLES_USE_ODE +#include +#include "vehicle.qh" // vehicle cvars -float autocvar_g_vehicles; -float autocvar_g_vehicles_enter; -float autocvar_g_vehicles_enter_radius; -float autocvar_g_vehicles_steal; -float autocvar_g_vehicles_steal_show_waypoint; -float autocvar_g_vehicles_crush_dmg; -float autocvar_g_vehicles_crush_force; -float autocvar_g_vehicles_delayspawn; -float autocvar_g_vehicles_delayspawn_jitter; +bool autocvar_g_vehicles = true; +AUTOCVAR(g_vehicles_enter, bool, false, "require pressing use key to enter a vehicle"); +float autocvar_g_vehicles_enter_radius = 250; +AUTOCVAR(g_vehicles_steal, bool, true, "allow stealing enemy vehicles in teamplay modes"); +AUTOCVAR(g_vehicles_steal_show_waypoint, bool, true, "show a waypoint above the thief"); +float autocvar_g_vehicles_crush_dmg = 70; +float autocvar_g_vehicles_crush_force = 50; +bool autocvar_g_vehicles_delayspawn = true; +float autocvar_g_vehicles_delayspawn_jitter = 10; float autocvar_g_vehicles_allow_bots; -float autocvar_g_vehicles_teams; +int autocvar_g_vehicles_exit_attempts = 25; +float autocvar_g_vehicles_thinkrate = 0.1; + +AUTOCVAR(g_vehicles_teams, bool, true, "allow team specific vehicles"); float autocvar_g_vehicles_teleportable; float autocvar_g_vehicles_vortex_damagerate = 0.5; float autocvar_g_vehicles_machinegun_damagerate = 0.5; @@ -27,6 +28,8 @@ float autocvar_g_vehicles_vaporizer_damagerate = 0.001; float autocvar_g_vehicles_tag_damagerate = 5; float autocvar_g_vehicles_weapon_damagerate = 1; +.float vehicle_last_trace; + // flags: .int vehicle_flags; @@ -43,14 +46,14 @@ float autocvar_g_vehicles_weapon_damagerate = 1; .entity gunner1; .entity gunner2; -.float vehicle_health; /// If self is player this is 0..100 indicating precentage of health left on vehicle. If self is vehile, this is the real health value. -.float vehicle_energy; /// If self is player this is 0..100 indicating precentage of energy left on vehicle. If self is vehile, this is the real energy value. -.float vehicle_shield; /// If self is player this is 0..100 indicating precentage of shield left on vehicle. If self is vehile, this is the real shield value. +.float vehicle_health = _STAT(VEHICLESTAT_HEALTH); /// If ent is player this is 0..100 indicating precentage of health left on vehicle. If ent is vehile, this is the real health value. +.float vehicle_energy = _STAT(VEHICLESTAT_ENERGY); /// If ent is player this is 0..100 indicating precentage of energy left on vehicle. If ent is vehile, this is the real energy value. +.float vehicle_shield = _STAT(VEHICLESTAT_SHIELD); /// If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehile, this is the real shield value. -.float vehicle_ammo1; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real ammo1 value. -.float vehicle_reload1; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real reload1 value. -.float vehicle_ammo2; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real ammo2 value. -.float vehicle_reload2; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real reload2 value. +.float vehicle_ammo1 = _STAT(VEHICLESTAT_AMMO1); /// If ent is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already stored in vehicle_energy. If ent is vehile, this is the real ammo1 value. +.float vehicle_reload1 = _STAT(VEHICLESTAT_RELOAD1); /// If ent is player this is 0..100 indicating percentage of primary reload status. If ent is vehile, this is the real reload1 value. +.float vehicle_ammo2 = _STAT(VEHICLESTAT_AMMO2); /// If ent is player this is 0..100 indicating percentage of secondary ammo left. If ent is vehile, this is the real ammo2 value. +.float vehicle_reload2 = _STAT(VEHICLESTAT_RELOAD2); /// If ent is player this is 0..100 indicating percentage of secondary reload status. If ent is vehile, this is the real reload2 value. .float sound_nexttime; const float VOL_VEHICLEENGINE = 1; @@ -62,7 +65,7 @@ const float SVC_UPDATEENTITY = 128; // Net.Protocol 0x80 const float VHSF_NORMAL = 0; const float VHSF_FACTORY = 2; -.int hud; +.int hud = _STAT(HUD); .float dmg_time; .int volly_counter; @@ -80,10 +83,10 @@ const float DAMAGE_TARGETDRONE = 10; // vehicle functions .void(int _spawnflag) vehicle_spawn; /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns -.bool(int _imp) vehicles_impulse; -.int vehicle_weapon2mode; -.void(int exit_flags) vehicle_exit; -.bool() vehicle_enter; +.bool(entity this, int _imp) vehicles_impulse; +.int vehicle_weapon2mode = _STAT(VEHICLESTAT_W2MODE); +.void(entity this, int exit_flags) vehicle_exit; +.bool(entity this, entity player) vehicle_enter; const int VHEF_NORMAL = 0; /// User pressed exit key const int VHEF_EJECT = 1; /// User pressed exit key 3 times fast (not implemented) or vehile is dying const int VHEF_RELEASE = 2; /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented) @@ -95,20 +98,16 @@ vector force_fromtag_origin; float vehicles_exit_running; // macros -#define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \ - ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100 - -#ifdef VEHICLES_USE_ODE -void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object -void(entity e, vector force, vector force_pos) physics_addforce = #541; // apply a force from certain origin, length of force vector is power of force -void(entity e, vector torque) physics_addtorque = #542; // add relative torque -#endif // VEHICLES_USE_ODE +#define VEHICLE_UPDATE_PLAYER(ply,vehi,fld,vhname) \ + ply.vehicle_##fld = (vehi.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100 .float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly -void vehicles_exit(float eject); -float vehicle_initialize(float vehicle_id, float nodrop); +void vehicles_exit(entity vehic, int eject); +bool vehicle_initialize(entity this, Vehicle info, float nodrop); +bool vehicle_impulse(entity this, int imp); +bool vehicles_crushable(entity e); +float vehicle_altitude(entity this, float amax); #endif - #endif