Skip to content

Commit

Permalink
M202 Thermobaric Warhead ; init
Browse files Browse the repository at this point in the history
  • Loading branch information
DrNewbie committed Oct 12, 2017
1 parent b5ea181 commit f82f627
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 15 deletions.
@@ -0,0 +1,30 @@
<?xml version="1.0"?>
<unit type="item" slot="14">
<network sync="spawn" />
<object file="units/pd2_dlc_friend/weapons/wpn_third_ray_fired_rocket/wpn_third_ray_fired_rocket" />
<dependencies>
<depends_on physic_effect="physic_effects/anti_gravitate" />
<depends_on effect="effects/payday2/particles/explosions/grenade_explosion" />
<depends_on effect="effects/payday2/particles/weapons/rpg_smoke_trail" />
<depends_on effect="effects/particles/fire/small_light_fire" />
<depends_on effect="effects/payday2/particles/impacts/stone_explosion_impact_pd2" />
<depends_on effect="effects/payday2/particles/impacts/metal_explosion_impact_pd2" />
<depends_on effect="effects/payday2/particles/impacts/dirt_explosion_impact_pd2" />
<depends_on effect="effects/payday2/particles/impacts/concrete_explosion_impact_pd2" />
<depends_on bnk="soundbanks/weapon_rpg" />
<depends_on bnk="soundbanks/regular_weapon_sfx" />
</dependencies>
<extensions>
<extension name="base" class="FragGrenade" >
<var name="_tweak_projectile_entry" value="rocket_ray_frag_incen" />
</extension>
<extension name="unit_data" class="ScriptUnitData" />
<extension name="damage" class="UnitDamage" >
</extension>
</extensions>
<sounds>
<default_soundsource source="rp_wpn_third_rpg7_fired_rocket" />
<soundsource name="snd" source="rp_wpn_third_rpg7_fired_rocket" />
<spawn_event source="snd" name="wp_rpg_rocket_flyby" stop_when_killed="true"/>
</sounds>
</unit>
@@ -1,12 +1,21 @@
function FragGrenade:_spawn_environment_fire(normal)
local grenade_entry = self._tweak_projectile_entry or "frag"
local tweak_entry = tweak_data.projectiles[grenade_entry]
if tweak_entry.incendiary_fire_arbiter then
local position = self._unit:position()
local rotation = self._unit:rotation()
local data = tweak_entry.incendiary_fire_arbiter
EnvironmentFire.spawn(position, rotation, data, normal, self._thrower_unit, 0, 1)
end
end

function FragGrenade:_detonate(tag, unit, body, other_unit, other_body, position, normal, collision_velocity, velocity, other_velocity, new_velocity, direction, damage, ...)
local pos = self._unit:position()
local normal = math.UP
local range = self._range
local slot_mask = managers.slot:get_mask("explosion_targets")

managers.explosion:give_local_player_dmg(pos, range, self._player_damage)
managers.explosion:play_sound_and_effects(pos, normal, range, self._custom_params)

local hit_units, splinters = managers.explosion:detect_and_give_dmg({
player_damage = 0,
hit_pos = pos,
Expand All @@ -18,10 +27,8 @@ function FragGrenade:_detonate(tag, unit, body, other_unit, other_body, position
alert_radius = self._alert_radius,
user = self:thrower_unit() or self._unit,
owner = self._unit
})

IncendiaryGrenade._spawn_environment_fire(self, normal)

})
self:_spawn_environment_fire(normal)
managers.network:session():send_to_peers_synched("sync_unit_event_id_16", self._unit, "base", GrenadeBase.EVENT_IDS.detonate)
self._unit:set_slot(0)
end
@@ -1 +1,14 @@
--??
Hooks:PostHook(BlackMarketTweakData, "_init_projectiles", "M202Incen_BlackMarketTweakData_init_projectiles", function(self, tweak_data)
self.projectiles.rocket_ray_frag_incen = deep_clone(self.projectiles.rocket_ray_frag)
self.projectiles.rocket_ray_frag_incen.unit = "units/pd2_dlc_friend/weapons/wpn_third_ray_fired_rocket/wpn_third_ray_fired_incen_rocket"
if not table.contains(self._projectiles_index, 'rocket_ray_frag_incen') then
table.insert(self._projectiles_index, 'rocket_ray_frag_incen')
end
local free_dlcs = tweak_data:free_dlc_list()
for _, data in pairs(self.projectiles) do
if free_dlcs[data.dlc] then
data.dlc = nil
end
end
self:_add_desc_from_name_macro(self.projectiles)
end)
@@ -1,3 +1,27 @@
Hooks:PostHook( TweakData, "init", "M202IncenInit", function(self)

end)
tweak_data.projectiles.rocket_ray_frag_incen = deep_clone(tweak_data.projectiles.rocket_ray_frag)
tweak_data.projectiles.rocket_ray_frag_incen.damage = 250
tweak_data.projectiles.rocket_ray_frag_incen.projectile_trail = true
tweak_data.projectiles.rocket_ray_frag_incen.adjust_z = 0
tweak_data.projectiles.rocket_ray_frag_incen.push_at_body_index = 0
tweak_data.projectiles.rocket_ray_frag_incen.incendiary_fire_arbiter = {
sound_event = "gl_explode",
range = 75,
curve_pow = 3,
damage = 1,
fire_alert_radius = 1500,
alert_radius = 1500,
sound_event_burning = "burn_loop_gen",
player_damage = 2,
sound_event_impact_duration = 6,
burn_tick_period = 0.5,
burn_duration = 3,
effect_name = "effects/payday2/particles/explosions/molotov_grenade",
fire_dot_data = {
dot_trigger_chance = 35,
dot_damage = 15,
dot_length = 6,
dot_trigger_max_distance = 3000,
dot_tick_period = 0.5
}
}
tweak_data.weapon_disable_crit_for_damage.rocket_ray_frag_incen = {explosion = false, fire = false}
@@ -1,10 +1,9 @@
Hooks:PostHook( WeaponFactoryTweakData, "init", "M202IncenInit", function(self)
Hooks:PostHook(WeaponFactoryTweakData, "init", "M202Incen_WeaponFactoryTweakData_init", function(self)
local dlc_data = Global.dlc_manager.all_dlc_data["bbq"]
self.parts.wpn_fps_gre_ray_incen.custom_stats = {
launcher_grenade = "rocket_ray_frag"
launcher_grenade = "rocket_ray_frag_incen"
}
self.parts.wpn_fps_gre_ray_incen.desc_id = "bm_wp_wpn_fps_gre_ray_incen_desc"

self.parts.wpn_fps_gre_ray_incen.desc_id = "bm_wp_wpn_fps_gre_ray_incen_desc"
if not dlc_data.verified then
self.parts.wpn_fps_gre_ray_incen = {
stats = {damage = -50},
Expand Down
Expand Up @@ -15,6 +15,7 @@
<AddFiles directory="assets">
<texture path="guis/dlcs/mods/textures/pd2/blackmarket/icons/mods/wpn_fps_gre_ray_incen"/>
<texture path="guis/m202incen"/>
<unit path="units/pd2_dlc_friend/weapons/wpn_third_ray_fired_rocket/wpn_third_ray_fired_incen_rocket"/>
</AddFiles>

<Hooks directory="Hooks">
Expand Down
@@ -1 +1 @@
0.5
1

0 comments on commit f82f627

Please sign in to comment.