Merge pull request #160 from alex-gh/bs12_fixes_optimizations

Fixes and optimizations cherry picked from BS12
This commit is contained in:
ZomgPonies
2014-02-15 12:39:30 -05:00
21 changed files with 133 additions and 99 deletions
+1 -1
View File
@@ -145,7 +145,7 @@
if(istype(M, /mob/living/carbon/human))
M:attacked_by(src, user, def_zone)
return M:attacked_by(src, user, def_zone)
else
switch(damtype)
if("brute")
+19 -17
View File
@@ -6,6 +6,7 @@
var/rate
var/list/solars // for debugging purposes, references solars_list at the constructor
var/nexttime = 3600 // Replacement for var/counter to force the sun to move every X IC minutes
var/lastAngleUpdate
/datum/sun/New()
@@ -24,15 +25,25 @@
counter = 0 */
angle = ((rate*world.time/100)%360 + 360)%360
/*
Yields a 45 - 75 IC minute rotational period
Rotation rate can vary from 4.8 deg/min to 8 deg/min (288 to 480 deg/hr)
*/
// To prevent excess server load the server only updates the sun's sight lines every 6 minutes
if(nexttime < world.time)
if(lastAngleUpdate != angle)
for(var/obj/machinery/power/tracker/T in solars_list)
if(!T.powernet)
solars_list.Remove(T)
continue
T.set_angle(angle)
lastAngleUpdate=angle
if(nexttime > world.time)
return
nexttime = nexttime + 3600 // 600 world.time ticks = 1 minute, 3600 = 6 minutes.
nexttime = nexttime + 600 // 600 world.time ticks = 1 minute
// now calculate and cache the (dx,dy) increments for line drawing
@@ -54,22 +65,13 @@
dy = c / abs(s)
for(var/obj/machinery/power/M in solars_list)
for(var/obj/machinery/power/solar/S in solars_list)
if(!M.powernet)
solars_list.Remove(M)
if(!S.powernet)
solars_list.Remove(S)
continue
// Solar Tracker
if(istype(M, /obj/machinery/power/tracker))
var/obj/machinery/power/tracker/T = M
T.set_angle(angle)
// Solar Panel
else if(istype(M, /obj/machinery/power/solar))
var/obj/machinery/power/solar/S = M
if(S.control)
occlusion(S)
if(S.control)
occlusion(S)
+6
View File
@@ -1,4 +1,5 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
var/global/list/all_objectives = list()
var/list/potential_theft_objectives=typesof(/datum/theft_objective) \
- /datum/theft_objective \
@@ -14,9 +15,14 @@ datum/objective
var/completed = 0 //currently only used for custom objectives.
New(var/text)
all_objectives |= src
if(text)
explanation_text = text
Del()
all_objectives -= src
..()
proc/check_completion()
return completed
@@ -155,9 +155,17 @@
return 1
/mob/living/carbon/human/proc/RevConvert(mob/M as mob in oview(src))
/mob/living/carbon/human/proc/RevConvert()
set name = "Rev-Convert"
set category = "IC"
var/list/Possible = list()
for (var/mob/living/carbon/human/P in oview(src))
if(!stat && P.client && P.mind && !P.mind.special_role)
Possible += P
if(!Possible.len)
src << "\red There doesn't appear to be anyone available for you to convert here."
return
var/mob/living/carbon/human/M = input("Select a person to convert", "Viva la revolution!", null) as mob in Possible
if(((src.mind in ticker.mode:head_revolutionaries) || (src.mind in ticker.mode:revolutionaries)))
if((M.mind in ticker.mode:head_revolutionaries) || (M.mind in ticker.mode:revolutionaries))
src << "\red <b>[M] is already be a revolutionary!</b>"
@@ -250,4 +258,4 @@
rev_obj.target = M.mind
rev_obj.explanation_text = "Assassinate, convert or capture [M.real_name], the [M.mind.assigned_role]."
rev_mind.objectives += rev_obj
rev_mind.current << "\red A new Head of Staff, [M.real_name], the [M.mind.assigned_role] has appeared. Your objectives have been updated."
rev_mind.current << "\red A new Head of Staff, [M.real_name], the [M.mind.assigned_role] has appeared. Your objectives have been updated."
+15 -15
View File
@@ -96,7 +96,6 @@ obj/machinery/computer/cryopod/Topic(href, href_list)
frozen_items -= I
else if(href_list["crew"])
user << "\red Functionality unavailable at this time."
src.updateUsrDialog()
@@ -211,20 +210,21 @@ obj/machinery/computer/cryopod/Topic(href, href_list)
frozen_items += W
//Update any existing objectives involving this mob.
for(var/mob/living/M in world) //There has to be a more efficient way to do this.
if(!(M.mind) || !(M.mind.objectives.len)) continue
for(var/datum/objective/O in M.mind.objectives)
if(O.target && istype(O.target,/datum/mind))
if(O.target == occupant.mind)
if(O.owner && O.owner.current)
O.owner.current << "\red You get the feeling your target is no longer within your reach. Time for Plan [pick(list("A","B","C","D","X","Y","Z"))]..."
O.target = null
spawn(1) //This should ideally fire after the occupant is deleted.
if(!O) return
O.find_target()
if(!(O.target))
O.owner.objectives -= O
for(var/datum/objective/O in all_objectives)
if(istype(O,/datum/objective/mutiny)) //We don't want revs to get objectives that aren't for heads of staff. Letting them win or lose based on cryo is silly so we remove the objective.
del(O) //TODO: Update rev objectives on login by head (may happen already?) ~ Z
else if(O.target && istype(O.target,/datum/mind))
if(O.target == occupant.mind)
if(O.owner && O.owner.current)
O.owner.current << "\red You get the feeling your target is no longer within your reach. Time for Plan [pick(list("A","B","C","D","X","Y","Z"))]..."
O.target = null
spawn(1) //This should ideally fire after the occupant is deleted.
if(!O) return
O.find_target()
if(!(O.target))
all_objectives -= O
O.owner.objectives -= O
del(O)
//Handle job slot/tater cleanup.
var/job = occupant.mind.assigned_role
+2 -9
View File
@@ -393,7 +393,7 @@
user.visible_message("[user] turned the shield generator off.", \
"You turn off the shield generator.", \
"You hear heavy droning fade out.")
src.cleanup()
for(var/dir in list(1,2,4,8)) src.cleanup(dir)
else
src.active = 1
icon_state = "Shield_Gen +a"
@@ -433,14 +433,7 @@
"You hear heavy droning fade out")
icon_state = "Shield_Gen"
src.active = 0
spawn(1)
src.cleanup(1)
spawn(1)
src.cleanup(2)
spawn(1)
src.cleanup(4)
spawn(1)
src.cleanup(8)
for(var/dir in list(1,2,4,8)) src.cleanup(dir)
/obj/machinery/shieldwallgen/proc/setup_field(var/NSEW = 0)
var/turf/T = src.loc
@@ -809,6 +809,8 @@ var/global/list/obj/item/device/pda/PDAs = list()
P.tnote.Add(list(list("sent" = 0, "owner" = "[owner]", "job" = "[ownjob]", "message" = "[t]", "target" = "\ref[src]")))
for(var/mob/M in player_list)
if(M.stat == DEAD && M.client && (M.client.prefs.toggles & CHAT_GHOSTEARS)) // src.client is so that ghosts don't have to listen to mice
if(istype(M, /mob/new_player))
continue
M.show_message("<span class='game say'>PDA Message - <span class='name'>[owner]</span> -> <span class='name'>[P.owner]</span>: <span class='message'>[t]</span></span>")
if(!conversations.Find("\ref[P]"))
@@ -167,7 +167,7 @@
playsound(src.loc, 'sound/weapons/empty.ogg', 50, 1)
add_fingerprint(user)
if (!blood_DNA) return
if(blood_overlay && (blood_DNA.len >= 1)) //updates blood overlay, if any
if(blood_overlay && (blood_DNA.len >= 1)) //updates blood overlay, if any
overlays.Cut()//this might delete other item overlays as well but eeeeeeeh
var/icon/I = new /icon(src.icon, src.icon_state)
@@ -194,7 +194,6 @@
if(!..()) return
if(!isrobot(target))
playsound(src.loc, "swing_hit", 50, 1, -1)
//target.Stun(4) //naaah
target.Weaken(4)
else
playsound(src.loc, 'sound/weapons/Genhit.ogg', 50, 1, -1)
@@ -243,8 +242,6 @@
/*
* Energy Axe
*/
/obj/item/weapon/melee/energy/axe/attack(target as mob, mob/user as mob)
..()
/obj/item/weapon/melee/energy/axe/attack_self(mob/user as mob)
src.active = !( src.active )
+33 -29
View File
@@ -360,35 +360,39 @@
/obj/item/weapon/weldingtool/proc/eyecheck(mob/user as mob)
if(!iscarbon(user)) return 1
var/safety = user:eyecheck()
var/mob/living/carbon/human/H = user
var/datum/organ/internal/eyes/E = H.internal_organs["eyes"]
switch(safety)
if(1)
usr << "\red Your eyes sting a little."
E.damage += rand(1, 2)
if(E.damage > 12)
user.eye_blurry += rand(3,6)
if(0)
usr << "\red Your eyes burn."
E.damage += rand(2, 4)
if(istype(user, /mob/living/carbon/human))
var/mob/living/carbon/human/H = user
var/datum/organ/internal/eyes/E = H.internal_organs["eyes"]
switch(safety)
if(1)
usr << "\red Your eyes sting a little."
E.damage += rand(1, 2)
if(E.damage > 12)
user.eye_blurry += rand(3,6)
if(0)
usr << "\red Your eyes burn."
E.damage += rand(2, 4)
if(E.damage > 10)
E.damage += rand(4,10)
if(-1)
usr << "\red Your thermals intensify the welder's glow. Your eyes itch and burn severely."
user.eye_blurry += rand(12,20)
E.damage += rand(12, 16)
if(safety<2)
if(E.damage > 10)
E.damage += rand(4,10)
if(-1)
usr << "\red Your thermals intensify the welder's glow. Your eyes itch and burn severely."
user.eye_blurry += rand(12,20)
E.damage += rand(12, 16)
if(E.damage > 10 && safety < 2)
user << "\red Your eyes are really starting to hurt. This can't be good for you!"
if (E.damage >= E.min_broken_damage)
user << "\red You go blind!"
user.sdisabilities |= BLIND
else if (E.damage >= E.min_bruised_damage)
user << "\red You go blind!"
user.eye_blind = 5
user.eye_blurry = 5
user.disabilities |= NEARSIGHTED
spawn(100)
user.disabilities &= ~NEARSIGHTED
user << "\red Your eyes are really starting to hurt. This can't be good for you!"
if (E.damage >= E.min_broken_damage)
user << "\red You go blind!"
user.sdisabilities |= BLIND
else if (E.damage >= E.min_bruised_damage)
user << "\red You go blind!"
user.eye_blind = 5
user.eye_blurry = 5
user.disabilities |= NEARSIGHTED
spawn(100)
user.disabilities &= ~NEARSIGHTED
return
@@ -491,4 +495,4 @@
attack_self(mob/user as mob)
open = !open
user << "\blue You [open?"open" : "close"] the conversion kit."
update_icon()
update_icon()
+3 -1
View File
@@ -62,7 +62,7 @@
if(30)
new/obj/item/weapon/melee/baton(src)
/obj/structure/closet/crate/secure/loot/attack_hand(mob/user as mob)
/obj/structure/closet/crate/secure/loot/togglelock(mob/user as mob)
if(locked)
user << "<span class='notice'>The crate is locked with a Deca-code lock.</span>"
var/input = input(usr, "Enter digit from [min] to [max].", "Deca-Code Lock", "") as num
@@ -71,6 +71,8 @@
if (input == code)
user << "<span class='notice'>The crate unlocks!</span>"
locked = 0
overlays.Cut()
overlays += greenlight
else if (input == null || input > max || input < min)
user << "<span class='notice'>You leave the crate alone.</span>"
else
@@ -7,6 +7,7 @@
icon_state = "body_m_s"
var/list/hud_list = list()
var/datum/species/species //Contains icon generation and language information, set during New().
var/embedded_flag //To check if we've need to roll for damage on movement while an item is imbedded in us.
/mob/living/carbon/human/dummy
real_name = "Test Dummy"
@@ -251,6 +251,7 @@
if(!istype(W, /obj/item/weapon/butch/meatcleaver))
organ.implants += W
visible_message("<span class='danger'>\The [W] sticks in the wound!</span>")
embedded_flag = 1
src.verbs += /mob/proc/yank_out_object
W.add_blood(src)
if(ismob(W.loc))
@@ -273,4 +274,4 @@
if(prob(60))
step_rand(H)
if(!stat)
src << "<span class='warning'>Your [H] fell off!</span>"
src << "<span class='warning'>Your [H] fell off!</span>"
@@ -100,6 +100,7 @@ emp_act
(SP.loc) = organ
organ.implants += SP
visible_message("<span class='danger'>The projectile sticks in the wound!</span>")
embedded_flag = 1
src.verbs += /mob/proc/yank_out_object
SP.add_blood(src)
return (..(P , def_zone))
@@ -200,7 +201,7 @@ emp_act
target_zone = user.zone_sel.selecting
if(!target_zone && !src.stat)
visible_message("\red <B>[user] misses [src] with \the [I]!")
return
return 0
if(istype(I, /obj/item/weapon/butch/meatcleaver) && src.stat == DEAD && user.a_intent == "harm")
var/obj/item/weapon/reagent_containers/food/snacks/meat/human/newmeat = new /obj/item/weapon/reagent_containers/food/snacks/meat/human(get_turf(src.loc))
@@ -225,10 +226,10 @@ emp_act
var/datum/organ/external/affecting = get_organ(target_zone)
if (!affecting)
return
return 0
if(affecting.status & ORGAN_DESTROYED)
user << "What [affecting.display_name]?"
return
return 0
var/hit_area = affecting.display_name
if((user != src) && check_shields(I.force, "the [I.name]"))
@@ -245,7 +246,7 @@ emp_act
var/obj/item/weapon/card/emag/emag = I
emag.uses--
affecting.sabotaged = 1
return
return 1
if(I.attack_verb.len)
visible_message("\red <B>[src] has been [pick(I.attack_verb)] in the [hit_area] with [I.name] by [user]!</B>")
@@ -300,6 +301,7 @@ emp_act
if(bloody)
bloody_body(src)
return 1
/mob/living/carbon/human/proc/bloody_hands(var/mob/living/source, var/amount = 2)
@@ -6,7 +6,8 @@
if (istype(loc, /turf/space)) return -1 // It's hard to be slowed down in space by... anything
handle_embedded_objects() //Moving with objects stuck in you can cause bad times.
if(embedded_flag)
handle_embedded_objects() //Moving with objects stuck in you can cause bad times.
if(reagents.has_reagent("hyperzine")) return -1
@@ -104,20 +104,20 @@
if (W == wear_suit)
if(s_store)
u_equip(s_store)
drop_from_inventory(s_store)
if(W)
success = 1
wear_suit = null
update_inv_wear_suit()
else if (W == w_uniform)
if (r_store)
u_equip(r_store)
drop_from_inventory(r_store)
if (l_store)
u_equip(l_store)
drop_from_inventory(l_store)
if (wear_id)
u_equip(wear_id)
drop_from_inventory(wear_id)
if (belt)
u_equip(belt)
drop_from_inventory(belt)
w_uniform = null
success = 1
update_inv_w_uniform()
+8 -1
View File
@@ -130,7 +130,7 @@
handle_environment(environment)
//Status updates, death etc.
handle_regular_status_updates() //TODO: optimise ~Carn
handle_regular_status_updates() //TODO: optimise ~Carn NO SHIT ~Ccomp
update_canmove()
//Update our name based on whether our face is obscured/disfigured
@@ -1146,6 +1146,13 @@
if(halloss > 0)
adjustHalLoss(-1)
if(embedded_flag && !(life_tick % 10))
var/list/E
E = get_visible_implants(0)
if(!E.len)
embedded_flag = 0
//Eyes
if(sdisabilities & BLIND) //disabled-blind, doesn't get better on its own
blinded = 1
+3 -2
View File
@@ -623,9 +623,10 @@
for(var/mob/O in viewers(CM))// lags so hard that 40s isn't lenient enough - Quarxink
O.show_message("\red <B>[CM] manages to remove the handcuffs!</B>", 1)
CM << "\blue You successfully remove \the [CM.handcuffed]."
CM.handcuffed.loc = usr.loc
CM.drop_from_inventory(CM.handcuffed)
CM.handcuffed = null
CM.update_inv_handcuffed()
else if(CM.legcuffed && CM.canmove && (CM.last_special <= world.time))
CM.next_move = world.time + 100
CM.last_special = world.time + 100
@@ -661,7 +662,7 @@
for(var/mob/O in viewers(CM))// lags so hard that 40s isn't lenient enough - Quarxink
O.show_message("\red <B>[CM] manages to remove the legcuffs!</B>", 1)
CM << "\blue You successfully remove \the [CM.legcuffed]."
CM.legcuffed.loc = usr.loc
CM.drop_from_inventory(CM.legcuffed)
CM.legcuffed = null
CM.update_inv_legcuffed()
+4 -3
View File
@@ -694,10 +694,11 @@ var/list/ai_list = list()
camera_light_on = !camera_light_on
src << "Camera lights [camera_light_on ? "activated" : "deactivated"]."
if(!camera_light_on)
if(src.current)
src.current.SetLuminosity(0)
if(current)
current.SetLuminosity(0)
current = null
else
src.lightNearbyCamera()
lightNearbyCamera()
@@ -643,5 +643,12 @@
dat += "</li>"
dat += "</ul>"
dat += "<br><br>"
dat += "Messages: <hr> [pda.tnote]"
return dat
for(var/index in pda.tnote)
if(index["sent"])
dat += addtext("<i><b>&rarr; To <a href='byond://?src=\ref[src];software=pdamessage;target=",index["src"],"'>", index["owner"],"</a>:</b></i><br>", index["message"], "<br>")
else
dat += addtext("<i><b>&larr; From <a href='byond://?src=\ref[src];software=pdamessage;target=",index["target"],"'>", index["owner"],"</a>:</b></i><br>", index["message"], "<br>")
return dat
-1
View File
@@ -1188,7 +1188,6 @@ mob/proc/yank_out_object()
var/datum/wound/internal_bleeding/I = new (15)
affected.wounds += I
H.custom_pain("Something tears wetly in your [affected] as [selection] is pulled free!", 1)
return 1
selection.loc = get_turf(src)
+1 -1
View File
@@ -177,7 +177,7 @@
for(var/mob/living/carbon/human/l in view(src, min(7, round(power ** 0.25)))) // If they can see it without mesons on. Bad on them.
if(!istype(l.glasses, /obj/item/clothing/glasses/meson))
l.hallucination = max(0, min(200, l.hallucination + power * config_hallucination_power * sqrt( 1 / get_dist(l, src) ) ) )
l.hallucination = max(0, min(200, l.hallucination + power * config_hallucination_power * sqrt( 1 / max(1,get_dist(l, src)) ) ) )
for(var/mob/living/l in range(src, round((power / 100) ** 0.25)))
var/rads = (power / 10) * sqrt( 1 / get_dist(l, src) )