From cddc7cb340e8291aecffff3cfbeef2d10f119b30 Mon Sep 17 00:00:00 2001 From: FalseIncarnate Date: Tue, 6 Sep 2016 04:15:44 -0400 Subject: [PATCH] Nano-Mob Hunter GO! WIP commit 3: The committening --- .../game/machinery/computer/communications.dm | 10 +++++ code/game/machinery/vending.dm | 4 +- code/modules/arcade/mob_hunt/game_server.dm | 6 +-- code/modules/arcade/mob_hunt/mob_avatar.dm | 30 ++++++++++---- code/modules/arcade/mob_hunt/mob_cards.dm | 2 +- code/modules/arcade/mob_hunt/mob_datums.dm | 41 +++++++++---------- code/modules/arcade/prize_datums.dm | 6 +++ .../preference/loadout/loadout_general.dm | 5 +++ code/modules/pda/PDA.dm | 7 +++- code/modules/pda/app.dm | 3 ++ code/modules/pda/cart.dm | 14 ++++++- code/modules/pda/mob_hunt_game_app.dm | 21 ++++++++-- code/modules/store/items.dm | 6 +++ nano/templates/comm_console.tmpl | 3 ++ nano/templates/pda_mob_hunt.tmpl | 4 ++ 15 files changed, 118 insertions(+), 44 deletions(-) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 7c77ca6099f..adce79343b2 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -273,6 +273,16 @@ src.emagged = 0 setMenuState(usr,COMM_SCREEN_MAIN) + if("RestartNanoMob") + if(mob_hunt_server) + var/loading_msg = pick("Respawning spawns", "Reticulating splines", "Flipping hat", + "Capturing all of them", "Fixing minor text issues", "Being the very best", + "Nerfing this", "Not communicating with playerbase", "Coding a ripoff in a 2D spaceman game") + to_chat(usr, "Restarting Nano-Mob Hunter GO! game server. [loading_msg]...") + mob_hunt_server.manual_reboot() + else + to_chat(usr, "Nano-Mob Hunter GO! game server is offline for extended maintenance. Contact your Central Command administrators for more info if desired.") + if("AcceptDocking") to_chat(usr, "Docking request accepted!") trade_dock_timelimit = world.time + 1200 diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index b3be3a4542c..8e00ffa346a 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -833,11 +833,11 @@ product_slogans = "Carts to go!" icon_state = "cart" icon_deny = "cart-deny" - products = list(/obj/item/device/pda =10,/obj/item/weapon/cartridge/medical = 10,/obj/item/weapon/cartridge/chemistry = 10, + products = list(/obj/item/device/pda =10,/obj/item/weapon/cartridge/mob_hunt_game = 25,/obj/item/weapon/cartridge/medical = 10,/obj/item/weapon/cartridge/chemistry = 10, /obj/item/weapon/cartridge/engineering = 10,/obj/item/weapon/cartridge/atmos = 10,/obj/item/weapon/cartridge/janitor = 10, /obj/item/weapon/cartridge/signal/toxins = 10,/obj/item/weapon/cartridge/signal = 10) contraband = list(/obj/item/weapon/cartridge/clown = 1,/obj/item/weapon/cartridge/mime = 1) - prices = list(/obj/item/device/pda =300,/obj/item/weapon/cartridge/medical = 200,/obj/item/weapon/cartridge/chemistry = 150,/obj/item/weapon/cartridge/engineering = 100, + prices = list(/obj/item/device/pda =300,/obj/item/weapon/cartridge/mob_hunt_game = 50,/obj/item/weapon/cartridge/medical = 200,/obj/item/weapon/cartridge/chemistry = 150,/obj/item/weapon/cartridge/engineering = 100, /obj/item/weapon/cartridge/atmos = 75,/obj/item/weapon/cartridge/janitor = 100,/obj/item/weapon/cartridge/signal/toxins = 150, /obj/item/weapon/cartridge/signal = 75) diff --git a/code/modules/arcade/mob_hunt/game_server.dm b/code/modules/arcade/mob_hunt/game_server.dm index 6ea8ef3f340..1f801250835 100644 --- a/code/modules/arcade/mob_hunt/game_server.dm +++ b/code/modules/arcade/mob_hunt/game_server.dm @@ -90,7 +90,7 @@ var/global/obj/machinery/mob_hunt_server/mob_hunt_server = null /obj/machinery/mob_hunt_server/proc/register_spawn(datum/mob_hunt/mob_info) if(!mob_info) return 0 - var/obj/effect/nanomob/new_mob = new /obj/effect/nanomob(get_turf(src), mob_info) + var/obj/effect/nanomob/new_mob = new /obj/effect/nanomob(mob_info.spawn_point, mob_info) normal_spawns += new_mob return 1 @@ -98,8 +98,8 @@ var/global/obj/machinery/mob_hunt_server/mob_hunt_server = null if(!mob_info) return 0 if(!mob_info.is_trap) - return register_spawn() - var/obj/effect/nanomob/new_mob = new /obj/effect/nanomob(locate(mob_info.x_coord, mob_info.y_coord, STATION_LEVEL), mob_info) + return register_spawn(mob_info) + var/obj/effect/nanomob/new_mob = new /obj/effect/nanomob(mob_info.spawn_point, mob_info) trap_spawns += new_mob check_stability() return 1 \ No newline at end of file diff --git a/code/modules/arcade/mob_hunt/mob_avatar.dm b/code/modules/arcade/mob_hunt/mob_avatar.dm index 7ed0a0a6f73..3d5ad935d58 100644 --- a/code/modules/arcade/mob_hunt/mob_avatar.dm +++ b/code/modules/arcade/mob_hunt/mob_avatar.dm @@ -2,8 +2,8 @@ /obj/effect/nanomob name = "Nano-Mob Avatar" //will be overridden by the mob datum name value when created desc = "A wild Nano-Mob appeared! Hit it with your PDA with the game open to attempt to capture it!" - alpha = 128 invisibility = 101 //normally invisible, this gets adjusted through the game's scanning + alpha = 128 anchored = 1 //just in case density = 0 icon = 'icons/effects/mob_hunt.dmi' @@ -17,28 +17,36 @@ qdel(src) return mob_info = new_info + update_self() + forceMove(mob_info.spawn_point) + if(!mob_info.is_trap) + addtimer(src, "despawn", mob_info.lifetime) + +/obj/effect/nanomob/proc/update_self() + if(!mob_info) + return name = mob_info.mob_name + desc = "A wild [name] (level [mob_info.level]) appeared! Hit it with your PDA with the game open to attempt to capture it!" if(mob_info.is_shiny) icon_state = mob_info.icon_state_shiny else icon_state = mob_info.icon_state_normal - var/turf/target_turf = locate(mob_info.x_coord, mob_info.y_coord, STATION_LEVEL) - forceMove(target_turf) - to_chat(world, "[name] located at ([x],[y],[z])") - if(!mob_info.is_trap) - addtimer(src, "despawn", mob_info.lifetime) /obj/effect/nanomob/attackby(obj/item/O, mob/user) + if(invisibility) //no catching mobs you can't normally see! + return if(istype(O, /obj/item/device/pda)) var/obj/item/device/pda/P = O - if(P.current_app && P.current_app == /datum/data/pda/app/mob_hunter_game) + if(P.current_app && istype(P.current_app, /datum/data/pda/app/mob_hunter_game)) attempt_capture(P) return 1 /obj/effect/nanomob/hitby(obj/item/O) + if(invisibility) //no catching mobs you can't normally see! + return if(istype(O, /obj/item/device/pda)) var/obj/item/device/pda/P = O - if(P.current_app && P.current_app == /datum/data/pda/app/mob_hunter_game) + if(P.current_app && istype(P.current_app, /datum/data/pda/app/mob_hunter_game)) attempt_capture(P) return 1 @@ -52,7 +60,9 @@ O.show_message("[bicon(P)] No server connection. Capture aborted.") return - if(mob_info.is_trap) //traps work even if you ran into them before + if(mob_info.is_trap) //traps work even if you ran into them before, which is why this is before the clients_encountered check + if(client.hacked) //hacked copies of the game (copies capable of setting traps) are protected from traps + return if(istype(P.loc, /mob/living/carbon)) var/mob/living/carbon/C = P.loc //Strike them down with a lightning bolt to complete the illusion (copied from the surge reagent overdose, probably could @@ -97,6 +107,8 @@ /obj/effect/nanomob/proc/reveal() if(invisibility == 101) invisibility = 0 + //density = 1 spawn(30) if(src) invisibility = 101 + //density = 1 diff --git a/code/modules/arcade/mob_hunt/mob_cards.dm b/code/modules/arcade/mob_hunt/mob_cards.dm index 9ab1d781d49..578f928fe7e 100644 --- a/code/modules/arcade/mob_hunt/mob_cards.dm +++ b/code/modules/arcade/mob_hunt/mob_cards.dm @@ -28,7 +28,7 @@ /obj/item/weapon/nanomob_card/booster/New() var/datum/mob_hunt/mob_info = pick(subtypesof(/datum/mob_hunt)) - mob_data = new mob_info(0,0,0,1) + mob_data = new mob_info(0,null,1) update_info() //Booster Packs (Box of booster pack cards) diff --git a/code/modules/arcade/mob_hunt/mob_datums.dm b/code/modules/arcade/mob_hunt/mob_datums.dm index 58034198c21..70c4f23239d 100644 --- a/code/modules/arcade/mob_hunt/mob_datums.dm +++ b/code/modules/arcade/mob_hunt/mob_datums.dm @@ -41,8 +41,7 @@ var/list/turf_blacklist = list() //list of turfs this mob can NOT spawn on (such as wood floors) var/list/area_whitelist = list() //list of areas this mob is more likely to spawn in (can be used to reinclude subtypes of blacklisted areas) var/list/turf_whitelist = list() //list of turfs this mob is more likely to spawn on (can be used to reinclude subtypes of blacklisted turfs) - var/x_coord = 0 //gets set and sent to the game server to spawn its avatar (generated in select_spawn) - var/y_coord = 0 //gets set and sent to the game server to spawn its avatar (generated in select_spawn) + var/turf/spawn_point //gets set and sent to the game server to spawn its avatar (generated in select_spawn or assigned via set_trap) var/lifetime = 6000 //number of deciseconds the mob will remain before despawning (REMEMBER: DECISECONDS! So 6000 is 600 seconds which is 10 minutes) var/is_shiny = 0 //if this gets set at spawn (super rare), the mob is considered "shiny" and will use the shiny icon_state and holographic cards @@ -52,29 +51,32 @@ var/is_trap = 0 //if this gets set, the mob is a booby-trap and will electrocute any players that dare attempt to catch it -/datum/mob_hunt/New(set_trap = 0, trap_x = 0, trap_y=0, no_register = 0) - level = rand(min_level, max_level) - health[2] = base_health + (level * health_multiplier) +/datum/mob_hunt/New(set_trap = 0, turf/trap_turf = null, no_register = 0) + if(set_trap) + level = max_level + is_trap = 1 + spawn_point = trap_turf + else + level = rand(min_level, max_level) if(prob(1) && prob(1)) is_shiny = 1 + health[2] = base_health + (level * health_multiplier) if(no_register) //for booster pack cards return if(mob_hunt_server) if(set_trap) - is_trap = 1 - x_coord = trap_x - y_coord = trap_y - mob_hunt_server.register_trap(src) + if(mob_hunt_server.register_trap(src)) + return else if(select_spawn()) - mob_hunt_server.register_spawn(src) - else //if we aren't a trap and can't spawn, delete the datum to avoid buildups - qdel(src) - else - qdel(src) + if(mob_hunt_server.register_spawn(src)) + return + qdel(src) //if you reach this, the datum is just pure clutter, so delete it /datum/mob_hunt/proc/select_spawn() var/list/possible_areas = list() for(var/areapath in the_station_areas) + if(istype(areapath, /area/holodeck)) //don't allow holodeck areas as possible spawns since it will allow it to spawn in the holodeck rooms on z2 as well + continue possible_areas += typesof(areapath) for(var/areapath in area_blacklist) possible_areas -= typesof(areapath) @@ -84,7 +86,6 @@ log_admin("No possible areas to spawn [type] found. Possible code/mapping error?") return 0 var/list/possible_turfs = list() - var/turf/T while(possible_areas.len) //randomly select an area from our possible_areas list to try spawning in, then remove it from possible_areas so it won't get picked over and over forever. var/area/spawn_area = locate(pick_n_take(possible_areas)) @@ -104,17 +105,13 @@ if(!possible_turfs.len) //If we don't have any possible turfs, this attempt was a failure. Try again. continue //if we got this far, we're spawning on this attempt, hooray! - T = pickweight(possible_turfs) - x_coord = T.x - y_coord = T.y + spawn_point = pickweight(possible_turfs) break - if(T) - to_chat(world, "DEBUGGING: [type] spawning at ([x_coord], [y_coord])") - return 1 - else + if(!spawn_point) //if we get to this, we failed every attempt to find a suitable turf for EVERY area in our list of possible areas. DAMN. log_admin("No acceptable turfs to spawn [type] on could be located. Possible code/mapping error, or someone replaced/destroyed all the acceptable turf types?") return 0 + return 1 /datum/mob_hunt/proc/calc_dam_multiplier(datum/mob_type/attack_type) if(!primary_type) diff --git a/code/modules/arcade/prize_datums.dm b/code/modules/arcade/prize_datums.dm index da78a7806ef..9334502dd10 100644 --- a/code/modules/arcade/prize_datums.dm +++ b/code/modules/arcade/prize_datums.dm @@ -190,6 +190,12 @@ var/global/datum/prizes/global_prizes = new typepath = /obj/item/weapon/spellbook/oneuse/fake_gib cost = 100 +/datum/prize_item/nanomob_booster + name = "Nano-Mob Hunter Trading Card Booster Pack" + desc = "Contains 6 random Nano-Mob Hunter Trading Cards. May contain a holographic card!" + typepath = /obj/item/weapon/storage/box/nanomob_booster_pack + cost = 100 + /datum/prize_item/capgun name = "Capgun Revolver" desc = "Do you feel lucky... punk?" diff --git a/code/modules/client/preference/loadout/loadout_general.dm b/code/modules/client/preference/loadout/loadout_general.dm index 347447f892f..919a77a44e8 100644 --- a/code/modules/client/preference/loadout/loadout_general.dm +++ b/code/modules/client/preference/loadout/loadout_general.dm @@ -74,3 +74,8 @@ /datum/gear/skullbandana display_name = "bandana, skull" path = /obj/item/clothing/mask/bandana/skull + +/datum/gear/mob_hunt_game + display_name = "Nano-Mob Hunter GO! Cartridge" + path = /obj/item/weapon/cartridge/mob_hunt_game + cost = 2 diff --git a/code/modules/pda/PDA.dm b/code/modules/pda/PDA.dm index 0642ad64029..138000e8df3 100755 --- a/code/modules/pda/PDA.dm +++ b/code/modules/pda/PDA.dm @@ -504,4 +504,9 @@ var/global/list/obj/item/device/pda/PDAs = list() /obj/item/device/pda/process() if(current_app) - current_app.program_process() \ No newline at end of file + current_app.program_process() + +/obj/item/device/pda/hit_check(speed) + if(current_app) + current_app.program_hit_check() + ..() \ No newline at end of file diff --git a/code/modules/pda/app.dm b/code/modules/pda/app.dm index b6182bf99b8..4ad6c40ae24 100644 --- a/code/modules/pda/app.dm +++ b/code/modules/pda/app.dm @@ -20,6 +20,9 @@ /datum/data/pda/proc/program_process() return +/datum/data/pda/proc/program_hit_check() + return + /datum/data/pda/proc/notify(message, blink = 1) if(message) //Search for holder of the PDA. diff --git a/code/modules/pda/cart.dm b/code/modules/pda/cart.dm index aa72770e72f..647f2f835cc 100644 --- a/code/modules/pda/cart.dm +++ b/code/modules/pda/cart.dm @@ -314,11 +314,12 @@ D.remote_door_id = initial_remote_door_id /obj/item/weapon/cartridge/mob_hunt_game - name = "Nano-Mob Hunter GO" + name = "Nano-Mob Hunter GO! Cartridge" desc = "The hit new PDA game that lets you track down and capture your favorite Nano-Mobs living in your world!" icon_state = "cart-eye" programs = list( new/datum/data/pda/app/mob_hunter_game) + var/emagged = 0 /obj/item/weapon/cartridge/mob_hunt_game/attackby(obj/item/O, mob/user, params) if(istype(O, /obj/item/weapon/nanomob_card)) @@ -330,4 +331,13 @@ else to_chat(user, "Transfer failed. Could not read mob data from card.") else - ..() \ No newline at end of file + ..() + +/obj/item/weapon/cartridge/mob_hunt_game/emag_act(mob/user) + if(!emagged) + emagged = 1 + var/datum/data/pda/app/mob_hunter_game/my_game = programs[1] + my_game.hacked = 1 + to_chat(user, "TR4P_M45T3R.mod successfully initialized. ToS violated. User Agreement nullified. Gotta pwn them all.") + to_chat(user, "You can now create trapped versions of any mob in your collection that will damage hunters who attempt to capture it.") + description_antag = "This copy of Nano-Mob Hunter GO! has been hacked to allow the creation of trap mobs which will cause any PDA that attempts to capture it to shock anyone holding it. Hacked copies of the game will not trigger the trap." \ No newline at end of file diff --git a/code/modules/pda/mob_hunt_game_app.dm b/code/modules/pda/mob_hunt_game_app.dm index d0c02836207..2d034ba13de 100644 --- a/code/modules/pda/mob_hunt_game_app.dm +++ b/code/modules/pda/mob_hunt_game_app.dm @@ -14,6 +14,7 @@ var/list/my_collection = list() var/current_index = 0 var/connected = 0 + var/hacked = 0 //if set, this cartridge is able to spawn trap mobs from its collection (set via emag_act on the cartridge) /datum/data/pda/app/mob_hunter_game/start() ..() @@ -71,9 +72,9 @@ data["connected"] = 0 else data["connected"] = 1 - data["not_collection"] = 0 + data["no_collection"] = 0 if(!my_collection.len) - data["no_collecton"] = 1 + data["no_collection"] = 1 return var/datum/mob_hunt/mob_info if(!current_index) @@ -89,11 +90,14 @@ "level" = mob_info.level, "type1" = mob_info.get_type1(), "type2" = mob_info.get_type2(), - "sprite" = "[mob_info.icon_state_normal].png" + "sprite" = "[mob_info.icon_state_normal].png", + "is_hacked" = hacked ) if(mob_info.is_shiny) entry["sprite"] = "[mob_info.icon_state_shiny].png" data["entry"] = entry + for(var/a in entry) + log_debug("[a] = [entry[a]]") /datum/data/pda/app/mob_hunter_game/proc/assign_nickname() if(!my_collection.len) @@ -127,6 +131,13 @@ if(current_index > my_collection.len) current_index = my_collection.len +/datum/data/pda/app/mob_hunter_game/proc/set_trap() + if(!my_collection.len || !pda || !hacked) + return + var/datum/mob_hunt/bait = my_collection[current_index] + bait = bait.type + new bait(1, get_turf(pda)) + /datum/data/pda/app/mob_hunter_game/Topic(href, list/href_list) switch(href_list["choice"]) if("Rename") @@ -146,4 +157,6 @@ if("Disconnect") disconnect() if("Transfer") - print_card() \ No newline at end of file + print_card() + if("Set_Trap") + set_trap() \ No newline at end of file diff --git a/code/modules/store/items.dm b/code/modules/store/items.dm index c67ed43fd92..4fc51d7fb8d 100644 --- a/code/modules/store/items.dm +++ b/code/modules/store/items.dm @@ -57,6 +57,12 @@ typepath = /obj/item/weapon/storage/box/dice cost = 200 +/datum/storeitem/nanomob_booster + name = "Nano-Mob Hunter Trading Card Booster Pack" + desc = "Contains 6 random Nano-Mob Hunter Trading Cards. May contain a holographic card!" + typepath = /obj/item/weapon/storage/box/nanomob_booster_pack + cost = 250 + /datum/storeitem/crayons name = "Crayons" desc = "Let security know how they're doing by scrawling lovenotes all over their hallways." diff --git a/nano/templates/comm_console.tmpl b/nano/templates/comm_console.tmpl index 209ae5f0ee8..2bfe7e70c1e 100644 --- a/nano/templates/comm_console.tmpl +++ b/nano/templates/comm_console.tmpl @@ -68,6 +68,9 @@ Used In File(s): /code/game/machinery/computers/communications.dm
{{:helper.link('Message List','comment',{'operation':'messagelist'})}}
+
+ {{:helper.link('Restart Nano-Mob Hunter GO! Server','power-off',{'operation':'RestartNanoMob'})}} +
{{if data.dock_request}}
{{:helper.link('Accept Docking Request','signal',{'operation':'AcceptDocking'})}} diff --git a/nano/templates/pda_mob_hunt.tmpl b/nano/templates/pda_mob_hunt.tmpl index 83df635ab6a..7bdb87bf9e0 100644 --- a/nano/templates/pda_mob_hunt.tmpl +++ b/nano/templates/pda_mob_hunt.tmpl @@ -79,5 +79,9 @@ + {{if data.entry.is_hacked}} +
+ {{:helper.link('Set Trap', 'bolt', {'choice': 'Set_Trap'})}} + {{/if}}
{{/if}} \ No newline at end of file