if (this.max_health)
{
this.takedamage = DAMAGE_YES;
- SetResourceAmountExplicit(this, RESOURCE_HEALTH, this.max_health);
+ SetResourceExplicit(this, RES_HEALTH, this.max_health);
}
this.state = STATE_DOWN;
if(this.spawnflags & NOSPLASH)
if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
return;
- TakeResource(this, RESOURCE_HEALTH, damage);
+ TakeResource(this, RES_HEALTH, damage);
if (this.itemkeys)
{
return;
}
- if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+ if (GetResource(this, RES_HEALTH) <= 0)
{
- SetResourceAmountExplicit(this.owner, RESOURCE_HEALTH, this.owner.max_health);
+ SetResourceExplicit(this.owner, RES_HEALTH, this.owner.max_health);
this.owner.takedamage = DAMAGE_NO; // will be reset upon return
- door_use(this.owner, NULL, NULL);
+ door_use(this.owner, attacker, NULL);
}
}
void door_trigger_touch(entity this, entity toucher)
{
- if (GetResourceAmount(toucher, RESOURCE_HEALTH) < 1)
+ if (GetResource(toucher, RES_HEALTH) < 1)
#ifdef SVQC
if (!((toucher.iscreature || (toucher.flags & FL_PROJECTILE)) && !IS_DEAD(toucher)))
#elif defined(CSQC)
{
this.owner = this.enemy = this;
- if (GetResourceAmount(this, RESOURCE_HEALTH))
+ if (GetResource(this, RES_HEALTH))
return;
- IFTARGETED
+ if(this.targetname && this.targetname != "")
return;
if (this.items)
return;
cmaxs = this.absmax;
for(t = this; ; t = t.enemy)
{
- if(GetResourceAmount(t, RESOURCE_HEALTH) && !GetResourceAmount(this, RESOURCE_HEALTH))
- SetResourceAmountExplicit(this, RESOURCE_HEALTH, GetResourceAmount(t, RESOURCE_HEALTH));
+ if(GetResource(t, RES_HEALTH) && !GetResource(this, RES_HEALTH))
+ SetResourceExplicit(this, RES_HEALTH, GetResource(t, RES_HEALTH));
if((t.targetname != "") && (this.targetname == ""))
this.targetname = t.targetname;
if((t.message != "") && (this.message == ""))
// distribute health, targetname, message
for(t = this; t; t = t.enemy)
{
- SetResourceAmountExplicit(t, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH));
+ SetResourceExplicit(t, RES_HEALTH, GetResource(this, RES_HEALTH));
t.targetname = this.targetname;
t.message = this.message;
if(t.enemy == this)
// shootable, or triggered doors just needed the owner/enemy links,
// they don't spawn a field
- if (GetResourceAmount(this, RESOURCE_HEALTH))
+ if (GetResource(this, RES_HEALTH))
return;
- IFTARGETED
+ if(this.targetname && this.targetname != "")
return;
if (this.items)
return;
void door_link()
{
- // set size now, as everything is loaded
- //FixSize(this);
//Net_LinkEntity(this, false, 0, door_send);
}
#endif
// common code for func_door and func_door_rotating spawnfuncs
void door_init_shared(entity this)
{
- this.max_health = GetResourceAmount(this, RESOURCE_HEALTH);
+ this.max_health = GetResource(this, RES_HEALTH);
// unlock sound
if(this.noise == "")
}
// TODO: other soundpacks
- if (this.sounds > 0)
+ if (this.sounds > 0 || q3compat)
{
+ // Doors in Q3 always have sounds (they're hard coded in Q3 engine)
this.noise2 = "plats/medplat1.wav";
this.noise1 = "plats/medplat2.wav";
}
+ if (q3compat)
+ {
+ // CPMA adds these fields for overriding the engine sounds
+ string s = GetField_fullspawndata(this, "sound_start", true);
+ string e = GetField_fullspawndata(this, "sound_end", true);
+
+ if (s)
+ this.noise2 = strzone(s);
+ if (e)
+ this.noise1 = strzone(e);
+ }
+
// sound when door stops moving
if(this.noise1 && this.noise1 != "")
{
precache_sound(this.noise2);
}
- if (!this.wait)
- {
- this.wait = 3;
- }
+ if(autocvar_sv_doors_always_open)
+ {
+ this.wait = -1;
+ }
+ else if (!this.wait)
+ {
+ this.wait = 3;
+ }
+
if (!this.lip)
{
this.lip = 8;
this.state = STATE_BOTTOM;
- if (GetResourceAmount(this, RESOURCE_HEALTH))
+ if (GetResource(this, RES_HEALTH))
{
//this.canteamdamage = true; // TODO
this.takedamage = DAMAGE_YES;
setblocked(this, door_blocked);
this.use = door_use;
- this.pos1 = this.origin;
- this.pos2 = this.pos1 + this.movedir*(fabs(this.movedir*this.size) - this.lip);
-
if(this.spawnflags & DOOR_NONSOLID)
this.solid = SOLID_NOT;
door_init_shared(this);
- if (!this.speed)
- {
- this.speed = 100;
- }
+ this.pos1 = this.origin;
+ this.pos2 = this.pos1 + this.movedir*(fabs(this.movedir*this.size) - this.lip);
+
+ if(autocvar_sv_doors_always_open)
+ {
+ this.speed = max(750, this.speed);
+ }
+ else if (!this.speed)
+ {
+ if (q3compat)
+ this.speed = 400;
+ else
+ this.speed = 100;
+ }
settouch(this, door_touch);