Merge pull request #1365 from SkyMarshal/BugFixes

Lots of fixes for derped up while loops (In an attempt to destroy the crashing), and changed flavor text for auto-fire-mode shooting guns stuff.
This commit is contained in:
CIB
2012-06-22 15:02:27 -07:00
32 changed files with 179 additions and 247 deletions
-1
View File
@@ -356,7 +356,6 @@
#include "code\defines\procs\logging.dm"
#include "code\defines\procs\religion_name.dm"
#include "code\defines\procs\station_name.dm"
#include "code\defines\procs\statistics.dm"
#include "code\defines\procs\syndicate_name.dm"
#include "code\defines\procs\time_stamp.dm"
#include "code\defines\sd_procs\base64.dm"
+1 -1
View File
@@ -214,7 +214,7 @@ atom/proc/ul_BlankLocal()
var/TurfAdjust = isturf(src) ? 1 : 0
for(var/atom/Affected in view(ul_TopLuminosity, src))
if(ul_IsLuminous(Affected) && Affected.ul_Extinguished == UL_I_LIT && (ul_FalloffAmount(Affected) <= Affected.luminosity + TurfAdjust))
if(ul_IsLuminous(Affected) && Affected.ul_Extinguished == UL_I_LIT && (ul_FalloffAmount(Affected) <= ul_Luminosity(Affected) + TurfAdjust))
Affected.ul_Extinguish()
Blanked += Affected
+1 -1
View File
@@ -162,7 +162,7 @@ datum
if(!success) //Runtimed.
failed_ticks++
if(failed_ticks > 20)
world << "<font size='4' color='red'>ERROR IN ATMOS TICKER. Killing air simulation!</font>"
world << "<font color='red'><b>ERROR IN ATMOS TICKER. Killing air simulation!</font></b>"
kill_air = 1
sleep(max(5,update_delay*tick_multiplier))
+3 -2
View File
@@ -93,8 +93,9 @@
src.inherent = list()
/datum/ai_laws/proc/add_supplied_law(var/number, var/law)
while (src.supplied.len < number + 1)
src.supplied += ""
// while (src.supplied.len < number + 1)
// src.supplied += ""
//Infinite loop
src.supplied[number + 1] = law
@@ -53,7 +53,7 @@
affected_mob.updatehealth()
if(prob(40)) //So everyone can feel like robot Seth Brundle
if(src.gibbed != 0) return 0
var/turf/T = find_loc(affected_mob)
var/turf/T = get_turf(affected_mob)
gibs(T)
src.cure(0)
gibbed = 1
+1 -1
View File
@@ -53,7 +53,7 @@
affected_mob.updatehealth()
if(prob(40))
if(gibbed != 0) return 0
var/turf/T = find_loc(affected_mob)
var/turf/T = get_turf(affected_mob)
gibs(T)
src.cure(0)
gibbed = 1
@@ -46,11 +46,11 @@
proc/check_all_steps(atom/used_atom,mob/user as mob) //check all steps, remove matching one.
for(var/i=1;i<=steps.len;i++)
var/list/L = steps[i];
var/list/L = steps[i]
if(istype(used_atom, L["key"]))
if(custom_action(i, used_atom, user))
steps[i]=null;//stupid byond list from list removal...
listclearnulls(steps);
steps[i]=null//stupid byond list from list removal...
steps.Remove(null)
if(!steps.len)
spawn_result()
return 1
+2 -1
View File
@@ -172,7 +172,8 @@
if(istype(teleatom, /obj/item/weapon/disk/nuclear)) // Don't let nuke disks get teleported --NeoFite
teleatom.visible_message("\red <B>The [teleatom] bounces off of the portal!</B>")
return 0
if(!isemptylist(teleatom.search_contents_for(/obj/item/weapon/disk/nuclear)))
var/list/temp = teleatom.search_contents_for(/obj/item/weapon/disk/nuclear)
if(temp.len)
if(istype(teleatom, /mob/living))
var/mob/living/MM = teleatom
MM.visible_message("\red <B>The [MM] bounces off of the portal!</B>","\red Something you are carrying seems to be unable to pass through the portal. Better drop it if you want to go through.")
-11
View File
@@ -1152,17 +1152,6 @@ proc/islist(list/list)
return 1
return 0
proc/isemptylist(list/list)
if(!list.len)
return 1
return 0
proc/listclearnulls(list/list)
if(istype(list))
while(null in list)
list -= null
return
/atom/proc/GetAllContents(searchDepth = 5)
var/list/toReturn = list()
+2 -3
View File
@@ -240,9 +240,8 @@ datum/radio_frequency
for (var/devices_filter in devices)
var/list/devices_line = devices[devices_filter]
devices_line-=device
while (null in devices_line)
devices_line -= null
if (devices_line.len==0)
devices_line.Remove(null)
if (!devices_line.len)
devices -= devices_filter
del(devices_line)
+1 -3
View File
@@ -23,9 +23,7 @@
command_alert("Station has entered radiation cloud. Do not leave cover until it has passed.")
if(ActiveFor == 100 || ActiveFor == 150) //1/2 and 2/2 f the way after it start proper make peope be half dead mostly
for(var/mob/living/carbon/M in world)
var/area = M.loc.loc
while(!istype(area, /area))
area = area:loc
var/area = get_area(M)
if(area:radsafe)
continue
if(!M.stat)
+3 -3
View File
@@ -136,9 +136,9 @@ var/datum/roundinfo/roundinfo = new()
//Start master_controller.process()
spawn master_controller.process()
if (config.sql_enabled)
spawn(3000)
statistic_cycle() // Polls population totals regularly and stores them in an SQL DB -- TLE
// if (config.sql_enabled)
// spawn(3000)
// statistic_cycle() // Polls population totals regularly and stores them in an SQL DB -- TLE
return 1
/datum/controller/gameticker
+13 -23
View File
@@ -753,13 +753,9 @@ Auto Patrol: []"},
if(lastfired && world.time - lastfired < shot_delay)
return
lastfired = world.time
var/turf/T = loc
var/atom/U = (istype(target, /atom/movable) ? target.loc : target)
if ((!( U ) || !( T )))
return
while(!( istype(U, /turf) ))
U = U.loc
if (!( istype(T, /turf) ))
var/turf/T = get_turf(src)
var/turf/U = (istype(target, /atom/movable) ? get_turf(target) : target)
if ( !istype(T) || !istype(U) )
return
//if(lastfired && world.time - lastfired < 100)
@@ -767,31 +763,25 @@ Auto Patrol: []"},
var/obj/item/projectile/A
if(!lasercolor)
if (src.emagged)
A = new /obj/item/projectile/beam( loc )
if (emagged)
A = new /obj/item/projectile/beam( T )
else
A = new /obj/item/projectile/energy/electrode( loc )
A = new /obj/item/projectile/energy/electrode( T )
else if(lasercolor == "b")
if (src.emagged)
A = new /obj/item/projectile/energy/electrode( loc )
if (emagged)
A = new /obj/item/projectile/energy/electrode( T )
else
A = new /obj/item/projectile/bluetag( loc )
A = new /obj/item/projectile/bluetag( T )
else if(lasercolor == "r")
if (src.emagged)
A = new /obj/item/projectile/energy/electrode( loc )
if (emagged)
A = new /obj/item/projectile/energy/electrode( T )
else
A = new /obj/item/projectile/redtag( loc )
if (!( istype(U, /turf) ))
//A = null
del(A)
return
A = new /obj/item/projectile/redtag( T )
A.current = U
A.yo = U.y - T.y
A.xo = U.x - T.x
spawn( 0 )
A.process()
return
A.fired()
return
/obj/machinery/bot/ed209/attack_alien(var/mob/living/carbon/alien/user as mob)
+8 -8
View File
@@ -174,7 +174,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //list that will contain r
dat+="<BR><HR>The newscaster recognises you as: <FONT COLOR='green'>[src.scanned_user]</FONT>"
if(1)
dat+= "Station Feed Channels<HR>"
if( isemptylist(src.channel_list) )
if(channel_list.len)
dat+="<I>No active channels found...</I>"
else
for(var/datum/feed_channel/CHANNEL in src.channel_list)
@@ -255,7 +255,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //list that will contain r
dat+="<FONT COLOR='red'><B>ATTENTION: </B></FONT>This channel has been deemed as threatening to the welfare of the station, and marked with a Nanotrasen D-Notice.<BR>"
dat+="No further feed story additions are allowed while the D-Notice is in effect.</FONT><BR><BR>"
else
if( isemptylist(src.viewing_channel.messages) )
if(!viewing_channel.messages.len)
dat+="<I>No feed messages found in channel...</I><BR>"
else
for(var/datum/feed_message/MESSAGE in src.viewing_channel.messages)
@@ -267,7 +267,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //list that will contain r
dat+="<FONT SIZE=1>NOTE: Due to the nature of news Feeds, total deletion of a Feed Story is not possible.<BR>"
dat+="Keep in mind that users attempting to view a censored feed will instead see the \[REDACTED\] tag above it.</FONT>"
dat+="<HR>Select Feed channel to get Stories from:<BR>"
if(isemptylist(src.channel_list))
if(!channel_list.len)
dat+="<I>No feed channels found active...</I><BR>"
else
for(var/datum/feed_channel/CHANNEL in src.channel_list)
@@ -278,7 +278,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //list that will contain r
dat+="<FONT SIZE=1>A D-Notice is to be bestowed upon the channel if the handling Authority deems it as harmful for the station's"
dat+="morale, integrity or disciplinary behaviour. A D-Notice will render a channel unable to be updated by anyone, without deleting any feed"
dat+="stories it might contain at the time. You can lift a D-Notice if you have the required access at any time.</FONT><HR>"
if(isemptylist(src.channel_list))
if(channel_list.len)
dat+="<I>No feed channels found active...</I><BR>"
else
for(var/datum/feed_channel/CHANNEL in src.channel_list)
@@ -290,7 +290,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //list that will contain r
dat+="<FONT SIZE=2><A href='?src=\ref[src];censor_channel_author=\ref[src.viewing_channel]'>[(src.viewing_channel.author=="\[REDACTED\]") ? ("Undo Author censorship") : ("Censor channel Author")]</A></FONT><HR>"
if( isemptylist(src.viewing_channel.messages) )
if( !viewing_channel.messages.len )
dat+="<I>No feed messages found in channel...</I><BR>"
else
for(var/datum/feed_message/MESSAGE in src.viewing_channel.messages)
@@ -304,7 +304,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //list that will contain r
dat+="<FONT COLOR='red'><B>ATTENTION: </B></FONT>This channel has been deemed as threatening to the welfare of the station, and marked with a Nanotrasen D-Notice.<BR>"
dat+="No further feed story additions are allowed while the D-Notice is in effect.</FONT><BR><BR>"
else
if( isemptylist(src.viewing_channel.messages) )
if( !viewing_channel.messages.len )
dat+="<I>No feed messages found in channel...</I><BR>"
else
for(var/datum/feed_message/MESSAGE in src.viewing_channel.messages)
@@ -685,7 +685,7 @@ obj/item/weapon/newspaper/attack_self(mob/user as mob)
if(0) //Cover
dat+="<DIV ALIGN='center'><B><FONT SIZE=6>The Griffon</FONT></B></div>"
dat+="<DIV ALIGN='center'><FONT SIZE=2>Nanotrasen-standard newspaper, for use on Nanotrasen© Space Facilities</FONT></div><HR>"
if(isemptylist(src.news_content))
if(!news_content.len)
if(src.important_message)
dat+="Contents:<BR><ul><B><FONT COLOR='red'>**</FONT>Important Security Announcement<FONT COLOR='red'>**</FONT></B> <FONT SIZE=2>\[page [src.pages+2]\]</FONT><BR></ul>"
else
@@ -712,7 +712,7 @@ obj/item/weapon/newspaper/attack_self(mob/user as mob)
if(C.censored)
dat+="This channel was deemed dangerous to the general welfare of the station and therefore marked with a <B><FONT COLOR='red'>D-Notice</B></FONT>. Its contents were not transferred to the newspaper at the time of printing."
else
if(isemptylist(C.messages))
if(!C.messages.len)
dat+="No Feed stories stem from this channel..."
else
dat+="<ul>"
-8
View File
@@ -105,14 +105,6 @@
src.id = t
return
/proc/find_loc(obj/R as obj)
if (!R) return null
var/turf/T = R.loc
while(!istype(T, /turf))
T = T.loc
if(!T || istype(T, /area)) return null
return T
/obj/machinery/teleport/hub/Bumped(M as mob|obj)
spawn()
if (src.icon_state == "tele1")
+15 -10
View File
@@ -477,6 +477,7 @@
var/health = 40
var/list/scan_for = list("human"=0,"cyborg"=0,"mecha"=0,"alien"=1)
var/on = 0
var/processing = 0 //So we dun get dozens of duplicate while loops
icon = 'turrets.dmi'
icon_state = "gun_turret"
@@ -567,16 +568,20 @@
process()
spawn while(on)
if(projectiles<=0)
on = 0
return
if(cur_target && !validate_target(cur_target))
cur_target = null
if(!cur_target)
cur_target = get_target()
fire(cur_target)
sleep(cooldown)
if(!processing)
spawn
while(on)
processing = 1
if(projectiles<=0)
on = 0
return
if(cur_target && !validate_target(cur_target))
cur_target = null
if(!cur_target)
cur_target = get_target()
fire(cur_target)
sleep(cooldown)
processing = 0
return
proc/get_target()
+1 -1
View File
@@ -47,7 +47,7 @@
/obj/item/mecha_parts/mecha_equipment/proc/destroy()//missiles detonating, teleporter creating singularity?
if(chassis)
chassis.equipment -= src
listclearnulls(chassis.equipment)
chassis.equipment.Remove(null)
if(chassis.selected == src)
chassis.selected = null
src.update_chassis_page()
+1 -1
View File
@@ -721,7 +721,7 @@
del(src)
return 1
else
user << "\red You can't load the [src.name] while it's opened."
user << "\red You can't load \the [src] while it's opened."
return 1
if(istype(W, /obj/item/weapon/card/emag))
+1 -1
View File
@@ -350,7 +350,7 @@
///////////////////////////////////
/obj/mecha/proc/check_for_internal_damage(var/list/possible_int_damage,var/ignore_threshold=null)
if(!islist(possible_int_damage) || isemptylist(possible_int_damage)) return
if(!islist(possible_int_damage) || !possible_int_damage.len) return
if(prob(20))
if(ignore_threshold || src.health*100/initial(src.health)<src.internal_damage_threshold)
for(var/T in possible_int_damage)
+9 -9
View File
@@ -36,7 +36,7 @@
if(salvage_num <= 0)
user << "You don't see anything that can be cut with [W]."
return
if (!isemptylist(welder_salvage) && WT.remove_fuel(0,user))
if (welder_salvage && welder_salvage.len && WT.remove_fuel(0,user))
var/type = prob(70)?pick(welder_salvage):null
if(type)
var/N = new type(get_turf(user))
@@ -53,7 +53,7 @@
if(salvage_num <= 0)
user << "You don't see anything that can be cut with [W]."
return
else if(!isemptylist(wirecutters_salvage))
else if(wirecutters_salvage && wirecutters_salvage.len)
var/type = prob(70)?pick(wirecutters_salvage):null
if(type)
var/N = new type(get_turf(user))
@@ -62,7 +62,7 @@
else
user << "You failed to salvage anything valuable from [src]."
if(istype(W, /obj/item/weapon/crowbar))
if(!isemptylist(crowbar_salvage))
if(crowbar_salvage && crowbar_salvage.len)
var/obj/S = pick(crowbar_salvage)
if(S)
S.loc = get_turf(user)
@@ -89,7 +89,7 @@
/obj/item/mecha_parts/part/gygax_left_leg,
/obj/item/mecha_parts/part/gygax_right_leg)
for(var/i=0;i<2;i++)
if(!isemptylist(parts) && prob(40))
if(parts.len && prob(40))
var/part = pick(parts)
welder_salvage += part
parts -= part
@@ -124,7 +124,7 @@
/obj/item/mecha_parts/part/ripley_left_leg,
/obj/item/mecha_parts/part/ripley_right_leg)
for(var/i=0;i<2;i++)
if(!isemptylist(parts) && prob(40))
if(parts && parts.len && prob(40))
var/part = pick(parts)
welder_salvage += part
parts -= part
@@ -143,7 +143,7 @@
/obj/item/mecha_parts/part/ripley_right_leg,
/obj/item/clothing/suit/fire)
for(var/i=0;i<2;i++)
if(!isemptylist(parts) && prob(40))
if(parts && parts.len && prob(40))
var/part = pick(parts)
welder_salvage += part
parts -= part
@@ -168,7 +168,7 @@
/obj/item/mecha_parts/part/honker_left_leg,
/obj/item/mecha_parts/part/honker_right_leg)
for(var/i=0;i<2;i++)
if(!isemptylist(parts) && prob(40))
if(parts && parts.len && prob(40))
var/part = pick(parts)
welder_salvage += part
parts -= part
@@ -188,7 +188,7 @@
/obj/item/mecha_parts/part/durand_left_leg,
/obj/item/mecha_parts/part/durand_right_leg)
for(var/i=0;i<2;i++)
if(!isemptylist(parts) && prob(40))
if(parts && parts.len && prob(40))
var/part = pick(parts)
welder_salvage += part
parts -= part
@@ -213,7 +213,7 @@
/obj/item/mecha_parts/part/odysseus_left_leg,
/obj/item/mecha_parts/part/odysseus_right_leg)
for(var/i=0;i<2;i++)
if(!isemptylist(parts) && prob(40))
if(parts && parts.len && prob(40))
var/part = pick(parts)
welder_salvage += part
parts -= part
+1 -1
View File
@@ -32,7 +32,7 @@
/proc/get_turf(turf/location as turf)
while (location)
if (istype(location, /turf))
if (istype(location))
return location
location = location.loc
@@ -271,8 +271,8 @@ the implant may become unstable and either pre-maturely inject the subject or si
if(istype(imp_in, /mob/))
var/mob/T = imp_in
T.gib()
explosion(find_loc(imp_in), 1, 3, 4, 6, 3)
var/turf/t = find_loc(imp_in)
explosion(get_turf(imp_in), 1, 3, 4, 6, 3)
var/turf/t = get_turf(imp_in)
if(t)
t.hotspot_expose(3500,125)
del(src)
+5 -6
View File
@@ -229,12 +229,11 @@
step(src, get_dir(user, src))
if (src.health <= 0)
if (src.dir == SOUTHWEST)
var/index = null
index = 0
while(index < 2)
new /obj/item/weapon/shard( src.loc )
if(reinf) new /obj/item/stack/rods( src.loc)
index++
new /obj/item/weapon/shard( src.loc )
new /obj/item/weapon/shard( src.loc )
if(reinf)
new /obj/item/stack/rods( src.loc)
new /obj/item/stack/rods( src.loc)
else
new /obj/item/weapon/shard( src.loc )
if(reinf) new /obj/item/stack/rods( src.loc)
+2 -1
View File
@@ -1660,7 +1660,8 @@ turf/simulated/floor/return_siding_icon_state()
del(A) //The disk's Del() proc ensures a new one is created
return
if(!isemptylist(A.search_contents_for(/obj/item/weapon/disk/nuclear)))
var/list/temp = A.search_contents_for(/obj/item/weapon/disk/nuclear)
if(temp.len)
if(istype(A, /mob/living))
var/mob/living/MM = A
if(MM.client)
+1 -1
View File
@@ -1894,7 +1894,7 @@ var/global/BSACooldown = 0
//feedback_add_details("admin_secrets_fun_used","PW")
message_admins("\blue [key_name_admin(usr)] teleported all players to the prison station.", 1)
for(var/mob/living/carbon/human/H in world)
var/turf/loc = find_loc(H)
var/turf/loc = get_turf(H)
var/security = 0
if(loc.z > 1 || prisonwarped.Find(H))
//don't warp them if they aren't ready or are already there
+4 -10
View File
@@ -165,16 +165,10 @@ var/intercom_range_display_status = 0
for(var/atom/A in world)
if(istype(A,type_path))
var/atom/B = A
while(!(isturf(B.loc)))
if(B && B.loc)
B = B.loc
else
break
if(B)
if(B.z == num_level)
count++
atom_list += A
var/turf/B = get_turf(A)
if(istype(B) && B.z == num_level)
count++
atom_list += A
/*
var/atom/temp_atom
for(var/i = 0; i <= (atom_list.len/10); i++)
+74 -108
View File
@@ -1,60 +1,59 @@
dmm_suite{
load_map(var/dmm_file as file, var/z_offset as num){
if(!z_offset){
dmm_suite
load_map(var/dmm_file as file, var/z_offset as num)
if(!z_offset)
z_offset = world.maxz+1
}
var/quote = ascii2text(34)
var/tfile = file2text(dmm_file)
var/tfile_len = length(tfile)
var/list/grid_models[0]
var/key_len = length(copytext(tfile,2,findtext(tfile,quote,2,0)))
for(var/lpos=1;lpos<tfile_len;lpos=findtext(tfile,"\n",lpos,0)+1){
for(var/lpos=1;lpos<tfile_len;lpos=findtext(tfile,"\n",lpos,0)+1)
var/tline = copytext(tfile,lpos,findtext(tfile,"\n",lpos,0))
if(copytext(tline,1,2)!=quote){break}
if(copytext(tline,1,2)!=quote)
break
var/model_key = copytext(tline,2,findtext(tfile,quote,2,0))
var/model_contents = copytext(tline,findtext(tfile,"=")+3,length(tline))
grid_models[model_key] = model_contents
sleep(-1)
}
var/zcrd=-1
var/ycrd=0
var/xcrd=0
for(var/zpos=findtext(tfile,"\n(1,1,");TRUE;zpos=findtext(tfile,"\n(1,1,",zpos+1,0)){
for(var/zpos=findtext(tfile,"\n(1,1,");TRUE;zpos=findtext(tfile,"\n(1,1,",zpos+1,0))
zcrd++
world.maxz = max(world.maxz, zcrd+z_offset)
ycrd=0
var/zgrid = copytext(tfile,findtext(tfile,quote+"\n",zpos,0)+2,findtext(tfile,"\n"+quote,zpos,0)+1)
for(var/gpos=1;gpos!=0;gpos=findtext(zgrid,"\n",gpos,0)+1){
for(var/gpos=1;gpos!=0;gpos=findtext(zgrid,"\n",gpos,0)+1)
var/grid_line = copytext(zgrid,gpos,findtext(zgrid,"\n",gpos,0)+1)
var/y_depth = length(zgrid)/(length(grid_line))
if(world.maxy<y_depth){world.maxy=y_depth}
if(world.maxy<y_depth)
world.maxy=y_depth
grid_line=copytext(grid_line,1,length(grid_line))
if(!ycrd){
if(!ycrd)
ycrd = y_depth
}
else{ycrd--}
else
ycrd--
xcrd=0
for(var/mpos=1;mpos<=length(grid_line);mpos+=key_len){
for(var/mpos=1;mpos<=length(grid_line);mpos+=key_len)
xcrd++
if(world.maxx<xcrd){world.maxx=xcrd}
if(world.maxx<xcrd)
world.maxx=xcrd
var/model_key = copytext(grid_line,mpos,mpos+key_len)
parse_grid(grid_models[model_key],xcrd,ycrd,zcrd+z_offset)
}
if(gpos+length(grid_line)+1>length(zgrid)){break}
if(gpos+length(grid_line)+1>length(zgrid))
break
sleep(-1)
}
if(findtext(tfile,quote+"}",zpos,0)+2==tfile_len){break}
if(findtext(tfile,quote+"}",zpos,0)+2==tfile_len)
break
sleep(-1)
}
}
proc{
parse_grid(var/model as text,var/xcrd as num,var/ycrd as num,var/zcrd as num){
proc
parse_grid(var/model as text,var/xcrd as num,var/ycrd as num,var/zcrd as num)
/*Method parse_grid()
- Accepts a text string containing a comma separated list of type paths of the
same construction as those contained in a .dmm file, and instantiates them.
*/
var/list/text_strings[0]
for(var/index=1;findtext(model,quote);index++){
for(var/index=1;findtext(model,quote);index++)
/*Loop: Stores quoted portions of text in text_strings, and replaces them with an
index to that list.
- Each iteration represents one quoted section of text.
@@ -63,7 +62,6 @@ dmm_suite{
text_strings[index] = copytext(model,findtext(model,quote)+1,findtext(model,quote,findtext(model,quote)+1,0))
model = copytext(model,1,findtext(model,quote))+"~[index]"+copytext(model,findtext(model,quote,findtext(model,quote)+1,0)+1,0)
sleep(-1)
}
var/list/old_turf_underlays[0]
var/old_turf_density
var/old_turf_opacity
@@ -71,118 +69,104 @@ dmm_suite{
This is done to approximate the layered turf effect of DM's map editor.
An image of each turf is stored in old_turf_underlays[], and is later added to the new turf's underlays.
*/
for(var/dpos=1;dpos!=0;dpos=findtext(model,",",dpos,0)+1){
for(var/dpos=1;dpos!=0;dpos=findtext(model,",",dpos,0)+1)
/*Loop: Identifies each object's data, instantiates it, and reconstitues it's fields.
- Each iteration represents one object's data, including type path and field values.
*/
var/full_def = copytext(model,dpos,findtext(model,",",dpos,0))
var/atom_def = text2path(copytext(full_def,1,findtext(full_def,"{")))
var/list/attributes[0]
if(findtext(full_def,"{")){
if(findtext(full_def,"{"))
full_def = copytext(full_def,1,length(full_def))
for(var/apos=findtext(full_def,"{")+1;apos!=0;apos=findtext(full_def,";",apos,0)+1){
for(var/apos=findtext(full_def,"{")+1;apos!=0;apos=findtext(full_def,";",apos,0)+1)
//Loop: Identifies each attribute/value pair, and stores it in attributes[].
attributes.Add(copytext(full_def,apos,findtext(full_def,";",apos,0)))
if(!findtext(copytext(full_def,apos,0),";")){break}
if(!findtext(copytext(full_def,apos,0),";"))
break
sleep(-1)
}
}
//Construct attributes associative list
var/list/fields = new(0)
for(var/index=1;index<=attributes.len;index++){
for(var/index=1;index<=attributes.len;index++)
var/trim_left = trim_text(copytext(attributes[index],1,findtext(attributes[index],"=")))
var/trim_right = trim_text(copytext(attributes[index],findtext(attributes[index],"=")+1,0))
//Check for string
if(findtext(trim_right,"~")){
if(findtext(trim_right,"~"))
var/reference_index = copytext(trim_right,findtext(trim_right,"~")+1,0)
trim_right=text_strings[text2num(reference_index)]
}
//Check for number
else if(isnum(text2num(trim_right))){
else if(isnum(text2num(trim_right)))
trim_right = text2num(trim_right)
}
//Check for file
else if(copytext(trim_right,1,2) == "'"){
else if(copytext(trim_right,1,2) == "'")
trim_right = file(copytext(trim_right,2,length(trim_right)))
}
fields[trim_left] = trim_right
}
//End construction
//Begin Instanciation
var/atom/instance
var/dmm_suite/preloader/_preloader = new(fields)
if(ispath(atom_def,/area)){
if(ispath(atom_def,/area))
instance = locate(atom_def)
instance.contents.Add(locate(xcrd,ycrd,zcrd))
}
else if(ispath(atom_def,/turf)){
else if(ispath(atom_def,/turf))
var/turf/old_turf = locate(xcrd,ycrd,zcrd)
if(old_turf.density){old_turf_density = 1}
if(old_turf.opacity){old_turf_opacity = 1}
if(old_turf.icon){
if(old_turf.icon)
var/image/old_turf_image = image(old_turf.icon,null,old_turf.icon_state,old_turf.layer,old_turf.dir)
old_turf_underlays.Add(old_turf_image)
}
instance = new atom_def(old_turf, _preloader)
for(var/inverse_index=old_turf_underlays.len;inverse_index;inverse_index--){
for(var/inverse_index=old_turf_underlays.len;inverse_index;inverse_index--)
var/image/image_underlay = old_turf_underlays[inverse_index]
image_underlay.loc = instance
instance.underlays.Add(image_underlay)
}
if(!instance.density){instance.density = old_turf_density}
if(!instance.opacity){instance.opacity = old_turf_opacity}
}
if(!instance.density)
instance.density = old_turf_density
if(!instance.opacity)
instance.opacity = old_turf_opacity
if(_preloader && instance){
if(_preloader && instance)
_preloader.load(instance)
}
//End Instanciation
if(!findtext(copytext(model,dpos,0),",")){break}
if(!findtext(copytext(model,dpos,0),","))
break
sleep(-1)
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
for(var/dpos=1;dpos!=0;dpos=findtext(model,",",dpos,0)+1)
{
/*Loop: Identifies each object's data, instantiates it, and reconstitues it's fields.
- Each iteration represents one object's data, including type path and field values.
*/
var/full_def = copytext(model,dpos,findtext(model,",",dpos,0))
var/atom_def = text2path(copytext(full_def,1,findtext(full_def,"{")))
var/list/attributes[0]
if(findtext(full_def,"{")){
if(findtext(full_def,"{"))
full_def = copytext(full_def,1,length(full_def))
for(var/apos=findtext(full_def,"{")+1;apos!=0;apos=findtext(full_def,";",apos,0)+1){
for(var/apos=findtext(full_def,"{")+1;apos!=0;apos=findtext(full_def,";",apos,0)+1)
//Loop: Identifies each attribute/value pair, and stores it in attributes[].
attributes.Add(copytext(full_def,apos,findtext(full_def,";",apos,0)))
if(!findtext(copytext(full_def,apos,0),";")){break}
if(!findtext(copytext(full_def,apos,0),";"))
break
sleep(-1)
}
}
//Construct attributes associative list
var/list/fields = new(0)
for(var/index=1;index<=attributes.len;index++){
for(var/index=1;index<=attributes.len;index++)
var/trim_left = trim_text(copytext(attributes[index],1,findtext(attributes[index],"=")))
var/trim_right = trim_text(copytext(attributes[index],findtext(attributes[index],"=")+1,0))
//Check for string
if(findtext(trim_right,"~")){
if(findtext(trim_right,"~"))
var/reference_index = copytext(trim_right,findtext(trim_right,"~")+1,0)
trim_right=text_strings[text2num(reference_index)]
}
//Check for number
else if(isnum(text2num(trim_right))){
else if(isnum(text2num(trim_right)))
trim_right = text2num(trim_right)
}
//Check for file
else if(copytext(trim_right,1,2) == "'"){
else if(copytext(trim_right,1,2) == "'")
trim_right = file(copytext(trim_right,2,length(trim_right)))
}
fields[trim_left] = trim_right
}
//End construction
@@ -190,60 +174,42 @@ dmm_suite{
var/atom/instance
var/dmm_suite/preloader/_preloader = new(fields)
if(!ispath(atom_def,/area) && !ispath(atom_def,/turf))
{
instance = new atom_def(locate(xcrd,ycrd,zcrd), _preloader)
}
if(_preloader && instance)
{
_preloader.load(instance)
}
//End Instanciation
if(!findtext(copytext(model,dpos,0),",")){break}
if(!findtext(copytext(model,dpos,0),","))
break
sleep(-1)
}
}
trim_text(var/what as text){
while(length(what) && findtext(what," ",1,2)){
trim_text(var/what as text)
while(length(what) && findtext(what," ",1,2))
what=copytext(what,2,0)
}
while(length(what) && findtext(what," ",length(what),0)){
while(length(what) && findtext(what," ",length(what),0))
what=copytext(what,1,length(what))
}
return what
}
}
}
atom/New(atom/loc, dmm_suite/preloader/_dmm_preloader){
if(istype(_dmm_preloader, /dmm_suite/preloader)){
atom/New(atom/loc, dmm_suite/preloader/_dmm_preloader)
if(istype(_dmm_preloader, /dmm_suite/preloader))
_dmm_preloader.load(src)
}
. = ..()
}
dmm_suite{
preloader{
parent_type = /datum
var{
list/attributes
}
New(list/the_attributes){
.=..()
if(!the_attributes.len){ Del()}
attributes = the_attributes
}
proc{
load(atom/what){
for(var/attribute in attributes){
what.vars[attribute] = attributes[attribute]
}
Del()
}
}
}
}
dmm_suite
preloader
parent_type = /datum
var
list/attributes
New(list/the_attributes)
.=..()
if(!the_attributes.len)
Del()
attributes = the_attributes
proc
load(atom/what)
for(var/attribute in attributes)
what.vars[attribute] = attributes[attribute]
Del()
@@ -167,20 +167,15 @@
if ((O.client && !( O.blinded )))
O << "\red [src] spits neurotoxin at [target]!"
//I'm not motivated enough to revise this. Prjectile code in general needs update.
var/turf/T = loc
var/turf/U = (istype(target, /atom/movable) ? target.loc : target)
var/turf/T = get_turf(src)
var/turf/U = (istype(target, /atom/movable) ? get_turf(target) : target)
if(!U || !T)
return
while(U && !istype(U,/turf))
U = U.loc
if(!istype(T, /turf))
if(!istype(T, /turf) || !istype(U,/turf))
return
if (U == T)
usr.bullet_act(src, src.get_organ_target())
return
if(!istype(U, /turf))
return
var/obj/item/projectile/energy/dart/A = new /obj/item/projectile/energy/dart(usr.loc)
@@ -88,7 +88,7 @@
var/tod = time2text(world.realtime,"hh:mm:ss") //weasellos time of death patch
if(mind)
mind.store_memory("Time of death: [tod]", 0)
sql_report_death(src)
// sql_report_death(src)
//Calls the rounds wincheck, mainly for wizard, malf, and changeling now
ticker.mode.check_win()
@@ -67,7 +67,7 @@
var/tod = time2text(world.realtime,"hh:mm:ss") //weasellos time of death patch
store_memory("Time of death: [tod]", 0)
sql_report_cyborg_death(src)
// sql_report_cyborg_death(src)
if (src.key)
spawn(50)
+1 -1
View File
@@ -1081,7 +1081,7 @@ note dizziness decrements automatically in the mob's Life() proc.
* Sends resource files to client cache
*/
/mob/proc/getFiles()
if(!isemptylist(args))
if(args && args.len)
for(var/file in args)
src << browse_rsc(file)
return 1
+17 -14
View File
@@ -57,7 +57,7 @@
if(M)
M.NotTargeted(src)
del(target)
usr.visible_message("\blue [usr] lowers \the [src]...")
usr.visible_message("\blue \The [usr] lowers \the [src]...")
return 0
return 1
@@ -65,36 +65,36 @@
attack(mob/living/M as mob, mob/living/user as mob, def_zone)
if (M == user && user.zone_sel.selecting == "mouth" && load_into_chamber() && !mouthshoot) //Suicide handling.
mouthshoot = 1
M.visible_message("\red [user] sticks their gun in their mouth, ready to pull the trigger...")
M.visible_message("\red \The [user] sticks their gun in their mouth, ready to pull the trigger...")
if(!do_after(user, 40))
M.visible_message("\blue [user] decided life was worth living")
M.visible_message("\blue \The [user] decided life was worth living")
mouthshoot = 0
return
if(istype(src.in_chamber, /obj/item/projectile/bullet) && !istype(src.in_chamber, /obj/item/projectile/bullet/stunshot) && !istype(src.in_chamber, /obj/item/ammo_casing/shotgun/beanbag))
M.apply_damage(75, BRUTE, "head", used_weapon = "Suicide attempt with a projectile weapon.")
M.apply_damage(85, BRUTE, "chest")
M.visible_message("\red [user] pulls the trigger.")
M.visible_message("\red \The [user] pulls the trigger.")
else if(istype(src.in_chamber, /obj/item/projectile/bullet/stunshot) || istype(src.in_chamber, /obj/item/projectile/energy/electrode))
M.apply_damage(10, BURN, "head", used_weapon = "Suicide attempt with a stun round.")
M.visible_message("\red [user] pulls the trigger, but luckily it was a stun round.")
M.visible_message("\red \The [user] pulls the trigger, but luckily it was a stun round.")
else if(istype(src.in_chamber, /obj/item/ammo_casing/shotgun/beanbag))
M.apply_damage(20, BRUTE, "head", used_weapon = "Suicide attempt with a beanbag.")
M.visible_message("\red [user] pulls the trigger, but luckily it was a stun round.")
M.visible_message("\red \The [user] pulls the trigger, but luckily it was a stun round.")
else if(istype(src.in_chamber, /obj/item/projectile/beam) || istype(src.in_chamber, /obj/item/projectile/energy))
M.apply_damage(75, BURN, "head", used_weapon = "Suicide attempt with an energy weapon")
M.apply_damage(85, BURN, "chest")
M.visible_message("\red [user] pulls the trigger.")
M.visible_message("\red \The [user] pulls the trigger.")
else
M.apply_damage(75, BRUTE, "head", used_weapon = "Suicide attempt with a gun")
M.apply_damage(85, BRUTE, "chest")
M.visible_message("\red [user] pulls the trigger. Ow.")
M.visible_message("\red \The [user] pulls the trigger. Ow.")
del(in_chamber)
mouthshoot = 0
return
else if(user.a_intent == "hurt" && load_into_chamber() && (istype(src.in_chamber, /obj/item/projectile/beam) || istype(src.in_chamber, /obj/item/projectile/energy)\
|| istype(src.in_chamber, /obj/item/projectile/bullet)) && !istype(in_chamber,/obj/item/projectile/energy/electrode)) //Point blank shooting.
//Lets shoot them, then.
user.visible_message("\red <b> [user] fires \the [src] point blank at [M]!</b>")
user.visible_message("\red <b> \The [user] fires \the [src] point blank at [M]!</b>")
if(silenced)
playsound(user, fire_sound, 10, 1)
else
@@ -109,7 +109,7 @@
return
else if(user.a_intent != "hurt" && load_into_chamber() && istype(in_chamber,/obj/item/projectile/energy/electrode)) //Point blank tasering.
if (M.canstun == 0 || M.canweaken == 0)
user.visible_message("\red <B>[M] has been stunned with the taser gun by [user] to no effect!</B>")
user.visible_message("\red <B>\The [M] has been stunned with the taser gun by \the [user] to no effect!</B>")
del(in_chamber)
update_icon()
return
@@ -125,7 +125,7 @@
playsound(user, fire_sound, 10, 1)
else
playsound(user, fire_sound, 50, 1)
user.visible_message("\red <B>[M] has been stunned with the taser gun by [user]!</B>")
user.visible_message("\red <B>\The [M] has been stunned with the taser gun by \the [user]!</B>")
M.attack_log += text("\[[]\] <b>[]/[]</b> stunned <b>[]/[]</b> with a <b>[]</b>", time_stamp(), user, user.ckey, M, M.ckey, src)
user.attack_log += text("\[[]\] <b>[]/[]</b> stunned <b>[]/[]</b> with a <b>[]</b>", time_stamp(), user, user.ckey, M, M.ckey, src)
log_admin("ATTACK: [user] ([user.ckey]) stunned [M] ([M.ckey]) with [src].")
@@ -144,7 +144,7 @@
//POWPOW!... Used to be afterattack.
proc/Fire(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, params)//TODO: go over this
proc/Fire(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, params, reflex = 0)//TODO: go over this
if(istype(user, /mob/living))
var/mob/living/M = user
if ((CLUMSY in M.mutations) && prob(50)) ///Who ever came up with this...
@@ -193,7 +193,10 @@
playsound(user, fire_sound, 10, 1)
else
playsound(user, fire_sound, 50, 1)
user.visible_message("\red [user] fires \the [src]!", "\red You fire \the [src]!", "\blue You hear a [istype(in_chamber, /obj/item/projectile/beam) ? "laser blast" : "gunshot"]!")
if(reflex)
user.visible_message("\red \The [user] fires \the [src] by reflex!", "\red You reflex fire \the [src]!", "\blue You hear a [istype(in_chamber, /obj/item/projectile/beam) ? "laser blast" : "gunshot"]!")
else
user.visible_message("\red \The [user] fires \the [src]!", "\red You fire \the [src]!", "\blue You hear a [istype(in_chamber, /obj/item/projectile/beam) ? "laser blast" : "gunshot"]!")
in_chamber.original = targloc
in_chamber.loc = get_turf(user)
@@ -254,7 +257,7 @@
var/firing_check = in_chamber.check_fire(T,usr) //0 if it cannot hit them, 1 if it is capable of hitting, and 2 if a special check is preventing it from firing.
if(firing_check > 0)
if(firing_check == 1)
Fire(T,usr)
Fire(T,usr, reflex = 1)
else if(!told_cant_shoot)
M << "\red They can't be hit from here!"
told_cant_shoot = 1