diff --git a/NPC-Factory.md b/NPC-Factory.md index 72d769e..e1d67f5 100644 --- a/NPC-Factory.md +++ b/NPC-Factory.md @@ -11,6 +11,28 @@ Units with a [ComPort](https://github.com/simon987/Much-Assembly-Required/wiki/H The Factory starts accepting data sent by the ComPort as soon as it has received the password for this Settlement (See [Settlement](https://github.com/simon987/Much-Assembly-Required/wiki/Settlement)). Attempts to send messages to the Factory while it is locked will fail (the `COMPORT_FRONT_PORT_OUT` command will return `0`) +Example: + +```assembly +to_upload: + ; This is the code that will be uploaded to the Hacked NPC + mov a, 3 + mov b, 0x100 + hwi 0x9 + brk +password: dw "12345678" +.text + ; Send password + mov a, 2 ; COMPORT_FRONT_PORT_OUT + mov x, password + hwi 0x000D ; ComPort + + ; Send first 8 words of the program + mov a, 2 ; COMPORT_FRONT_PORT_OUT + mov x, to_upload + hwi 0x000D ; ComPort +``` + ### Spawn rate Currently, the Factory will create a new NPC every `NPC_LIFETIME / MAX_NPC_COUNT` ticks.