-
Notifications
You must be signed in to change notification settings - Fork 224
/
Copy pathscreen_zone_selector.dm
76 lines (73 loc) · 1.83 KB
/
screen_zone_selector.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/obj/screen/zone_selector
name = "damage zone"
icon_state = "zone_sel_tail"
screen_loc = ui_zonesel
var/selecting = BP_CHEST
/obj/screen/zone_selector/handle_click(mob/user, params)
var/list/PL = params2list(params)
var/icon_x = text2num(PL["icon-x"])
var/icon_y = text2num(PL["icon-y"])
var/new_selecting
switch(icon_y)
if(1 to 3) //Feet
switch(icon_x)
if(10 to 15)
new_selecting = BP_R_FOOT
if(17 to 22)
new_selecting = BP_L_FOOT
else
return 1
if(4 to 9) //Legs
switch(icon_x)
if(10 to 15)
new_selecting = BP_R_LEG
if(17 to 22)
new_selecting = BP_L_LEG
if(23 to 28)
new_selecting = BP_TAIL
else
return 1
if(10 to 13) //Hands and groin
switch(icon_x)
if(8 to 11)
new_selecting = BP_R_HAND
if(12 to 20)
new_selecting = BP_GROIN
if(21 to 24)
new_selecting = BP_L_HAND
else
return 1
if(14 to 22) //Chest and arms to shoulders
switch(icon_x)
if(8 to 11)
new_selecting = BP_R_ARM
if(12 to 20)
new_selecting = BP_CHEST
if(21 to 24)
new_selecting = BP_L_ARM
else
return 1
if(23 to 30) //Head, but we need to check for eye or mouth
if(icon_x in 12 to 20)
new_selecting = BP_HEAD
switch(icon_y)
if(23 to 24)
if(icon_x in 15 to 17)
new_selecting = BP_MOUTH
if(26) //Eyeline, eyes are on 15 and 17
if(icon_x in 14 to 18)
new_selecting = BP_EYES
if(25 to 27)
if(icon_x in 15 to 17)
new_selecting = BP_EYES
set_selected_zone(new_selecting)
return TRUE
/obj/screen/zone_selector/proc/set_selected_zone(bodypart)
var/old_selecting = selecting
selecting = bodypart
if(old_selecting != selecting)
update_icon()
return TRUE
/obj/screen/zone_selector/rebuild_screen_overlays()
..()
add_overlay(image('icons/mob/zone_sel.dmi', "[selecting]"))