mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Modified TK to be more effective and polished. You can use the TK grab to interact with machines and stuff from far away (but you cannot pick them up!). This means you can also bonk people with items you are holding with your TK grab.
Changed the energy gun sprites to a better-looking version, made by Khodoque! More work on NTSL. Including the ability to create comments by using // and /* insert comment here */. Removed the traffic control machine from telecomms, as requested by Urist. NTSL is still a work in progress, and needs to be completely fool-proof before players can get anywhere near it. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3252 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
/proc/in_range(source, user)
|
||||
if(get_dist(source, user) <= 1)
|
||||
return 1
|
||||
|
||||
return 0 //not in range and not telekinetic
|
||||
|
||||
/proc/circlerange(center=usr,radius=3)
|
||||
|
||||
@@ -189,3 +189,11 @@ proc/countJob(rank)
|
||||
for(var/mob/living/silicon/ai/M in world)
|
||||
if ((M.client && M.machine == subject))
|
||||
subject.attack_ai(M)
|
||||
|
||||
/proc/AutoUpdateTK(obj/subject)
|
||||
if (subject!=null)
|
||||
for(var/obj/item/tk_grab/T in world)
|
||||
if (T.host)
|
||||
var/mob/M = T.host
|
||||
if(M.client && M.machine == subject)
|
||||
subject.attack_hand(M)
|
||||
|
||||
@@ -158,8 +158,19 @@ Class Procs:
|
||||
istype(usr, /mob/living/carbon/monkey) && ticker && ticker.mode.name == "monkey") )
|
||||
usr << "\red You don't have the dexterity to do this!"
|
||||
return 1
|
||||
if ((!in_range(src, usr) || !istype(src.loc, /turf)) && !istype(usr, /mob/living/silicon))
|
||||
return 1
|
||||
|
||||
var/norange = 0
|
||||
if(istype(usr, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = usr
|
||||
if(istype(H.l_hand, /obj/item/tk_grab))
|
||||
norange = 1
|
||||
else if(istype(H.r_hand, /obj/item/tk_grab))
|
||||
norange = 1
|
||||
|
||||
if(!norange)
|
||||
if ((!in_range(src, usr) || !istype(src.loc, /turf)) && !istype(usr, /mob/living/silicon))
|
||||
return 1
|
||||
|
||||
src.add_fingerprint(usr)
|
||||
return 0
|
||||
|
||||
|
||||
@@ -318,8 +318,18 @@
|
||||
Metroid.canmove = 1
|
||||
|
||||
|
||||
var/showname = "."
|
||||
if(user)
|
||||
showname = " by [user]."
|
||||
if(!(user in viewers(M, null)))
|
||||
showname = "."
|
||||
|
||||
for(var/mob/O in viewers(messagesource, null))
|
||||
O.show_message(text("\red <B>[] has been attacked with [][] </B>", M, src, (user ? text(" by [].", user) : ".")), 1)
|
||||
O.show_message(text("\red <B>[] has been attacked with [][] </B>", M, src, showname), 1)
|
||||
|
||||
if(!showname && user)
|
||||
if(user.client)
|
||||
user << "\red <B>You attack [M] with [src]. </B>"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, flag)//TODO: go over this
|
||||
if(!target || !user) return
|
||||
if(last_throw+4 > world.time) return
|
||||
if(last_throw+3 > world.time) return
|
||||
if(!host)
|
||||
del(src)
|
||||
return
|
||||
@@ -51,19 +51,24 @@
|
||||
del(src)
|
||||
return
|
||||
if(!focus)
|
||||
focus_object(target)
|
||||
focus_object(target, user)
|
||||
return
|
||||
var/focusturf = get_turf(focus)
|
||||
if(get_dist(focusturf, target) <= 1 && !istype(target, /turf))
|
||||
target.attackby(focus, user, user:get_organ_target())
|
||||
|
||||
if((get_dist(target, user) <= 16) && (get_dist(focus, user) <= 10))
|
||||
else if(get_dist(focusturf, target) <= 16)
|
||||
apply_focus_overlay()
|
||||
focus.throw_at(target, 10, 1)
|
||||
last_throw = world.time
|
||||
return
|
||||
|
||||
|
||||
proc/focus_object(var/obj/target)
|
||||
proc/focus_object(var/obj/target, var/mob/living/user)
|
||||
if(!istype(target,/obj)) return//Cant throw non objects atm might let it do mobs later
|
||||
if(target.anchored) return//No throwing anchored things
|
||||
if(target.anchored)
|
||||
target.attack_hand(user) // you can use shit now!
|
||||
return//No throwing anchored things
|
||||
focus = target
|
||||
update_icon()
|
||||
apply_focus_overlay()
|
||||
|
||||
@@ -8,12 +8,16 @@
|
||||
if (usr.client && usr.machine==src) // && M.machine == src is omitted because if we triggered this by using the dialog, it doesn't matter if our machine changed in between triggering it and this - the dialog is probably still supposed to refresh.
|
||||
src.attack_ai(usr)
|
||||
|
||||
// check for TK users
|
||||
AutoUpdateTK(src)
|
||||
|
||||
/obj/proc/updateDialog()
|
||||
var/list/nearby = viewers(1, src)
|
||||
for(var/mob/M in nearby)
|
||||
if ((M.client && M.machine == src))
|
||||
src.attack_hand(M)
|
||||
AutoUpdateAI(src)
|
||||
AutoUpdateTK(src)
|
||||
|
||||
/obj/proc/update_icon()
|
||||
return
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
bmark.pixel_x--
|
||||
bmark.pixel_y--
|
||||
|
||||
if(Proj.damage >= 20)
|
||||
if(Proj.damage >= 20 || istype(Proj, /obj/item/projectile/practice))
|
||||
bmark.icon_state = "scorch"
|
||||
bmark.dir = pick(NORTH,SOUTH,EAST,WEST) // random scorch design
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ mob/living/carbon/proc/handle_hallucinations()
|
||||
spawn(rand(50,80)) //Only seen for a brief moment.
|
||||
if(client) client.images -= halbody
|
||||
halbody = null
|
||||
if(71 to 75)
|
||||
if(71 to 72)
|
||||
//Fake death
|
||||
// src.sleeping_willingly = 1
|
||||
src.sleeping = 1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/obj/item/weapon/gun/energy
|
||||
icon_state = "energy"
|
||||
name = "energy gun"
|
||||
desc = "A basic energy-based gun with two settings: Stun and kill."
|
||||
desc = "A basic energy-based gun."
|
||||
fire_sound = 'Taser.ogg'
|
||||
|
||||
var
|
||||
@@ -9,6 +9,7 @@
|
||||
charge_cost = 100 //How much energy is needed to fire.
|
||||
cell_type = "/obj/item/weapon/cell"
|
||||
projectile_type = "/obj/item/projectile/energy"
|
||||
modifystate
|
||||
|
||||
emp_act(severity)
|
||||
power_supply.use(round(power_supply.maxcharge / severity))
|
||||
@@ -23,6 +24,7 @@
|
||||
else
|
||||
power_supply = new(src)
|
||||
power_supply.give(power_supply.maxcharge)
|
||||
modifystate = icon_state
|
||||
return
|
||||
|
||||
|
||||
@@ -38,7 +40,7 @@
|
||||
update_icon()
|
||||
var/ratio = power_supply.charge / power_supply.maxcharge
|
||||
ratio = round(ratio, 0.25) * 100
|
||||
icon_state = text("[][]", initial(icon_state), ratio)
|
||||
icon_state = text("[][]", modifystate, ratio)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/obj/item/weapon/gun/energy/gun
|
||||
icon_state = "energy"
|
||||
icon_state = "energystun100"
|
||||
name = "energy gun"
|
||||
desc = "A basic energy-based gun with two settings: Stun and kill."
|
||||
fire_sound = 'Taser.ogg'
|
||||
@@ -20,12 +20,14 @@
|
||||
fire_sound = 'Laser.ogg'
|
||||
user << "\red [src.name] is now set to kill."
|
||||
projectile_type = "/obj/item/projectile/beam"
|
||||
modifystate = "energykill"
|
||||
if(1)
|
||||
mode = 0
|
||||
charge_cost = 100
|
||||
fire_sound = 'Taser.ogg'
|
||||
user << "\red [src.name] is now set to stun."
|
||||
projectile_type = "/obj/item/projectile/energy/electrode"
|
||||
modifystate = "energystun"
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
@@ -52,6 +52,10 @@
|
||||
message+="[id]'. "
|
||||
if(T)message+="Found '[T.value]'."
|
||||
|
||||
|
||||
UnterminatedComment
|
||||
message="Unterminated multi-line comment statement: expected */"
|
||||
|
||||
DuplicateFunction
|
||||
New(name, token/t)
|
||||
message="Function '[name]' defined twice."
|
||||
|
||||
@@ -59,6 +59,10 @@
|
||||
line = 1
|
||||
linepos = 0 //column=codepos-linepos
|
||||
n_scriptOptions/nS_Options/options
|
||||
|
||||
commenting = 0
|
||||
// 1: single-line
|
||||
// 2: multi-line
|
||||
list
|
||||
/*
|
||||
Variable: ignore
|
||||
@@ -112,12 +116,16 @@
|
||||
Scan() //Creates a list of tokens from source code
|
||||
var/list/tokens=new
|
||||
for(, src.codepos<=lentext(code), src.codepos++)
|
||||
|
||||
var/char=copytext(code, codepos, codepos+1)
|
||||
if(char=="\n")
|
||||
line++
|
||||
linepos=codepos
|
||||
|
||||
if(ignore.Find(char))
|
||||
continue
|
||||
else if(char == "/")
|
||||
ReadComment()
|
||||
else if(end_stmt.Find(char))
|
||||
tokens+=new /token/end(char, line, COL)
|
||||
else if(string_delim.Find(char))
|
||||
@@ -129,6 +137,8 @@
|
||||
tokens+=ReadNumber()
|
||||
else if(options.symbols.Find(char))
|
||||
tokens+=ReadSymbol()
|
||||
|
||||
|
||||
codepos=initial(codepos)
|
||||
line=initial(line)
|
||||
linepos=initial(linepos)
|
||||
@@ -229,3 +239,49 @@
|
||||
T.value=0
|
||||
codepos-- //allow main Scan() proc to read the next character
|
||||
return T
|
||||
|
||||
/*
|
||||
Proc: ReadComment
|
||||
Reads a comment and outputs the type of comment
|
||||
*/
|
||||
|
||||
ReadComment()
|
||||
var
|
||||
char=copytext(code, codepos, codepos+1)
|
||||
nextchar=copytext(code, codepos+1, codepos+2)
|
||||
charstring = char+nextchar
|
||||
comm = 1
|
||||
// 1: single-line comment
|
||||
// 2: multi-line comment
|
||||
expectedend = 0
|
||||
|
||||
if(charstring == "//" || charstring == "/*")
|
||||
if(charstring == "/*")
|
||||
comm = 2 // starts a multi-line comment
|
||||
|
||||
while(comm)
|
||||
if(++codepos>lentext(code)) break
|
||||
|
||||
if(expectedend) // ending statement expected...
|
||||
char = copytext(code, codepos, codepos+1)
|
||||
if(char == "/") // ending statement found - beak the comment
|
||||
comm = 0
|
||||
break
|
||||
|
||||
if(comm == 2)
|
||||
// multi-line comments are broken by ending statements
|
||||
char = copytext(code, codepos, codepos+1)
|
||||
if(char == "*")
|
||||
expectedend = 1
|
||||
continue
|
||||
else
|
||||
char = copytext(code, codepos, codepos+1)
|
||||
if(char == "\n")
|
||||
comm = 0
|
||||
break
|
||||
|
||||
if(expectedend) expectedend = 0
|
||||
|
||||
if(comm == 2)
|
||||
errors+=new/scriptError/UnterminatedComment()
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user