ID:1739387
 
(See the best response by Lugia319.)
Code:
obj/tang/tools/sythe
sythebomb
square = 1
dist = 3
icon = 'Icons.dmi'
icon_state = "Bomb"

use(mob/player/p)
var/obj/tang/tools/sythe/s = p.removeinv(src)
if(s)
s.abst = 1
s.loc = get_step(p,p.dir)
s.center = get_step(p,p.dir)
sleep(50)
s...() // Incorrect attempt to call the parent use() proc for s
s.loc = null


Problem description:
Hello, I have run into an issue with calling the parent proc for an object of the same type that isn't the src object.

To explain what is happening: In the above code, the use() proc is first activated by a Click() proc not shown. The object s is selected from the player's inventory by the removeinv(src) proc (also not shown). In cases where items "stack" in the inventory, stacked items are pulled first, meaning s may not be equal to src. A few variables are set for s and after a 5 second waiting period, I intended to call the use() proc from the parent /obj/tang/tools/sythe (Also not shown) for s. s is then removed.

The problem is I don't know how to call the parent proc for s, when s isn't the src. The above code compiles, but tosses: runtime error: undefined proc or verb /obj/tang/tools/sythe/sythebomb/Call(). My reasoning with using s...() was the first dot would be the dot operator for s, and the ..() was the call to the parent proc.

I have also tried call(s,..())() and received runtime error: undefined proc or verb /obj/tang/tools/sythe/sythebomb/().

Recommendations?
Best response
Well a kluge would be to have a parameter you pass when use is being called by non-src.
Don't you just want to use s.use() ?
In response to Super Saiyan X
I am trying to access the code that is for use() that is located under obj/tang/tools/sythe (Not shown), not the code that was overridden under obj/tang/tools/sythe/sythebomb (shown).

EDIT: It occurred to me where your response came from, which is due to a typecasting mistake where var/obj/tang/tools/sythe/s = p.removeinv(src) should be var/obj/tang/tools/sythe/sythebomb/s = p.removeinv(src).

While implementing Lugia319's suggestion, it occurred to me that I should try setting src to s and doing a normal parent proc call, which surprising works as expected.

My current code looks like this:
        use(mob/player/p)
var/obj/tang/tools/sythe/sythebomb/s = p.removeinv(src)
if(s)
src = s // s is now the src, so I can call the parent proc.
s.abst = 1
s.loc = get_step(p,p.dir)
s.center = get_step(p,p.dir)
sleep(50)
..()
s.loc = null


It occurs to me this morning that calling the parent proc of an object who isn't actually doing any processing is something of a logical error on my part...

Thank you for your help.