From 474926b4e5bde6847b6863d299926e442990e560 Mon Sep 17 00:00:00 2001 From: otta8634 Date: Mon, 23 Dec 2024 00:58:25 +0800 Subject: [PATCH] Give powerup statuseffect classes better names (cherry-pick 28ca8192ce) This helps distinction between the Item and the StatusEffect clear for the main 4 powerups. Also moved relevant attributes into their classes. --- .../mutator/powerups/powerup/invisibility.qc | 12 ++--- .../mutator/powerups/powerup/invisibility.qh | 50 ++++++++++--------- .../mutator/powerups/powerup/shield.qc | 18 +++---- .../mutator/powerups/powerup/shield.qh | 46 +++++++++-------- .../mutator/powerups/powerup/speed.qc | 12 ++--- .../mutator/powerups/powerup/speed.qh | 50 ++++++++++--------- .../mutator/powerups/powerup/strength.qc | 18 +++---- .../mutator/powerups/powerup/strength.qh | 46 +++++++++-------- 8 files changed, 130 insertions(+), 122 deletions(-) diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qc b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qc index dda2dcf8f..ebc83e870 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qc +++ b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qc @@ -1,7 +1,7 @@ #include "invisibility.qh" #ifdef SVQC -METHOD(Invisibility, m_remove, void(StatusEffects this, entity actor, int removal_type)) +METHOD(InvisibilityStatusEffect, m_remove, void(StatusEffects this, entity actor, int removal_type)) { bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); if(removal_type == STATUSEFFECT_REMOVE_TIMEOUT && wasactive && IS_PLAYER(actor)) @@ -17,9 +17,9 @@ METHOD(Invisibility, m_remove, void(StatusEffects this, entity actor, int remova if(actor.exteriorweaponentity) actor.exteriorweaponentity.alpha = default_weapon_alpha; } - SUPER(Invisibility).m_remove(this, actor, removal_type); + SUPER(InvisibilityStatusEffect).m_remove(this, actor, removal_type); } -METHOD(Invisibility, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) +METHOD(InvisibilityStatusEffect, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) { bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); if(!wasactive && IS_PLAYER(actor)) @@ -28,9 +28,9 @@ METHOD(Invisibility, m_apply, void(StatusEffects this, entity actor, float eff_t Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_INVISIBILITY, actor.netname); Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_INVISIBILITY); } - SUPER(Invisibility).m_apply(this, actor, eff_time, eff_flags); + SUPER(InvisibilityStatusEffect).m_apply(this, actor, eff_time, eff_flags); } -METHOD(Invisibility, m_tick, void(StatusEffects this, entity actor)) +METHOD(InvisibilityStatusEffect, m_tick, void(StatusEffects this, entity actor)) { play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF); if(!actor.vehicle) @@ -39,6 +39,6 @@ METHOD(Invisibility, m_tick, void(StatusEffects this, entity actor)) if(actor.exteriorweaponentity) actor.exteriorweaponentity.alpha = autocvar_g_balance_powerup_invisibility_alpha; } - SUPER(Invisibility).m_tick(this, actor); + SUPER(InvisibilityStatusEffect).m_tick(this, actor); } #endif diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh index df25c8a9c..ef814f39c 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh @@ -28,35 +28,37 @@ void powerup_invisibility_init(Pickup def, entity item) item.invisibility_finished = (item.count) ? item.count : autocvar_g_balance_powerup_invisibility_time; } #endif -REGISTER_ITEM(Invisibility, NEW(Powerup)) { - this.m_canonical_spawnfunc = "item_invisibility"; + +CLASS(InvisibilityItem, Powerup) + ATTRIB(InvisibilityItem, m_canonical_spawnfun, string, "item_invisibility"); #ifdef SVQC - this.m_iteminit = powerup_invisibility_init; + ATTRIB(InvisibilityItem, m_iteminit, void(Pickup def, entity item), powerup_invisibility_init); #endif #ifdef GAMEQC - this.spawnflags = ITEM_FLAG_NORMAL; - this.m_itemid = IT_INVISIBILITY; - this.m_model = MDL_BUFF; // TODO: MDL_Invisibility_ITEM when new model available - this.m_skin = 12; - this.m_sound = SND_Invisibility; - this.m_glow = true; - this.m_respawnsound = SND_STRENGTH_RESPAWN; + ATTRIB(InvisibilityItem, spawnflags, int, ITEM_FLAG_NORMAL); + ATTRIB(InvisibilityItem, m_itemid, int, IT_INVISIBILITY); + ATTRIB(InvisibilityItem, m_model, Model, MDL_BUFF); // TODO: MDL_Invisibility_ITEM when new model available + ATTRIB(InvisibilityItem, m_skin, int, 12); + ATTRIB(InvisibilityItem, m_sound, Sound, SND_Invisibility); + ATTRIB(InvisibilityItem, m_glow, bool, true); + ATTRIB(InvisibilityItem, m_respawnsound, Sound, SND_STRENGTH_RESPAWN); #endif - this.netname = "invisibility"; - this.m_name = _("Invisibility"); - this.m_icon = "buff_invisible"; - this.m_color = '0.5 0.5 1'; - this.m_waypoint = _("Invisibility"); - this.m_waypointblink = 2; -} + ATTRIB(InvisibilityItem, netname, string, "invisibility"); + ATTRIB(InvisibilityItem, m_name, string, _("Invisibility")); + ATTRIB(InvisibilityItem, m_icon, string, "buff_invisible"); + ATTRIB(InvisibilityItem, m_color, vector, '0.5 0.5 1'); + ATTRIB(InvisibilityItem, m_waypoint, string, _("Invisibility")); + ATTRIB(InvisibilityItem, m_waypointblink, int, 2); +ENDCLASS(InvisibilityItem) +REGISTER_ITEM(Invisibility, NEW(InvisibilityItem)); SPAWNFUNC_ITEM(item_invisibility, ITEM_Invisibility) SPAWNFUNC_ITEM(item_buff_invisibility, ITEM_Invisibility) -CLASS(Invisibility, Powerups) - ATTRIB(Invisibility, netname, string, "invisibility"); - ATTRIB(Invisibility, m_name, string, _("Invisibility")); - ATTRIB(Invisibility, m_color, vector, '0.5 0.5 1'); - ATTRIB(Invisibility, m_icon, string, "buff_invisible"); -ENDCLASS(Invisibility) -REGISTER_STATUSEFFECT(Invisibility, NEW(Invisibility)); +CLASS(InvisibilityStatusEffect, Powerups) + ATTRIB(InvisibilityStatusEffect, netname, string, "invisibility"); + ATTRIB(InvisibilityStatusEffect, m_name, string, _("Invisibility")); + ATTRIB(InvisibilityStatusEffect, m_color, vector, '0.5 0.5 1'); + ATTRIB(InvisibilityStatusEffect, m_icon, string, "buff_invisible"); +ENDCLASS(InvisibilityStatusEffect) +REGISTER_STATUSEFFECT(Invisibility, NEW(InvisibilityStatusEffect)); diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qc b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qc index 230967b2b..999b683ef 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qc +++ b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qc @@ -1,7 +1,7 @@ #include "shield.qh" #ifdef SVQC -METHOD(Shield, m_remove, void(StatusEffects this, entity actor, int removal_type)) +METHOD(ShieldStatusEffect, m_remove, void(StatusEffects this, entity actor, int removal_type)) { bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); if(removal_type == STATUSEFFECT_REMOVE_TIMEOUT && wasactive && IS_PLAYER(actor)) @@ -12,9 +12,9 @@ METHOD(Shield, m_remove, void(StatusEffects this, entity actor, int removal_type if(wasactive) stopsound(actor, CH_TRIGGER_SINGLE); // get rid of the pickup sound actor.effects &= ~(EF_RED | EF_ADDITIVE | EF_FULLBRIGHT); - SUPER(Shield).m_remove(this, actor, removal_type); + SUPER(ShieldStatusEffect).m_remove(this, actor, removal_type); } -METHOD(Shield, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) +METHOD(ShieldStatusEffect, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) { bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); if(!wasactive && IS_PLAYER(actor)) @@ -23,23 +23,23 @@ METHOD(Shield, m_apply, void(StatusEffects this, entity actor, float eff_time, f Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_SHIELD, actor.netname); Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_SHIELD); } - SUPER(Shield).m_apply(this, actor, eff_time, eff_flags); + SUPER(ShieldStatusEffect).m_apply(this, actor, eff_time, eff_flags); } -METHOD(Shield, m_tick, void(StatusEffects this, entity actor)) +METHOD(ShieldStatusEffect, m_tick, void(StatusEffects this, entity actor)) { play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF); actor.effects |= (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT); - SUPER(Shield).m_tick(this, actor); + SUPER(ShieldStatusEffect).m_tick(this, actor); } #endif #ifdef CSQC -METHOD(Shield, m_active, bool(StatusEffects this, entity actor)) +METHOD(ShieldStatusEffect, m_active, bool(StatusEffects this, entity actor)) { if(autocvar__hud_configure) return true; - return SUPER(Shield).m_active(this, actor); + return SUPER(ShieldStatusEffect).m_active(this, actor); } -METHOD(Shield, m_tick, void(StatusEffects this, entity actor)) +METHOD(ShieldStatusEffect, m_tick, void(StatusEffects this, entity actor)) { if(this.m_hidden) return; diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh index ac7faaeda..280b4a33f 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh @@ -27,33 +27,35 @@ void powerup_shield_init(Pickup def, entity item) item.invincible_finished = (item.count) ? item.count : autocvar_g_balance_powerup_invincible_time; } #endif -REGISTER_ITEM(Shield, NEW(Powerup)) { - this.m_canonical_spawnfunc = "item_shield"; + +CLASS(ShieldItem, Powerup) + ATTRIB(ShieldItem, m_canonical_spawnfunc, string, "item_shield"); #ifdef SVQC - this.m_iteminit = powerup_shield_init; + ATTRIB(ShieldItem, m_iteminit, void(Pickup def, entity item), powerup_shield_init); #endif #ifdef GAMEQC - this.spawnflags = ITEM_FLAG_NORMAL; - this.m_itemid = IT_INVINCIBLE; - this.m_model = MDL_Shield_ITEM; - this.m_sound = SND_Shield; - this.m_glow = true; - this.m_respawnsound = SND_SHIELD_RESPAWN; + ATTRIB(ShieldItem, spawnflags, int, ITEM_FLAG_NORMAL); + ATTRIB(ShieldItem, m_itemid, int, IT_INVINCIBLE); + ATTRIB(ShieldItem, m_model, Model, MDL_Shield_ITEM); + ATTRIB(ShieldItem, m_sound, Sound, SND_Shield); + ATTRIB(ShieldItem, m_glow, bool, true); + ATTRIB(ShieldItem, m_respawnsound, Sound, SND_SHIELD_RESPAWN); #endif - this.netname = "invincible"; - this.m_name = _("Shield"); - this.m_icon = "shield"; - this.m_color = '1 0 1'; - this.m_waypoint = _("Shield"); - this.m_waypointblink = 2; -} + ATTRIB(ShieldItem, netname, string, "invincible"); + ATTRIB(ShieldItem, m_name, string, _("Shield")); + ATTRIB(ShieldItem, m_icon, string, "shield"); + ATTRIB(ShieldItem, m_color, vector, '1 0 1'); + ATTRIB(ShieldItem, m_waypoint, string, _("Shield")); + ATTRIB(ShieldItem, m_waypointblink, int, 2); +ENDCLASS(ShieldItem) +REGISTER_ITEM(Shield, NEW(ShieldItem)); SPAWNFUNC_ITEM(item_shield, ITEM_Shield) SPAWNFUNC_ITEM(item_invincible, ITEM_Shield) -CLASS(Shield, Powerups) - ATTRIB(Shield, netname, string, "invincible"); // NOTE: referring to as invincible so that it matches the powerup item - ATTRIB(Shield, m_name, string, _("Shield")); - ATTRIB(Shield, m_icon, string, "shield"); -ENDCLASS(Shield) -REGISTER_STATUSEFFECT(Shield, NEW(Shield)); +CLASS(ShieldStatusEffect, Powerups) + ATTRIB(ShieldStatusEffect, netname, string, "invincible"); // NOTE: referring to as invincible so that it matches the powerup item + ATTRIB(ShieldStatusEffect, m_name, string, _("Shield")); + ATTRIB(ShieldStatusEffect, m_icon, string, "shield"); +ENDCLASS(ShieldStatusEffect) +REGISTER_STATUSEFFECT(Shield, NEW(ShieldStatusEffect)); diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qc b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qc index 069d832f6..db481fe2a 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qc +++ b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qc @@ -1,7 +1,7 @@ #include "speed.qh" #ifdef SVQC -METHOD(Speed, m_remove, void(StatusEffects this, entity actor, int removal_type)) +METHOD(SpeedStatusEffect, m_remove, void(StatusEffects this, entity actor, int removal_type)) { bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); if(removal_type == STATUSEFFECT_REMOVE_TIMEOUT && wasactive && IS_PLAYER(actor)) @@ -11,9 +11,9 @@ METHOD(Speed, m_remove, void(StatusEffects this, entity actor, int removal_type) } if(wasactive) stopsound(actor, CH_TRIGGER_SINGLE); // get rid of the pickup sound - SUPER(Speed).m_remove(this, actor, removal_type); + SUPER(SpeedStatusEffect).m_remove(this, actor, removal_type); } -METHOD(Speed, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) +METHOD(SpeedStatusEffect, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) { bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); if(!wasactive && IS_PLAYER(actor)) @@ -22,11 +22,11 @@ METHOD(Speed, m_apply, void(StatusEffects this, entity actor, float eff_time, fl Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_SPEED, actor.netname); Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_SPEED); } - SUPER(Speed).m_apply(this, actor, eff_time, eff_flags); + SUPER(SpeedStatusEffect).m_apply(this, actor, eff_time, eff_flags); } -METHOD(Speed, m_tick, void(StatusEffects this, entity actor)) +METHOD(SpeedStatusEffect, m_tick, void(StatusEffects this, entity actor)) { play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF); - SUPER(Speed).m_tick(this, actor); + SUPER(SpeedStatusEffect).m_tick(this, actor); } #endif diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh index 6b4653546..0682f16d6 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh @@ -29,35 +29,37 @@ void powerup_speed_init(Pickup def, entity item) item.speed_finished = (item.count) ? item.count : autocvar_g_balance_powerup_speed_time; } #endif -REGISTER_ITEM(Speed, NEW(Powerup)) { - this.m_canonical_spawnfunc = "item_speed"; + +CLASS(SpeedItem, Powerup) + ATTRIB(SpeedItem, m_canonical_spawnfunc, string, "item_speed"); #ifdef SVQC - this.m_iteminit = powerup_speed_init; + ATTRIB(SpeedItem, m_iteminit, void(Pickup def, entity item), powerup_speed_init); #endif #ifdef GAMEQC - this.spawnflags = ITEM_FLAG_NORMAL; - this.m_itemid = IT_SPEED; - this.m_model = MDL_BUFF; // TODO: MDL_Speed_ITEM when new model available - this.m_skin = 9; - this.m_sound = SND_Speed; - this.m_glow = true; - this.m_respawnsound = SND_SHIELD_RESPAWN; + ATTRIB(SpeedItem, spawnflags, int, ITEM_FLAG_NORMAL); + ATTRIB(SpeedItem, m_itemid, int, IT_SPEED); + ATTRIB(SpeedItem, m_model, Model, MDL_BUFF); // TODO: MDL_Speed_ITEM when new model available + ATTRIB(SpeedItem, m_skin, int, 9); + ATTRIB(SpeedItem, m_sound, Sound, SND_Speed); + ATTRIB(SpeedItem, m_glow, bool, true); + ATTRIB(SpeedItem, m_respawnsound, Sound, SND_SHIELD_RESPAWN); #endif - this.netname = "speed"; - this.m_name = _("Speed"); - this.m_icon = "buff_speed"; - this.m_color = '0.1 1 0.84'; - this.m_waypoint = _("Speed"); - this.m_waypointblink = 2; -} + ATTRIB(SpeedItem, netname, string, "speed"); + ATTRIB(SpeedItem, m_name, string, _("Speed")); + ATTRIB(SpeedItem, m_icon, string, "buff_speed"); + ATTRIB(SpeedItem, m_color, vector, '0.1 1 0.84'); + ATTRIB(SpeedItem, m_waypoint, string, _("Speed")); + ATTRIB(SpeedItem, m_waypointblink, int, 2); +ENDCLASS(SpeedItem) +REGISTER_ITEM(Speed, NEW(SpeedItem)); SPAWNFUNC_ITEM(item_speed, ITEM_Speed) SPAWNFUNC_ITEM(item_buff_speed, ITEM_Speed) -CLASS(Speed, Powerups) - ATTRIB(Speed, netname, string, "speed"); - ATTRIB(Speed, m_name, string, _("Speed")); - ATTRIB(Speed, m_color, vector, '0.1 1 0.84'); - ATTRIB(Speed, m_icon, string, "buff_speed"); -ENDCLASS(Speed) -REGISTER_STATUSEFFECT(Speed, NEW(Speed)); +CLASS(SpeedStatusEffect, Powerups) + ATTRIB(SpeedStatusEffect, netname, string, "speed"); + ATTRIB(SpeedStatusEffect, m_name, string, _("Speed")); + ATTRIB(SpeedStatusEffect, m_color, vector, '0.1 1 0.84'); + ATTRIB(SpeedStatusEffect, m_icon, string, "buff_speed"); +ENDCLASS(SpeedStatusEffect) +REGISTER_STATUSEFFECT(Speed, NEW(SpeedStatusEffect)); diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qc b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qc index c2f257292..2c5c7d20a 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qc +++ b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qc @@ -1,7 +1,7 @@ #include "strength.qh" #ifdef SVQC -METHOD(Strength, m_remove, void(StatusEffects this, entity actor, int removal_type)) +METHOD(StrengthStatusEffect, m_remove, void(StatusEffects this, entity actor, int removal_type)) { bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); if(removal_type == STATUSEFFECT_REMOVE_TIMEOUT && wasactive && IS_PLAYER(actor)) @@ -12,9 +12,9 @@ METHOD(Strength, m_remove, void(StatusEffects this, entity actor, int removal_ty if(wasactive) stopsound(actor, CH_TRIGGER_SINGLE); // get rid of the pickup sound actor.effects &= ~(EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT); - SUPER(Strength).m_remove(this, actor, removal_type); + SUPER(StrengthStatusEffect).m_remove(this, actor, removal_type); } -METHOD(Strength, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) +METHOD(StrengthStatusEffect, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) { bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); if(!wasactive && IS_PLAYER(actor)) @@ -23,23 +23,23 @@ METHOD(Strength, m_apply, void(StatusEffects this, entity actor, float eff_time, Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_STRENGTH, actor.netname); Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_STRENGTH); } - SUPER(Strength).m_apply(this, actor, eff_time, eff_flags); + SUPER(StrengthStatusEffect).m_apply(this, actor, eff_time, eff_flags); } -METHOD(Strength, m_tick, void(StatusEffects this, entity actor)) +METHOD(StrengthStatusEffect, m_tick, void(StatusEffects this, entity actor)) { play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF); actor.effects |= (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT); - SUPER(Strength).m_tick(this, actor); + SUPER(StrengthStatusEffect).m_tick(this, actor); } #endif #ifdef CSQC -METHOD(Strength, m_active, bool(StatusEffects this, entity actor)) +METHOD(StrengthStatusEffect, m_active, bool(StatusEffects this, entity actor)) { if(autocvar__hud_configure) return true; - return SUPER(Strength).m_active(this, actor); + return SUPER(StrengthStatusEffect).m_active(this, actor); } -METHOD(Strength, m_tick, void(StatusEffects this, entity actor)) +METHOD(StrengthStatusEffect, m_tick, void(StatusEffects this, entity actor)) { if(this.m_hidden) return; diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh index 3567cb1c3..d61cbeb6b 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh @@ -29,32 +29,34 @@ void powerup_strength_init(Pickup def, entity item) item.strength_finished = (item.count) ? item.count : autocvar_g_balance_powerup_strength_time; } #endif -REGISTER_ITEM(Strength, NEW(Powerup)) { - this.m_canonical_spawnfunc = "item_strength"; + +CLASS(StrengthItem, Powerup) + ATTRIB(StrengthItem, m_canonical_spawnfunc, string, "item_strength"); #ifdef SVQC - this.m_iteminit = powerup_strength_init; + ATTRIB(StrengthItem, m_iteminit, void(Pickup def, entity item), powerup_strength_init); #endif #ifdef GAMEQC - this.spawnflags = ITEM_FLAG_NORMAL; - this.m_itemid = IT_STRENGTH; - this.m_model = MDL_Strength_ITEM; - this.m_sound = SND_Strength; - this.m_glow = true; - this.m_respawnsound = SND_STRENGTH_RESPAWN; + ATTRIB(StrengthItem, spawnflags, int, ITEM_FLAG_NORMAL); + ATTRIB(StrengthItem, m_itemid, int, IT_STRENGTH); + ATTRIB(StrengthItem, m_model, Model, MDL_Strength_ITEM); + ATTRIB(StrengthItem, m_sound, Sound, SND_Strength); + ATTRIB(StrengthItem, m_glow, bool, true); + ATTRIB(StrengthItem, m_respawnsound, Sound, SND_STRENGTH_RESPAWN); #endif - this.netname = "strength"; - this.m_name = _("Strength"); - this.m_icon = "strength"; - this.m_color = '0 0 1'; - this.m_waypoint = _("Strength"); - this.m_waypointblink = 2; -} + ATTRIB(StrengthItem, netname, string, "strength"); + ATTRIB(StrengthItem, m_name, string, _("Strength")); + ATTRIB(StrengthItem, m_icon, string, "strength"); + ATTRIB(StrengthItem, m_color, vector, '1 0 0'); + ATTRIB(StrengthItem, m_waypoint, string, _("Strength")); + ATTRIB(StrengthItem, m_waypointblink, int, 2); +ENDCLASS(StrengthItem) +REGISTER_ITEM(Strength, NEW(StrengthItem)); SPAWNFUNC_ITEM(item_strength, ITEM_Strength) -CLASS(Strength, Powerups) - ATTRIB(Strength, netname, string, "strength"); - ATTRIB(Strength, m_name, string, _("Strength")); - ATTRIB(Strength, m_icon, string, "strength"); -ENDCLASS(Strength) -REGISTER_STATUSEFFECT(Strength, NEW(Strength)); +CLASS(StrengthStatusEffect, Powerups) + ATTRIB(StrengthStatusEffect, netname, string, "strength"); + ATTRIB(StrengthStatusEffect, m_name, string, _("Strength")); + ATTRIB(StrengthStatusEffect, m_icon, string, "strength"); +ENDCLASS(StrengthStatusEffect) +REGISTER_STATUSEFFECT(Strength, NEW(StrengthStatusEffect)); -- 2.39.5