mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 11:34:19 +01:00
Merge pull request #1270 from tigercat2000/tramprocess
Move tram processing to internal loop, so they can go a decent speed.
This commit is contained in:
+56
-35
@@ -1,36 +1,3 @@
|
||||
/obj/tram/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if(prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if(prob(25))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/tram/blob_act()
|
||||
if(prob(50))
|
||||
qdel(src)
|
||||
|
||||
/obj/tram/meteorhit()
|
||||
qdel(src)
|
||||
|
||||
/obj/tram/attack_animal(var/mob/living/simple_animal/M as mob)
|
||||
if(M.melee_damage_upper == 0) return
|
||||
if(prob(M.melee_damage_upper))
|
||||
qdel(src)
|
||||
src.visible_message("\red <B>[M] has [M.attacktext] [src]!</B>")
|
||||
M.attack_log += text("\[[time_stamp()]\] <font color='red'>attacked [src.name]</font>")
|
||||
|
||||
/obj/tram/bullet_act(var/obj/item/projectile/proj)
|
||||
if(prob(proj.damage))
|
||||
qdel(src)
|
||||
..()
|
||||
|
||||
/obj/tram/tram_controller
|
||||
name = ""
|
||||
desc = "tram controller"
|
||||
@@ -48,6 +15,11 @@
|
||||
var/last_played_rail
|
||||
|
||||
var/automode = 0
|
||||
var/fast_mode = 0
|
||||
|
||||
var/activated = 0
|
||||
var/looptick = 0
|
||||
|
||||
var/list/blacklist = list(/obj/tram/rail,/atom/movable/lighting_overlay)
|
||||
var/list/ancwhitelist = list(/obj/tram, /obj/vehicle, /obj/structure/stool/bed/chair, /obj/structure/grille, /obj/structure/window)
|
||||
|
||||
@@ -59,7 +31,6 @@
|
||||
init_tram() //Combine walls and floors and anything inside the tram
|
||||
init_controllers() //Find control pads
|
||||
gen_collision() //Generate collision system
|
||||
processing_objects.Add(src) //Add to processing objects manually
|
||||
|
||||
/obj/tram/tram_controller/Destroy()
|
||||
for(var/obj/tram/floor/F in tram_floors)
|
||||
@@ -68,16 +39,32 @@
|
||||
remove_wall(TW)
|
||||
for(var/obj/tram/controlpad/CP in controllers)
|
||||
remove_controller(CP)
|
||||
killLoop()
|
||||
..()
|
||||
|
||||
/obj/tram/tram_controller/emp_act(severity)
|
||||
if(automode) automode = 0
|
||||
..()
|
||||
|
||||
/obj/tram/tram_controller/proc/startLoop()
|
||||
if(activated) return
|
||||
activated = 1
|
||||
spawn(0)
|
||||
while(activated)
|
||||
process()
|
||||
looptick++
|
||||
sleep(1)
|
||||
|
||||
/obj/tram/tram_controller/proc/killLoop()
|
||||
activated = 0
|
||||
looptick = 0
|
||||
|
||||
/obj/tram/tram_controller/process()
|
||||
update_tram() //Update combine to account for new mobs and/or objects
|
||||
if(automode)
|
||||
tram_rail_follow()
|
||||
if(fast_mode)
|
||||
tram_rail_follow()
|
||||
|
||||
/obj/tram/tram_controller/proc/update_tram()
|
||||
tram.Cut()
|
||||
@@ -234,4 +221,38 @@
|
||||
if(A.light_range)
|
||||
A.set_light()
|
||||
gen_collision() //Generate collision again
|
||||
return 1
|
||||
return 1
|
||||
|
||||
//////////////////////DAMAGE PROCS
|
||||
/obj/tram/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if(prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if(prob(25))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/tram/blob_act()
|
||||
if(prob(50))
|
||||
qdel(src)
|
||||
|
||||
/obj/tram/meteorhit()
|
||||
qdel(src)
|
||||
|
||||
/obj/tram/attack_animal(var/mob/living/simple_animal/M as mob)
|
||||
if(M.melee_damage_upper == 0) return
|
||||
if(prob(M.melee_damage_upper))
|
||||
qdel(src)
|
||||
src.visible_message("\red <B>[M] has [M.attacktext] [src]!</B>")
|
||||
M.attack_log += text("\[[time_stamp()]\] <font color='red'>attacked [src.name]</font>")
|
||||
|
||||
/obj/tram/bullet_act(var/obj/item/projectile/proj)
|
||||
if(prob(proj.damage))
|
||||
qdel(src)
|
||||
..()
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
if(href_list["engine_toggle"])
|
||||
tram_linked.automode = !tram_linked.automode
|
||||
if(tram_linked.automode) tram_linked.startLoop()
|
||||
else tram_linked.killLoop()
|
||||
else if(href_list["close"])
|
||||
usr.unset_machine()
|
||||
usr << browse(null, "window=trampad")
|
||||
|
||||
Reference in New Issue
Block a user