Volcano projectiles originate from player

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
Burnstreet
Wayist
Posts: 17
Joined: Mon Feb 06, 2012 12:08 am

Volcano projectiles originate from player

#1 Post by Burnstreet »

I have an amulet with a chance to spawn Volcanos on hit. The projectiles of these volcanos seem to spawn at the position of my char instead of the volcano, which is weird.

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Volcano projectiles originate from player

#2 Post by yufra »

Can you describe the situation in more detail so that we can test it more easily? Are you far away from the Volcano and can see the projectiles leaving you instead of the Volcano for example?
<DarkGod> lets say it's intended

lukep
Sher'Tul Godslayer
Posts: 1712
Joined: Mon Mar 14, 2011 10:32 am
Location: Canada

Re: Volcano projectiles originate from player

#3 Post by lukep »

Some of my tools for helping make talents:
Melee Talent Creator
Annotated Talent Code (incomplete)

Burnstreet
Wayist
Posts: 17
Joined: Mon Feb 06, 2012 12:08 am

Re: Volcano projectiles originate from player

#4 Post by Burnstreet »

yufra wrote:Can you describe the situation in more detail so that we can test it more easily? Are you far away from the Volcano and can see the projectiles leaving you instead of the Volcano for example?
Exactly that.
I stand somewhere, shooting my alchemist bomb. All enemies are clustered in one direction from my pc.
Volcano procs and a volcano is created where one of the monsters was. Volcano projectiles start flying from my pc to the remaining monsters (even if my pc can not see them or the volcano).

tiger_eye
Perspiring Physicist
Posts: 889
Joined: Thu Feb 17, 2011 5:20 am

Re: Volcano projectiles originate from player

#5 Post by tiger_eye »

Aye, i confirmed that Volcano projectiles originate from the player. This occurs because the function "projectile(...)" is a function for actors, and so needs an actor to call it (in this case the actor that created the volcano, which hopefully still exists when the Volcano tries to do its thing :-P ). Unlike "project(...)", "projectile(...)" can't currently overwrite the location of origination with data from "typ" (i.e., tg, target_type, or Target:getType). Attached is a patch that does just that. I confirmed that it works for Volcano (as long as the source actor exists), although I can't promise it won't break something else ;)

Code: Select all

diff --git a/game/engines/default/engine/Projectile.lua b/game/engines/default/engine/Projectile.lua
index 2a9a822..aba5c85 100644
--- a/game/engines/default/engine/Projectile.lua
+++ b/game/engines/default/engine/Projectile.lua
@@ -258,7 +258,7 @@ function _M:makeProject(src, display, def, do_move, do_act, do_stop)
                travel_particle_args = display.particle_args,
                trail_particle = display.trail,
                src = src,
-               src_x = src.x, src_y = src.y,
+               src_x = def.start_x or src.x, src_y = def.start_y or src.y,
                project = {def=def},
                energy = {mod=speed},
                tmp_proj = {},
diff --git a/game/engines/default/engine/interface/ActorProject.lua b/game/engines/default/engine/interface/ActorProject.lua
index 73c02a9..90c0bac 100644
--- a/game/engines/default/engine/interface/ActorProject.lua
+++ b/game/engines/default/engine/interface/ActorProject.lua
@@ -270,12 +270,12 @@ function _M:projectile(t, x, y, damtype, dam, particles)
 --     if type(dam) == "number" and dam < 0 then return end
        local typ = Target:getType(t)
        typ.source_actor = self
-       typ.start_x = self.x
-       typ.start_y = self.y
+       typ.start_x = t.x or self.x
+       typ.start_y = t.y or self.y
        if self.lineFOV then
-               typ.line_function = self:lineFOV(x, y)
+               typ.line_function = self:lineFOV(x, y, nil, nil, t.x, t.y)
        else
-               typ.line_function = core.fov.line(self.x, self.y, x, y)
+               typ.line_function = core.fov.line(t.x or self.x, t.y or self.y, x, y)
        end
        local block_corner = typ.block_path and function(_, bx, by) local b, h, hr = typ:block_path(bx, by, true) ; return b and h and not hr end
                or function(_, bx, by) return false end
Attachments
volcano_targeting.txt
(1.57 KiB) Downloaded 132 times
darkgod wrote:OMFG tiger eye you are my hero!

Post Reply