Problem description:
I had a a Death(mob/M) proc that would be called anytime someone damaged someone else. It would check to see whether someone died, or (if an enemy) fight the attacker.
/mob/proc/Death 50.251(self cpu)/ 53.936(total cpu)/ 6697.031(realtime)/ 13145(calls)
Is it normal for a Death proc to use that much cpu. If not, what is another way of letting npcs fight back players
Feb 6 2013, 5:28 pm
|
|
Can you show the code snippet please.
|
It's a very long proc
mob I also have all /obj/projectiles/ that hit people go through Death() and an atk verb that Edit:Now only uses Death() under certain circumstances if(M.toochep||M.health<0||M.wound>200||M.aizentag) |
I only started it for you, you have a lot of redundant things in there. You also need to compress code, split up certain checks instead of hauling it all under the Death() proc.
mob/var/list/clone_list = new |
In response to Critical172
|
|
I don't think that more lines will cause extra lag, but it's the proper way to do it. Compressing it, that is.
|
As boubi says its alot easier to compress things like overlays or exp gains into another procedure and just call the procedure, its better for readability and for efficiency instead of writing those lines each time you wish to use them you can call the proc saves alot of time.
About your cpu issue, theres a few things it could be, how many loops you have constantly running, how bigs the map? These are issues i have had in the past on low specced pcs. |