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?
ID:138376
Sep 21 2000, 6:03 pm
|
|
check(obj/wire/wire in view(1))
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.