Quote:
Originally Posted by Eggman
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
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
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(ent, client)
{
new TFObjectType:type = BuildingType[ent];
if (type == TFObjectType_Amplifier ||
type == TFObjectType_RepairNode)
{
new ref = EntIndexToEntRef(ent);
CreateTimer(0.1, FixModel, ref);
new level = GetEntProp(ent, Prop_Send, "m_iHighestUpgradeLevel");
CreateTimer((level > 2) ? 11.4 : 10.4, Activate, ref);
}
}
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 > 0 && IsValidEntity(ent))
{
new particle;
if (TFTeam:GetEntProp(ent, Prop_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.1, FixModel, EntIndexToEntRef(ent));
}
return Plugin_Continue;
}
The repairnode plugin has a brute force timer than constantly resets every model for every repair node every 4 seconds