View Single Post
naris
AlliedModders Donor
Join Date: Dec 2006
Old 07-25-2010 , 15:58   Re: [TF2] The Amplifier
Reply With Quote #146

Quote:
Originally Posted by Eggman View Post
and what if author of Node will want update this?
I didn't actually use any of the code from repairnode, I used my own implementation. Especially since the original code only allows for 1 sg and 1 teleporter pair per client, which is not sufficient for our needs.

Quote:
Originally Posted by Eggman View Post
And Amplifier must be unupgradeable
Why is that? The modified version I have allows for upgraded amplifiers to have increased range.

Quote:
Originally Posted by Eggman View Post
And I can not find: how you made Amplifier movable?
Every time a building is moved, the player_builtobject event fires. Apparently, you must of figured that out

So all I had to do was add a check in CheckDisp() so that if the entity was already an amplifier, fix the model. Additionally, you have to fix the model again after the "building" animation completes (11.4 seconds for level 3, 10.4 seconds for 1 & 2)
PHP Code:
CheckDisp(entclient)
{
    new 
TFObjectType:type BuildingType[ent];
    if (
type == TFObjectType_Amplifier ||
        
type == TFObjectType_RepairNode)
    {
        new 
ref EntIndexToEntRef(ent);
        
CreateTimer(0.1FixModelref);

        new 
level GetEntProp(entProp_Send"m_iHighestUpgradeLevel");
        
CreateTimer((level 2) ? 11.4 10.4Activateref);
    }

To support upgrading buildings, all that needs to be done is to handle the player_upgradedobject event and fix the model again:
PHP Code:
public Action:Event_Upgrade(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
ent GetEventInt(event"index");
    if (
ent && IsValidEntity(ent))
    {
        new 
particle;
        if (
TFTeam:GetEntProp(entProp_Send"m_iTeamNum")==TFTeam_Red)
            
AttachParticle(ent,"teleported_red",particle); //Create Effect of TP
        
else
            
AttachParticle(ent,"teleported_blue",particle); //Create Effect of TP

        
CreateTimer(0.1FixModelEntIndexToEntRef(ent));
    }

    return 
Plugin_Continue;

The repairnode plugin has a brute force timer than constantly resets every model for every repair node every 4 seconds
naris is offline