1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
untyped
global function ClassicRodeo_InitPlaylistVars
#if SERVER
global function CreateClassicRodeoWeakpoint
#endif
const asset RODEO_WEAKPOINT_HITBOX_MODEL = $"models/Weapons/ammoboxes/backpack_single.mdl"
void function ClassicRodeo_InitPlaylistVars()
{
AddPrivateMatchModeSettingEnum( "#MODE_SETTING_CATEGORY_TITAN", "classic_rodeo", [ "Disabled", "Enabled" ], "0" )
}
#if SERVER
entity function CreateClassicRodeoWeakpoint( entity player, entity titan )
{
entity weakpoint = CreatePropScript( RODEO_WEAKPOINT_HITBOX_MODEL )
weakpoint.SetParent( titan, "RODEO_BATTERY" )
weakpoint.SetLocalAngles( < 90, -90, 0 > )
weakpoint.SetTakeDamageType( DAMAGE_YES )
SetTeam( weakpoint, TEAM_UNASSIGNED )
SetObjectCanBeMeleed( weakpoint, false )
weakpoint.kv.solid = 6
weakpoint.Hide()
// stryder ones don't really work in the default position, so change it
// note: stryders are way too easy to hit because of this lol so possibly fuck with it
if ( GetSoulTitanSubClass( titan.GetTitanSoul() ) == "stryder" )
weakpoint.SetLocalOrigin( < 0, 4, -4 > )
weakpoint.s.pilot <- player
weakpoint.s.titan <- titan
AddEntityCallback_OnDamaged( weakpoint, OnRodeoWeakpointDamaged )
}
void function OnRodeoWeakpointDamaged( entity weakpoint, var damageInfo )
{
entity attacker = DamageInfo_GetAttacker( damageInfo )
entity titan = attacker.GetParent()
float damageAmount = DamageInfo_GetDamage( damageInfo )
DamageInfo_SetDamage( damageInfo, 0 ) // make sure weakpoint ent doesn't die ever
if ( attacker != weakpoint.s.pilot || titan != weakpoint.s.titan )
return
// hitmarker
attacker.NotifyDidDamage( weakpoint, DamageInfo_GetHitBox( damageInfo ), DamageInfo_GetDamagePosition( damageInfo ), DamageInfo_GetCustomDamageType( damageInfo ) | DF_CRITICAL, damageAmount, DamageInfo_GetDamageFlags( damageInfo ), DamageInfo_GetHitGroup( damageInfo ), DamageInfo_GetWeapon( damageInfo ), DamageInfo_GetDistFromAttackOrigin( damageInfo ) )
// figure out damage to deal to titan
entity attackerWeapon = DamageInfo_GetWeapon( damageInfo )
if ( !IsValid( attackerWeapon ) )
attackerWeapon = attacker.GetActiveWeapon()
int rodeoDamage = attackerWeapon.GetWeaponSettingInt( eWeaponVar.damage_rodeo ) // only really on weapons that were in tf1, unfortunately
if ( rodeoDamage == 0 ) // would use headshot scale, but it's a bit low in most cases to be competitive with weapons with a valid damage_rodeo
rodeoDamage = int( attackerWeapon.GetWeaponSettingInt( eWeaponVar.damage_near_value_titanarmor ) * ( attackerWeapon.GetWeaponSettingFloat( eWeaponVar.damage_headshot_scale ) * 1.5 ) )
// damage titan, make sure DF_BYPASS_SHIELD is a thing for proper behaviour
titan.TakeDamage( rodeoDamage, attacker, attackerWeapon, { damageSourceId = eDamageSourceId.rodeo, scriptType = DamageInfo_GetCustomDamageType( damageInfo ) | DF_BYPASS_SHIELD } )
}
#endif
|