mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
Merge pull request #1528 from SkyMarshal/master
Adds caching to dummy objects, seems to work great.
This commit is contained in:
+18
-4
@@ -1005,9 +1005,20 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
|
||||
|
||||
usr.next_move = world.time + 6
|
||||
return
|
||||
////////////////////////////////////////
|
||||
///IMPORTANT: CACHE FOR DUMMY OBJECTS///
|
||||
//Used to cut down on stupid deletions//
|
||||
////////////////////////////////////////
|
||||
var/list/DummyCache = list()
|
||||
|
||||
/proc/CanReachThrough(turf/srcturf, turf/targetturf, atom/target)
|
||||
var/obj/item/weapon/dummy/D = new /obj/item/weapon/dummy( srcturf )
|
||||
|
||||
var/obj/item/weapon/dummy/D = locate() in DummyCache
|
||||
if(!D)
|
||||
D = new /obj/item/weapon/dummy( srcturf )
|
||||
else
|
||||
DummyCache.Remove(D)
|
||||
D.loc = srcturf
|
||||
|
||||
if(targetturf.density && targetturf != get_turf(target))
|
||||
return 0
|
||||
@@ -1016,17 +1027,20 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
|
||||
for(var/obj/border_obstacle in srcturf)
|
||||
if(border_obstacle.flags & ON_BORDER)
|
||||
if(!border_obstacle.CheckExit(D, targetturf))
|
||||
del D
|
||||
D.loc = null
|
||||
DummyCache.Add(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) && (target != border_obstacle))
|
||||
if(!border_obstacle.CanPass(D, srcturf, 1, 0))
|
||||
del D
|
||||
D.loc = null
|
||||
DummyCache.Add(D)
|
||||
return 0
|
||||
|
||||
del D
|
||||
D.loc = null
|
||||
DummyCache.Add(D)
|
||||
return 1
|
||||
|
||||
/atom/proc/CtrlClick(var/mob/M as mob)
|
||||
|
||||
+16
-7
@@ -99,12 +99,11 @@
|
||||
if(istype(A,/mob/living))
|
||||
if(A:lying) continue
|
||||
src.throw_impact(A)
|
||||
if(src.throwing == 1)
|
||||
src.throwing = 0
|
||||
throwing = 0
|
||||
if(isobj(A))
|
||||
if(A.density && !A.CanPass(src,target))
|
||||
src.throw_impact(A)
|
||||
src.throwing = 0
|
||||
throwing = 0
|
||||
|
||||
/atom/proc/throw_impact(atom/hit_atom)
|
||||
if(istype(hit_atom,/mob/living))
|
||||
@@ -133,10 +132,20 @@
|
||||
message_admins("ATTACK: [hit_atom] ([M.ckey]) was hit by [src] thrown by ([src.fingerprintslast])")
|
||||
|
||||
else if(isobj(hit_atom))
|
||||
var/obj/O = hit_atom
|
||||
if(!O.anchored)
|
||||
step(O, src.dir)
|
||||
O.hitby(src)
|
||||
if (istype(hit_atom,/obj/machinery/disposal) && istype(src, /obj/item))
|
||||
var/obj/item/I = src
|
||||
if(prob(75))
|
||||
I.loc = hit_atom
|
||||
for(var/mob/M in viewers(hit_atom))
|
||||
M.show_message("\The [I] lands in \the [hit_atom].", 3)
|
||||
else
|
||||
for(var/mob/M in viewers(hit_atom))
|
||||
M.show_message("\The [I] bounces off of \the [hit_atom]'s rim!", 3)
|
||||
else
|
||||
var/obj/O = hit_atom
|
||||
if(!O.anchored)
|
||||
step(O, src.dir)
|
||||
O.hitby(src)
|
||||
|
||||
else if(isturf(hit_atom))
|
||||
var/turf/T = hit_atom
|
||||
|
||||
@@ -700,10 +700,15 @@ mob/living/carbon/metroid/var/temperature_resistance = T0C+75
|
||||
health = 150
|
||||
stat = 0
|
||||
|
||||
|
||||
/mob/living/carbon/metroid/proc/get_obstacle_ok(atom/A)
|
||||
var/direct = get_dir(src, A)
|
||||
var/obj/item/weapon/dummy/D = new /obj/item/weapon/dummy( src.loc )
|
||||
var/obj/item/weapon/dummy/D = locate() in DummyCache //See atom_procs.dm
|
||||
if(!D)
|
||||
D = new /obj/item/weapon/dummy( src.loc )
|
||||
else
|
||||
D.loc = src.loc
|
||||
DummyCache.Remove(D)
|
||||
|
||||
var/ok = 0
|
||||
|
||||
if ( (direct - 1) & direct)
|
||||
@@ -781,7 +786,8 @@ mob/living/carbon/metroid/var/temperature_resistance = T0C+75
|
||||
if(!border_obstacle.CanPass(D, D.loc, 1, 0))
|
||||
ok = 0
|
||||
|
||||
del(D)
|
||||
D.loc = null
|
||||
DummyCache.Add(D)
|
||||
if (!( ok ))
|
||||
return 0
|
||||
|
||||
|
||||
@@ -502,22 +502,6 @@
|
||||
H.vent_gas(loc)
|
||||
del(H)
|
||||
|
||||
CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
||||
if (istype(mover,/obj/item) && mover.throwing)
|
||||
var/obj/item/I = mover
|
||||
if(istype(I, /obj/item/weapon/dummy) || istype(I, /obj/item/projectile))
|
||||
return
|
||||
if(prob(75))
|
||||
I.loc = src
|
||||
for(var/mob/M in viewers(src))
|
||||
M.show_message("\the [I] lands in \the [src].", 3)
|
||||
else
|
||||
for(var/mob/M in viewers(src))
|
||||
M.show_message("\the [I] bounces off of \the [src]'s rim!", 3)
|
||||
return 0
|
||||
else
|
||||
return ..()
|
||||
|
||||
// virtual disposal object
|
||||
// travels through pipes in lieu of actual items
|
||||
// contents will be items flushed by the disposal
|
||||
|
||||
Reference in New Issue
Block a user