client
var
obj/radar // The client's radar object (handy because we get reference to it later!)
mob
icon = 'Chars.dmi'
var
team
NPC
Blue
team = rgb(0,0,255) // Blue
icon_state = "Blue"
Red
team = rgb(255,0,0) // Red
icon_state = "Red"
Turrent
team = rgb(0,0,0) //White
icon_state = "White"
Bullet
team = rgb(255,255,255) //Black
icon_state = "Black"
..()
WalkAround() // Call simple AI
world/New()
Update_Radar() // Initate the radar loop
..()
client/New()
var/obj/O = new // This code creates the radar object and places it on the client's screen. Note how the object 'follows' the mob around as he moves. This is because the object is 'attached' to the client screen.
O.icon = icon('Radar_Blips.dmi',"Radar")
O.screen_loc = "11,11" // Place the radar at the top-right corner of the screen
O.layer = 50 // Set it to a high layer so nothing appears over it
src.screen += O
src.radar = O
..()
proc/Update_Radar()
for(var/client/C) // Loop through all non-npc players...
if(C.radar)
var/icon/R = icon('Radar_Blips.dmi',"Radar") // Create an icon to draw on
R.DrawBox(rgb(0,128,0),0,0,32,32) // Clear the radar icon with a dark-ish green
R.DrawBox(rgb(255,255,255), 17, 17-3, 17, 17+3)
R.DrawBox(rgb(255,255,255), 17-3, 17, 17+3, 17)
for(var/mob/M in world) // Search through all of the mobs...
if(get_dist(C.mob,M) < 20 && C.mob.z == M.z && C.mob != M) // If the mob is within 10 squares of the player, is on the same z level, and isn't itself (don't want to place yourself on it, do you?)
var/x = 16-(C.mob.x - M.x)+1
var/y = 16-(C.mob.y - M.y)+1
R.DrawBox(M.team, x-1, y-1, x+1, y+1) // Draw the blip at the proper x/y coordinates
C.radar.icon = R // Set the new icon onto the radar
spawn(1)
Update_Radar() // Refresh the radar every 1/2 second (feel free to play with the update speed!)
mob/proc/WalkAround() // Simple AI for moving the mob to make things more interesting!
step(src, pick(NORTH,SOUTH,EAST,WEST))
spawn(rand(5,15))
WalkAround()
Update_Radar()
obj/Turrent
icon = 'weapons.dmi'
Turrent
obj/Bullet
icon = 'missile.dmi'
icon_state = "missile"
Bullet
ID:170052
Mar 26 2005, 1:28 pm
|
|
I am using, Malvars Radar System. The Radar background part or the green part works fine. But, if I get next to a mob or an obj that I want to appear on the radar it does'nt show up.
|
Mar 27 2005, 4:40 am
|
|
Well, I got the mobs part to work but can anyone help with the turrent and bullet part?
|