ID:138376
 
obj
terran
equipment
icon = 'terran_equipment.dmi'
verb
get()
set src in oview(1)
src.loc = usr
drop()
set src in usr
src.loc = usr.loc
voltmeter
icon_state = "voltmeter"
verb
check(obj/wire/wire in view(1))
usr << "Checking wiring:"
if(istype(wire,/obj/wire))
usr << "- Efficiency = [wire.efficiency/10]%"
if(istype(wire,/obj/power_source) || istype(wire,/obj/wire))
usr << "- Power = [wire.power]"
usr << "- Maximum Bandwidth = [wire.max_power]"

I specify the obj/wire type for the wire variable, but it gives me a list of every object in view(1), even power sources and others. Huh?
On 9/21/00 10:03 pm Spuzzum wrote:

check(obj/wire/wire in view(1))

I specify the obj/wire type for the wire variable, but it gives me a list of every object in view(1), even power sources and others. Huh?

Yes. This is a limitation in the current system. Arguments are evaluated client-side in situations like this, and right now the client isn't aware of non-base types (eg obj versus obj/wire). You can get around this by soft-coding your own list function like viewtype():

proc/viewtype(type,dist)
var/O
var/L[0]
for(O in view(dist))
if(istype(O,type))
L += O
return L

And then do, for instance:

check(wire in viewtype(/obj/wire,1))
...

This is a fairly useful construct and I think Dan plans to build it into the system at some point.