Merge pull request #5226 from clusterfack/thingy

Various small optimizations
This commit is contained in:
d3athrow
2015-07-05 12:01:52 -05:00
15 changed files with 96 additions and 226 deletions

View File

@@ -613,23 +613,6 @@ proc/GaussRand(var/sigma)
proc/GaussRandRound(var/sigma,var/roundto)
return round(GaussRand(sigma),roundto)
proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,flick_anim as text,sleeptime = 0,direction as num)
//This proc throws up either an icon or an animation for a specified amount of time.
//The variables should be apparent enough.
var/atom/movable/overlay/animation = new(location)
if(direction)
animation.dir = direction
animation.icon = a_icon
animation.layer = target:layer+1
if(a_icon_state)
animation.icon_state = a_icon_state
else
animation.icon_state = "blank"
animation.master = target
flick(flick_anim, animation)
sleep(max(sleeptime, 15))
animation.loc = null
//Step-towards method of determining whether one atom can see another. Similar to viewers()
/proc/can_see(var/atom/source, var/atom/target, var/length=5) // I couldnt be arsed to do actual raycasting :I This is horribly inaccurate.
var/turf/current = get_turf(source)

View File

@@ -88,20 +88,6 @@ var/global/list/pda_app_menus = list(
var/y = 1
var/num = 0
/datum/pda_app/station_map/proc/minimap_update(var/mob/user)
if(istype(user,/mob/living/carbon))
var/mob/living/carbon/C = user
if(C.machine && istype(C.machine,/obj/item/device/pda))
var/obj/item/device/pda/pda_device = C.machine
var/turf/user_loc = get_turf(user)
var/turf/pda_loc = get_turf(pda_device)
if(get_dist(user_loc,pda_loc) <= 1)
if(pda_device.mode == PDA_APP_STATIONMAP)
pda_device.attack_self(C)
else
user.unset_machine()
user << browse(null, "window=pda")
///////////SNAKEII//////////////////////////////////////////////////////////////
/datum/pda_app/snake

View File

@@ -231,13 +231,14 @@
return
spawn(5)
if((M && !(M.anchored) && !(M.pulledby) && (M.loc == src)))
var/mob/living/carbon/carbons = M
if(istype(carbons))
carbons.update_minimap() //Should this even be here, oh well whatever
if(M.inertia_dir)
step(M, M.inertia_dir)
call(/datum/pda_app/station_map/proc/minimap_update)(M)
return
M.inertia_dir = M.last_move
step(M, M.inertia_dir)
call(/datum/pda_app/station_map/proc/minimap_update)(M)
return
/turf/proc/levelupdate()

View File

@@ -20,6 +20,22 @@
returnToPool(c_animation)
c_animation = null
proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,flick_anim as text,sleeptime = 0,direction as num)
//This proc throws up either an icon or an animation for a specified amount of time.
//The variables should be apparent enough.
var/atom/movable/overlay/animation = getFromPool(/atom/movable/overlay, location)
if(direction)
animation.dir = direction
animation.icon = a_icon
animation.layer = target:layer+1
if(a_icon_state)
animation.icon_state = a_icon_state
else
animation.icon_state = "blank"
animation.master = target
flick(flick_anim, animation)
sleep(max(sleeptime, 15))
returnToPool(animation)
/*
//called when the tile is cultified

View File

@@ -2,24 +2,17 @@
//added different sort of gibs and animations. N
/mob/proc/gib()
death(1)
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
// flick("gibbed-m", animation)
// anim(target = src, a_icon = 'icons/mob/mob.dmi', /*flick_anim = "dust-m"*/, sleeptime = 15)
gibs(loc, viruses, dna)
dead_mob_list -= src
spawn(15)
if(animation) del(animation)
if(src) del(src)
qdel(src)
//This is the proc for turning a mob into ash. Mostly a copy of gib code (above).
@@ -27,24 +20,17 @@
//Dusting robots does not eject the MMI, so it's a bit more powerful than gib() /N
/mob/proc/dust()
death(1)
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
// flick("dust-m", animation)
// anim(target = src, a_icon = 'icons/mob/mob.dmi', /*flick_anim = "dust-m"*/, sleeptime = 15)
new /obj/effect/decal/cleanable/ash(loc)
dead_mob_list -= src
spawn(15)
if(animation) del(animation)
if(src) del(src)
qdel(src)
/mob/proc/death(gibbed)

View File

@@ -1,41 +1,25 @@
/mob/living/carbon/alien/gib()
death(1)
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
flick("gibbed-a", animation)
anim(target = src, a_icon = 'icons/mob/mob.dmi', flick_anim = "gibbed-a", sleeptime = 15)
xgibs(loc, viruses)
dead_mob_list -= src
spawn(15)
if(animation) del(animation)
if(src) del(src)
qdel(src)
/mob/living/carbon/alien/dust()
death(1)
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
flick("dust-a", animation)
anim(target = src, a_icon = 'icons/mob/mob.dmi', flick_anim = "dust-a", sleeptime = 15)
new /obj/effect/decal/remains/xeno(loc)
dead_mob_list -= src
spawn(15)
if(animation) del(animation)
if(src) del(src)
qdel(src)

View File

@@ -17,26 +17,19 @@
/mob/living/carbon/brain/gib()
death(1)
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
// flick("gibbed-m", animation)
gibs(loc, viruses, dna)
dead_mob_list -= src
if(container && istype(container, /obj/item/device/mmi))
qdel(container)//Gets rid of the MMI if there is one
if(loc)
if(istype(loc,/obj/item/organ/brain))
qdel(loc)//Gets rid of the brain item
spawn(15)
if(animation) del(animation)
if(src) del(src)
anim(target = src, a_icon = 'icons/mob/mob.dmi', /*flick_anim = "gibbed-m"*/, sleeptime = 15)
gibs(loc, viruses, dna)
dead_mob_list -= src
qdel(src)

View File

@@ -29,6 +29,20 @@
if((M_FAT in mutations) && m_intent == "run" && bodytemperature <= 360)
bodytemperature += 2
update_minimap()
/mob/living/carbon/proc/update_minimap()
var/obj/item/device/pda/pda_device = machine
if(machine && istype(machine))
var/turf/user_loc = get_turf(src)
var/turf/pda_loc = get_turf(pda_device)
if(get_dist(user_loc,pda_loc) <= 1)
if(pda_device.mode == PDA_APP_STATIONMAP)
pda_device.attack_self(src)
else
unset_machine()
src << browse(null, "window=pda")
/mob/living/carbon/relaymove(var/mob/user, direction)
if(user in src.stomach_contents)
if(prob(40))

View File

@@ -1,16 +1,10 @@
/mob/living/carbon/human/gib()
death(1)
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
// If we have brain worms, dump 'em.
var/mob/living/simple_animal/borer/B=has_brain_worms()
if(B)
@@ -24,41 +18,29 @@
// Override the current limb status and don't cause an explosion
E.droplimb(1,1)
flick("gibbed-h", animation)
anim(target = src, a_icon = 'icons/mob/mob.dmi', flick_anim = "gibbed-h", sleeptime = 15)
hgibs(loc, viruses, dna, species.flesh_color, species.blood_color)
spawn(15)
if(animation) del(animation)
if(src) del(src)
qdel(src)
/mob/living/carbon/human/dust()
death(1)
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
// If we have brain worms, dump 'em.
var/mob/living/simple_animal/borer/B=has_brain_worms()
if(B)
B.detach()
if (istype(src, /mob/living/carbon/human/manifested))
flick("dust-hm", animation)
anim(target = src, a_icon = 'icons/mob/mob.dmi', flick_anim = "dust-hm", sleeptime = 15)
else
flick("dust-h", animation)
new /obj/effect/decal/remains/human(loc)
anim(target = src, a_icon = 'icons/mob/mob.dmi', flick_anim = "dust-h", sleeptime = 15)
spawn(15)
if(animation) del(animation)
if(src) del(src)
new /obj/effect/decal/remains/human(loc)
qdel(src)
/mob/living/carbon/human/death(gibbed)

View File

@@ -1,42 +1,26 @@
/mob/living/carbon/monkey/gib()
death(1)
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
flick("gibbed-m", animation)
anim(target = src, a_icon = 'icons/mob/mob.dmi', flick_anim = "gibbed-m", sleeptime = 15)
gibs(loc, viruses, dna)
spawn(15)
if(animation) del(animation)
if(src) del(src)
qdel(src)
/mob/living/carbon/monkey/dust()
death(1)
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
flick("dust-m", animation)
anim(target = src, a_icon = 'icons/mob/mob.dmi', flick_anim = "dust-m", sleeptime = 15)
new /obj/effect/decal/cleanable/ash(loc)
spawn(15)
if(animation) del(animation)
if(src) del(src)
qdel(src)
/mob/living/carbon/monkey/death(gibbed)

View File

@@ -1,41 +1,25 @@
/mob/living/silicon/gib()
death(1)
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
// flick("gibbed-r", animation)
// anim(target = src, a_icon = 'icons/mob/mob.dmi', /*flick_anim = "gibbed-r"*/, sleeptime = 15)
robogibs(loc, viruses)
dead_mob_list -= src
spawn(15)
if(animation) del(animation)
if(src) del(src)
qdel(src)
/mob/living/silicon/dust()
death(1)
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
// flick("dust-r", animation)
// anim(target = src, a_icon = 'icons/mob/mob.dmi', /*flick_anim = "dust-r"*/, sleeptime = 15)
new /obj/effect/decal/remains/robot(loc)
dead_mob_list -= src
spawn(15)
if(animation) del(animation)
if(src) del(src)
qdel(src)

View File

@@ -1,17 +1,11 @@
/mob/living/silicon/robot/mommi/gib()
//robots don't die when gibbed. instead they drop their MMI'd brain
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
flick("gibbed-r", animation)
anim(target = src, a_icon = 'icons/mob/mob.dmi', flick_anim = "gibbed-r", sleeptime = 15)
robogibs(loc, viruses)
living_mob_list -= src
@@ -21,31 +15,22 @@
if(!found && tool_state != src.module.emag)
var/obj/item/TS = tool_state
drop_item(TS)
spawn(15)
if(animation) del(animation)
if(src) del(src)
qdel(src)
/mob/living/silicon/robot/mommi/dust()
death(1)
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
flick("dust-r", animation)
anim(target = src, a_icon = 'icons/mob/mob.dmi', flick_anim = "dust-r", sleeptime = 15)
new /obj/effect/decal/remains/robot(loc)
if(mmi) del(mmi) //Delete the MMI first so that it won't go popping out.
if(mmi)
qdel(mmi) //Delete the MMI first so that it won't go popping out.
dead_mob_list -= src
spawn(15)
if(animation) del(animation)
if(src) del(src)
qdel(src)
/mob/living/silicon/robot/mommi/death(gibbed)
if(stat == DEAD) return

View File

@@ -1,46 +1,31 @@
/mob/living/silicon/robot/gib()
//robots don't die when gibbed. instead they drop their MMI'd brain
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
flick("gibbed-r", animation)
anim(target = src, a_icon = 'icons/mob/mob.dmi', flick_anim = "gibbed-r", sleeptime = 15)
robogibs(loc, viruses)
living_mob_list -= src
dead_mob_list -= src
spawn(15)
if(animation) del(animation)
if(src) del(src)
qdel(src)
/mob/living/silicon/robot/dust()
death(1)
var/atom/movable/overlay/animation = null
monkeyizing = 1
canmove = 0
icon = null
invisibility = 101
animation = new(loc)
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
flick("dust-r", animation)
anim(target = src, a_icon = 'icons/mob/mob.dmi', flick_anim = "dust-r", sleeptime = 15)
new /obj/effect/decal/remains/robot(loc)
if(mmi) del(mmi) //Delete the MMI first so that it won't go popping out.
if(mmi)
qdel(mmi) //Delete the MMI first so that it won't go popping out.
dead_mob_list -= src
spawn(15)
if(animation) del(animation)
if(src) del(src)
qdel(src)
/mob/living/silicon/robot/death(gibbed)

View File

@@ -199,19 +199,16 @@
if(!mob)
return // Moved here to avoid nullrefs below. - N3X
if(moving) return 0
if(move_delayer.blocked()) return
if(move_delayer.next_allowed > world.time)
return 0
// /vg/ - Deny clients from moving certain mobs. (Like cluwnes :^)
if(mob.deny_client_move)
src << "<span class='warning'>You cannot move this mob.</span>"
return
// USE /event
call(/datum/pda_app/station_map/proc/minimap_update)(mob)
if(mob.control_object) Move_object(dir)
if(mob.control_object)
Move_object(dir)
if(mob.incorporeal_move)
Process_Incorpmove(dir)
@@ -222,20 +219,23 @@
if(S.victim == mob)
return
if(mob.stat==2) return
if(mob.stat == DEAD)
return
if(isAI(mob)) return AIMove(loc,dir,mob)
if(isAI(mob))
return AIMove(loc,dir,mob)
if(mob.monkeyizing) return//This is sota the goto stop mobs from moving var
if(mob.monkeyizing)
return//This is sota the goto stop mobs from moving var
if(Process_Grab()) return
if(Process_Grab())
return
if(mob.buckled) //if we're buckled to something, tell it we moved.
return mob.buckled.relaymove(mob, dir)
if(!mob.canmove) return
if(!mob.canmove)
return
//if(istype(mob.loc, /turf/space) || (mob.flags & NOGRAV))
// if(!mob.Process_Spacemove(0)) return 0
@@ -281,8 +281,8 @@
move_delay += 7
//We are now going to move
moving = 1
mob.delayNextMove(move_delay/2)
move_delay = min(move_delay,1)
mob.delayNextMove(move_delay)
//Something with pulling things
if(Findgrab)
var/list/L = mob.ret_grab()
@@ -322,13 +322,6 @@
. = ..()
mob.last_movement=world.time
moving = 0
return .
return
///Process_Grab()
///Called by client/Move()
///Checks to see if you are being grabbed and if so attemps to break it
@@ -418,6 +411,7 @@
for(var/obj/S in mob.loc)
if(istype(S,/obj/effect/step_trigger) || istype(S,/obj/effect/beam))
S.Crossed(mob)
mob.delayNextMove(1)
return 1

View File

@@ -15,13 +15,8 @@
for(var/t in organs)
del(t)
var/atom/movable/overlay/animation = new /atom/movable/overlay( loc )
animation.icon_state = "blank"
animation.icon = 'icons/mob/mob.dmi'
animation.master = src
flick("h2monkey", animation)
sleep(48)
//animation = null
anim(target = src, a_icon = 'icons/mob/mob.dmi', flick_anim = "h2monkey", sleeptime = 15)
sleep(33)
if(!species.primitive) //If the creature in question has no primitive set, this is going to be messy.
gib()
@@ -47,9 +42,7 @@
O << "<B>You are now [O]. </B>"
spawn(0)//To prevent the proc from returning null.
del(src)
del(animation)
qdel(src)
return O