Resolved merge conflicts... I hope.

This commit is contained in:
Purpose
2018-10-06 16:01:34 +01:00
184 changed files with 18696 additions and 6969 deletions
+7 -9
View File
@@ -9,7 +9,6 @@
window_name = "Claw Game"
var/machine_image = "_1"
var/bonus_prize_chance = 5 //chance to dispense a SECOND prize if you win, increased by matter bin rating
//This is to make sure the images are available
var/list/img_resources = list('icons/obj/arcade_images/backgroundsprite.png',
'icons/obj/arcade_images/clawpieces.png',
@@ -49,26 +48,25 @@
icon_state = "clawmachine[machine_image]_off"
else
icon_state = "clawmachine[machine_image]_on"
return
/obj/machinery/arcade/claw/win()
icon_state = "clawmachine[machine_image]_win"
visible_message("<span class='game say'><span class='name'>[src.name]</span> beeps, \"WINNER!\"</span>")
if(prob(bonus_prize_chance))
//double prize mania!
if(prob(bonus_prize_chance)) //double prize mania!
atom_say("DOUBLE PRIZE!")
new /obj/item/toy/prizeball(get_turf(src))
else
atom_say("WINNER!")
new /obj/item/toy/prizeball(get_turf(src))
playsound(src.loc, 'sound/arcade/Win.ogg', 50, 1, extrarange = -3, falloff = 10)
spawn(10)
update_icon()
addtimer(CALLBACK(src, .update_icon), 10)
/obj/machinery/arcade/claw/start_play(mob/user as mob)
..()
user << browse_rsc('page.css')
for(var/i=1, i<=img_resources.len, i++)
for(var/i in 1 to img_resources.len)
user << browse_rsc(img_resources[i])
var/my_game_html = replacetext(claw_game_html, "/* ref src */", UID())
user << browse(my_game_html, "window=[window_name];size=700x600")
user << browse(my_game_html, "window=[window_name];size=915x600;can_resize=0")
/obj/machinery/arcade/claw/Topic(href, list/href_list)
if(..())
+71 -78
View File
@@ -2,7 +2,7 @@
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Crane game</title>
<title>Claw Game</title>
<link rel="stylesheet" type="text/css" href="page.css" />
<script src="libraries.min.js"></script>
<!-- Prize.js --><script>
@@ -22,7 +22,6 @@
$(pic).append(ball);
$('#game').append(pic);
//console.log(crane);
this.GetState = function() {return state};
var CheckBoundaries = function () {
@@ -38,12 +37,11 @@
top = 347;
state = 'resting';
} else if(top > 500 && state =='won') {
top=500;
top = 500;
}
};
var CheckGrabbed = function() {
var tmp = Math.floor(Math.random()*100);
if(tmp>error) {
setTimeout(function(){
@@ -51,8 +49,9 @@
$('#debug-streak').html(0); //reset streak
setTimeout(gameShutDown,500); //end game because you dropped it
},4*error+300);
}
}else{
prizeWon = true; // Incase you are interupted, you still get a prize.
}
state = 'is grabbed';
};
@@ -63,7 +62,7 @@
top = 347;
left = crane.GetLeft()+23;
if(left <= 60) {
if(left <= 60) { // Claw has reached the drop-off with payload.
left = 60;
state = 'won';
}
@@ -95,10 +94,8 @@
top += vspd;
if(state=='won' && top > 460) {
$('#prize'+id).remove();//css({visibility:'hidden'});
$('#prize'+id).remove();
state='hidden';
prizeWon = true;
gameShutDown();
}
@@ -107,16 +104,14 @@
this.Repaint = function () {
$('#prize'+id).css({'top':top, 'left':left});
//$('#'+id+' #crane-handle-top').css({height: handleHeight});
};
}</script>
<!-- Crane.js --><script>
function Crane(id) {
//console.log("crane created");
var top = 131; //private
var left = 100;
var hspd = 6;
var hspd = 5;
var vspd = 4;
var state = false;
var handleHeight = 83;
@@ -131,34 +126,39 @@
this.GetTop = function() {return top};
var Grab = function () {
top += (state == 'down')?vspd:-vspd;
handleHeight += (state == 'down')?vspd:-vspd;
if(top > 300 && state == 'down') { //when going down
top = 300;
//handleHeight = ;
state = 'up';
$('#'+id+' #crane-claw').css(frames['half']);
} else if(top < 131 && state == 'up') { //when going up
top = 131;
handleHeight = 83;
state = 'drop';
} else if(state == 'drop') { //when up and dropping
left -= hspd;
top = 131;
handleHeight = 83;
if(left < 30) {
left = 30;
$('#'+id+' #crane-claw').css(frames['open']);
setTimeout(function(){$('#'+id+' #crane-claw').css(frames['normal']);state = false;},500);
}
switch (state) {
case 'up':
top -= vspd;
handleHeight -= vspd;
if(top < 131) { // when going up
top = 131;
handleHeight = 83;
state = 'drop';
}
break;
case 'down': // when going down
top += vspd;
handleHeight += vspd;
if(top > 300) {
top = 300;
state = 'up';
$('#'+id+' #crane-claw').css(frames['half']);
}
break;
case 'drop': // when up and dropping
left -= hspd;
top = 131;
handleHeight = 83;
if(left < 30) {
left = 30;
$('#'+id+' #crane-claw').css(frames['open']);
setTimeout(function(){$('#'+id+' #crane-claw').css(frames['normal']);state = false;},500);
}
break;
}
};
var CheckBoundaries = function () {
if(left < 30)
left = 30;
else if(left > 788)
@@ -166,20 +166,18 @@
};
this.Update = function () {
//console.log(left);
if(keys["left"] && !state) //left
left -= hspd;
if(keys["right"] && !state) //right
left += hspd;
if(keys["down"] && !state) { //drop
state = 'down';
$('#'+id+' #crane-claw').css(frames['open']);
}
if(state) {
if(!state){
if(keys["left"]) //Move claw left
left -= hspd;
if(keys["right"]) // Move claw right
left += hspd;
if(keys["down"]){ // Drop claw.
state = 'down';
$('#'+id+' #crane-claw').css(frames['open']);
}
}else{
Grab();
}
@@ -204,57 +202,49 @@
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback){
window.setTimeout(callback, 1000 / 30);
window.setTimeout(callback, 33.333); //1000 / 30
};
})();
function animate(){
//console.log("animate called");
crane.Update();
for(var i = 0; i< prizes.length; i++)
for(var i=0; i<prizes.length; i++){
prizes[i].Update();
for(var i = 0; i< prizes.length; i++)
prizes[i].Repaint();
}
crane.Repaint();
requestAnimFrame(function(){
animate();
});
}
function joystickControlOn(direction){
//console.log(direction);
keys[direction] = true;
}
function joystickControlOff(direction){
//console.log(direction);
keys[direction] = false;
}
function gameStartUp(){ //main function
//console.log("game start!");
document.getElementById("play_btn").disabled = true; //to prevent button-mashing the start button.
for(var i = 0; i< 5; i++)
for(var i=0; i<5; i++){ // Creates prize balls.
prizes[i] = new Prize(i,{top: Math.ceil(Math.random()*100),left: 400+i*100-Math.ceil(Math.random()*50)},crane);
//console.log("prize made");
//crane.Repaint();
}
animate();
}
function gameShutDown(){
document.getElementById("play_btn").disabled = true;
var close_game_link = '<h2>TRY AGAIN!</h2><br><a href="byond://?src=/* ref src */;prizeWon=0">\[Close Game\]</a>'
if(prizeWon)
close_game_link = '<h2>YOU WON!</h2><br><a href="byond://?src=/* ref src */;prizeWon=1">\[Close Game\]</a>'
document.getElementById('game').innerHTML = '<center><h1> GAME OVER!</h1><br>'+close_game_link+'</center>'
function checkPrize(){
// Tells the machine if it should drop a prize.
prizeWon?document.getElementById("close_nao").href = "byond://?src=/* ref src */;prizeWon=1":document.getElementById("close_nao").href = "byond://?src=/* ref src */;prizeWon=0";
}
function gameShutDown(){
checkPrize();
if(prizeWon){ emergencyShutDown(); }else{
document.getElementById('game').innerHTML = '<br><br><br><div class="end-text"><center><h1> GAME OVER!</h1><br><h2>BETTER LUCK NEXT TIME!</h2></center></div>';
}
}
// Runs if close window or press close button.
function emergencyShutDown(){
checkPrize();
document.getElementById("close_nao").click();
}
</script>
@@ -278,11 +268,14 @@
</div>
<div id='controls' style='position: absolute; top: 550px'>
<br><button id="play_btn" onclick="gameStartUp()">Play Now!</button> <button id="close_btn" onclick="gameShutDown()">Close Game.</button><a id="close_nao" hidden="true" href="byond://?src=/* ref src */;prizeWon=0"></a>
<div id='controls' style='position: absolute; top: 515px; left: 385px;'>
<br>
<button class="button" id="play_btn" onclick="gameStartUp()">Play Now!</button>
<button class="button" id="close_btn" onclick="emergencyShutDown()">Close.</button>
<a id="close_nao" hidden="true" href="byond://?src=/* ref src */;prizeWon=0"></a>
<br>
<button onmouseover="joystickControlOn('left')" onmouseout="joystickControlOff('left')">/==<br>\==</button>
<button onmousedown="joystickControlOn('down')" onmouseup="joystickControlOff('down')">DROP<br>CLAW</button>
<button class="button" onmousedown="joystickControlOn('down')" onmouseup="joystickControlOff('down')">DROP<br>CLAW</button>
<button onmouseover="joystickControlOn('right')" onmouseout="joystickControlOff('right')">==\<br>==/</button>
</div>
</body>
+20 -20
View File
@@ -44,13 +44,13 @@
/obj/machinery/computer/mob_battle_terminal/Destroy()
eject_card(1)
if(mob_hunt_server)
if(mob_hunt_server.battle_turn)
mob_hunt_server.battle_turn = null
if(mob_hunt_server.red_terminal == src)
mob_hunt_server.red_terminal = null
if(mob_hunt_server.blue_terminal == src)
mob_hunt_server.blue_terminal = null
if(SSmob_hunt)
if(SSmob_hunt.battle_turn)
SSmob_hunt.battle_turn = null
if(SSmob_hunt.red_terminal == src)
SSmob_hunt.red_terminal = null
if(SSmob_hunt.blue_terminal == src)
SSmob_hunt.blue_terminal = null
QDEL_NULL(avatar)
return ..()
@@ -80,7 +80,7 @@
/obj/machinery/computer/mob_battle_terminal/proc/eject_card(override = 0)
if(!override)
if(ready && mob_hunt_server.battle_turn != team)
if(ready && SSmob_hunt.battle_turn != team)
audible_message("You can't recall on your rival's turn!", null, 2)
return
card.mob_data = mob_info
@@ -126,7 +126,7 @@
dat += "<h1>No Nano-Mob card loaded.</h1>"
dat += "</td>"
dat += "</tr>"
if(ready && mob_hunt_server.battle_turn) //offer the surrender option if they are in a battle (ready), but don't have a card loaded
if(ready && SSmob_hunt.battle_turn) //offer the surrender option if they are in a battle (ready), but don't have a card loaded
dat += "<tr>"
dat += "<td><a href='?src=[UID()];surrender=1'>Surrender!</a></td>"
dat += "</tr>"
@@ -170,7 +170,7 @@
dat += "<tr>"
dat += "<td><a href='?src=[UID()];ready=1'>Battle!</a></td>"
dat += "</tr>"
if(ready && !mob_hunt_server.battle_turn)
if(ready && !SSmob_hunt.battle_turn)
dat += "<tr>"
dat += "<td><a href='?src=[UID()];ready=2'>Cancel Battle!</a></td>"
dat += "</tr>"
@@ -205,23 +205,23 @@
/obj/machinery/computer/mob_battle_terminal/proc/check_connection()
if(team == "Red")
if(mob_hunt_server && !mob_hunt_server.red_terminal)
mob_hunt_server.red_terminal = src
if(SSmob_hunt && !SSmob_hunt.red_terminal)
SSmob_hunt.red_terminal = src
else if(team == "Blue")
if(mob_hunt_server && !mob_hunt_server.blue_terminal)
mob_hunt_server.blue_terminal = src
if(SSmob_hunt && !SSmob_hunt.blue_terminal)
SSmob_hunt.blue_terminal = src
/obj/machinery/computer/mob_battle_terminal/proc/do_attack()
if(!ready) //no attacking if you arent ready to fight (duh)
return
if(!mob_hunt_server || team != mob_hunt_server.battle_turn) //don't attack unless it is actually our turn
if(!SSmob_hunt || team != SSmob_hunt.battle_turn) //don't attack unless it is actually our turn
return
else
var/message = "[mob_info.mob_name] attacks!"
if(mob_info.nickname)
message = "[mob_info.nickname] attacks!"
audible_message(message, null, 5)
mob_hunt_server.launch_attack(team, mob_info.get_raw_damage(), mob_info.get_attack_type())
SSmob_hunt.launch_attack(team, mob_info.get_raw_damage(), mob_info.get_attack_type())
/obj/machinery/computer/mob_battle_terminal/proc/start_battle()
if(ready) //don't do anything if we are still ready
@@ -230,20 +230,20 @@
return
ready = 1
audible_message("[team] Player is ready for battle! Waiting for rival...", null, 5)
mob_hunt_server.start_check()
SSmob_hunt.start_check()
/obj/machinery/computer/mob_battle_terminal/proc/receive_attack(raw_damage, datum/mob_type/attack_type)
var/message = mob_info.take_damage(raw_damage, attack_type)
avatar.audible_message(message, null, 5)
if(!mob_info.cur_health)
mob_hunt_server.end_battle(team)
SSmob_hunt.end_battle(team)
eject_card(1) //force the card out, they were defeated
else
mob_hunt_server.end_turn()
SSmob_hunt.end_turn()
/obj/machinery/computer/mob_battle_terminal/proc/surrender()
audible_message("[team] Player surrenders the battle!", null, 5)
mob_hunt_server.end_battle(team, 1)
SSmob_hunt.end_battle(team, 1)
//////////////////////////////
// Mob Healing Terminal //
+11 -11
View File
@@ -94,33 +94,33 @@
P.audible_message(message, null, 4)
/obj/effect/nanomob/proc/despawn()
if(mob_hunt_server)
if(SSmob_hunt)
if(mob_info.is_trap)
mob_hunt_server.trap_spawns -= src
SSmob_hunt.trap_spawns -= src
else
mob_hunt_server.normal_spawns -= src
SSmob_hunt.normal_spawns -= src
qdel(src)
/obj/effect/nanomob/proc/reveal()
if(!mob_hunt_server)
if(!SSmob_hunt)
return
var/list/show_to = list()
for(var/A in mob_hunt_server.connected_clients)
if((A in clients_encountered) || !mob_hunt_server.connected_clients[A])
for(var/A in SSmob_hunt.connected_clients)
if((A in clients_encountered) || !SSmob_hunt.connected_clients[A])
continue
show_to |= mob_hunt_server.connected_clients[A]
show_to |= SSmob_hunt.connected_clients[A]
display_alt_appearance("nanomob_avatar", show_to)
/obj/effect/nanomob/proc/conceal(list/hide_from)
if(!mob_hunt_server)
if(!SSmob_hunt)
return
var/list/hiding_from = list()
if(hide_from)
hiding_from = hide_from
else
for(var/A in mob_hunt_server.connected_clients)
if((A in clients_encountered) && mob_hunt_server.connected_clients[A])
hiding_from |= mob_hunt_server.connected_clients[A]
for(var/A in SSmob_hunt.connected_clients)
if((A in clients_encountered) && SSmob_hunt.connected_clients[A])
hiding_from |= SSmob_hunt.connected_clients[A]
hide_alt_appearance("nanomob_avatar", hiding_from)
// BATTLE MOB AVATARS
+3 -3
View File
@@ -72,12 +72,12 @@
secondary_type = new secondary_type()
if(no_register) //for booster pack cards
return
if(mob_hunt_server)
if(SSmob_hunt)
if(set_trap)
if(mob_hunt_server.register_trap(src))
if(SSmob_hunt.register_trap(src))
return
else if(select_spawn())
if(mob_hunt_server.register_spawn(src))
if(SSmob_hunt.register_spawn(src))
return
qdel(src) //if you reach this, the datum is just pure clutter, so delete it
+8
View File
@@ -1,3 +1,7 @@
body {
/* Disables scroll bars */
overflow:hidden;
}
#background {
width:900px;
height:406px;
@@ -81,4 +85,8 @@
//-webkit-border-radius: 30px;
//border-radius: 30px;
position: absolute;
}
.button {
cursor: pointer;
}