Thread Rating:
  • 5 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Project make pathology suck less [New path symptoms, tweaks, nerfs, and rebalances]
#23
(07-08-2018, 05:51 AM)Noah Buttes Wrote:
(07-08-2018, 01:44 AM)Spy_Guy Wrote: I like this.
Some things I see straight away:
  • Buy pathogen looks like it can be href exploited, doesn't check machine state after the topic call and doesn't check again after the prompt. Since prompts are blocking, someone could mass order samples bypassing the 30s time.
  • What's with touching admins.txt?
  • Why remove the origin.symptomatic check from coughing?
  • Oh gosh, that sounds bad. What would be the best way to fix that?
  • I added myself as a coder for testing purposes. When I was finished, I removed myself from the list. For some reason, there was no new line character at the end of the file, so git is showing that the last line was removed and subsequently re-added. There's no actual difference.
  • I didn't. I moved it up in scope. Now instead of having a separate check for each stage of the disease, we check to see if the pathogen is symptomatic before even handling the stages. This results not only in cleaner code but also in greater consistency since most other symptoms handle the symptomaticity check identically.

Good ol' line endings. Also fair about the symptomatic check, I missed that when reading through. Looks way better your way.

Code:
else if (href_list["buymats"])
+                var/confirm = alert("Are you sure you want to spend 2000 credits to manufacture a new pathogen culture? This will take about thirty seconds", "Confirm Purchase", "Yes", "No")
+                if (confirm == "Yes")
+                    var/cost = 2000
+                    if (cost > wagesystem.research_budget)
+                        boutput(usr, "<span style=\"color:red\">Insufficient research budget to make that transaction.</span>")
+                    else
+                        boutput(usr, "<span style=\"color:blue\">Transaction successful.</span>")
+                        wagesystem.research_budget -= cost
+                        machine_state = 1
+                        icon_state = "synth2"
+                        src.visible_message("The [src.name] bubbles and begins synthesis.", "You hear a bubbling noise.")
+                        spawn (300)
+                            machine_state = 0
+                            icon_state = "synth1"
+                            for (var/mob/C in viewers(src))
+                                C.show_message("The [src.name] shuts down and ejects a new pathogen sample.", 3)
+                            new/obj/item/reagent_containers/glass/vial/prepared(src.loc)                
        show_interface(usr)
Topic calls have an interesting property. They can actually be made by anyone, at any time, causing the code to run.

Now, machine_state = 1 may prevent the url from being shown to a player, but they can still fake a click, if they know how. Hence, there needs to be a check after else if (href_list["buymats"]) that machine_state == 0 before continuing.

Alert() and Input() also have some interesting properties in that they block the calling proc until they have something to return. Hence, the user may take several actions between alert() is called and when it returns. He may:
  • Leave the area and use the prompt to do some action remotely.
  • Click the "buymats" link again, queueing up another alert() that blocks
Hence, you need a check for machine_state==0 after both the href_list check and the alert(). You could also have a check that usr in range(1), to prevent remote activation tomfoolery.
Reply


Messages In This Thread
RE: Project make pathology suck less [New path symptoms, tweaks, nerfs, and rebalances] - by Spy_Guy - 07-08-2018, 01:35 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)