Merge pull request #708 from SkyMarshal/Airlocks

Fixed give bug, announcement bug, old reaching method, chemicals can now react in mobs, added a light repairing portable-autolathe for janitor.
This commit is contained in:
CIB
2012-03-20 06:15:11 -07:00
10 changed files with 60 additions and 156 deletions
+1
View File
@@ -1095,6 +1095,7 @@
#include "code\WorkInProgress\Ported\Bureaucracy\copier.dm"
#include "code\WorkInProgress\Ported\Bureaucracy\filing.dm"
#include "code\WorkInProgress\SkyMarshal\coatrack.dm"
#include "code\WorkInProgress\SkyMarshal\portalathe.dm"
#include "code\WorkInProgress\SkyMarshal\traitoritems.dm"
#include "code\WorkInProgress\SkyMarshal\wardrobes.dm"
#include "code\WorkInProgress\Tastyfish\Eliza.dm"
@@ -0,0 +1,18 @@
//May expand later, but right now it just repairs lights.
/obj/item/device/portalathe
name = "\improper Portable Autolathe"
desc = "It blinks and has an antenna on it. It must be advanced."
icon_state = "t-ray0"
afterattack(var/atom/target, mob/user as mob)
if(!target || !user)
return
if(!istype(target))
return
if(!istype(target, /obj/machinery/light))
return
var/obj/machinery/light/L = target
if(L.stat > 1) //Burned or broke
L.stat = 0
user.visible_message("[user] repairs \the [target] on the spot with their [src]!","You repair the lightbulb!")
return
+2 -1
View File
@@ -2,7 +2,8 @@
density = 1
layer = 4.0
animate_movement = 2
flags = NOREACT
// flags = NOREACT
//THE SOLUTION BUBBLES was funnier.
var/datum/mind/mind
+4 -102
View File
@@ -43,12 +43,12 @@
return
/proc/in_range(source, user, telepathy=1)
/proc/in_range(source, user)
if(get_dist(source, user) <= 1)
return 1
else
if (istype(user, /mob/living/carbon))
if (user:mutations & telepathy)
if (user:mutations & TK)
var/X = source:x
var/Y = source:y
var/Z = source:z
@@ -190,104 +190,6 @@
return turfs
proc/check_can_reach(atom/user, atom/target)
var/direct = get_dir(user, target)
var/obj/item/weapon/dummy/D = new /obj/item/weapon/dummy( user.loc )
var/ok = 0
if ( (direct - 1) & direct)
// ------- CLICKED OBJECT IS LOCATED IN A DIAGONAL POSITION FROM THE PERSON -------
var/turf/Step_1
var/turf/Step_2
switch(direct)
if(5.0)
Step_1 = get_step(user, NORTH)
Step_2 = get_step(user, EAST)
if(6.0)
Step_1 = get_step(user, SOUTH)
Step_2 = get_step(user, EAST)
if(9.0)
Step_1 = get_step(user, NORTH)
Step_2 = get_step(user, WEST)
if(10.0)
Step_1 = get_step(user, SOUTH)
Step_2 = get_step(user, WEST)
else
if(Step_1 && Step_2)
// ------- BOTH CARDINAL DIRECTIONS OF THE DIAGONAL EXIST IN THE GAME WORLD -------
var/check_1 = 0
var/check_2 = 0
if(step_to(D, Step_1))
check_1 = 1
for(var/obj/border_obstacle in Step_1)
if(border_obstacle.flags & ON_BORDER)
if(!border_obstacle.CheckExit(D, target))
check_1 = 0
// ------- YOU TRIED TO CLICK ON AN ITEM THROUGH A WINDOW (OR SIMILAR THING THAT LIMITS ON BORDERS) ON ONE OF THE DIRECITON TILES -------
for(var/obj/border_obstacle in get_turf(target))
if((border_obstacle.flags & ON_BORDER) && (target != border_obstacle))
if(!border_obstacle.CanPass(D, D.loc, 1, 0))
// ------- YOU TRIED TO CLICK ON AN ITEM THROUGH A WINDOW (OR SIMILAR THING THAT LIMITS ON BORDERS) ON THE TILE YOU'RE ON -------
check_1 = 0
D.loc = user.loc
if(step_to(D, Step_2))
check_2 = 1
for(var/obj/border_obstacle in Step_2)
if(border_obstacle.flags & ON_BORDER)
if(!border_obstacle.CheckExit(D, target))
check_2 = 0
for(var/obj/border_obstacle in get_turf(target))
if((border_obstacle.flags & ON_BORDER) && (target != border_obstacle))
if(!border_obstacle.CanPass(D, D.loc, 1, 0))
check_2 = 0
if(check_1 || check_2)
ok = 1
// ------- YOU CAN REACH THE ITEM THROUGH AT LEAST ONE OF THE TWO DIRECTIONS. GOOD. -------
/*
More info:
If you're trying to click an item in the north-east of your mob, the above section of code will first check if tehre's a tile to the north or you and to the east of you
These two tiles are Step_1 and Step_2. After this, a new dummy object is created on your location. It then tries to move to Step_1, If it succeeds, objects on the turf you're on and
the turf that Step_1 is are checked for items which have the ON_BORDER flag set. These are itmes which limit you on only one tile border. Windows, for the most part.
CheckExit() and CanPass() are use to determine this. The dummy object is then moved back to your location and it tries to move to Step_2. Same checks are performed here.
If at least one of the two checks succeeds, it means you can reach the item and ok is set to 1.
*/
else
// ------- OBJECT IS ON A CARDINAL TILE (NORTH, SOUTH, EAST OR WEST OR THE TILE YOU'RE ON) -------
if(target.loc == user.loc)
ok = 1
// ------- OBJECT IS ON THE SAME TILE AS YOU -------
else
ok = 1
//Now, check objects to block exit that are on the border
for(var/obj/border_obstacle in user.loc)
if(border_obstacle.flags & ON_BORDER)
if(!border_obstacle.CheckExit(D, target))
ok = 0
//Next, check objects to block entry that are on the border
for(var/obj/border_obstacle in get_turf(target))
if((border_obstacle.flags & ON_BORDER) && (target != border_obstacle))
if(!border_obstacle.CanPass(D, D.loc, 1, 0))
ok = 0
/*
See the previous More info, for... more info...
*/
if(get_dist(user, target) > 1)
if(!in_range(user,target))
return 0
del(D)
// ------- DUMMY OBJECT'S SERVED IT'S PURPOSE, IT'S REWARDED WITH A SWIFT DELETE -------
return ok
return CanReachThrough(get_turf(user), get_turf(target), target)
+28 -43
View File
@@ -745,7 +745,6 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
// ------- CLICKED OBJECT EXISTS IN GAME WORLD, DISTANCE FROM PERSON TO OBJECT IS 1 SQUARE OR THEY'RE ON THE SAME SQUARE -------
var/direct = get_dir(usr, src)
var/obj/item/weapon/dummy/D = new /obj/item/weapon/dummy( usr.loc )
var/ok = 0
if ( (direct - 1) & direct)
@@ -777,31 +776,11 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
var/check_1 = 0
var/check_2 = 0
if(step_to(D, Step_1))
check_1 = 1
for(var/obj/border_obstacle in Step_1)
if(border_obstacle.flags & ON_BORDER)
if(!border_obstacle.CheckExit(D, src))
check_1 = 0
// ------- YOU TRIED TO CLICK ON AN ITEM THROUGH A WINDOW (OR SIMILAR THING THAT LIMITS ON BORDERS) ON ONE OF THE DIRECITON TILES -------
for(var/obj/border_obstacle in get_turf(src))
if((border_obstacle.flags & ON_BORDER) && (src != border_obstacle))
if(!border_obstacle.CanPass(D, D.loc, 1, 0))
// ------- YOU TRIED TO CLICK ON AN ITEM THROUGH A WINDOW (OR SIMILAR THING THAT LIMITS ON BORDERS) ON THE TILE YOU'RE ON -------
check_1 = 0
check_1 = CanReachThrough(get_turf(usr), Step_1, src) && CanReachThrough(Step_1, get_turf(src), src)
D.loc = usr.loc
if(step_to(D, Step_2))
check_2 = 1
check_2 = CanReachThrough(get_turf(usr), Step_2, src) && CanReachThrough(Step_2, get_turf(src), src)
for(var/obj/border_obstacle in Step_2)
if(border_obstacle.flags & ON_BORDER)
if(!border_obstacle.CheckExit(D, src))
check_2 = 0
for(var/obj/border_obstacle in get_turf(src))
if((border_obstacle.flags & ON_BORDER) && (src != border_obstacle))
if(!border_obstacle.CanPass(D, D.loc, 1, 0))
check_2 = 0
ok = (check_1 || check_2)
if(check_1 || check_2)
@@ -818,29 +797,11 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
*/
else
// ------- OBJECT IS ON A CARDINAL TILE (NORTH, SOUTH, EAST OR WEST OR THE TILE YOU'RE ON) -------
if(loc == usr.loc)
ok = 1
// ------- OBJECT IS ON THE SAME TILE AS YOU -------
else
ok = 1
//Now, check objects to block exit that are on the border
for(var/obj/border_obstacle in usr.loc)
if(border_obstacle.flags & ON_BORDER)
if(!border_obstacle.CheckExit(D, src))
ok = 0
//Next, check objects to block entry that are on the border
for(var/obj/border_obstacle in get_turf(src))
if((border_obstacle.flags & ON_BORDER) && (src != border_obstacle))
if(!border_obstacle.CanPass(D, D.loc, 1, 0))
ok = 0
ok = CanReachThrough(get_turf(usr), get_turf(src), src)
/*
See the previous More info, for... more info...
*/
del(D)
// ------- DUMMY OBJECT'S SERVED IT'S PURPOSE, IT'S REWARDED WITH A SWIFT DELETE -------
if (!( ok ))
// ------- TESTS ABOVE DETERMINED YOU CANNOT REACH THE TILE -------
return 0
@@ -953,6 +914,30 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
return
proc/CanReachThrough(turf/srcturf, turf/targetturf, atom/target)
var/obj/item/weapon/dummy/D = new /obj/item/weapon/dummy( srcturf )
if(targetturf.density && targetturf != get_turf(target))
return 0
//Now, check objects to block exit that are on the border
for(var/obj/border_obstacle in srcturf)
if(border_obstacle.flags & ON_BORDER)
if(!border_obstacle.CheckExit(D, targetturf))
del D
return 0
//Next, check objects to block entry that are on the border
for(var/obj/border_obstacle in targetturf)
if((border_obstacle.flags & ON_BORDER) && (src != border_obstacle))
if(!border_obstacle.CanPass(D, srcturf, 1, 0))
del D
return 0
del D
return 1
/*/atom/proc/get_global_map_pos()
if(!islist(global_map) || isemptylist(global_map)) return
var/cur_x = null
+1
View File
@@ -212,6 +212,7 @@
H.equip_if_possible(new /obj/item/clothing/under/rank/janitor(H), H.slot_w_uniform)
H.equip_if_possible(new /obj/item/clothing/shoes/black(H), H.slot_shoes)
H.equip_if_possible(new /obj/item/device/pda/janitor(H), H.slot_belt)
H.equip_if_possible(new /obj/item/device/portalathe(H), H.slot_in_backpack)
return 1
+1
View File
@@ -20,3 +20,4 @@
new /obj/item/weapon/cleaner(src)
new /obj/item/weapon/cleaner(src)
new /obj/item/weapon/trashbag(src)
new /obj/item/device/portalathe(src)
-5
View File
@@ -294,11 +294,6 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
var/filter_type = 2
/* --- Intercoms can only broadcast to other intercoms, but bounced radios can broadcast to bounced radios and intercoms --- */
if(istype(src, /obj/item/device/radio/intercom))
filter_type = 1
var/datum/signal/signal = new
signal.transmission_method = 2
+4 -4
View File
@@ -46,9 +46,9 @@ mob/living/carbon/verb/give()
I.layer = 20
I.add_fingerprint(src)
src.update_clothing()
src.visible_message(src,"[usr.name] handed \the [I.name] to [src.name].")
src.visible_message("[usr.name] handed \the [I.name] to [src.name].")
if("No")
src.visible_message(src,"[usr.name] tried to hand [I.name] to [src.name] but [src.name] didn't want it.")
src.visible_message("[usr.name] tried to hand [I.name] to [src.name] but [src.name] didn't want it.")
else if(src.l_hand == null)
switch(alert(src,"[src.name] wants to give you \a [I.name]?",,"Yes","No"))
if("Yes")
@@ -75,8 +75,8 @@ mob/living/carbon/verb/give()
I.layer = 20
I.add_fingerprint(src)
src.update_clothing()
src.visible_message(src,"[usr.name] handed \the [I.name] to [src.name].")
src.visible_message("[usr.name] handed \the [I.name] to [src.name].")
if("No")
src.visible_message(src,"[usr.name] tried to hand [I.name] to [src.name] but [src.name] didn't want it.")
src.visible_message("[usr.name] tried to hand [I.name] to [src.name] but [src.name] didn't want it.")
else
usr << "[src.name]\s hands are full."
+1 -1
View File
@@ -421,7 +421,7 @@
usr.sleeping = 1
usr.sleeping_willingly = 1
if("rest")
usr.resting = !( usr.resting )
usr.resting = !usr.resting
if("throw")
if (!usr.stat && isturf(usr.loc) && !usr.restrained())
usr:toggle_throw_mode()