-
Notifications
You must be signed in to change notification settings - Fork 0
/
EGP_RussianRoulette
89 lines (89 loc) · 2.55 KB
/
EGP_RussianRoulette
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
77
78
79
80
81
82
83
84
85
86
87
88
89
@name egp russian roulette
@inputs E:wirelink U:entity
@outputs
@persist B X
@trigger
#[
Made by Xandertron5000 - STEAM_0:1:42942061 - github.com/Xandertron
clickclickclickclickcli- BANG
]#
interval(10)
if(first()){
function number entity:getAimObject(EGP:wirelink){
local Out = 0
for (I = 1, EGP:egpNumObjects()){
Cursor = EGP:egpCursor(U)
TL = EGP:egpPos(I) - ((0.5) * EGP:egpSize(I))
BR = EGP:egpPos(I) + ((0.5) * EGP:egpSize(I))
if (inrange(Cursor, TL, BR)){
Out = I
break
}
}
return Out
}
function void spin(){
local E = entity()
E:soundPlay(10,0,"weapons/357/357_spin1.wav")
}
function void fire(){
local E = entity()
E:soundPlay(10,0,"weapons/357/357_fire3.wav")
}
function void empty(){
local E = entity()
E:soundPlay(10,0,"weapons/shotgun/shotgun_empty.wav")
}
entity():createWire(entity():isWeldedTo(),"E","wirelink")
entity():createWire(entity():isWeldedTo(),"U","User")
E:egpClear()
#E:egpBox(60,vec2(256,430),vec2(100,200))
E:egpOrderBelow(60,2)
E:egpColor(60,vec(30))
E:egpBox(1,vec2(256,460),vec2(150,50))
E:egpCircle(2,vec2(256),vec2(100))
for(I=1,6){
A = (I/6 * 360)
E:egpCircle(I+2,vec2(cos(A)*115+256,sin(A)*115+256),vec2(20))
E:egpColor(I+2,vec(0))
E:egpCircle(I+20,vec2(cos(A+32)*72+256,sin(A+32)*72+256),vec2(20))
E:egpColor(I+20,vec(0))
E:egpText(I+40,"?",vec2(cos(A+32)*72+256,sin(A+32)*72+256))
E:egpAlign(I+40,1,1)
}
E:egpText(299,"Spin!",vec2(256,460))
E:egpAlign(299,1,1)
E:egpColor(299,vec(0))
E:egpSize(299,30)
E:egpOrderBelow(60,1)
}
if(B<0){B+=2}
elseif(B<-360){B=-360}
elseif(B==0&X==1){
X = 0
if(randint(0,6)==2){
fire()
Prop = propSpawn("models/props_c17/oildrum001_explosive.mdl",entity():isWeldedTo():pos(),1)
Prop:propBreak()
}
else{empty()}
#fire
}
else{B=0}
for(I=1,6){
A = (I/6 * 360)+B
E:egpCircle(I+2,vec2(cos(A)*115+256,sin(A)*115+256),vec2(20))
E:egpColor(I+2,vec(0))
E:egpOrderBelow(60,I+2)
E:egpCircle(I+20,vec2(cos(A+32)*72+256,sin(A+32)*72+256),vec2(20))
E:egpColor(I+20,vec(0))
E:egpText(I+40,"?",vec2(cos(A+32)*72+256,sin(A+32)*72+256))
E:egpAlign(I+40,1,1)
}
if(U:getAimObject(E)==1){
B=-randint(100,200)
spin()
X = 1
}
#have sounds, use black circles for chambers
#for sounds use the default revolver sounds with the empty and shoot sounds