mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +00:00
-Almost every instance of 'for(mob in world)' has been killed. Because GODDAMN was it being run a bunch. Instead, a series of global lists have been made, and they are all handled auto-magically through New()'s, Del()'s, Login()'s, death()'s, etc... Lists are as follows: -mob_list : Contains all atom/mobs by ref -player_list : Like mob_list, but only contains mobs with clients attached -admin_list : Like player_list, but holds all mobs with clients attached and admin status -living_mob_list : Contains all mobs that ARE alive, regardless of client status -dead_mob_list : Contains all mobs that are dead, which comes down to corpses and ghosts -cable_list : A list containing every obj/structure/cable in existence Note: There is an object (/obj/item/debuglist) that you can use to check the contents of each of the lists except for cables (Since getting a message saying "a cable," x9001 isn't very helpful) These lists have been tested as much as I could on my own, and have been mostly implemented. There are still places where they could be used, but for now it's important that the core is working. If this all checks out I would really like to implement it into the MC as well, simply so it doesn't check call Life() on every mob by checking for all the ones in world every damn tick. Just testing locally I was able to notice improvements with certain aspects, like admin verbs being MUCH more responsive (They checked for every mob in the world every time they were clicked), many sources of needless lag were cut out (Like Adminwho and Who checking every single mob when clicked), and due to the cable_list powernet rebuilding is MUCH more efficient, because instead of checking for every cable in the world every time a powernet was broken (read: A cable was deleted), it runs though the pre-made list, and even with a singulo tearing all the way across the station, the powernet load was VERY small compared to pretty much everything else. If you want to know how any of this works, check global_lists.dm, there I have it rigorously commented, and it should provide an understanding of what's going on. Mob related in worlds before this commit: 1262 After: 4 I'm helping git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4179 316c924e-a436-60f5-8080-3fe189b3f50e
461 lines
14 KiB
Plaintext
461 lines
14 KiB
Plaintext
/**********************Mineral deposits**************************/
|
|
|
|
/turf/simulated/mineral //wall piece
|
|
name = "Rock"
|
|
icon = 'icons/turf/walls.dmi'
|
|
icon_state = "rock"
|
|
oxygen = 0
|
|
nitrogen = 0
|
|
opacity = 1
|
|
density = 1
|
|
blocks_air = 1
|
|
temperature = TCMB
|
|
var/mineralName = ""
|
|
var/mineralAmt = 0
|
|
var/spread = 0 //will the seam spread?
|
|
var/spreadChance = 0 //the percentual chance of an ore spreading to the neighbouring tiles
|
|
var/last_act = 0
|
|
|
|
/turf/simulated/mineral/Del()
|
|
return
|
|
|
|
/turf/simulated/mineral/ex_act(severity)
|
|
switch(severity)
|
|
if(3.0)
|
|
return
|
|
if(2.0)
|
|
if (prob(70))
|
|
src.mineralAmt -= 1 //some of the stuff gets blown up
|
|
src.gets_drilled()
|
|
if(1.0)
|
|
src.mineralAmt -= 2 //some of the stuff gets blown up
|
|
src.gets_drilled()
|
|
return
|
|
|
|
/turf/simulated/mineral/New()
|
|
|
|
spawn(1)
|
|
var/turf/T
|
|
if((istype(get_step(src, NORTH), /turf/simulated/floor)) || (istype(get_step(src, NORTH), /turf/space)) || (istype(get_step(src, NORTH), /turf/simulated/shuttle/floor)))
|
|
T = get_step(src, NORTH)
|
|
if (T)
|
|
T.overlays += image('icons/turf/walls.dmi', "rock_side_s")
|
|
if((istype(get_step(src, SOUTH), /turf/simulated/floor)) || (istype(get_step(src, SOUTH), /turf/space)) || (istype(get_step(src, SOUTH), /turf/simulated/shuttle/floor)))
|
|
T = get_step(src, SOUTH)
|
|
if (T)
|
|
T.overlays += image('icons/turf/walls.dmi', "rock_side_n", layer=6)
|
|
if((istype(get_step(src, EAST), /turf/simulated/floor)) || (istype(get_step(src, EAST), /turf/space)) || (istype(get_step(src, EAST), /turf/simulated/shuttle/floor)))
|
|
T = get_step(src, EAST)
|
|
if (T)
|
|
T.overlays += image('icons/turf/walls.dmi', "rock_side_w", layer=6)
|
|
if((istype(get_step(src, WEST), /turf/simulated/floor)) || (istype(get_step(src, WEST), /turf/space)) || (istype(get_step(src, WEST), /turf/simulated/shuttle/floor)))
|
|
T = get_step(src, WEST)
|
|
if (T)
|
|
T.overlays += image('icons/turf/walls.dmi', "rock_side_e", layer=6)
|
|
|
|
if (mineralName && mineralAmt && spread && spreadChance)
|
|
if(prob(spreadChance))
|
|
if(istype(get_step(src, SOUTH), /turf/simulated/mineral/random))
|
|
new src.type(get_step(src, SOUTH))
|
|
if(prob(spreadChance))
|
|
if(istype(get_step(src, NORTH), /turf/simulated/mineral/random))
|
|
new src.type(get_step(src, NORTH))
|
|
if(prob(spreadChance))
|
|
if(istype(get_step(src, WEST), /turf/simulated/mineral/random))
|
|
new src.type(get_step(src, WEST))
|
|
if(prob(spreadChance))
|
|
if(istype(get_step(src, EAST), /turf/simulated/mineral/random))
|
|
new src.type(get_step(src, EAST))
|
|
return
|
|
|
|
/turf/simulated/mineral/random
|
|
name = "Mineral deposit"
|
|
var/mineralAmtList = list("Uranium" = 5, "Iron" = 5, "Diamond" = 5, "Gold" = 5, "Silver" = 5, "Plasma" = 5/*, "Adamantine" = 5*/)
|
|
var/mineralSpawnChanceList = list("Uranium" = 5, "Iron" = 50, "Diamond" = 1, "Gold" = 5, "Silver" = 5, "Plasma" = 25/*, "Adamantine" =5*/)//Currently, Adamantine won't spawn as it has no uses. -Durandan
|
|
var/mineralChance = 10 //means 10% chance of this plot changing to a mineral deposit
|
|
|
|
/turf/simulated/mineral/random/New()
|
|
..()
|
|
if (prob(mineralChance))
|
|
var/mName = pickweight(mineralSpawnChanceList) //temp mineral name
|
|
|
|
if (mName)
|
|
var/turf/simulated/mineral/M
|
|
switch(mName)
|
|
if("Uranium")
|
|
M = new/turf/simulated/mineral/uranium(src)
|
|
if("Iron")
|
|
M = new/turf/simulated/mineral/iron(src)
|
|
if("Diamond")
|
|
M = new/turf/simulated/mineral/diamond(src)
|
|
if("Gold")
|
|
M = new/turf/simulated/mineral/gold(src)
|
|
if("Silver")
|
|
M = new/turf/simulated/mineral/silver(src)
|
|
if("Plasma")
|
|
M = new/turf/simulated/mineral/plasma(src)
|
|
/*if("Adamantine")
|
|
M = new/turf/simulated/mineral/adamantine(src)*/
|
|
if(M)
|
|
src = M
|
|
M.levelupdate()
|
|
return
|
|
|
|
/turf/simulated/mineral/random/high_chance
|
|
mineralChance = 25
|
|
mineralSpawnChanceList = list("Uranium" = 10, "Iron" = 30, "Diamond" = 2, "Gold" = 10, "Silver" = 10, "Plasma" = 25)
|
|
|
|
/turf/simulated/mineral/random/Del()
|
|
return
|
|
|
|
/turf/simulated/mineral/uranium
|
|
name = "Uranium deposit"
|
|
icon_state = "rock_Uranium"
|
|
mineralName = "Uranium"
|
|
mineralAmt = 5
|
|
spreadChance = 10
|
|
spread = 1
|
|
|
|
|
|
|
|
/turf/simulated/mineral/iron
|
|
name = "Iron deposit"
|
|
icon_state = "rock_Iron"
|
|
mineralName = "Iron"
|
|
mineralAmt = 5
|
|
spreadChance = 25
|
|
spread = 1
|
|
|
|
|
|
/turf/simulated/mineral/diamond
|
|
name = "Diamond deposit"
|
|
icon_state = "rock_Diamond"
|
|
mineralName = "Diamond"
|
|
mineralAmt = 5
|
|
spreadChance = 10
|
|
spread = 1
|
|
|
|
|
|
/turf/simulated/mineral/gold
|
|
name = "Gold deposit"
|
|
icon_state = "rock_Gold"
|
|
mineralName = "Gold"
|
|
mineralAmt = 5
|
|
spreadChance = 10
|
|
spread = 1
|
|
|
|
|
|
/turf/simulated/mineral/silver
|
|
name = "Silver deposit"
|
|
icon_state = "rock_Silver"
|
|
mineralName = "Silver"
|
|
mineralAmt = 5
|
|
spreadChance = 10
|
|
spread = 1
|
|
|
|
|
|
/turf/simulated/mineral/plasma
|
|
name = "Plasma deposit"
|
|
icon_state = "rock_Plasma"
|
|
mineralName = "Plasma"
|
|
mineralAmt = 5
|
|
spreadChance = 25
|
|
spread = 1
|
|
|
|
|
|
/turf/simulated/mineral/clown
|
|
name = "Bananium deposit"
|
|
icon_state = "rock_Clown"
|
|
mineralName = "Clown"
|
|
mineralAmt = 3
|
|
spreadChance = 0
|
|
spread = 0
|
|
|
|
|
|
/turf/simulated/mineral/ReplaceWithFloor()
|
|
if(!icon_old) icon_old = icon_state
|
|
var/turf/simulated/floor/plating/airless/asteroid/W
|
|
var/old_dir = dir
|
|
|
|
for(var/direction in cardinal)
|
|
for(var/obj/effect/glowshroom/shroom in get_step(src,direction))
|
|
if(!shroom.floor) //shrooms drop to the floor
|
|
shroom.floor = 1
|
|
shroom.icon_state = "glowshroomf"
|
|
shroom.pixel_x = 0
|
|
shroom.pixel_y = 0
|
|
|
|
W = new /turf/simulated/floor/plating/airless/asteroid( locate(src.x, src.y, src.z) )
|
|
W.dir = old_dir
|
|
W.fullUpdateMineralOverlays()
|
|
|
|
/*
|
|
W.icon_old = old_icon
|
|
if(old_icon) W.icon_state = old_icon
|
|
*/
|
|
W.opacity = 1
|
|
W.sd_SetOpacity(0)
|
|
W.sd_LumReset()
|
|
W.levelupdate()
|
|
return W
|
|
|
|
|
|
/turf/simulated/mineral/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|
|
|
if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")
|
|
usr << "\red You don't have the dexterity to do this!"
|
|
return
|
|
|
|
if (istype(W, /obj/item/weapon/pickaxe))
|
|
var/turf/T = user.loc
|
|
if (!( istype(T, /turf) ))
|
|
return
|
|
/*
|
|
if (istype(W, /obj/item/weapon/pickaxe/radius))
|
|
var/turf/T = user.loc
|
|
if (!( istype(T, /turf) ))
|
|
return
|
|
*/
|
|
//Watch your tabbing, microwave. --NEO
|
|
if(last_act+W:digspeed > world.time)//prevents message spam
|
|
return
|
|
last_act = world.time
|
|
user << "\red You start picking."
|
|
playsound(user, 'Genhit.ogg', 20, 1)
|
|
|
|
if(do_after(user,W:digspeed))
|
|
user << "\blue You finish cutting into the rock."
|
|
gets_drilled()
|
|
|
|
else
|
|
return attack_hand(user)
|
|
return
|
|
|
|
/turf/simulated/mineral/proc/gets_drilled()
|
|
if ((src.mineralName != "") && (src.mineralAmt > 0) && (src.mineralAmt < 11))
|
|
var/i
|
|
for (i=0;i<mineralAmt;i++)
|
|
if (src.mineralName == "Uranium")
|
|
new /obj/item/weapon/ore/uranium(src)
|
|
if (src.mineralName == "Iron")
|
|
new /obj/item/weapon/ore/iron(src)
|
|
if (src.mineralName == "Gold")
|
|
new /obj/item/weapon/ore/gold(src)
|
|
if (src.mineralName == "Silver")
|
|
new /obj/item/weapon/ore/silver(src)
|
|
if (src.mineralName == "Plasma")
|
|
new /obj/item/weapon/ore/plasma(src)
|
|
if (src.mineralName == "Diamond")
|
|
new /obj/item/weapon/ore/diamond(src)
|
|
if (src.mineralName == "Clown")
|
|
new /obj/item/weapon/ore/clown(src)
|
|
ReplaceWithFloor()
|
|
return
|
|
|
|
/*
|
|
/turf/simulated/mineral/proc/setRandomMinerals()
|
|
var/s = pickweight(list("uranium" = 5, "iron" = 50, "gold" = 5, "silver" = 5, "plasma" = 50, "diamond" = 1))
|
|
if (s)
|
|
mineralName = s
|
|
|
|
var/N = text2path("/turf/simulated/mineral/[s]")
|
|
if (N)
|
|
var/turf/simulated/mineral/M = new N
|
|
src = M
|
|
if (src.mineralName)
|
|
mineralAmt = 5
|
|
return*/
|
|
|
|
/turf/simulated/mineral/Bumped(AM as mob|obj)
|
|
..()
|
|
if(istype(AM,/mob/living/carbon/human))
|
|
var/mob/living/carbon/human/H = AM
|
|
if((istype(H.l_hand,/obj/item/weapon/pickaxe)) && (!H.hand))
|
|
src.attackby(H.l_hand,H)
|
|
else if((istype(H.r_hand,/obj/item/weapon/pickaxe)) && H.hand)
|
|
src.attackby(H.r_hand,H)
|
|
return
|
|
else if(istype(AM,/mob/living/silicon/robot))
|
|
var/mob/living/silicon/robot/R = AM
|
|
if(istype(R.module_active,/obj/item/weapon/pickaxe))
|
|
src.attackby(R.module_active,R)
|
|
return
|
|
/* else if(istype(AM,/obj/mecha))
|
|
var/obj/mecha/M = AM
|
|
if(istype(M.selected,/obj/item/mecha_parts/mecha_equipment/tool/drill))
|
|
src.attackby(M.selected,M)
|
|
return*/
|
|
//Aparantly mechs are just TOO COOL to call Bump(), so fuck em (for now)
|
|
else
|
|
return
|
|
|
|
/**********************Asteroid**************************/
|
|
|
|
/turf/simulated/floor/plating/airless/asteroid //floor piece
|
|
name = "Asteroid"
|
|
icon = 'icons/turf/floors.dmi'
|
|
icon_state = "asteroid"
|
|
oxygen = 0.01
|
|
nitrogen = 0.01
|
|
temperature = TCMB
|
|
icon_plating = "asteroid"
|
|
var/dug = 0 //0 = has not yet been dug, 1 = has already been dug
|
|
|
|
/turf/simulated/floor/plating/airless/asteroid/New()
|
|
var/proper_name = name
|
|
..()
|
|
name = proper_name
|
|
//if (prob(50))
|
|
// seedName = pick(list("1","2","3","4"))
|
|
// seedAmt = rand(1,4)
|
|
if(prob(20))
|
|
icon_state = "asteroid[rand(0,12)]"
|
|
spawn(2)
|
|
updateMineralOverlays()
|
|
|
|
/turf/simulated/floor/plating/airless/asteroid/ex_act(severity)
|
|
switch(severity)
|
|
if(3.0)
|
|
return
|
|
if(2.0)
|
|
if (prob(70))
|
|
src.gets_dug()
|
|
if(1.0)
|
|
src.gets_dug()
|
|
return
|
|
|
|
/turf/simulated/floor/plating/airless/asteroid/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|
|
|
if(!W || !user)
|
|
return 0
|
|
|
|
if ((istype(W, /obj/item/weapon/shovel)))
|
|
var/turf/T = user.loc
|
|
if (!( istype(T, /turf) ))
|
|
return
|
|
|
|
if (dug)
|
|
user << "\red This area has already been dug"
|
|
return
|
|
|
|
user << "\red You start digging."
|
|
playsound(src.loc, 'rustle1.ogg', 50, 1) //russle sounds sounded better
|
|
|
|
sleep(40)
|
|
if ((user.loc == T && user.get_active_hand() == W))
|
|
user << "\blue You dug a hole."
|
|
gets_dug()
|
|
|
|
if ((istype(W,/obj/item/weapon/pickaxe/drill)))
|
|
var/turf/T = user.loc
|
|
if (!( istype(T, /turf) ))
|
|
return
|
|
|
|
if (dug)
|
|
user << "\red This area has already been dug"
|
|
return
|
|
|
|
user << "\red You start digging."
|
|
playsound(src.loc, 'rustle1.ogg', 50, 1) //russle sounds sounded better
|
|
|
|
sleep(30)
|
|
if ((user.loc == T && user.get_active_hand() == W))
|
|
user << "\blue You dug a hole."
|
|
gets_dug()
|
|
|
|
if ((istype(W,/obj/item/weapon/pickaxe/diamonddrill)) || (istype(W,/obj/item/weapon/pickaxe/borgdrill)))
|
|
var/turf/T = user.loc
|
|
if (!( istype(T, /turf) ))
|
|
return
|
|
|
|
if (dug)
|
|
user << "\red This area has already been dug"
|
|
return
|
|
|
|
user << "\red You start digging."
|
|
playsound(src.loc, 'rustle1.ogg', 50, 1) //russle sounds sounded better
|
|
|
|
sleep(0)
|
|
if ((user.loc == T && user.get_active_hand() == W))
|
|
user << "\blue You dug a hole."
|
|
gets_dug()
|
|
|
|
if(istype(W,/obj/item/weapon/satchel))
|
|
var/obj/item/weapon/satchel/S = W
|
|
if(S.mode)
|
|
for(var/obj/item/weapon/ore/O in src.contents)
|
|
O.attackby(W,user)
|
|
return
|
|
|
|
else
|
|
..(W,user)
|
|
return
|
|
|
|
/turf/simulated/floor/plating/airless/asteroid/proc/gets_dug()
|
|
if(dug)
|
|
return
|
|
new/obj/item/weapon/ore/glass(src)
|
|
new/obj/item/weapon/ore/glass(src)
|
|
new/obj/item/weapon/ore/glass(src)
|
|
new/obj/item/weapon/ore/glass(src)
|
|
new/obj/item/weapon/ore/glass(src)
|
|
dug = 1
|
|
icon_plating = "asteroid_dug"
|
|
icon_state = "asteroid_dug"
|
|
return
|
|
|
|
/turf/simulated/floor/plating/airless/asteroid/proc/updateMineralOverlays()
|
|
|
|
src.overlays = null
|
|
|
|
if(istype(get_step(src, NORTH), /turf/simulated/mineral))
|
|
src.overlays += image('icons/turf/walls.dmi', "rock_side_n")
|
|
if(istype(get_step(src, SOUTH), /turf/simulated/mineral))
|
|
src.overlays += image('icons/turf/walls.dmi', "rock_side_s", layer=6)
|
|
if(istype(get_step(src, EAST), /turf/simulated/mineral))
|
|
src.overlays += image('icons/turf/walls.dmi', "rock_side_e", layer=6)
|
|
if(istype(get_step(src, WEST), /turf/simulated/mineral))
|
|
src.overlays += image('icons/turf/walls.dmi', "rock_side_w", layer=6)
|
|
|
|
|
|
/turf/simulated/floor/plating/airless/asteroid/proc/fullUpdateMineralOverlays()
|
|
var/turf/simulated/floor/plating/airless/asteroid/A
|
|
if(istype(get_step(src, WEST), /turf/simulated/floor/plating/airless/asteroid))
|
|
A = get_step(src, WEST)
|
|
A.updateMineralOverlays()
|
|
if(istype(get_step(src, EAST), /turf/simulated/floor/plating/airless/asteroid))
|
|
A = get_step(src, EAST)
|
|
A.updateMineralOverlays()
|
|
if(istype(get_step(src, NORTH), /turf/simulated/floor/plating/airless/asteroid))
|
|
A = get_step(src, NORTH)
|
|
A.updateMineralOverlays()
|
|
if(istype(get_step(src, NORTHWEST), /turf/simulated/floor/plating/airless/asteroid))
|
|
A = get_step(src, NORTHWEST)
|
|
A.updateMineralOverlays()
|
|
if(istype(get_step(src, NORTHEAST), /turf/simulated/floor/plating/airless/asteroid))
|
|
A = get_step(src, NORTHEAST)
|
|
A.updateMineralOverlays()
|
|
if(istype(get_step(src, SOUTHWEST), /turf/simulated/floor/plating/airless/asteroid))
|
|
A = get_step(src, SOUTHWEST)
|
|
A.updateMineralOverlays()
|
|
if(istype(get_step(src, SOUTHEAST), /turf/simulated/floor/plating/airless/asteroid))
|
|
A = get_step(src, SOUTHEAST)
|
|
A.updateMineralOverlays()
|
|
if(istype(get_step(src, SOUTH), /turf/simulated/floor/plating/airless/asteroid))
|
|
A = get_step(src, SOUTH)
|
|
A.updateMineralOverlays()
|
|
src.updateMineralOverlays()
|
|
|
|
/turf/simulated/floor/plating/airless/asteroid/Entered(atom/movable/M as mob|obj)
|
|
..()
|
|
if(istype(M,/mob/living/silicon/robot))
|
|
var/mob/living/silicon/robot/R = M
|
|
if(istype(R.module, /obj/item/weapon/robot_module/miner))
|
|
if(istype(R.module_state_1,/obj/item/weapon/satchel/borg))
|
|
src.attackby(R.module_state_1,R)
|
|
else if(istype(R.module_state_2,/obj/item/weapon/satchel/borg))
|
|
src.attackby(R.module_state_2,R)
|
|
else if(istype(R.module_state_3,/obj/item/weapon/satchel/borg))
|
|
src.attackby(R.module_state_3,R)
|
|
else
|
|
return |