diff --git a/code/WorkInProgress/KeelinsStuff.dm b/code/WorkInProgress/KeelinsStuff.dm index 30b91e5aac9..170b7c244ca 100644 --- a/code/WorkInProgress/KeelinsStuff.dm +++ b/code/WorkInProgress/KeelinsStuff.dm @@ -305,11 +305,11 @@ return 0 /proc/do_after(mob/M as mob, time as num) - var/turf/T = get_turf(M) + var/turf/T = M.loc var/holding = M.equipped() sleep(time) if(M) - if ((get_turf(M) == T && M.equipped() == holding && !( M.stat ))) + if ((M.loc == T && M.equipped() == holding && !( M.stat ))) return 1 else return 0 diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm index 1e316ba8b98..f266c20fd67 100644 --- a/code/game/gamemodes/events.dm +++ b/code/game/gamemodes/events.dm @@ -1,5 +1,5 @@ /proc/start_events() - if(prob(50))//Every 120 seconds and prob 50 4-8 weak spacedusts will hit the station + if(prob(50))//Every 120 seconds and prob 50 2-4 weak spacedusts will hit the station spawn(1) dust_swarm("weak") if (!event && prob(eventchance)) diff --git a/code/game/gamemodes/events/dust.dm b/code/game/gamemodes/events/dust.dm index 966b46c2c53..a8aac075941 100644 --- a/code/game/gamemodes/events/dust.dm +++ b/code/game/gamemodes/events/dust.dm @@ -9,7 +9,7 @@ The "dust" will damage the hull of the station causin minor hull breaches. var/numbers = 1 switch(strength) if("weak") - numbers = rand(4,8) + numbers = rand(2,4) for(var/i = 0 to numbers) new/obj/space_dust/weak() if("norm") diff --git a/code/game/objects/items/helper_procs.dm b/code/game/objects/items/helper_procs.dm index 8aef8b435cf..3c39c5f1359 100644 --- a/code/game/objects/items/helper_procs.dm +++ b/code/game/objects/items/helper_procs.dm @@ -72,8 +72,10 @@ mo.show_message(rendered, 2) return -/proc/is_item_in_list(var/list/L, var/atom/A) - for(var/atom/O in L) - if(O == A) +/proc/is_type_in_list(var/list/L, var/atom/A) + for(var/type in L) + if(isnull(type)) + continue + if(istype(A, type)) return 1 return 0 \ No newline at end of file diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm index 6c84e384659..32656353597 100644 --- a/code/modules/power/singularity/collector.dm +++ b/code/modules/power/singularity/collector.dm @@ -51,6 +51,10 @@ user.visible_message("[user.name] [anchored? "secures":"unsecures"] the [src.name].", \ "You [anchored? "secure":"undo"] the external bolts.", \ "You hear ratchet") + if(anchored) + connect_to_network() + else + disconnect_from_network() else ..() return 1 diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index 1a26b37091e..96feacd4b39 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -1,5 +1,4 @@ -/////FIELD GEN #define field_generator_max_power 250 /obj/machinery/field_generator name = "Field Generator" @@ -141,15 +140,15 @@ bullet_act(flag) if (flag == PROJECTILE_BULLET) - src.power -= 100 - else if (flag == PROJECTILE_WEAKBULLET) src.power -= 50 + else if (flag == PROJECTILE_WEAKBULLET) + src.power -= 25 else if (flag == PROJECTILE_LASER) - src.power += 20 + src.power += 10 else if (flag == PROJECTILE_TASER) src.power += 5 else - src.power -= 30 + src.power -= 10 update_icon() return @@ -194,8 +193,12 @@ if (isnull(F)) continue power_draw++ - - if(draw_power(round(power_draw/2,1))) + if(!power_draw)//If we are usin no power then we have no fields and should turn off + for(var/mob/M in viewers(src)) + M.show_message("\red The [src.name] shuts down!") + turn_off() + src.power = 0 + else if(draw_power(round(power_draw/2,1))) return 1 else for(var/mob/M in viewers(src)) @@ -204,33 +207,34 @@ src.power = 0 return - - draw_power(var/draw = 0,var/obj/machinery/field_generator/G = null, var/obj/machinery/field_generator/last = null) -// if(G && G == src)//Loopin, set fail -// return 0 +//This could likely be better, it tends to start loopin if you have a complex generator loop setup. Still works well enough to run the engine fields will likely recode the field gens and fields sometime -Mport + draw_power(var/draw = 0, var/failsafe = 0, var/obj/machinery/field_generator/G = null, var/obj/machinery/field_generator/last = null) + if((G && G == src) || (failsafe >= 8))//Loopin, set fail + return 0 + else + failsafe++ if(src.power >= draw)//We have enough power src.power -= draw return 1 else//Need more power - return 0 -/* draw -= src.power - src.power = 0 ill finis this up when not about to pass out + draw -= src.power + src.power = 0 for(var/obj/machinery/field_generator/FG in connected_gens) if(isnull(FG)) continue if(FG == last)//We just asked you continue if(G)//Another gen is askin for power and we dont have it - if(FG.draw_power(draw,G,src))//Can you take the load + if(FG.draw_power(draw,failsafe,G,src))//Can you take the load return 1 else return 0 else//We are askin another for power - if(FG.draw_power(draw,src,src)) + if(FG.draw_power(draw,failsafe,src,src)) return 1 else return 0 -*/ + start_fields() if(!src.state == 2 || !anchored) @@ -255,12 +259,20 @@ return for(var/dist = 0, dist <= 9, dist += 1) // checks out to 8 tiles away for another generator T = get_step(T, NSEW) + if(T.density)//We cant shoot a field though this + return 0 + for(var/atom/A in T.contents) + if(ismob(A)) + continue + if(!istype(A,/obj/machinery/field_generator)) + if(A.density)//Somethin is blocking our path, note downside to this is that you can easily mess up the system by tossin a locker or such in the way and it takes forever to reset it + return 0 steps += 1 G = locate(/obj/machinery/field_generator) in T if(!isnull(G)) steps -= 1 if(!G.active) - return + return 0 break if(isnull(G)) return diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 39d398f58b7..a1ab4eba251 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -14,7 +14,7 @@ var/global/list/uneatable = list( unacidable = 1 //Don't comment this out. power_usage = 0 var - active = 0 +// active = 0 contained = 1 //Are we going to move around? energy = 100 //How strong are we? dissipate = 0 //Do we lose energy over time? TODO:Set this to 1 when/if the feederthing is finished @@ -57,7 +57,10 @@ var/global/list/uneatable = list( if(prob(10)) del(src) return + else + energy += 50 if(2.0 to 3.0) + energy += round((rand(20,60)/2),1) return return @@ -77,7 +80,7 @@ var/global/list/uneatable = list( dissipate() check_energy() move() - if(prob(event_chance))//Chance for it to run a special event + if(prob(event_chance))//Chance for it to run a special event TODO:Come up with one or two more that fit event() pulse() return @@ -111,18 +114,11 @@ var/global/list/uneatable = list( return 1 - is_eatable(atom/X) - for (var/Type in uneatable) - if (istype(X, Type)) - return 0 - return 1 - - eat() for (var/atom/X in orange(grav_pull,src)) if(isarea(X)) continue - if (!is_eatable(X)) + if(is_type_in_list(uneatable,X)) continue switch(get_dist(src,X)) if(0 to 2) @@ -142,8 +138,8 @@ var/global/list/uneatable = list( consume(var/atom/A) var/gain = 0 - if (!is_eatable(A)) - return + if(is_type_in_list(uneatable,A)) + return 0 if (istype(A,/mob/living))//Mobs get gibbed gain = 20 if(istype(A,/mob/living/carbon/human)) @@ -170,21 +166,23 @@ var/global/list/uneatable = list( move(var/movement_dir = 0) - if(!movement_dir == 1 || !movement_dir == 2 || !movement_dir == 4 || !movement_dir == 8) + if(!(movement_dir in cardinal)) movement_dir = pick(NORTH, SOUTH, EAST, WEST) - var/turf/T = null switch(movement_dir) if(NORTH) - T = locate(src.x,src.y+3,src.z) + if(!(can_move(locate(src.x,src.y+3,src.z))&&can_move(locate(src.x+1,src.y+3,src.z))&&can_move(locate(src.x-1,src.y+3,src.z)))) + return 0 if(SOUTH) - T = locate(src.x,src.y-3,src.z) + if(!(can_move(locate(src.x,src.y-3,src.z))&&can_move(locate(src.x+1,src.y-3,src.z))&&can_move(locate(src.x-1,src.y-3,src.z)))) + return 0 if(EAST) - T =locate(src.x+3,src.y,src.z) + if(!(can_move(locate(src.x+3,src.y,src.z))&&can_move(locate(src.x+3,src.y+1,src.z))&&can_move(locate(src.x+3,src.y-1,src.z)))) + return 0 if(WEST) - T = locate(src.x-3,src.y,src.z) - if(can_move(T)) - spawn(0) - step(src, movement_dir) + if(!(can_move(locate(src.x-3,src.y,src.z))&&can_move(locate(src.x-3,src.y+1,src.z))&&can_move(locate(src.x-3,src.y-1,src.z)))) + return 0 + spawn(0) + step(src, movement_dir) can_move(var/turf/T) diff --git a/icons/obj/singularity.dmi b/icons/obj/singularity.dmi index 42b2d442280..116f4ff0526 100644 Binary files a/icons/obj/singularity.dmi and b/icons/obj/singularity.dmi differ